mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-02-26 21:45:57 +00:00
Merge 7a8ab0271e
into 223cde831f
This commit is contained in:
commit
b60c84c955
2 changed files with 55 additions and 30 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 } = require("../../src/util");
|
||||||
|
|
||||||
const NotificationProvider = require("./notification-provider");
|
const NotificationProvider = require("./notification-provider");
|
||||||
const axios = require("axios");
|
const axios = require("axios");
|
||||||
|
@ -43,15 +44,20 @@ 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"]}`;
|
|
||||||
|
if (heartbeatJSON.status === UP && notification.pushoversounds_up) {
|
||||||
|
// default = DOWN => DOWN-sound is also played for non-UP/DOWN notiifcations
|
||||||
|
data.sound = notification.pushoversounds_up;
|
||||||
|
}
|
||||||
|
|
||||||
|
data.message += `\n<b>Time (${heartbeatJSON["timezone"]})</b>: ${heartbeatJSON["localDateTime"]}`;
|
||||||
await axios.post(url, data);
|
await axios.post(url, data);
|
||||||
return okMsg;
|
return okMsg;
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.throwGeneralAxiosError(error);
|
this.throwGeneralAxiosError(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,34 +16,24 @@
|
||||||
<option>1</option>
|
<option>1</option>
|
||||||
<option>2</option>
|
<option>2</option>
|
||||||
</select>
|
</select>
|
||||||
<label for="pushover-sound" class="form-label">{{ $t("Notification Sound") }}</label>
|
|
||||||
<select id="pushover-sound" v-model="$parent.notification.pushoversounds" class="form-select">
|
<label for="pushover-sound-down" class="form-label">{{ $t("Notification Sound") }} - Up</label>
|
||||||
<option value="pushover">{{ $t("pushoversounds pushover") }}</option>
|
<select id="pushover-sound-down" v-model="$parent.notification.pushoversounds" class="form-select">
|
||||||
<option value="bike">{{ $t("pushoversounds bike") }}</option>
|
<option v-for="sound in soundOptions" :key="sound" :value="sound">
|
||||||
<option value="bugle">{{ $t("pushoversounds bugle") }}</option>
|
{{ $t(`pushoversounds ${sound}`) }}
|
||||||
<option value="cashregister">{{ $t("pushoversounds cashregister") }}</option>
|
</option>
|
||||||
<option value="classical">{{ $t("pushoversounds classical") }}</option>
|
|
||||||
<option value="cosmic">{{ $t("pushoversounds cosmic") }}</option>
|
|
||||||
<option value="falling">{{ $t("pushoversounds falling") }}</option>
|
|
||||||
<option value="gamelan">{{ $t("pushoversounds gamelan") }}</option>
|
|
||||||
<option value="incoming">{{ $t("pushoversounds incoming") }}</option>
|
|
||||||
<option value="intermission">{{ $t("pushoversounds intermission") }}</option>
|
|
||||||
<option value="magic">{{ $t("pushoversounds magic") }}</option>
|
|
||||||
<option value="mechanical">{{ $t("pushoversounds mechanical") }}</option>
|
|
||||||
<option value="pianobar">{{ $t("pushoversounds pianobar") }}</option>
|
|
||||||
<option value="siren">{{ $t("pushoversounds siren") }}</option>
|
|
||||||
<option value="spacealarm">{{ $t("pushoversounds spacealarm") }}</option>
|
|
||||||
<option value="tugboat">{{ $t("pushoversounds tugboat") }}</option>
|
|
||||||
<option value="alien">{{ $t("pushoversounds alien") }}</option>
|
|
||||||
<option value="climb">{{ $t("pushoversounds climb") }}</option>
|
|
||||||
<option value="persistent">{{ $t("pushoversounds persistent") }}</option>
|
|
||||||
<option value="echo">{{ $t("pushoversounds echo") }}</option>
|
|
||||||
<option value="updown">{{ $t("pushoversounds updown") }}</option>
|
|
||||||
<option value="vibrate">{{ $t("pushoversounds vibrate") }}</option>
|
|
||||||
<option value="none">{{ $t("pushoversounds none") }}</option>
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<label for="pushover-sound-up" class="form-label">{{ $t("Notification Sound") }} - Down</label>
|
||||||
|
<select id="pushover-sound-up" v-model="$parent.notification.pushoversounds_up" class="form-select">
|
||||||
|
<option v-for="sound in soundOptions" :key="sound" :value="sound">
|
||||||
|
{{ $t(`pushoversounds ${sound}`) }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
<label for="pushover-ttl" class="form-label">{{ $t("pushoverMessageTtl") }}</label>
|
<label for="pushover-ttl" class="form-label">{{ $t("pushoverMessageTtl") }}</label>
|
||||||
<input id="pushover-ttl" v-model="$parent.notification.pushoverttl" type="number" min="0" step="1" class="form-control">
|
<input id="pushover-ttl" v-model="$parent.notification.pushoverttl" type="number" min="0" step="1" class="form-control">
|
||||||
|
|
||||||
<div class="form-text">
|
<div class="form-text">
|
||||||
<span style="color: red;"><sup>*</sup></span>{{ $t("Required") }}
|
<span style="color: red;"><sup>*</sup></span>{{ $t("Required") }}
|
||||||
<i18n-t tag="p" keypath="More info on:" style="margin-top: 8px;">
|
<i18n-t tag="p" keypath="More info on:" style="margin-top: 8px;">
|
||||||
|
@ -66,5 +56,34 @@ export default {
|
||||||
components: {
|
components: {
|
||||||
HiddenInput,
|
HiddenInput,
|
||||||
},
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
soundOptions: [
|
||||||
|
"pushover",
|
||||||
|
"bike",
|
||||||
|
"bugle",
|
||||||
|
"cashregister",
|
||||||
|
"classical",
|
||||||
|
"cosmic",
|
||||||
|
"falling",
|
||||||
|
"gamelan",
|
||||||
|
"incoming",
|
||||||
|
"intermission",
|
||||||
|
"magic",
|
||||||
|
"mechanical",
|
||||||
|
"pianobar",
|
||||||
|
"siren",
|
||||||
|
"spacealarm",
|
||||||
|
"tugboat",
|
||||||
|
"alien",
|
||||||
|
"climb",
|
||||||
|
"persistent",
|
||||||
|
"echo",
|
||||||
|
"updown",
|
||||||
|
"vibrate",
|
||||||
|
"none",
|
||||||
|
],
|
||||||
|
};
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Add table
Reference in a new issue