Browse Source

Normalize URL comparison in admin diagnostics checkDomain

pull/7735/head
7heMech 2 weeks ago
parent
commit
f2db050877
  1. 46
      src/static/scripts/admin_diagnostics.js

46
src/static/scripts/admin_diagnostics.js

@ -195,19 +195,41 @@ function checkTimeDrift(utcTimeA, utcTimeB, statusPrefix) {
} }
function checkDomain(browserURL, serverURL) { function checkDomain(browserURL, serverURL) {
if (serverURL == browserURL) { try {
document.getElementById("domain-success").classList.remove("d-none"); const browser = new URL(browserURL);
domainCheck = true; const server = new URL(serverURL);
} else {
document.getElementById("domain-warning").classList.remove("d-none");
}
// Check for HTTPS at domain-server-string const browserPath = browser.pathname.split("/").filter(Boolean).join("/");
if (serverURL.startsWith("https://") ) { const serverPath = server.pathname.split("/").filter(Boolean).join("/");
document.getElementById("https-success").classList.remove("d-none");
httpsCheck = true; if (browser.origin === server.origin && browserPath === serverPath) {
} else { document.getElementById("domain-success").classList.remove("d-none");
document.getElementById("https-warning").classList.remove("d-none"); domainCheck = true;
} else {
document.getElementById("domain-warning").classList.remove("d-none");
}
// Check for HTTPS at domain-server-string
if (server.protocol === "https:") {
document.getElementById("https-success").classList.remove("d-none");
httpsCheck = true;
} else {
document.getElementById("https-warning").classList.remove("d-none");
}
} catch {
if (serverURL == browserURL) {
document.getElementById("domain-success").classList.remove("d-none");
domainCheck = true;
} else {
document.getElementById("domain-warning").classList.remove("d-none");
}
if (serverURL.startsWith("https://")) {
document.getElementById("https-success").classList.remove("d-none");
httpsCheck = true;
} else {
document.getElementById("https-warning").classList.remove("d-none");
}
} }
} }

Loading…
Cancel
Save