From 0692cca20de54b732fb7dbcf2b68ec89d58bf0ba Mon Sep 17 00:00:00 2001 From: web3dev1337 Date: Sun, 19 Jul 2026 12:43:04 +1000 Subject: [PATCH] fix: dashboard API calls use same-origin instead of hardcoded localhost ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The recovery/startup helpers mapped client port 2080 -> localhost:3000 and 2081 -> localhost:4000, which only resolves on the machine the browser runs on — from a phone or second PC "localhost" is that device, so the calls timed out ("please check if server is running on port 3000") and got CORS-blocked locally too. The client dev server already proxies /api to the backend, so same-origin works everywhere, remote browsers included. Co-Authored-By: Claude Fable 5 --- client/dashboard.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/client/dashboard.js b/client/dashboard.js index fdb6383c..a4b8e874 100644 --- a/client/dashboard.js +++ b/client/dashboard.js @@ -4534,9 +4534,9 @@ class Dashboard { } async installWindowsStartup() { - const serverUrl = window.location.port === '2080' ? 'http://localhost:3000' : - window.location.port === '2081' ? 'http://localhost:4000' : - window.location.origin; + // Same-origin: the client dev server proxies /api to the backend, which + // also works from remote browsers (a hardcoded localhost:PORT does not). + const serverUrl = window.location.origin; // First check if we're on WSL try { @@ -4589,9 +4589,9 @@ class Dashboard { } async checkRecoveryState(workspaceId) { - const serverUrl = window.location.port === '2080' ? 'http://localhost:3000' : - window.location.port === '2081' ? 'http://localhost:4000' : - window.location.origin; + // Same-origin: the client dev server proxies /api to the backend, which + // also works from remote browsers (a hardcoded localhost:PORT does not). + const serverUrl = window.location.origin; try { const response = await fetch(`${serverUrl}/api/recovery/${encodeURIComponent(workspaceId)}`); @@ -4687,9 +4687,9 @@ class Dashboard { document.body.appendChild(modal); - const serverUrl = window.location.port === '2080' ? 'http://localhost:3000' : - window.location.port === '2081' ? 'http://localhost:4000' : - window.location.origin; + // Same-origin: the client dev server proxies /api to the backend, which + // also works from remote browsers (a hardcoded localhost:PORT does not). + const serverUrl = window.location.origin; const setButtonsDisabled = (disabled) => { modal.querySelectorAll('button').forEach((btn) => { btn.disabled = !!disabled; });