mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-07-18 23:34:04 +02:00
Add separate down priority field to ntfy.sh
This commit is contained in:
parent
b0b22a0116
commit
a8549d55de
3 changed files with 18 additions and 4 deletions
|
@ -37,12 +37,12 @@ class Ntfy extends NotificationProvider {
|
||||||
let tags = [];
|
let tags = [];
|
||||||
let status = "unknown";
|
let status = "unknown";
|
||||||
let priority = notification.ntfyPriority || 4;
|
let priority = notification.ntfyPriority || 4;
|
||||||
|
let downPriority = notification.ntfyPriorityDown || 5;
|
||||||
if ("status" in heartbeatJSON) {
|
if ("status" in heartbeatJSON) {
|
||||||
if (heartbeatJSON.status === DOWN) {
|
if (heartbeatJSON.status === DOWN) {
|
||||||
tags = [ "red_circle" ];
|
tags = [ "red_circle" ];
|
||||||
status = "Down";
|
status = "Down";
|
||||||
// if priority is not 5, increase priority for down alerts
|
priority = downPriority
|
||||||
priority = priority === 5 ? priority : priority + 1;
|
|
||||||
} else if (heartbeatJSON["status"] === UP) {
|
} else if (heartbeatJSON["status"] === UP) {
|
||||||
tags = [ "green_circle" ];
|
tags = [ "green_circle" ];
|
||||||
status = "Up";
|
status = "Up";
|
||||||
|
|
|
@ -13,13 +13,20 @@
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="ntfy-priority" class="form-label">{{ $t("Priority") }}</label>
|
<label for="ntfy-priority" class="form-label">{{ $t("Priority") }}</label>
|
||||||
<input id="ntfy-priority" v-model="$parent.notification.ntfyPriority" type="number" class="form-control" required min="1" max="5" step="1">
|
<input id="ntfy-priority" v-model="$parent.notification.ntfyPriority" type="number" class="form-control" required min="1" max="5" step="1">
|
||||||
|
<label for="ntfy-priority-down" class="form-label">{{ $t("ntfyPriorityDown") }}</label>
|
||||||
|
<input id="ntfy-priority-down" v-model="$parent.notification.ntfyPriorityDown" type="number" class="form-control" required min="1" max="5" step="1">
|
||||||
<div class="form-text">
|
<div class="form-text">
|
||||||
<p v-if="$parent.notification.ntfyPriority >= 5">
|
<p v-if="$parent.notification.ntfyPriority == $parent.notification.ntfyPriorityDown && $parent.notification.ntfyPriority >= 5">
|
||||||
{{ $t("ntfyPriorityHelptextAllEvents") }}
|
{{ $t("ntfyPriorityHelptextAllEvents") }}
|
||||||
</p>
|
</p>
|
||||||
|
<i18n-t v-else-if="$parent.notification.ntfyPriority > $parent.notification.ntfyPriorityDown" tag="p" keypath="ntfyPriorityHelptextPriorityHigherThanDown">
|
||||||
|
<code>DOWN</code>
|
||||||
|
<code>{{ $parent.notification.ntfyPriority }}</code>
|
||||||
|
<code>{{ $parent.notification.ntfyPriorityDown }}</code>
|
||||||
|
</i18n-t>
|
||||||
<i18n-t v-else tag="p" keypath="ntfyPriorityHelptextAllExceptDown">
|
<i18n-t v-else tag="p" keypath="ntfyPriorityHelptextAllExceptDown">
|
||||||
<code>DOWN</code>
|
<code>DOWN</code>
|
||||||
<code>{{ $parent.notification.ntfyPriority + 1 }}</code>
|
<code>{{ $parent.notification.ntfyPriorityDown }}</code>
|
||||||
</i18n-t>
|
</i18n-t>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -69,6 +76,11 @@ export default {
|
||||||
this.$parent.notification.ntfyPriority = 5;
|
this.$parent.notification.ntfyPriority = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Setting down priority if it's undefined
|
||||||
|
if (typeof this.$parent.notification.ntfyPriorityDown === "undefined") {
|
||||||
|
this.$parent.notification.ntfyPriorityDown = 5;
|
||||||
|
}
|
||||||
|
|
||||||
// Handling notifications that added before 1.22.0
|
// Handling notifications that added before 1.22.0
|
||||||
if (typeof this.$parent.notification.ntfyAuthenticationMethod === "undefined") {
|
if (typeof this.$parent.notification.ntfyAuthenticationMethod === "undefined") {
|
||||||
if (!this.$parent.notification.ntfyusername) {
|
if (!this.$parent.notification.ntfyusername) {
|
||||||
|
|
|
@ -841,6 +841,8 @@
|
||||||
"ntfyAuthenticationMethod": "Authentication Method",
|
"ntfyAuthenticationMethod": "Authentication Method",
|
||||||
"ntfyPriorityHelptextAllEvents": "All events are sent with the maximum priority",
|
"ntfyPriorityHelptextAllEvents": "All events are sent with the maximum priority",
|
||||||
"ntfyPriorityHelptextAllExceptDown": "All events are sent with this priority, except {0}-events, which have a priority of {1}",
|
"ntfyPriorityHelptextAllExceptDown": "All events are sent with this priority, except {0}-events, which have a priority of {1}",
|
||||||
|
"ntfyPriorityHelptextPriorityHigherThanDown":"Regular priority should be higher than {0} priority. Priority {1} is higher than {0} priority {2}",
|
||||||
|
"ntfyPriorityDown":"Priority for DOWN-events",
|
||||||
"ntfyUsernameAndPassword": "Username and Password",
|
"ntfyUsernameAndPassword": "Username and Password",
|
||||||
"twilioAccountSID": "Account SID",
|
"twilioAccountSID": "Account SID",
|
||||||
"twilioApiKey": "Api Key (optional)",
|
"twilioApiKey": "Api Key (optional)",
|
||||||
|
|
Loading…
Add table
Reference in a new issue