import { NextResponse } from "next/server"; import { getPaths } from "yt-dlp-transcript-common/lib/paths"; import { getSettings } from "yt-dlp-transcript-common/lib/settings"; import { COPIES_RELEASE_BODY_KEYS, applyCopiesDecision } from "yt-dlp-transcript-common/controller/copiesScan"; import { ops, opsFail } from "../_lib"; export const dynamic = "force-dynamic"; // POST { group, video: "/" | videos: [...], undo?, note?, by? } // -> { ok, group, action: "release", undo, applied, unknown, skipped, now } // // A PERSON'S RELEASE (lane cross-source-dupes, slice 1): the transcription // and Speakers lanes treat each named video as they did before its source // group existed — a held copy and a skipped one alike are queued again by // their lane's own rules. A video is named by its dir or its id (a Rumble // video's differ: the lanes key by dir); one the group's scan does not list // is reported in `unknown` and not stored. `undo: true` takes the release // back. `by` is "operator" or "agent" (the default): the caller's word, as // judge-trending takes it. Written with the time and the note to // `transcripts/copies/.decisions.json` by its one writer, under its // lock; the scan never touches it. Synchronous. // // AN ADAPTER: the checks are the controller's (applyCopiesDecision). export async function POST(request: Request) { return ops(request, COPIES_RELEASE_BODY_KEYS, async (body) => { const out = await applyCopiesDecision(getPaths(), getSettings(), "release", body); if (!out.ok) return opsFail(out.error, out.status); return NextResponse.json(out); }); }