Fixed entry route not redirecting correctly when the status entry page changes slug.

This commit is contained in:
George Tsomlektsis 2022-10-03 17:48:34 +03:00
parent 25ea99a436
commit b0d6b5b13d

View file

@ -155,7 +155,9 @@ let needSetup = false;
Database.init(args);
await initDatabase(testMode);
exports.entryPage = await setting("entryPage");
const entryPage = (await getSettings("general"))["entryPage"];
exports.entryPage = entryPage;
UptimeKumaServer.getInstance().entryPage = entryPage;
await StatusPage.loadDomainMappingList();
log.info("server", "Adding route");
@ -176,14 +178,15 @@ let needSetup = false;
log.debug("entry", `Request Domain: ${hostname}`);
const uptimeKumaEntryPage=UptimeKumaServer.getInstance().entryPage;
if (hostname in StatusPage.domainMappingList) {
log.debug("entry", "This is a status page domain");
let slug = StatusPage.domainMappingList[hostname];
await StatusPage.handleStatusPageResponse(response, server.indexHTML, slug);
} else if (exports.entryPage && exports.entryPage.startsWith("statusPage-")) {
response.redirect("/status/" + exports.entryPage.replace("statusPage-", ""));
} else if (uptimeKumaEntryPage && uptimeKumaEntryPage.startsWith('statusPage-')) {
response.redirect("/status/" + uptimeKumaEntryPage.replace("statusPage-", ""));
} else {
response.redirect("/dashboard");
@ -1085,6 +1088,7 @@ let needSetup = false;
await setSettings("general", data);
exports.entryPage = data.entryPage;
UptimeKumaServer.getInstance().entryPage = data.entryPage;
callback({
ok: true,