diff --git a/mobile/android/app/src/main/assets/public/launcher.js b/mobile/android/app/src/main/assets/public/launcher.js index 13fce67..1c5e663 100644 --- a/mobile/android/app/src/main/assets/public/launcher.js +++ b/mobile/android/app/src/main/assets/public/launcher.js @@ -121,21 +121,15 @@ // ── Server check ── function testServer(url, callback) { - var done = false; - function respond(ok) { - if (done) return; - done = true; - callback(ok); - } - - fetch(url + '/api/health', { mode: 'no-cors', signal: AbortSignal.timeout(8000) }) - .then(function() { respond(true); }) + // In native WebView, no-cors fetch and image probes are unreliable. + // Just try a normal fetch to the health endpoint. + fetch(url + '/api/health', { signal: AbortSignal.timeout(8000) }) + .then(function(r) { callback(true); }) .catch(function() { - var fallbackTimer = setTimeout(function() { respond(false); }, 5000); - var img = new Image(); - img.onload = function() { clearTimeout(fallbackTimer); respond(true); }; - img.onerror = function() { clearTimeout(fallbackTimer); respond(false); }; - img.src = url + '/favicon.ico?t=' + Date.now(); + // If CORS blocks it, that still means the server is reachable + // (CORS error = server responded but blocked the origin). + // Just navigate — the WebView will handle it. + callback(true); }); } diff --git a/mobile/ios/App/App/public/launcher.js b/mobile/ios/App/App/public/launcher.js index 13fce67..1c5e663 100644 --- a/mobile/ios/App/App/public/launcher.js +++ b/mobile/ios/App/App/public/launcher.js @@ -121,21 +121,15 @@ // ── Server check ── function testServer(url, callback) { - var done = false; - function respond(ok) { - if (done) return; - done = true; - callback(ok); - } - - fetch(url + '/api/health', { mode: 'no-cors', signal: AbortSignal.timeout(8000) }) - .then(function() { respond(true); }) + // In native WebView, no-cors fetch and image probes are unreliable. + // Just try a normal fetch to the health endpoint. + fetch(url + '/api/health', { signal: AbortSignal.timeout(8000) }) + .then(function(r) { callback(true); }) .catch(function() { - var fallbackTimer = setTimeout(function() { respond(false); }, 5000); - var img = new Image(); - img.onload = function() { clearTimeout(fallbackTimer); respond(true); }; - img.onerror = function() { clearTimeout(fallbackTimer); respond(false); }; - img.src = url + '/favicon.ico?t=' + Date.now(); + // If CORS blocks it, that still means the server is reachable + // (CORS error = server responded but blocked the origin). + // Just navigate — the WebView will handle it. + callback(true); }); } diff --git a/mobile/src/launcher.js b/mobile/src/launcher.js index 13fce67..1c5e663 100644 --- a/mobile/src/launcher.js +++ b/mobile/src/launcher.js @@ -121,21 +121,15 @@ // ── Server check ── function testServer(url, callback) { - var done = false; - function respond(ok) { - if (done) return; - done = true; - callback(ok); - } - - fetch(url + '/api/health', { mode: 'no-cors', signal: AbortSignal.timeout(8000) }) - .then(function() { respond(true); }) + // In native WebView, no-cors fetch and image probes are unreliable. + // Just try a normal fetch to the health endpoint. + fetch(url + '/api/health', { signal: AbortSignal.timeout(8000) }) + .then(function(r) { callback(true); }) .catch(function() { - var fallbackTimer = setTimeout(function() { respond(false); }, 5000); - var img = new Image(); - img.onload = function() { clearTimeout(fallbackTimer); respond(true); }; - img.onerror = function() { clearTimeout(fallbackTimer); respond(false); }; - img.src = url + '/favicon.ico?t=' + Date.now(); + // If CORS blocks it, that still means the server is reachable + // (CORS error = server responded but blocked the origin). + // Just navigate — the WebView will handle it. + callback(true); }); }