From 23af76c43d24401ae0a2477e6658630001ed1a4f Mon Sep 17 00:00:00 2001 From: Simon Nilsson Date: Mon, 25 Mar 2024 21:12:16 +0100 Subject: [PATCH] Modified files and last correction --- ...{cellsyntmobileservices.js => cellsynt.js} | 44 +++-------- server/notification.js | 4 +- src/components/NotificationDialog.vue | 2 +- src/components/notifications/Cellsynt.vue | 59 +++++++++++++++ .../notifications/CellsyntMobileServices.vue | 75 ------------------- src/components/notifications/index.js | 4 +- 6 files changed, 75 insertions(+), 113 deletions(-) rename server/notification-providers/{cellsyntmobileservices.js => cellsynt.js} (80%) create mode 100644 src/components/notifications/Cellsynt.vue delete mode 100644 src/components/notifications/CellsyntMobileServices.vue diff --git a/server/notification-providers/cellsyntmobileservices.js b/server/notification-providers/cellsynt.js similarity index 80% rename from server/notification-providers/cellsyntmobileservices.js rename to server/notification-providers/cellsynt.js index 68959549..d2c4fe6c 100644 --- a/server/notification-providers/cellsyntmobileservices.js +++ b/server/notification-providers/cellsynt.js @@ -1,12 +1,9 @@ const NotificationProvider = require("./notification-provider"); -const { DOWN, UP } = require("../../src/util"); const { default: axios } = require("axios"); -const Crypto = require("crypto"); -const qs = require("qs"); -class CellsyntMobileServices extends NotificationProvider { +class Cellsynt extends NotificationProvider { - name = "CellsyntMobileServices"; + name = "Cellsynt"; /** * @inheritdoc @@ -48,17 +45,6 @@ class CellsyntMobileServices extends NotificationProvider { /* Identifier which will be visible on recipient's mobile phone as originator of the message. Allowed values and function depends on parameter originatortype's value according to below: - ** numeric ** - Numeric value (max 15 digits) with telephone number on - international format without leading 00 (example UK number - 07920 110 000 should be set as 447920110000). Receiving - mobile phone will add a leading + sign and thus see the - originator as a normal mobile phone number (+447920110000). - Therefore it is also possible to reply to the message. - ** shortcode ** - Numerical value (max 15 digits). Used to set a shortcode in an - operator network as originator (i.e. will be shown without leading - + sign, e.g. 72456). ** alpha ** 3Send SMS Alphanumeric string (max 11 characters). The following @@ -66,12 +52,19 @@ class CellsyntMobileServices extends NotificationProvider { characters may work but functionality can not be guaranteed. Recipients can not reply to messages with alphanumeric originators + ** numeric ** + Numeric value (max 15 digits) with telephone number on + international format without leading 00 (example UK number + 07920 110 000 should be set as 447920110000). Receiving + mobile phone will add a leading + sign and thus see the + originator as a normal mobile phone number (+447920110000). + Therefore it is also possible to reply to the message. */ //"originator": "uptime-kuma", "originator": notification.cellsyntOriginator, /* Type of message that should be sent. Possible values: text (default), binary and unicode */ - "type": "text", + //"type": "text", /* Maximum number of SMS permitted to be linked together when needed (default value is 1, see Long SMS). Maximum value is 6 @@ -79,19 +72,6 @@ class CellsyntMobileServices extends NotificationProvider { */ "allowconcat": notification.cellsyntAllowLongSMS?6:1, - /* Can be used if you want to prevent a message from being - delivered after a certain time, e.g. 9 PM the same evening if - information thereafter is considered invalid / outdated. If - message has not been delivered after the set time (e.g. mobile - phone was switched off) you will get a delivery receipt with - status "failed". - Value should be given as a Unix timestamp. Different operators - permit different allowed max values (e.g. 3 days expiry time). If - a value is set that is above an operator's max allowed time it will - be adjusted to the highest possible value. - */ - //"expiry": "9 PM", - /* Value can be set to true if message should be sent as "flash message", i.e. displayed directly on phone screen instead of being saved to inbox. This is identical to setting class=0. @@ -132,8 +112,6 @@ class CellsyntMobileServices extends NotificationProvider { let resp = await axios.post("https://se-1.cellsynt.net/sms.php", null, data); if(typeof resp.data == undefined || resp.data == null || resp.data.includes("Error")) { this.throwGeneralAxiosError(resp.data); - }else{ - } }catch (error) { this.throwGeneralAxiosError(error); @@ -146,4 +124,4 @@ class CellsyntMobileServices extends NotificationProvider { } } -module.exports = CellsyntMobileServices; +module.exports = Cellsynt; diff --git a/server/notification.js b/server/notification.js index 83e36985..42efe33a 100644 --- a/server/notification.js +++ b/server/notification.js @@ -53,7 +53,7 @@ const GoAlert = require("./notification-providers/goalert"); const SMSManager = require("./notification-providers/smsmanager"); const ServerChan = require("./notification-providers/serverchan"); const ZohoCliq = require("./notification-providers/zoho-cliq"); -const CellsyntMobileServices = require("./notification-providers/cellsyntmobileservices"); +const Cellsynt = require("./notification-providers/cellsynt"); class Notification { @@ -119,7 +119,7 @@ class Notification { new WeCom(), new GoAlert(), new ZohoCliq(), - new CellsyntMobileServices() + new Cellsynt() ]; for (let item of list) { if (! item.name) { diff --git a/src/components/NotificationDialog.vue b/src/components/NotificationDialog.vue index c5b57bcd..cdc6e2cc 100644 --- a/src/components/NotificationDialog.vue +++ b/src/components/NotificationDialog.vue @@ -151,7 +151,7 @@ export default { "webhook": "Webhook", "GoAlert": "GoAlert", "ZohoCliq": "ZohoCliq", - "CellsyntMobileServices": "Cellsynt mobile services" + "Cellsynt": "Cellsynt" }; // Put notifications here if it's not supported in most regions or its documentation is not in English diff --git a/src/components/notifications/Cellsynt.vue b/src/components/notifications/Cellsynt.vue new file mode 100644 index 00000000..11bf3257 --- /dev/null +++ b/src/components/notifications/Cellsynt.vue @@ -0,0 +1,59 @@ + + + diff --git a/src/components/notifications/CellsyntMobileServices.vue b/src/components/notifications/CellsyntMobileServices.vue deleted file mode 100644 index 99cb8772..00000000 --- a/src/components/notifications/CellsyntMobileServices.vue +++ /dev/null @@ -1,75 +0,0 @@ - - - diff --git a/src/components/notifications/index.js b/src/components/notifications/index.js index 15d48764..7c2ea12d 100644 --- a/src/components/notifications/index.js +++ b/src/components/notifications/index.js @@ -51,7 +51,7 @@ import WeCom from "./WeCom.vue"; import GoAlert from "./GoAlert.vue"; import ZohoCliq from "./ZohoCliq.vue"; import Splunk from "./Splunk.vue"; -import CellsyntMobileServices from "./CellsyntMobileServices.vue"; +import Cellsynt from "./Cellsynt.vue"; /** @@ -113,7 +113,7 @@ const NotificationFormList = { "GoAlert": GoAlert, "ServerChan": ServerChan, "ZohoCliq": ZohoCliq, - "CellsyntMobileServices": CellsyntMobileServices + "Cellsynt": Cellsynt }; export default NotificationFormList;