From 21ffb65e0559f4a1f81f8a3d3cbe11c903426d16 Mon Sep 17 00:00:00 2001 From: a2nr Date: Sat, 5 Sep 2026 17:03:15 +0700 Subject: [PATCH] fix(frontend): handle /editor gracefully and enable desktopLayout for teacher arduino tab --- frontend/src/hooks.server.ts | 7 +++++++ frontend/src/lib/components/TeacherVelxioEditor.svelte | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/frontend/src/hooks.server.ts b/frontend/src/hooks.server.ts index 6321164..554a293 100644 --- a/frontend/src/hooks.server.ts +++ b/frontend/src/hooks.server.ts @@ -20,6 +20,13 @@ function resolveBackend(): string { const API_BACKEND = resolveBackend(); export const handle: Handle = async ({ event, resolve }) => { + console.log(`[hooks] ${event.request.method} ${event.url.pathname} (referer: ${event.request.headers.get('referer')})`); + + // Redirect /editor or /editor/ to /velxio/editor + if (event.url.pathname === '/editor' || event.url.pathname === '/editor/' || event.url.pathname.startsWith('/editor/')) { + return Response.redirect(`${event.url.origin}/velxio/editor${event.url.search}`, 302); + } + // Proxy /api/* and /assets/* to Flask backend const isApi = event.url.pathname.startsWith('/api/'); const isAsset = event.url.pathname.startsWith('/assets/'); diff --git a/frontend/src/lib/components/TeacherVelxioEditor.svelte b/frontend/src/lib/components/TeacherVelxioEditor.svelte index df70954..ef1bcff 100644 --- a/frontend/src/lib/components/TeacherVelxioEditor.svelte +++ b/frontend/src/lib/components/TeacherVelxioEditor.svelte @@ -17,7 +17,7 @@ let saveFeedback = $state(null); let feedbackTimeout: ReturnType | null = null; - const velxioSrc = '/velxio/editor?embed=true'; + const velxioSrc = '/velxio/editor?embed=true&desktopLayout=true'; export function getCurrentState(): { code: string; circuit: string } | null { return getVelxioState(iframeRef);