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 1/9] 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) { From 952816942f97e48d77a53f9a73950c77fffd3eda Mon Sep 17 00:00:00 2001 From: miesiu <44501255+miesiu@users.noreply.github.com> Date: Thu, 17 Jul 2025 13:03:57 +0200 Subject: [PATCH 2/9] Update SerwerSMS.vue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dodaje obsługę wyboru telefonu lub grupy. --- src/components/notifications/SerwerSMS.vue | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/components/notifications/SerwerSMS.vue b/src/components/notifications/SerwerSMS.vue index 32a0ff7a8..b15d83e22 100644 --- a/src/components/notifications/SerwerSMS.vue +++ b/src/components/notifications/SerwerSMS.vue @@ -3,14 +3,29 @@ +
+
- - + +
+ +
+ + +
+ {{ $t("serwersmsGroupIdHelp") }} +
+
+
From d9b7c7e77b0582c9206356a9adf75ed91783fc3e Mon Sep 17 00:00:00 2001 From: miesiu <44501255+miesiu@users.noreply.github.com> Date: Thu, 17 Jul 2025 13:05:22 +0200 Subject: [PATCH 3/9] Update en.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do obsługi wyboru telefonu lub grupy. --- src/lang/en.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lang/en.json b/src/lang/en.json index b6449371b..1f5f9ba2e 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -760,6 +760,8 @@ "serwersmsAPIPassword": "API Password", "serwersmsPhoneNumber": "Phone number", "serwersmsSenderName": "SMS Sender Name (registered via customer portal)", + "serwersmsGroupId": "Group ID", + "serwersmsGroupIdHelp": "Optional. Instead of a phone number, you can send SMS to a contact group (group_id from SerwerSMS panel). Provide either phone number OR group ID.", "smseagleTo": "Phone number(s)", "smseagleGroup": "Phonebook group name(s)", "smseagleContact": "Phonebook contact name(s)", From 6a34cecc9352a1871c45f7d48efb673e0fcb7c9a Mon Sep 17 00:00:00 2001 From: miesiu <44501255+miesiu@users.noreply.github.com> Date: Fri, 18 Jul 2025 12:47:03 +0200 Subject: [PATCH 4/9] Update en.json --- src/lang/en.json | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/lang/en.json b/src/lang/en.json index 1f5f9ba2e..306354b4f 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -756,12 +756,14 @@ "alertaApiKey": "API Key", "alertaAlertState": "Alert State", "alertaRecoverState": "Recover State", - "serwersmsAPIUser": "API Username (incl. webapi_ prefix)", - "serwersmsAPIPassword": "API Password", + "serwersmsAPIUser": "API username (including the webapi_ prefix)", + "serwersmsAPIPassword": "API password", "serwersmsPhoneNumber": "Phone number", - "serwersmsSenderName": "SMS Sender Name (registered via customer portal)", + "serwersmsSenderName": "SMS sender name (registered via the client portal)", "serwersmsGroupId": "Group ID", - "serwersmsGroupIdHelp": "Optional. Instead of a phone number, you can send SMS to a contact group (group_id from SerwerSMS panel). Provide either phone number OR group ID.", + "serwersmsGroupIdHelp": "Enter the GROUP ID (group_id from the SerwerSMS panel)", + "serwersmsDestinationType": "Recipient type", + "serwersmsPhoneHelp": "Enter the phone number, e.g., +48123456789.", "smseagleTo": "Phone number(s)", "smseagleGroup": "Phonebook group name(s)", "smseagleContact": "Phonebook contact name(s)", From c658beeddde6d9544cf2d4a12854dcd7b7457782 Mon Sep 17 00:00:00 2001 From: miesiu <44501255+miesiu@users.noreply.github.com> Date: Fri, 18 Jul 2025 12:54:52 +0200 Subject: [PATCH 5/9] Update serwersms.js --- server/notification-providers/serwersms.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/server/notification-providers/serwersms.js b/server/notification-providers/serwersms.js index 8d172536e..5987153d5 100644 --- a/server/notification-providers/serwersms.js +++ b/server/notification-providers/serwersms.js @@ -21,17 +21,18 @@ class SerwerSMS extends NotificationProvider { let data = { "username": notification.serwersmsUsername, "password": notification.serwersmsPassword, - "text": msg.replace(/[^\x00-\x7F]/g, ""), // SerwerSMS może nie obsługiwać znaków specjalnych bez utf + "text": msg.replace(/[^\x00-\x7F]/g, ""), // SerwerSMS may not support special characters without UTF-8 encoding "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; + // **CHANGED:** Now uses notification.destinationType and notification.destinationValue directly + if (notification.destinationType === "group") { + data.group_id = notification.destinationValue; + } else if (notification.destinationType === "phone") { + data.phone = notification.destinationValue; } else { - throw new Error("SerwerSMS: Either phone number or group_id must be provided."); + // Throws an error if recipient type is not defined or invalid + throw new Error("SerwerSMS: Recipient type (phone number or group ID) must be defined."); } let resp = await axios.post(url, data, config); @@ -41,8 +42,7 @@ class SerwerSMS extends NotificationProvider { let error = `SerwerSMS.pl API returned error code ${resp.data.error.code} (${resp.data.error.type}) with error message: ${resp.data.error.message}`; this.throwGeneralAxiosError(error); } else { - let error = "SerwerSMS.pl API returned an unexpected response"; - this.throwGeneralAxiosError(error); + this.throwGeneralAxiosError("SerwerSMS.pl API returned an unexpected response"); } } From 64dcaa0f703b0d9ceeade8c992ea9cc47e2bcb4c Mon Sep 17 00:00:00 2001 From: miesiu <44501255+miesiu@users.noreply.github.com> Date: Fri, 18 Jul 2025 12:55:58 +0200 Subject: [PATCH 6/9] Update SerwerSMS.vue --- src/components/notifications/SerwerSMS.vue | 28 +++++++++++++++------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/components/notifications/SerwerSMS.vue b/src/components/notifications/SerwerSMS.vue index b15d83e22..be727d039 100644 --- a/src/components/notifications/SerwerSMS.vue +++ b/src/components/notifications/SerwerSMS.vue @@ -10,20 +10,32 @@
- - +
+ + +
+ +
+ + +
-