mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-23 23:04:04 +00:00
Rework lunasea notification to allow for device id and user id
This commit is contained in:
parent
48b637d4c8
commit
b21c2adcc2
2 changed files with 23 additions and 8 deletions
|
@ -9,8 +9,8 @@ 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 lunaseaurl = "";
|
let lunaseaurl = "";
|
||||||
if (notification.lunaseaNotificationType === "user") {
|
if (notification.lunaseaTarget === "user") {
|
||||||
lunaseaurl = "https://notify.lunasea.app/v1/custom/user/" + notification.lunaseaDevice;
|
lunaseaurl = "https://notify.lunasea.app/v1/custom/user/" + notification.lunaseaUserID;
|
||||||
} else {
|
} else {
|
||||||
lunaseaurl = "https://notify.lunasea.app/v1/custom/device/" + notification.lunaseaDevice;
|
lunaseaurl = "https://notify.lunasea.app/v1/custom/device/" + notification.lunaseaDevice;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,33 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="lunasea-notification-type" class="form-label">{{ $t("Device ID or User ID") }}<span style="color: red;"><sup>*</sup></span></label>
|
<label for="lunasea-notification-target" class="form-label">{{ $t("Target") }}<span style="color: red;"><sup>*</sup></span></label>
|
||||||
<div class="form-text">
|
<div class="form-text">
|
||||||
<p>
|
<p>
|
||||||
<select id="lunasea-notification-type" v-model="$parent.notification.lunaseaNotificationType" class="form-select" required>
|
<select id="lunasea-notification-target" v-model="$parent.notification.lunaseaTarget" class="form-select" required>
|
||||||
<option value="device">Device</option>
|
<option value="device">Device</option>
|
||||||
<option value="user">User</option>
|
<option value="user">User</option>
|
||||||
</select>
|
</select>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<label for="lunasea-device" class="form-label">{{ $t("LunaSea ID") }}<span style="color: red;"><sup>*</sup></span></label>
|
<div v-if="$parent.notification.lunaseaTarget === 'device'">
|
||||||
<input id="lunasea-device" v-model="$parent.notification.lunaseaDevice" type="text" class="form-control" required>
|
<label for="lunasea-device" class="form-label">{{ $t("Device ID") }}<span style="color: red;"><sup>*</sup></span></label>
|
||||||
<div class="form-text">
|
<input id="lunasea-device" v-model="$parent.notification.lunaseaDevice" type="text" class="form-control">
|
||||||
<p><span style="color: red;"><sup>*</sup></span>{{ $t("Required") }}</p>
|
</div>
|
||||||
|
<div v-if="$parent.notification.lunaseaTarget === 'user'">
|
||||||
|
<label for="lunasea-device" class="form-label">{{ $t("User ID") }}<span style="color: red;"><sup>*</sup></span></label>
|
||||||
|
<input id="lunasea-device" v-model="$parent.notification.lunaseaUserID" type="text" class="form-control">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
|
||||||
|
export default {
|
||||||
|
mounted() {
|
||||||
|
if (typeof this.$parent.notification.lunaseaTarget === "undefined") {
|
||||||
|
this.$parent.notification.lunaseaTarget = "device";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue