Update serwersms.js

Dodano możliwość wyboru między numerem telefonu a grupą.
This commit is contained in:
miesiu 2025-07-17 13:01:45 +02:00 committed by GitHub
parent 2fd4e1cc72
commit 5dbbadc7fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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) {