fix(embed): patch base path, router basename, nginx redirect, and serial bridge on v3.0.4

This commit is contained in:
a2nr 2026-09-05 07:32:55 +07:00
parent 02ea4e3b86
commit 29aad7c456
6 changed files with 35 additions and 3 deletions

1
.gitignore vendored
View File

@ -42,6 +42,7 @@ third-party/
# Build outputs
frontend/dist/
frontend/public/monaco/
frontend/.vite/
backend/dist/

View File

@ -80,6 +80,6 @@ server {
}
location / {
try_files $uri $uri/ /index.html;
try_files $uri /index.html;
}
}

View File

@ -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;
}
}

View File

@ -97,7 +97,7 @@ function App() {
}, []);
return (
<Router>
<Router basename={import.meta.env.BASE_URL.replace(/\/+$/, '') || '/'}>
<LocaleSync>
<Routes>
{/* Default locale (English) — no URL prefix. */}

View File

@ -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();

View File

@ -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: {