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_DECIDE_BODY_KEYS, applyCopiesDecision } from "yt-dlp-transcript-common/controller/copiesScan"; import { ops, opsFail } from "../_lib"; export const dynamic = "force-dynamic"; // POST { group, pair: "/|/" | pairs: [...], undo?, note?, by? } // -> { ok, group, action: "reject", undo, applied, unknown, skipped, now } // // A PAIR THAT IS NOT ONE RECORDING (lane cross-source-dupes): removed from the // lanes for good — it never holds or skips a copy again, whatever its link, // and later scans do not bring it back (the decision is kept by the pair's // key). The pair stays in the scan's file and the report counts it under // `rejected`. Named as copies-confirm names it; recorded with who, when and // the note in `transcripts/copies/.decisions.json`. A reject replaces a // confirm of the same pair; `undo: true` takes it back. Synchronous. export async function POST(request: Request) { return ops(request, COPIES_DECIDE_BODY_KEYS, async (body) => { const out = await applyCopiesDecision(getPaths(), getSettings(), "reject", body); if (!out.ok) return opsFail(out.error, out.status); return NextResponse.json(out); }); }