mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-07-18 15:24:03 +02:00
Update serwersms.js
Dodano możliwość wyboru między numerem telefonu a grupą.
This commit is contained in:
parent
2fd4e1cc72
commit
5dbbadc7fa
1 changed files with 11 additions and 2 deletions
|
@ -17,14 +17,23 @@ class SerwerSMS extends NotificationProvider {
|
|||
"Content-Type": "application/json",
|
||||
}
|
||||
};
|
||||
|
||||
let data = {
|
||||
"username": notification.serwersmsUsername,
|
||||
"password": notification.serwersmsPassword,
|
||||
"phone": notification.serwersmsPhoneNumber,
|
||||
"text": msg.replace(/[^\x00-\x7F]/g, ""),
|
||||
"text": msg.replace(/[^\x00-\x7F]/g, ""), // SerwerSMS może nie obsługiwać znaków specjalnych bez utf
|
||||
"sender": notification.serwersmsSenderName,
|
||||
};
|
||||
|
||||
// Obsługa numeru telefonu lub grupy
|
||||
if (notification.serwersmsGroupId) {
|
||||
data.group_id = notification.serwersmsGroupId;
|
||||
} else if (notification.serwersmsPhoneNumber) {
|
||||
data.phone = notification.serwersmsPhoneNumber;
|
||||
} else {
|
||||
throw new Error("SerwerSMS: Either phone number or group_id must be provided.");
|
||||
}
|
||||
|
||||
let resp = await axios.post(url, data, config);
|
||||
|
||||
if (!resp.data.success) {
|
||||
|
|
Loading…
Add table
Reference in a new issue