fix(ui): parse gatewayUrl from URL params for remote gateway access
Adds support for passing `gatewayUrl` as a URL parameter to the WebChat UI, allowing the control-ui to connect to a remote gateway (e.g., VPS) instead of defaulting to localhost. Usage: http://localhost:5173/?gatewayUrl=ws://<vps-ip>:18789&token=<token> Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -62,6 +62,7 @@ export function applySettingsFromUrl(host: SettingsHost) {
|
|||||||
const tokenRaw = params.get("token");
|
const tokenRaw = params.get("token");
|
||||||
const passwordRaw = params.get("password");
|
const passwordRaw = params.get("password");
|
||||||
const sessionRaw = params.get("session");
|
const sessionRaw = params.get("session");
|
||||||
|
const gatewayUrlRaw = params.get("gatewayUrl");
|
||||||
let shouldCleanUrl = false;
|
let shouldCleanUrl = false;
|
||||||
|
|
||||||
if (tokenRaw != null) {
|
if (tokenRaw != null) {
|
||||||
@@ -94,6 +95,15 @@ export function applySettingsFromUrl(host: SettingsHost) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gatewayUrlRaw != null) {
|
||||||
|
const gatewayUrl = gatewayUrlRaw.trim();
|
||||||
|
if (gatewayUrl && gatewayUrl !== host.settings.gatewayUrl) {
|
||||||
|
applySettings(host, { ...host.settings, gatewayUrl });
|
||||||
|
}
|
||||||
|
params.delete("gatewayUrl");
|
||||||
|
shouldCleanUrl = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!shouldCleanUrl) return;
|
if (!shouldCleanUrl) return;
|
||||||
const url = new URL(window.location.href);
|
const url = new URL(window.location.href);
|
||||||
url.search = params.toString();
|
url.search = params.toString();
|
||||||
|
|||||||
Reference in New Issue
Block a user