mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-06-01 19:32:34 +02:00
Updated form to send simultaneously to phone, groups and contacts
This commit is contained in:
parent
c154d8b214
commit
e0f25eba60
2 changed files with 40 additions and 30 deletions
|
@ -18,36 +18,43 @@ class SMSEagle extends NotificationProvider {
|
|||
}
|
||||
};
|
||||
|
||||
let postData;
|
||||
let recipientType;
|
||||
|
||||
let encoding = (notification.smseagleEncoding) ? "unicode" : "standard";
|
||||
let priority = (notification.smseaglePriority) ? notification.smseaglePriority : 0;
|
||||
let recipientList = notification.smseagleRecipient.split(",");
|
||||
|
||||
if (notification.smseagleRecipientType === "smseagle-contact") {
|
||||
recipientType = "contacts";
|
||||
recipientList = recipientList.map(e => {
|
||||
return Number(e)
|
||||
});
|
||||
}
|
||||
if (notification.smseagleRecipientType === "smseagle-group") {
|
||||
recipientType = "groups";
|
||||
recipientList = recipientList.map(e => {
|
||||
return Number(e)
|
||||
});
|
||||
}
|
||||
if (notification.smseagleRecipientType === "smseagle-to") {
|
||||
recipientType = "to";
|
||||
}
|
||||
|
||||
postData = {
|
||||
[recipientType]: recipientList,
|
||||
let postData = {
|
||||
text: msg,
|
||||
encoding: encoding,
|
||||
priority: priority
|
||||
};
|
||||
|
||||
let to = notification.smseagleRecipientTo;
|
||||
let contacts = notification.smseagleRecipientContact;
|
||||
let groups = notification.smseagleRecipientGroup;
|
||||
console.log("b", to, contacts, groups);
|
||||
|
||||
if (contacts) {
|
||||
contacts = contacts.split(",");
|
||||
contacts = contacts.map(e => {
|
||||
return Number(e)
|
||||
});
|
||||
postData["contacts"] = contacts;
|
||||
}
|
||||
|
||||
if (groups) {
|
||||
groups = groups.split(",");
|
||||
groups = groups.map(e => {
|
||||
return Number(e)
|
||||
});
|
||||
postData["groups"] = groups;
|
||||
}
|
||||
|
||||
if (to) {
|
||||
to = to.split(",");
|
||||
postData["to"] = to;
|
||||
}
|
||||
|
||||
console.log(postData);
|
||||
|
||||
let resp = await axios.post(notification.smseagleUrl + "/api/v2/messages/sms", postData, config);
|
||||
|
||||
let countAll = resp.data.length;
|
||||
|
|
|
@ -8,16 +8,19 @@
|
|||
<HiddenInput id="smseagle-token" v-model="$parent.notification.smseagleToken" :required="true"></HiddenInput>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="smseagle-recipient-type" class="form-label">{{ $t("smseagleRecipientType") }}</label>
|
||||
<select id="smseagle-recipient-type" v-model="$parent.notification.smseagleRecipientType" class="form-select">
|
||||
<option value="smseagle-to" selected>{{ $t("smseagleTo") }}</option>
|
||||
<option value="smseagle-group">{{ $t("smseagleGroup") }}</option>
|
||||
<option value="smseagle-contact">{{ $t("smseagleContact") }}</option>
|
||||
</select>
|
||||
<label for="smseagle-recipient-type" class="form-label">{{ $t("smseagleRecipient") }}</label>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="smseagle-recipient" class="form-label">{{ $t("smseagleTo") }}</label>
|
||||
<input id="smseagle-recipient" v-model="$parent.notification.smseagleRecipientTo" type="text" class="form-control">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="smseagle-recipient" class="form-label">{{ $t("smseagleRecipient") }}</label>
|
||||
<input id="smseagle-recipient" v-model="$parent.notification.smseagleRecipient" type="text" class="form-control" required>
|
||||
<label for="smseagle-recipient" class="form-label">{{ $t("smseagleGroup") }}</label>
|
||||
<input id="smseagle-recipient" v-model="$parent.notification.smseagleRecipientGroup" type="text" class="form-control">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="smseagle-recipient" class="form-label">{{ $t("smseagleContact") }}</label>
|
||||
<input id="smseagle-recipient" v-model="$parent.notification.smseagleRecipientContact" type="text" class="form-control">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="smseagle-priority" class="form-label">{{ $t("smseaglePriority") }}</label>
|
||||
|
|
Loading…
Add table
Reference in a new issue