import { MEDIA_ROOTS } from "@/lib/paths"; import { listMedia } from "@/lib/media"; import { mediaGroups } from "@/lib/projects"; export const dynamic = "force-dynamic"; // Everything the bench could load. // // `?group=project` is the shape the picker uses now. The flat list stays for // anything that just wants "the newest renders", and because a flat newest-first // list is still almost always the order you want when the file you are about to // judge is the one that just finished rendering -- it is only COVERAGE it is bad // at, and coverage is what a picker over twelve projects needs. export async function GET(request: Request) { const grouped = new URL(request.url).searchParams.get("group") === "project"; if (grouped) { const { groups, other } = await mediaGroups(); return Response.json( { roots: MEDIA_ROOTS, groups, other }, { headers: { "cache-control": "no-store" } }, ); } const files = await listMedia(); return Response.json( { roots: MEDIA_ROOTS, files }, { headers: { "cache-control": "no-store" } }, ); }