feat: amber sync api route

This commit is contained in:
2026-04-13 21:09:34 +07:00 Unverified
parent 4c4d443ec7
commit 553326bdf5
+15
View File
@@ -0,0 +1,15 @@
import { exec } from "node:child_process";
import { env } from "node:process";
import { promisify } from "node:util";
import { actionLog } from "@/lib/api";
import { adminCheck } from "@/lib/auth";
export async function GET() {
if (!(await adminCheck()))
return new Response("Unauthorized", { status: 401 });
const res = await promisify(exec)("bun util/sync 2>&1", {
env: { ...env, NO_AUTH_CHECK: "1" },
});
await actionLog("Triggered an Amber sync from API", { result: res.stdout });
return new Response(res.stdout);
}