From d576f77435523d9a4965747e7d3441b7aab468da Mon Sep 17 00:00:00 2001 From: Dorian Date: Mon, 27 Jul 2026 16:34:19 +0100 Subject: [PATCH] fix(companion): off-LAN load falls back to mesh URL, not dead LAN IP When neither the LAN origin nor the mesh ULA answers the probe window, target the mesh URL (when paired) instead of the LAN IP: off-LAN the LAN address can never answer, and loading it showed a confusing 'can't reach 192.168.x.x' error while the mesh session was still coming up. Co-Authored-By: Claude Fable 5 --- .../com/archipelago/app/ui/screens/WebViewScreen.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Android/app/src/main/java/com/archipelago/app/ui/screens/WebViewScreen.kt b/Android/app/src/main/java/com/archipelago/app/ui/screens/WebViewScreen.kt index a61e96e8..e4f78fd2 100644 --- a/Android/app/src/main/java/com/archipelago/app/ui/screens/WebViewScreen.kt +++ b/Android/app/src/main/java/com/archipelago/app/ui/screens/WebViewScreen.kt @@ -227,13 +227,17 @@ private fun tcpAnswers(base: String, timeoutMs: Int): Boolean = try { } /** Fastest answering origin: LAN inside a short window, else the mesh ULA - * (patient — a cold session may still be establishing), else LAN anyway so - * the existing error/fallback path handles it. */ + * (patient — a cold session may still be establishing). If NEITHER answers, + * fall back to the mesh URL when we have one — off-LAN the LAN IP is + * unreachable, and loading it just produced a confusing "can't reach + * 192.168.x.x" error page (user-reported 2026-07-27). Targeting the mesh URL + * instead means the load retries against the path that's actually coming up, + * and any error shows the mesh address rather than a dead LAN IP. */ private suspend fun pickStartUrl(lanUrl: String, meshUrl: String?): String = withContext(Dispatchers.IO) { if (tcpAnswers(lanUrl, 2500)) return@withContext lanUrl if (meshUrl != null && tcpAnswers(meshUrl, 12_000)) return@withContext meshUrl - lanUrl + meshUrl ?: lanUrl } /** Apply the WebView settings shared by the kiosk view and the in-app browser.