mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-28 01:04:05 +00:00
Add ability to use User ID for LunaSea notifications
This commit is contained in:
parent
e241728419
commit
8725e5daf9
2 changed files with 21 additions and 7 deletions
|
@ -8,7 +8,12 @@ class LunaSea 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.";
|
||||||
let lunaseadevice = "https://notify.lunasea.app/v1/custom/device/" + notification.lunaseaDevice;
|
let lunaseaurl = "";
|
||||||
|
if(notification.lunaseaNotificationType === "device") {
|
||||||
|
lunaseaurl = "https://notify.lunasea.app/v1/custom/device/" + notification.lunaseaId;
|
||||||
|
} else {
|
||||||
|
lunaseaurl = "https://notify.lunasea.app/v1/custom/user/" + notification.lunaseaId;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (heartbeatJSON == null) {
|
if (heartbeatJSON == null) {
|
||||||
|
@ -16,7 +21,7 @@ class LunaSea extends NotificationProvider {
|
||||||
"title": "Uptime Kuma Alert",
|
"title": "Uptime Kuma Alert",
|
||||||
"body": msg,
|
"body": msg,
|
||||||
};
|
};
|
||||||
await axios.post(lunaseadevice, testdata);
|
await axios.post(lunaseaurl, testdata);
|
||||||
return okMsg;
|
return okMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +30,7 @@ class LunaSea extends NotificationProvider {
|
||||||
"title": "UptimeKuma Alert: " + monitorJSON["name"],
|
"title": "UptimeKuma Alert: " + monitorJSON["name"],
|
||||||
"body": "[🔴 Down] " + heartbeatJSON["msg"] + "\nTime (UTC): " + heartbeatJSON["time"],
|
"body": "[🔴 Down] " + heartbeatJSON["msg"] + "\nTime (UTC): " + heartbeatJSON["time"],
|
||||||
};
|
};
|
||||||
await axios.post(lunaseadevice, downdata);
|
await axios.post(lunaseaurl, downdata);
|
||||||
return okMsg;
|
return okMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +39,7 @@ class LunaSea extends NotificationProvider {
|
||||||
"title": "UptimeKuma Alert: " + monitorJSON["name"],
|
"title": "UptimeKuma Alert: " + monitorJSON["name"],
|
||||||
"body": "[✅ Up] " + heartbeatJSON["msg"] + "\nTime (UTC): " + heartbeatJSON["time"],
|
"body": "[✅ Up] " + heartbeatJSON["msg"] + "\nTime (UTC): " + heartbeatJSON["time"],
|
||||||
};
|
};
|
||||||
await axios.post(lunaseadevice, updata);
|
await axios.post(lunaseaurl, updata);
|
||||||
return okMsg;
|
return okMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,16 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="lunasea-device" class="form-label">{{ $t("LunaSea Device ID") }}<span style="color: red;"><sup>*</sup></span></label>
|
<label for="lunasea-notification-type" class="form-label">{{ $t("Device ID or User ID") }}<span style="color: red;"><sup>*</sup></span></label>
|
||||||
<input id="lunasea-device" v-model="$parent.notification.lunaseaDevice" type="text" class="form-control" required>
|
<div class="form-text">
|
||||||
|
<p>
|
||||||
|
<select class="form-select" id="lunasea-notification-type" v-model="$parent.notification.lunaseaNotificationType">
|
||||||
|
<option value="device">Device</option>
|
||||||
|
<option value="user">User</option>
|
||||||
|
</select>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<label for="lunasea-device" class="form-label">{{ $t("LunaSea ID") }}<span style="color: red;"><sup>*</sup></span></label>
|
||||||
|
<input id="lunasea-device" v-model="$parent.notification.lunaseaId" type="text" class="form-control" required>
|
||||||
<div class="form-text">
|
<div class="form-text">
|
||||||
<p><span style="color: red;"><sup>*</sup></span>{{ $t("Required") }}</p>
|
<p><span style="color: red;"><sup>*</sup></span>{{ $t("Required") }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue