Fix sidebar links: use Tailscale IP when accessed via public domain
Deploy Dashboard / deploy (push) Successful in 31s
Deploy Dashboard / deploy (push) Successful in 31s
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user