From 3f31831a7efc6e00ced7ac67410abdaa8b68faa1 Mon Sep 17 00:00:00 2001 From: Izzie Walton Date: Fri, 7 Jun 2024 09:16:29 -0400 Subject: [PATCH] Fix find-webclient for baseurls. --- native/find-webclient.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/native/find-webclient.js b/native/find-webclient.js index 71a50732..44fb32e5 100644 --- a/native/find-webclient.js +++ b/native/find-webclient.js @@ -7,7 +7,7 @@ async function tryConnect(server) { } server = server.replace(/\/+$/, ""); - const url = new URL("/System/Info/Public", server); + const url = server + "/System/Info/Public"; const response = await fetch(url); if (response.ok && (await response.json()).Id) { const htmlResponse = await fetch(server); @@ -29,16 +29,16 @@ async function tryConnect(server) { const base = doc.createElement("base"); base.href = webUrl doc.head.insertBefore(base, doc.head.firstChild); - + const oldPushState = window.history.pushState; window.history.pushState = function(state, title, url) { - url = (new URL(url, realUrl)).toString(); + url = url ? (new URL(url, realUrl)).toString() : realUrl; return oldPushState.call(window.history, state, title, url); }; const oldReplaceState = window.history.replaceState; window.history.replaceState = function(state, title, url) { - url = (new URL(url, realUrl)).toString(); + url = url ? (new URL(url, realUrl)).toString() : realUrl; return oldReplaceState.call(window.history, state, title, url); };