17 lines
610 B
TypeScript
17 lines
610 B
TypeScript
import { NextRequest, NextResponse } from "next/server";
|
|
import { assertLocalRequest } from "@/lib/api/localOnly";
|
|
import { cancelJob } from "@/lib/whisperjav/queue";
|
|
|
|
export const runtime = "nodejs";
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export async function POST(req: NextRequest, ctx: { params: Promise<{ id: string }> }) {
|
|
const blocked = assertLocalRequest(req);
|
|
if (blocked) return blocked;
|
|
|
|
const { id } = await ctx.params;
|
|
const ok = cancelJob(id);
|
|
if (!ok) return NextResponse.json({ error: "Not found or not cancellable" }, { status: 404 });
|
|
return NextResponse.json({ ok: true });
|
|
}
|