From 5196f873d912e31f669c157fbdafc85f8b178bbe Mon Sep 17 00:00:00 2001 From: Rob Date: Sat, 25 Apr 2026 15:18:44 -0400 Subject: [PATCH] fix: use BASE_PATH for WebSocket URL in subpath deployments When CloudCLI is served from a subpath (e.g. /s/myproject/), the plugin-ws WebSocket URL needs the base path prefix. Reads window.__CLOUDCLI_BASE_PATH__ which CloudCLI injects at runtime. Without this, the WebSocket connects to /plugin-ws/web-terminal instead of /s/myproject/plugin-ws/web-terminal and fails. --- src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index e8aadac..6645ce9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -301,7 +301,8 @@ function buildWsUrl(): string { const proto = location.protocol === 'https:' ? 'wss:' : 'ws:'; const token = localStorage.getItem('auth-token') || ''; const qs = token ? '?token=' + encodeURIComponent(token) : ''; - return proto + '//' + location.host + '/plugin-ws/web-terminal' + qs; + const basePath = (window as any).__CLOUDCLI_BASE_PATH__ || ''; + return proto + '//' + location.host + basePath + '/plugin-ws/web-terminal' + qs; } // ── Terminal session ──────────────────────────────────────────────────────────