Update server/routers/api-router.js

Co-authored-by: Frank Elsinga <frank@elsinga.de>
pull/4850/head
Qi Zhao 5 months ago
parent 3f425dc160
commit 58533e8f06

@ -310,7 +310,7 @@ router.get("/api/badge/:id/ping/:duration?", cache("5 minutes"), async (request,
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)
let requestedDuration = request.params.duration !== undefined ? request.params.duration : "24"; let requestedDuration = request.params.duration !== undefined ? request.params.duration : "24h";
const overrideValue = value && parseFloat(value); const overrideValue = value && parseFloat(value);
if (/^[0-9]+$/.test(requestedDuration)) { if (/^[0-9]+$/.test(requestedDuration)) {

Loading…
Cancel
Save