import { getPaths } from "yt-dlp-transcript-common/lib/paths"; import { loadCookieStatus } from "../../../lib/cookieStatus"; import { readRoute } from "../_read"; import { opsFail } from "../_lib"; export const dynamic = "force-dynamic"; // GET /api/ops/cookies[?fresh=1] // -> { ok, readAt, rows: [{ service, label, family, source, ageVerb, ageAt, // ageMinutes, age, ageNote?, ageUnknown?, state, alert?, todo?, // headed?, button, last?, running? }] } // // The /cookies screen's rows (editor/app/lib/cookieStatus.ts): one per service // the editor reads cookies for — X, Rumble, YouTube, Odysee, archive.today and // each forum host — with where its cookies come from (drawn through // settings.privacy), how old they are, its cookie alert (stale / fine / // unknown), the last press on its button and how it ended, and what is // running. Read-only: nothing is asked of any service. `fresh=1` re-reads the // browser's cookie store (names and times only) instead of the 5-minute cache. // The presses themselves: recheck-service (Check again); X's Refresh cookies // and the headed Connects stay human clicks on /cookies. export async function GET(request: Request) { return readRoute(request, ["fresh"], async (q) => { const fresh = q.get("fresh"); if (fresh !== null && fresh !== "1" && fresh !== "0") return opsFail(`fresh must be 1 or 0, not "${fresh}"`); return { ...(await loadCookieStatus(getPaths(), { fresh: fresh === "1" })) }; }); }