This commit is contained in:
NextJS
2026-05-05 20:02:40 +00:00
commit 0f6e979aac
51 changed files with 10161 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
import { cookies } from "next/headers";
import { ADMIN_SESSION_COOKIE } from "@/lib/auth/session";
import { parseMatchmakerLogParam } from "@/lib/matchmaker-log-source";
import { readMatchmakerLogFile } from "@/lib/matchmaker-logs-server";
const NO_STORE = { "Cache-Control": "no-store, max-age=0" };
export async function GET(request: Request) {
const cookieStore = await cookies();
if (cookieStore.get(ADMIN_SESSION_COOKIE)?.value !== "1") {
return Response.json(
{ error: "Unauthorized" },
{ status: 401, headers: NO_STORE },
);
}
const { searchParams } = new URL(request.url);
const source = parseMatchmakerLogParam(searchParams.get("mklog"));
const result = await readMatchmakerLogFile(source);
if (!result.ok) {
return Response.json(
{ error: result.message },
{ status: result.status, headers: NO_STORE },
);
}
return Response.json(
{ content: result.content },
{ headers: NO_STORE },
);
}