From 86ac9c3ce5560b4a1f19119ad72e283f4c9fa223 Mon Sep 17 00:00:00 2001 From: haorwen Date: Sun, 21 Jun 2026 20:01:26 +0800 Subject: [PATCH] fix: no auto-redirect on public domain after tunnel setup, show next button instead --- .../onboarding/steps/get-public-domain.tsx | 38 ++++++++++--------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/src/routes/onboarding/steps/get-public-domain.tsx b/src/routes/onboarding/steps/get-public-domain.tsx index a7aefc45..9997a1f4 100644 --- a/src/routes/onboarding/steps/get-public-domain.tsx +++ b/src/routes/onboarding/steps/get-public-domain.tsx @@ -29,20 +29,7 @@ export default function GetPublicDomain() { const currentVersion = useAppSelector((store) => store.server.version, shallowEqual); const { data: autoInfo } = useGetAutoTunnelInfoQuery(); - // If already on the tunnel domain, skip this step - useEffect(() => { - const tunnelUrl = autoInfo?.tunnel_status?.url; - if (tunnelUrl) { - try { - const tunnelOrigin = new URL(tunnelUrl).origin; - if (location.origin === tunnelOrigin) { - nextStep(); - } - } catch { - // ignore malformed URL - } - } - }, [autoInfo]); + const isLocalhost = /^https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?$/.test(location.origin); const [phase, setPhase] = useState("prompt"); const [logs, setLogs] = useState([]); @@ -65,6 +52,7 @@ export default function GetPublicDomain() { function startCountdown(url: string) { setTunnelUrl(url); setPhase("done"); + if (!isLocalhost) return; let remaining = COUNTDOWN_SECONDS; setCountdown(remaining); countRef.current = setInterval(() => { @@ -211,9 +199,25 @@ export default function GetPublicDomain() { {tunnelUrl} - - {t("tunnel_redirect_countdown", { seconds: countdown })} - + {isLocalhost ? ( + + {t("tunnel_redirect_countdown", { seconds: countdown })} + + ) : ( +
+ + {tunnelUrl} + + + {t("tunnel_opt_in_skip")} + +
+ )} ); }