fix(frontend): handle /editor gracefully and enable desktopLayout for teacher arduino tab

This commit is contained in:
a2nr 2026-09-05 17:03:15 +07:00
parent c3fc8dc8f1
commit 21ffb65e05
2 changed files with 8 additions and 1 deletions

View File

@ -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/');

View File

@ -17,7 +17,7 @@
let saveFeedback = $state<string | null>(null);
let feedbackTimeout: ReturnType<typeof setTimeout> | 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);