Remove isPublished, checkPublished which had been removed in upstream.

This commit is contained in:
Louis Lam 2022-05-02 13:32:19 +08:00
parent 96536ae391
commit c6ba5b621c

View File

@ -214,8 +214,6 @@ router.get("/api/badge/:id/status", cache("5 minutes"), async (request, response
} = request.query; } = request.query;
try { try {
await checkPublished();
const requestedMonitorId = parseInt(request.params.id, 10); const requestedMonitorId = parseInt(request.params.id, 10);
const overrideValue = value !== undefined ? parseInt(value) : undefined; const overrideValue = value !== undefined ? parseInt(value) : undefined;
@ -269,8 +267,6 @@ router.get("/api/badge/:id/uptime/:duration?", cache("5 minutes"), async (reques
} = request.query; } = request.query;
try { try {
await checkPublished();
const requestedMonitorId = parseInt(request.params.id, 10); const requestedMonitorId = parseInt(request.params.id, 10);
// if no duration is given, set value to 24 (h) // if no duration is given, set value to 24 (h)
const requestedDuration = request.params.duration !== undefined ? parseInt(request.params.duration, 10) : 24; const requestedDuration = request.params.duration !== undefined ? parseInt(request.params.duration, 10) : 24;
@ -335,8 +331,6 @@ router.get("/api/badge/:id/ping/:duration?", cache("5 minutes"), async (request,
} = request.query; } = request.query;
try { try {
await checkPublished();
const requestedMonitorId = parseInt(request.params.id, 10); const requestedMonitorId = parseInt(request.params.id, 10);
// Default duration is 24 (h) if not defined in queryParam, limited to 720h (30d) // Default duration is 24 (h) if not defined in queryParam, limited to 720h (30d)
@ -382,24 +376,6 @@ router.get("/api/badge/:id/ping/:duration?", cache("5 minutes"), async (request,
} }
}); });
async function checkPublished() {
if (! await isPublished()) {
throw new Error("The status page is not published");
}
}
/**
* Default is published
* @returns {Promise<boolean>}
*/
async function isPublished() {
const value = await setting("statusPagePublished");
if (value === null) {
return true;
}
return value;
}
/** /**
* Send a 403 response * Send a 403 response
* @param {Object} res Express response object * @param {Object} res Express response object