From c6ba5b621c2cb4a3d04c518904747f365c6bfc3b Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Mon, 2 May 2022 13:32:19 +0800 Subject: [PATCH] Remove isPublished, checkPublished which had been removed in upstream. --- server/routers/api-router.js | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/server/routers/api-router.js b/server/routers/api-router.js index 1d6215198..8cf73e162 100644 --- a/server/routers/api-router.js +++ b/server/routers/api-router.js @@ -214,8 +214,6 @@ router.get("/api/badge/:id/status", cache("5 minutes"), async (request, response } = request.query; try { - await checkPublished(); - const requestedMonitorId = parseInt(request.params.id, 10); 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; try { - await checkPublished(); - const requestedMonitorId = parseInt(request.params.id, 10); // if no duration is given, set value to 24 (h) 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; try { - await checkPublished(); - const requestedMonitorId = parseInt(request.params.id, 10); // 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} - */ -async function isPublished() { - const value = await setting("statusPagePublished"); - if (value === null) { - return true; - } - return value; -} - /** * Send a 403 response * @param {Object} res Express response object