Files
katelyatv/src/app/api/license-config/route.ts
T

38 lines
1.0 KiB
TypeScript

import { NextResponse } from 'next/server';
export const runtime = 'nodejs';
export async function GET() {
try {
const hub = (global as any).__licenseHub || eval('require')('/app/license-hub.js');
const st = hub.getStatus();
return NextResponse.json(
{ code: 200, message: 'ok', data: st },
{
headers: {
'Content-Type': 'application/json; charset=utf-8',
'Access-Control-Allow-Origin': '*',
'Cache-Control': 'public, max-age=60',
},
},
);
} catch (x: any) {
console.log('[LICENSE-CFG] ERR', x && x.message);
return NextResponse.json(
{ code: 500, message: String(x && x.message || x), data: null },
{ headers: { 'Access-Control-Allow-Origin': '*' } },
);
}
}
export async function OPTIONS() {
return new NextResponse(null, {
status: 200,
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, OPTIONS',
'Access-Control-Allow-Headers': 'Content-Type',
},
});
}