From 5dbbadc7fa259c0a6f60489bfa9bc4146deb7d2b Mon Sep 17 00:00:00 2001 From: miesiu <44501255+miesiu@users.noreply.github.com> Date: Thu, 17 Jul 2025 13:01:45 +0200 Subject: [PATCH] Update serwersms.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dodano możliwość wyboru między numerem telefonu a grupą. --- server/notification-providers/serwersms.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/server/notification-providers/serwersms.js b/server/notification-providers/serwersms.js index f7c8644af..8d172536e 100644 --- a/server/notification-providers/serwersms.js +++ b/server/notification-providers/serwersms.js @@ -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) {