25 lines
755 B
TypeScript
25 lines
755 B
TypeScript
import { NextResponse } from "next/server";
|
|
|
|
const OPENPANEL_SCRIPT_URL = "https://op.nodecrew.me/op1.js";
|
|
|
|
export async function GET(request: Request) {
|
|
const url = new URL(request.url);
|
|
const searchParams = url.search;
|
|
|
|
try {
|
|
const response = await fetch(`${OPENPANEL_SCRIPT_URL}${searchParams}`);
|
|
const content = await response.text();
|
|
|
|
return new NextResponse(content, {
|
|
status: 200,
|
|
headers: {
|
|
"Content-Type": "application/javascript",
|
|
"Cache-Control": "public, max-age=86400, stale-while-revalidate=86400",
|
|
},
|
|
});
|
|
} catch (error) {
|
|
console.error("[OpenPanel] Failed to fetch script:", error);
|
|
return new NextResponse("/* OpenPanel script unavailable */", { status: 500 });
|
|
}
|
|
}
|