mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-02-26 05:25:56 +00:00
add logic to select sound for UP vs DOWN events
This commit is contained in:
parent
89751b5f33
commit
6c8b159174
1 changed files with 10 additions and 5 deletions
|
@ -1,5 +1,6 @@
|
||||||
const { getMonitorRelativeURL } = require("../../src/util");
|
const { getMonitorRelativeURL } = require("../../src/util");
|
||||||
const { setting } = require("../util-server");
|
const { setting } = require("../util-server");
|
||||||
|
const { UP, DOWN } = require("../../src/util");
|
||||||
|
|
||||||
const NotificationProvider = require("./notification-provider");
|
const NotificationProvider = require("./notification-provider");
|
||||||
const axios = require("axios");
|
const axios = require("axios");
|
||||||
|
@ -43,15 +44,19 @@ class Pushover extends NotificationProvider {
|
||||||
if (heartbeatJSON == null) {
|
if (heartbeatJSON == null) {
|
||||||
await axios.post(url, data);
|
await axios.post(url, data);
|
||||||
return okMsg;
|
return okMsg;
|
||||||
} else {
|
|
||||||
data.message += `\n<b>Time (${heartbeatJSON["timezone"]})</b>:${heartbeatJSON["localDateTime"]}`;
|
|
||||||
await axios.post(url, data);
|
|
||||||
return okMsg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (heartbeatJSON.status === UP) {
|
||||||
|
data.sound = notification.pushoversounds_up;
|
||||||
|
}
|
||||||
|
|
||||||
|
data.message += `\n<b>Time (${heartbeatJSON["timezone"]})</b>: ${heartbeatJSON["localDateTime"]}`;
|
||||||
|
await axios.post(url, data);
|
||||||
|
return okMsg;
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.throwGeneralAxiosError(error);
|
this.throwGeneralAxiosError(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue