mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-01 00:42:49 +08:00
Fix: VITE_GATEWAY_URL override was missing the /ws path
The gateway's WebSocketServer only listens on /ws (gateway/src/index.ts), but the VITE_GATEWAY_URL build-time override connected to the bare host instead - causing 'Could not reach the gateway' on split-hosted deploys (e.g. client.webspeak3.de -> gateway.webspeak3.de). Now /ws is always appended, whether the URL comes from the same-origin fallback or the override. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fd24ae740e
commit
b70b4d1fc9
1 file changed
+6
-2
+6
-2
@@ -52,10 +52,14 @@ import { parseSoundpack } from "./soundpack";
|
||||
// VITE_GATEWAY_URL at build time to the gateway's public wss:// address
|
||||
// instead - the browser will still block a plain ws:// gateway from an
|
||||
// https:// page (mixed content), so that address needs real TLS.
|
||||
// Either way the gateway's WebSocketServer only listens on /ws (see
|
||||
// gateway/src/index.ts), so that path always gets appended here - a
|
||||
// VITE_GATEWAY_URL override only needs to name the host, not the path.
|
||||
const GATEWAY_URL = import.meta.env.DEV
|
||||
? "ws://localhost:8080"
|
||||
: import.meta.env.VITE_GATEWAY_URL ||
|
||||
`${window.location.protocol === "https:" ? "wss" : "ws"}://${window.location.host}/ws`;
|
||||
: import.meta.env.VITE_GATEWAY_URL
|
||||
? `${import.meta.env.VITE_GATEWAY_URL.replace(/\/$/, "")}/ws`
|
||||
: `${window.location.protocol === "https:" ? "wss" : "ws"}://${window.location.host}/ws`;
|
||||
|
||||
// One-time migration from the pre-rename "ts-web-client:*" localStorage
|
||||
// namespace so existing users don't lose their favorites/preferences.
|
||||
|
||||
Reference in new issue
Block a user