mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-07-22 06:29:17 -04:00
feat: added HTTP method option for push monitor
This commit is contained in:
parent
2af754b5e8
commit
f89ed0a3a4
2 changed files with 48 additions and 43 deletions
|
@ -31,9 +31,8 @@ router.get("/api/entry-page", async (request, response) => {
|
|||
response.json(result);
|
||||
});
|
||||
|
||||
router.get("/api/push/:pushToken", async (request, response) => {
|
||||
router.all("/api/push/:pushToken", async (request, response) => {
|
||||
try {
|
||||
|
||||
let pushToken = request.params.pushToken;
|
||||
let msg = request.query.msg || "OK";
|
||||
let ping = request.query.ping || null;
|
||||
|
@ -48,6 +47,10 @@ router.get("/api/push/:pushToken", async (request, response) => {
|
|||
throw new Error("Monitor not found or not active.");
|
||||
}
|
||||
|
||||
if (monitor.method !== request.method) {
|
||||
throw new Error("Monitor HTTP method (" + monitor.method + ") does not match request (" + request.method + ").");
|
||||
}
|
||||
|
||||
const previousHeartbeat = await Monitor.getPreviousHeartbeat(monitor.id);
|
||||
|
||||
if (monitor.isUpsideDown()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue