From f71af6a06d4ff9d95f276a3306d4b94785b944dd Mon Sep 17 00:00:00 2001 From: hypercross Date: Sat, 11 Jul 2026 09:29:16 +0800 Subject: [PATCH] fix: update proxy path and MQTT broker URL in dev Change the proxy path from `/journal` to `/.ttrpg` and ensure the MQTT broker URL points to localhost:3000 during development to match the CLI server configuration. --- rsbuild.config.ts | 2 +- src/components/journal/ConnectDialog.tsx | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/rsbuild.config.ts b/rsbuild.config.ts index a714e9d..a63ecb6 100644 --- a/rsbuild.config.ts +++ b/rsbuild.config.ts @@ -46,7 +46,7 @@ export default defineConfig({ "/__CONTENT_INDEX.json": "http://localhost:3000", "/__COMPLETIONS.json": "http://localhost:3000", "/content": "http://localhost:3000", - "/journal": "http://localhost:3000", + "/.ttrpg": "http://localhost:3000", }, }, output: { diff --git a/src/components/journal/ConnectDialog.tsx b/src/components/journal/ConnectDialog.tsx index 052c747..797737a 100644 --- a/src/components/journal/ConnectDialog.tsx +++ b/src/components/journal/ConnectDialog.tsx @@ -40,7 +40,12 @@ export const ConnectDialog: Component = () => { const name = playerName().trim() || stream.myName; if (!name) return; - const brokerUrl = `ws://${window.location.host}`; + // In dev, the MQTT broker lives on the CLI server (port 3000), not the + // rsbuild dev server. In production, the CLI serves everything itself. + const brokerUrl = + process.env.NODE_ENV === "development" + ? `ws://localhost:3000` + : `ws://${window.location.host}`; setConnecting(true); setError(null);