mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-10-01 01:25:45 -04:00
add status boolean parameter to push monitor
This commit is contained in:
parent
0ca68f791f
commit
3d002b3ce9
@ -5,7 +5,7 @@ const server = require("../server");
|
|||||||
const apicache = require("../modules/apicache");
|
const apicache = require("../modules/apicache");
|
||||||
const Monitor = require("../model/monitor");
|
const Monitor = require("../model/monitor");
|
||||||
const dayjs = require("dayjs");
|
const dayjs = require("dayjs");
|
||||||
const { UP, flipStatus, debug } = require("../../src/util");
|
const { UP, DOWN, flipStatus, debug } = require("../../src/util");
|
||||||
let router = express.Router();
|
let router = express.Router();
|
||||||
|
|
||||||
let cache = apicache.middleware;
|
let cache = apicache.middleware;
|
||||||
@ -22,6 +22,8 @@ router.get("/api/push/:pushToken", async (request, response) => {
|
|||||||
let pushToken = request.params.pushToken;
|
let pushToken = request.params.pushToken;
|
||||||
let msg = request.query.msg || "OK";
|
let msg = request.query.msg || "OK";
|
||||||
let ping = request.query.ping || null;
|
let ping = request.query.ping || null;
|
||||||
|
let status = request.query.status || "true";
|
||||||
|
status = status === "true" ? UP : DOWN;
|
||||||
|
|
||||||
let monitor = await R.findOne("monitor", " push_token = ? AND active = 1 ", [
|
let monitor = await R.findOne("monitor", " push_token = ? AND active = 1 ", [
|
||||||
pushToken
|
pushToken
|
||||||
@ -33,7 +35,6 @@ router.get("/api/push/:pushToken", async (request, response) => {
|
|||||||
|
|
||||||
const previousHeartbeat = await Monitor.getPreviousHeartbeat(monitor.id);
|
const previousHeartbeat = await Monitor.getPreviousHeartbeat(monitor.id);
|
||||||
|
|
||||||
let status = UP;
|
|
||||||
if (monitor.isUpsideDown()) {
|
if (monitor.isUpsideDown()) {
|
||||||
status = flipStatus(status);
|
status = flipStatus(status);
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
<CopyableInput id="push-url" v-model="pushURL" type="url" disabled="disabled" />
|
<CopyableInput id="push-url" v-model="pushURL" type="url" disabled="disabled" />
|
||||||
<div class="form-text">
|
<div class="form-text">
|
||||||
{{ $t("needPushEvery", [monitor.interval]) }}<br />
|
{{ $t("needPushEvery", [monitor.interval]) }}<br />
|
||||||
{{ $t("pushOptionalParams", ["msg, ping"]) }}
|
{{ $t("pushOptionalParams", ["status, msg, ping"]) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -349,7 +349,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
pushURL() {
|
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() {
|
bodyPlaceholder() {
|
||||||
|
Loading…
Reference in New Issue
Block a user