'use server'; import fs from 'fs'; import path from 'path'; export async function getAnnotatorAssets() { // Try /app/public first (docker), then process.cwd()/public let publicDir = '/app/public'; if (!fs.existsSync(publicDir)) { publicDir = path.join(process.cwd(), 'public'); } const walk = async (dir: string): Promise => { let results: string[] = []; if (!fs.existsSync(dir)) return results; const list = await fs.promises.readdir(dir); for (const file of list) { const filePath = path.join(dir, file); const stat = await fs.promises.stat(filePath); if (stat && stat.isDirectory()) { const nested = await walk(filePath); results = results.concat(nested); } else { if (filePath.match(/\.(png|jpg|jpeg|webp|mp4|svg)$/i)) { results.push(filePath.replace(publicDir, '')); } } } return results; }; const results = await walk(publicDir); // Console logs removed for absolute silence & speed return results; }