merge dev into main: sidebar network link fixes #16
@@ -169,9 +169,28 @@
|
|||||||
handleDragEnd();
|
handleDragEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toPublicHttpsUrl(href) {
|
||||||
|
if (typeof window === "undefined") return href;
|
||||||
|
if (!href) return href;
|
||||||
|
|
||||||
|
const isStandardHttps = location.protocol === "https:" && (!location.port || location.port === "443");
|
||||||
|
if (!isStandardHttps) return href;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const url = new URL(href);
|
||||||
|
if (url.protocol === "https:" && url.port === "8443") {
|
||||||
|
url.port = "";
|
||||||
|
return url.toString();
|
||||||
|
}
|
||||||
|
return href;
|
||||||
|
} catch {
|
||||||
|
return href;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function extHref(svc) {
|
function extHref(svc) {
|
||||||
if (lanReachable && svc.port) return `http://${LAN_IP}:${svc.port}`;
|
if (lanReachable && svc.port) return `http://${LAN_IP}:${svc.port}`;
|
||||||
if (svc.remoteHref) return svc.remoteHref;
|
if (svc.remoteHref) return lanReachable ? svc.remoteHref : toPublicHttpsUrl(svc.remoteHref);
|
||||||
if (svc.port) {
|
if (svc.port) {
|
||||||
const host = /^\d+\.\d+\.\d+\.\d+$/.test(location.hostname) ? location.hostname : TS_IP;
|
const host = /^\d+\.\d+\.\d+\.\d+$/.test(location.hostname) ? location.hostname : TS_IP;
|
||||||
return `http://${host}:${svc.port}`;
|
return `http://${host}:${svc.port}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user