feat: added HTTP method option for push monitor

pull/1991/head
Stefan Ottosson 2 years ago
parent 2af754b5e8
commit f89ed0a3a4

@ -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()) {

@ -398,7 +398,7 @@
</div>
<!-- HTTP Options -->
<template v-if="monitor.type === 'http' || monitor.type === 'keyword' ">
<template v-if="monitor.type === 'http' || monitor.type === 'keyword' || monitor.type === 'push'">
<h2 class="mt-5 mb-2">{{ $t("HTTP Options") }}</h2>
<!-- Method -->
@ -429,6 +429,7 @@
</select>
</div>
<template v-if="monitor.type !== 'push'">
<!-- Body -->
<div class="my-3">
<label for="body" class="form-label">{{ $t("Body") }}</label>
@ -482,6 +483,7 @@
</template>
</template>
</template>
</template>
</div>
</div>
</div>

Loading…
Cancel
Save