From 08f3065e24a450175a94e1b96106e0b4d2b1606c Mon Sep 17 00:00:00 2001 From: "Gan, Jimmy" Date: Wed, 25 Feb 2026 00:22:54 +0800 Subject: [PATCH] Fix sidebar links: use Tailscale IP when accessed via public domain --- dashboard/frontend/src/components/Sidebar.svelte | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dashboard/frontend/src/components/Sidebar.svelte b/dashboard/frontend/src/components/Sidebar.svelte index 7682ff2..938f2ad 100644 --- a/dashboard/frontend/src/components/Sidebar.svelte +++ b/dashboard/frontend/src/components/Sidebar.svelte @@ -9,6 +9,7 @@ ]; const LAN_IP = "192.168.31.221"; + const TS_IP = "100.78.131.124"; let lanReachable = $state(false); if (typeof window !== "undefined" && location.hostname !== LAN_IP) { @@ -36,7 +37,10 @@ function extHref(svc) { if (lanReachable && svc.port) return `http://${LAN_IP}:${svc.port}`; if (svc.remoteHref) return svc.remoteHref; - if (svc.port) return `${location.protocol}//${location.hostname}:${svc.port}`; + if (svc.port) { + const host = /^\d+\.\d+\.\d+\.\d+$/.test(location.hostname) ? location.hostname : TS_IP; + return `http://${host}:${svc.port}`; + } return svc.href; }