mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-20 21:24:44 -05:00
Make icon optional for ntfy notificaation provider. Add Icon header to ntfy request only, if icon is actually defined.
This commit is contained in:
parent
c03d911657
commit
1e8a16504b
@ -7,15 +7,18 @@ class Ntfy extends NotificationProvider {
|
|||||||
|
|
||||||
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
||||||
let okMsg = "Sent Successfully.";
|
let okMsg = "Sent Successfully.";
|
||||||
try {
|
var ntfyparams = {
|
||||||
await axios.post(`${notification.ntfyserverurl}`, {
|
|
||||||
"topic": notification.ntfytopic,
|
"topic": notification.ntfytopic,
|
||||||
"message": msg,
|
"message": msg,
|
||||||
"priority": notification.ntfyPriority || 4,
|
"priority": notification.ntfyPriority || 4,
|
||||||
"title": "Uptime-Kuma",
|
"title": "Uptime-Kuma",
|
||||||
"icon": notification.ntfyIcon || "",
|
};
|
||||||
});
|
if (notification.ntfyIcon) {
|
||||||
|
ntfyparams.icon = notification.ntfyIcon;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await axios.post(`${notification.ntfyserverurl}`, ntfyparams);
|
||||||
return okMsg;
|
return okMsg;
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="ntfy-icon" class="form-label">{{ $t("IconUrl") }}</label>
|
<label for="ntfy-icon" class="form-label">{{ $t("IconUrl") }}</label>
|
||||||
<input id="ntfy-icon" v-model="$parent.notification.ntfyIcon" type="text" class="form-control" required>
|
<input id="ntfy-icon" v-model="$parent.notification.ntfyIcon" type="text" class="form-control">
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user