|
|
@ -1,5 +1,12 @@
|
|
|
|
let express = require("express");
|
|
|
|
let express = require("express");
|
|
|
|
const { allowDevAllOrigin, allowAllOrigin, percentageToColor, filterAndJoin, sendHttpError } = require("../util-server");
|
|
|
|
const {
|
|
|
|
|
|
|
|
setting,
|
|
|
|
|
|
|
|
allowDevAllOrigin,
|
|
|
|
|
|
|
|
allowAllOrigin,
|
|
|
|
|
|
|
|
percentageToColor,
|
|
|
|
|
|
|
|
filterAndJoin,
|
|
|
|
|
|
|
|
sendHttpError,
|
|
|
|
|
|
|
|
} = require("../util-server");
|
|
|
|
const { R } = require("redbean-node");
|
|
|
|
const { R } = require("redbean-node");
|
|
|
|
const apicache = require("../modules/apicache");
|
|
|
|
const apicache = require("../modules/apicache");
|
|
|
|
const Monitor = require("../model/monitor");
|
|
|
|
const Monitor = require("../model/monitor");
|
|
|
@ -22,10 +29,14 @@ router.get("/api/entry-page", async (request, response) => {
|
|
|
|
allowDevAllOrigin(response);
|
|
|
|
allowDevAllOrigin(response);
|
|
|
|
|
|
|
|
|
|
|
|
let result = { };
|
|
|
|
let result = { };
|
|
|
|
|
|
|
|
let hostname = request.hostname;
|
|
|
|
|
|
|
|
if ((await setting("trustProxy")) && request.headers["x-forwarded-host"]) {
|
|
|
|
|
|
|
|
hostname = request.headers["x-forwarded-host"];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (request.hostname in StatusPage.domainMappingList) {
|
|
|
|
if (hostname in StatusPage.domainMappingList) {
|
|
|
|
result.type = "statusPageMatchedDomain";
|
|
|
|
result.type = "statusPageMatchedDomain";
|
|
|
|
result.statusPageSlug = StatusPage.domainMappingList[request.hostname];
|
|
|
|
result.statusPageSlug = StatusPage.domainMappingList[hostname];
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
result.type = "entryPage";
|
|
|
|
result.type = "entryPage";
|
|
|
|
result.entryPage = server.entryPage;
|
|
|
|
result.entryPage = server.entryPage;
|
|
|
|