Skip to content

Commit

Permalink
Fix find-webclient for baseurls.
Browse files Browse the repository at this point in the history
  • Loading branch information
iwalton3 committed Jun 7, 2024
1 parent 1075ff7 commit 3f31831
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions native/find-webclient.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
};

Expand Down

0 comments on commit 3f31831

Please sign in to comment.