监控页从 iframe 改为原生 React 组件:无加载延迟,30s JSON 轮询

This commit is contained in:
2569718930@qq.com
2026-05-14 00:18:26 +08:00
parent fd12c15518
commit fc48795299
4 changed files with 209 additions and 8 deletions
+5 -1
View File
@@ -8,9 +8,13 @@ export async function GET(req: NextRequest) {
return new NextResponse("API not configured", { status: 500 });
}
const isCards = req.nextUrl.searchParams.get("cards") === "1";
const path = isCards ? "/m/cards" : "/m";
const asJson = req.nextUrl.searchParams.get("json") === "1";
const path = asJson ? "/m/json" : isCards ? "/m/cards" : "/m";
const auth = await buildBackendRequestHeaders(req, { includeSupabaseIdentity: false });
const res = await fetch(`${API_BASE}${path}`, { headers: auth.headers });
if (asJson) {
return NextResponse.json(await res.json());
}
const html = await res.text();
return new NextResponse(html, {
status: res.status,