Initial commit

This commit is contained in:
admin
2026-05-26 22:46:00 +02:00
commit 7e2c2ff89c
256 changed files with 51523 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
import { NextRequest, NextResponse } from "next/server";
import { assertLocalRequest } from "@/lib/api/localOnly";
import { verifyCli, autoDetectCli } from "@/lib/whisperjav/spawn";
import { getAppSetting } from "@/lib/db/appSettings";
export const runtime = "nodejs";
export const dynamic = "force-dynamic";
export async function POST(req: NextRequest) {
const blocked = assertLocalRequest(req);
if (blocked) return blocked;
const body = await req.json().catch(() => ({}));
const explicit = typeof body.path === "string" ? body.path.trim() : "";
const autodetect = body.autodetect === true;
let cliPath = explicit;
if (!cliPath && !autodetect) {
cliPath = (getAppSetting("whisperjav").cliPath ?? "").trim();
}
if (!cliPath) {
const detected = await autoDetectCli();
if (!detected) {
return NextResponse.json({ ok: false, error: "whisperjav not found on PATH" });
}
cliPath = detected;
}
const result = await verifyCli(cliPath);
return NextResponse.json(result);
}