import { isValidChannelSlug } from "yt-dlp-transcript-common/controller/channels"; import { listMarksAction } from "../../../channels/actions"; import { readRoute } from "../_read"; import { opsFail } from "../_lib"; export const dynamic = "force-dynamic"; // GET ?slug= // -> { ok, count, sourceGone, marks: [{ id, setBy, mine, sourceGone, mark }] } // // Every do-not-clean mark of one channel and WHO SET IT AND WHEN, in the // video page's words ("availability check, 3 Nov; the source was gone", // "you, 20 Nov"). `mine`: a person's (by "operator", or from before marks said // who set them). `sourceGone`: set by the availability check, so Clean without // checking's opt-in can reach its audio; `do-not-clean {"keep": true}` makes // it yours. export async function GET(request: Request) { return readRoute(request, ["slug"], async (q) => { const slug = q.get("slug")?.trim() ?? ""; if (!isValidChannelSlug(slug)) return opsFail(`"${slug}" is not a valid channel slug`); const r = await listMarksAction(slug); if (!r.ok) return opsFail(r.error); return { count: r.marks.length, sourceGone: r.marks.filter((m) => m.sourceGone).length, marks: r.marks }; }); }