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) {
|
||||
let okMsg = "Sent Successfully.";
|
||||
try {
|
||||
await axios.post(`${notification.ntfyserverurl}`, {
|
||||
var ntfyparams = {
|
||||
"topic": notification.ntfytopic,
|
||||
"message": msg,
|
||||
"priority": notification.ntfyPriority || 4,
|
||||
"title": "Uptime-Kuma",
|
||||
"icon": notification.ntfyIcon || "",
|
||||
});
|
||||
};
|
||||
if (notification.ntfyIcon) {
|
||||
ntfyparams.icon = notification.ntfyIcon;
|
||||
}
|
||||
|
||||
try {
|
||||
await axios.post(`${notification.ntfyserverurl}`, ntfyparams);
|
||||
return okMsg;
|
||||
|
||||
} catch (error) {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
<div class="mb-3">
|
||||
<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>
|
||||
</template>
|
||||
|
||||
|
|
Loading…
Reference in New Issue