remove duplicate code

This commit is contained in:
kr-ilya 2025-12-03 23:12:03 +03:00
parent 5d84ed255d
commit 5df9b4f5c2

View file

@ -322,8 +322,9 @@
const { webDomain, webPort, webBasePath, webCertFile, webKeyFile } = this.allSetting; const { webDomain, webPort, webBasePath, webCertFile, webKeyFile } = this.allSetting;
const newProtocol = (webCertFile || webKeyFile) ? "https:" : "http:"; const newProtocol = (webCertFile || webKeyFile) ? "https:" : "http:";
const base = webBasePath ? webBasePath.replace(/^\//, "") : "";
if (!this.entryIsIP) { if (!this.entryIsIP) {
const base = webBasePath ? webBasePath.replace(/^\//, "") : "";
const url = new URL(window.location.href); const url = new URL(window.location.href);
url.pathname = `/${base}panel/settings`; url.pathname = `/${base}panel/settings`;
window.location.replace(url.toString()); window.location.replace(url.toString());
@ -341,8 +342,6 @@
finalPort = String(webPort); finalPort = String(webPort);
} }
const base = webBasePath ? webBasePath.replace(/^\//, "") : "";
const url = new URL(`${newProtocol}//${finalHost}`); const url = new URL(`${newProtocol}//${finalHost}`);
if (finalPort) url.port = finalPort; if (finalPort) url.port = finalPort;
url.pathname = `/${base}panel/settings`; url.pathname = `/${base}panel/settings`;