From 29aad7c456f62e71d2ce1fc68c7648dd689b9b4b Mon Sep 17 00:00:00 2001 From: a2nr Date: Sat, 5 Sep 2026 07:32:55 +0700 Subject: [PATCH] fix(embed): patch base path, router basename, nginx redirect, and serial bridge on v3.0.4 --- .gitignore | 1 + deploy/nginx.conf | 2 +- docker/nginx.conf | 6 +++++- frontend/src/App.tsx | 2 +- frontend/src/services/EmbedBridge.ts | 26 ++++++++++++++++++++++++++ frontend/vite.config.ts | 1 + 6 files changed, 35 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index cdff7b6b..92acc57e 100644 --- a/.gitignore +++ b/.gitignore @@ -42,6 +42,7 @@ third-party/ # Build outputs frontend/dist/ +frontend/public/monaco/ frontend/.vite/ backend/dist/ diff --git a/deploy/nginx.conf b/deploy/nginx.conf index 568ee2dc..b6d444ba 100644 --- a/deploy/nginx.conf +++ b/deploy/nginx.conf @@ -80,6 +80,6 @@ server { } location / { - try_files $uri $uri/ /index.html; + try_files $uri /index.html; } } diff --git a/docker/nginx.conf b/docker/nginx.conf index 1989323b..6b903097 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -84,7 +84,11 @@ server { gzip_types text/plain text/css text/xml text/javascript application/javascript application/json application/xml application/rss+xml; # Frontend SPA routing — must be last so specific locations above take precedence + location = / { + return 301 /velxio/editor; + } + location / { - try_files $uri $uri/ /index.html; + try_files $uri /index.html; } } diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 126bf13e..55e47fb6 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -97,7 +97,7 @@ function App() { }, []); return ( - + {/* Default locale (English) — no URL prefix. */} diff --git a/frontend/src/services/EmbedBridge.ts b/frontend/src/services/EmbedBridge.ts index 501e90e1..a12fe560 100644 --- a/frontend/src/services/EmbedBridge.ts +++ b/frontend/src/services/EmbedBridge.ts @@ -35,6 +35,11 @@ class EmbedBridge { this.send('velxio:compile_result', { success }); } + /** Notify parent that compilation finished and hex is available. Push model. */ + notifyHexReady(boardId: string | null, hex: string | null, boardKind: string | null) { + this.send('velxio:hex_ready', { boardId, hex, boardKind }); + } + /** Parent received ready — stop broadcasting. */ private stopReadyBroadcast() { if (this._readyInterval) { @@ -154,6 +159,27 @@ class EmbedBridge { break; } + case 'elemes:push_serial': { + const text = (event.data.text as string) || ''; + const targetBoardId = (event.data.boardId as string) || null; + const store = useSimulatorStore.getState(); + const boardId = targetBoardId ?? (store.activeBoardId as string | null); + if (boardId) { + store.appendSerialOutput(boardId, text); + } + break; + } + + case 'elemes:start_hardware_serial': { + window.dispatchEvent(new CustomEvent('velxio-hardware-serial-start')); + break; + } + + case 'elemes:stop_hardware_serial': { + window.dispatchEvent(new CustomEvent('velxio-hardware-serial-stop')); + break; + } + case 'elemes:ping': { // Parent missed the initial ready signal — re-send it this.notifyReady(); diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 33c77528..1a3d58df 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -16,6 +16,7 @@ const proOverlayPath = : path.resolve(__dirname, 'src/__pro_stub__') export default defineConfig(({ command }) => ({ + base: process.env.VITE_BASE_PATH || '/', plugins: [react()], resolve: { alias: {