- Redesign PreJoin component and CSS for improved template compatibility and deterministic rendering - Remove mock studio toggle and related runtime logic; update useStudioLauncher to always use real backend - Add README-MOCK.md to document mock studio deprecation - Add mock-studio.html for manual popup emulation - Update environment variable resolution in route.ts for backend API - Add visual regression test scripts (capture, compare, visual_test_prejoin) using Playwright, Puppeteer, pixelmatch, and pngjs - Update package.json scripts and devDependencies for visual testing - Simplify PreJoin.stories.tsx for robust Storybook usage
22 lines
1.1 KiB
TypeScript
22 lines
1.1 KiB
TypeScript
export async function GET(req: Request) {
|
|
try {
|
|
const url = new URL(req.url);
|
|
const parts = url.pathname.split('/');
|
|
const id = parts[parts.length - 1] || '';
|
|
if (!id) return new Response(JSON.stringify({ error: 'missing id' }), { status: 400, headers: { 'content-type': 'application/json' } });
|
|
|
|
const backend = process.env.VITE_BACKEND_API_URL || process.env.VITE_TOKEN_SERVER_URL || process.env.BACKEND_URL || process.env.BACKEND || '';
|
|
if (!backend) {
|
|
return new Response(JSON.stringify({ error: 'BACKEND_URL not configured' }), { status: 500, headers: { 'content-type': 'application/json' } });
|
|
}
|
|
|
|
const resp = await fetch(`${backend.replace(/\/$/, '')}/api/session/${encodeURIComponent(id)}`);
|
|
const text = await resp.text();
|
|
const headers = { 'content-type': 'application/json' };
|
|
return new Response(text, { status: resp.status, headers });
|
|
} catch (err) {
|
|
console.error('proxy GET /api/session/:id error', err);
|
|
return new Response(JSON.stringify({ error: 'internal' }), { status: 500, headers: { 'content-type': 'application/json' } });
|
|
}
|
|
}
|