From c87a783b883af0182e13aeec2c891a3c82d9d62f Mon Sep 17 00:00:00 2001 From: wusumac <736139669@qq.com> Date: Sun, 2 Aug 2026 23:52:24 +0800 Subject: [PATCH] fix(web): show the actual connected hub (baseUrl) in the connection row --- web/src/routes/settings/general.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/web/src/routes/settings/general.tsx b/web/src/routes/settings/general.tsx index 21c77939..69a4b9e4 100644 --- a/web/src/routes/settings/general.tsx +++ b/web/src/routes/settings/general.tsx @@ -11,7 +11,7 @@ const locales: ReadonlyArray<{ value: Locale; label: string }> = [ function ConnectionSwitch() { const { t } = useTranslation() - const { api, setServerUrl } = useAppContext() + const { api, baseUrl, setServerUrl } = useAppContext() const [info, setInfo] = useState<{ publicUrl: string | null; lanUrl: string | null } | null>(null) useEffect(() => { @@ -45,12 +45,12 @@ function ConnectionSwitch() { } catch { publicOrigin = null } - const currentOrigin = typeof window !== 'undefined' ? window.location.origin : '' // Anything other than the public domain counts as the alternative // (LAN) connection — this also covers IP-based access like // http://192.168.x.x:3006 even when the configured lanUrl uses a - // hostname. - const isOnLan = currentOrigin !== '' && currentOrigin !== publicOrigin + // hostname. baseUrl is the hub the app is actually talking to — it + // updates in place after setServerUrl() without a page reload. + const isOnLan = baseUrl !== '' && baseUrl !== publicOrigin const target = isOnLan ? info.publicUrl : info.lanUrl if (!target) { return null @@ -60,7 +60,7 @@ function ConnectionSwitch() { {currentOrigin}} + trailing={{baseUrl}} />