diff --git a/server/routers/api-router.js b/server/routers/api-router.js index 6d1a8d7b8..8f5f6d6f2 100644 --- a/server/routers/api-router.js +++ b/server/routers/api-router.js @@ -4,7 +4,7 @@ const { R } = require("redbean-node"); const apicache = require("../modules/apicache"); const Monitor = require("../model/monitor"); const dayjs = require("dayjs"); -const { UP, flipStatus, log } = require("../../src/util"); +const { UP, DOWN, flipStatus, log } = require("../../src/util"); const StatusPage = require("../model/status_page"); const { UptimeKumaServer } = require("../uptime-kuma-server"); let router = express.Router(); @@ -34,6 +34,8 @@ router.get("/api/push/:pushToken", async (request, response) => { let pushToken = request.params.pushToken; let msg = request.query.msg || "OK"; let ping = request.query.ping || null; + let statusString = request.query.status || "up"; + let status = (statusString === "up") ? UP : DOWN; let monitor = await R.findOne("monitor", " push_token = ? AND active = 1 ", [ pushToken @@ -45,7 +47,6 @@ router.get("/api/push/:pushToken", async (request, response) => { const previousHeartbeat = await Monitor.getPreviousHeartbeat(monitor.id); - let status = UP; if (monitor.isUpsideDown()) { status = flipStatus(status); } diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index 3a49c8293..39c114ad6 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -56,7 +56,7 @@
{{ $t("needPushEvery", [monitor.interval]) }}
- {{ $t("pushOptionalParams", ["msg, ping"]) }} + {{ $t("pushOptionalParams", ["status, msg, ping"]) }}
@@ -421,7 +421,7 @@ export default { }, pushURL() { - return this.$root.baseURL + "/api/push/" + this.monitor.pushToken + "?msg=OK&ping="; + return this.$root.baseURL + "/api/push/" + this.monitor.pushToken + "?status=true&msg=OK&ping="; }, bodyPlaceholder() {