18 lines
641 B
JavaScript
18 lines
641 B
JavaScript
import { NextResponse } from "next/server";
|
|||
|
|
import { getSettings } from "@/lib/localDb";
|
||
|
|
import { getHeadroomStatus } from "@/lib/headroom/detect";
|
||
|
|
import { getManagedPid } from "@/lib/headroom/process";
|
||
|
|
|
||
|
|
export const dynamic = "force-dynamic";
|
||
|
|
|
||
|
|
export async function GET() {
|
||
|
|
try {
|
||
|
|
const settings = await getSettings();
|
||
|
|
const url = settings.headroomUrl || "http://localhost:8787";
|
||
|
|
const status = await getHeadroomStatus(url);
|
||
|
|
const managedPid = getManagedPid();
|
||
|
|
return NextResponse.json({ ...status, url, managedPid });
|
||
|
|
} catch (error) {
|
||
|
|
return NextResponse.json({ error: error.message }, { status: 500 });
|
||
|
|
}
|
||
|
|
}
|