diff --git a/.github/workflows/auto-test.yml b/.github/workflows/auto-test.yml index b5240d77..c59a61b9 100644 --- a/.github/workflows/auto-test.yml +++ b/.github/workflows/auto-test.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: os: [macos-latest, ubuntu-latest, windows-latest] - node-version: [14.x, 15.x, 16.x] + node-version: [14.x, 16.x] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: @@ -27,7 +27,7 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: 'npm' - - run: npm ci + - run: npm run install-legacy - run: npm run build - run: npm test env: diff --git a/server/check-version.js b/server/check-version.js index 0da1e348..2ab5fe51 100644 --- a/server/check-version.js +++ b/server/check-version.js @@ -1,6 +1,5 @@ const { setSetting } = require("./util-server"); const axios = require("axios"); -const { isDev } = require("../src/util"); exports.version = require("../package.json").version; exports.latestVersion = null; diff --git a/server/client.js b/server/client.js index e83d1f59..c7b3bc16 100644 --- a/server/client.js +++ b/server/client.js @@ -4,6 +4,8 @@ const { TimeLogger } = require("../src/util"); const { R } = require("redbean-node"); const { io } = require("./server"); +const { setting } = require("./util-server"); +const checkVersion = require("./check-version"); async function sendNotificationList(socket) { const timeLogger = new TimeLogger(); @@ -14,10 +16,10 @@ async function sendNotificationList(socket) { ]); for (let bean of list) { - result.push(bean.export()) + result.push(bean.export()); } - io.to(socket.userID).emit("notificationList", result) + io.to(socket.userID).emit("notificationList", result); timeLogger.print("Send Notification List"); @@ -39,7 +41,7 @@ async function sendHeartbeatList(socket, monitorID, toUser = false, overwrite = LIMIT 100 `, [ monitorID, - ]) + ]); let result = list.reverse(); @@ -69,7 +71,7 @@ async function sendImportantHeartbeatList(socket, monitorID, toUser = false, ove LIMIT 500 `, [ monitorID, - ]) + ]); timeLogger.print(`[Monitor: ${monitorID}] sendImportantHeartbeatList`); @@ -81,8 +83,18 @@ async function sendImportantHeartbeatList(socket, monitorID, toUser = false, ove } +async function sendInfo(socket) { + socket.emit("info", { + version: checkVersion.version, + latestVersion: checkVersion.latestVersion, + primaryBaseURL: await setting("primaryBaseURL") + }); +} + module.exports = { sendNotificationList, sendImportantHeartbeatList, sendHeartbeatList, -} + sendInfo +}; + diff --git a/server/notification-providers/promosms.js b/server/notification-providers/promosms.js new file mode 100644 index 00000000..362ef714 --- /dev/null +++ b/server/notification-providers/promosms.js @@ -0,0 +1,41 @@ +const NotificationProvider = require("./notification-provider"); +const axios = require("axios"); + +class PromoSMS extends NotificationProvider { + + name = "promosms"; + + async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { + let okMsg = "Sent Successfully."; + + try { + let config = { + headers: { + "Content-Type": "application/json", + "Authorization": "Basic " + Buffer.from(notification.promosmsLogin + ":" + notification.promosmsPassword).toString('base64'), + "Accept": "text/json", + } + }; + let data = { + "recipients": [ notification.promosmsPhoneNumber ], + //Lets remove non ascii char + "text": msg.replace(/[^\x00-\x7F]/g, ""), + "type": Number(notification.promosmsSMSType), + "sender": notification.promosmsSenderName + }; + + let resp = await axios.post("https://promosms.com/api/rest/v3_2/sms", data, config); + + if (resp.data.response.status !== 0) { + let error = "Something gone wrong. Api returned " + resp.data.response.status + "."; + this.throwGeneralAxiosError(error); + } + + return okMsg; + } catch (error) { + this.throwGeneralAxiosError(error); + } + } +} + +module.exports = PromoSMS; diff --git a/server/notification.js b/server/notification.js index 207e0a37..5b104bf8 100644 --- a/server/notification.js +++ b/server/notification.js @@ -7,6 +7,7 @@ const LunaSea = require("./notification-providers/lunasea"); const Mattermost = require("./notification-providers/mattermost"); const Matrix = require("./notification-providers/matrix"); const Octopush = require("./notification-providers/octopush"); +const PromoSMS = require("./notification-providers/promosms"); const Pushbullet = require("./notification-providers/pushbullet"); const Pushover = require("./notification-providers/pushover"); const Pushy = require("./notification-providers/pushy"); @@ -37,6 +38,7 @@ class Notification { new Mattermost(), new Matrix(), new Octopush(), + new PromoSMS(), new Pushbullet(), new Pushover(), new Pushy(), diff --git a/server/server.js b/server/server.js index 55448a79..ed6fa6df 100644 --- a/server/server.js +++ b/server/server.js @@ -90,7 +90,7 @@ const io = new Server(server); module.exports.io = io; // Must be after io instantiation -const { sendNotificationList, sendHeartbeatList, sendImportantHeartbeatList } = require("./client"); +const { sendNotificationList, sendHeartbeatList, sendImportantHeartbeatList, sendInfo } = require("./client"); const { statusPageSocketHandler } = require("./socket-handlers/status-page-socket-handler"); app.use(express.json()); @@ -180,10 +180,7 @@ exports.entryPage = "dashboard"; console.log("Adding socket handler"); io.on("connection", async (socket) => { - socket.emit("info", { - version: checkVersion.version, - latestVersion: checkVersion.latestVersion, - }); + sendInfo(socket); totalClient++; @@ -870,6 +867,8 @@ exports.entryPage = "dashboard"; msg: "Saved" }); + sendInfo(socket); + } catch (e) { callback({ ok: false, diff --git a/src/assets/app.scss b/src/assets/app.scss index 3072e37c..2cbec5c0 100644 --- a/src/assets/app.scss +++ b/src/assets/app.scss @@ -3,7 +3,7 @@ @import "node_modules/bootstrap/scss/bootstrap"; #app { - font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, segoe ui, Roboto, helvetica neue, Arial, noto sans, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol, noto color emoji; + font-family: BlinkMacSystemFont, segoe ui, Roboto, helvetica neue, Arial, noto sans, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol, noto color emoji; } h1 { diff --git a/src/components/notifications/PromoSMS.vue b/src/components/notifications/PromoSMS.vue new file mode 100644 index 00000000..640360d0 --- /dev/null +++ b/src/components/notifications/PromoSMS.vue @@ -0,0 +1,39 @@ + + + diff --git a/src/components/notifications/index.js b/src/components/notifications/index.js index fab4075e..7d70eea1 100644 --- a/src/components/notifications/index.js +++ b/src/components/notifications/index.js @@ -10,6 +10,7 @@ import Teams from "./Teams.vue"; import Pushover from "./Pushover.vue"; import Pushy from "./Pushy.vue"; import Octopush from "./Octopush.vue"; +import PromoSMS from "./PromoSMS.vue"; import LunaSea from "./LunaSea.vue"; import Apprise from "./Apprise.vue"; import Pushbullet from "./Pushbullet.vue"; @@ -35,6 +36,7 @@ const NotificationFormList = { "pushover": Pushover, "pushy": Pushy, "octopush": Octopush, + "promosms": PromoSMS, "lunasea": LunaSea, "apprise": Apprise, "pushbullet": Pushbullet, diff --git a/src/languages/bg-BG.js b/src/languages/bg-BG.js index 0e915255..bcf1b573 100644 --- a/src/languages/bg-BG.js +++ b/src/languages/bg-BG.js @@ -190,6 +190,7 @@ export default { pushover: "Pushover", pushy: "Pushy", octopush: "Octopush", + promosms: "PromoSMS", lunasea: "LunaSea", apprise: "Apprise (Поддържа 50+ услуги за инвестяване)", pushbullet: "Pushbullet", diff --git a/src/languages/da-DK.js b/src/languages/da-DK.js index ad156aef..66e7cb3d 100644 --- a/src/languages/da-DK.js +++ b/src/languages/da-DK.js @@ -192,6 +192,7 @@ export default { pushover: "Pushover", pushy: "Pushy", octopush: "Octopush", + promosms: "PromoSMS", lunasea: "LunaSea", apprise: "Apprise (Support 50+ Notification services)", pushbullet: "Pushbullet", diff --git a/src/languages/de-DE.js b/src/languages/de-DE.js index a6cc42b3..20beb626 100644 --- a/src/languages/de-DE.js +++ b/src/languages/de-DE.js @@ -191,6 +191,7 @@ export default { pushover: "Pushover", pushy: "Pushy", octopush: "Octopush", + promosms: "PromoSMS", lunasea: "LunaSea", apprise: "Apprise (Support 50+ Notification services)", pushbullet: "Pushbullet", diff --git a/src/languages/en.js b/src/languages/en.js index 21904003..2ce8f46b 100644 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -235,6 +235,7 @@ export default { pushover: "Pushover", pushy: "Pushy", octopush: "Octopush", + promosms: "PromoSMS", lunasea: "LunaSea", apprise: "Apprise (Support 50+ Notification services)", pushbullet: "Pushbullet", @@ -273,5 +274,11 @@ export default { aboutIconURL: "You can provide a link to a picture in \"Icon URL\" to override the default profile picture. Will not be used if Icon Emoji is set.", aboutMattermostChannelName: "You can override the default channel that webhook posts to by entering the channel name into \"Channel Name\" field. This needs to be enabled in Mattermost webhook settings. Ex: #other-channel", "matrix": "Matrix", + promosmsTypeEco: "SMS ECO - cheap but slow and often overloaded. Limited only to Polish recipients.", + promosmsTypeFlash: "SMS FLASH - Message will automatically show on recipient device. Limited only to Polish recipients.", + promosmsTypeFull: "SMS FULL - Premium tier of SMS, You can use Your Sender Name (You need to register name first). Reliable for alerts.", + promosmsTypeFull: "SMS SPEED - Highest priority in system. Very quick and reliable but costly (about twice of SMS FULL price).", + promosmsPhoneNumber: "Phone number (for Polish recipient You can skip area codes)", + promosmsSMSSender: "SMS Sender Name : Pre-registred name or one of defaults: InfoSMS, SMS Info, MaxSMS, INFO, SMS", // End notification form }; diff --git a/src/languages/es-ES.js b/src/languages/es-ES.js index 2558a686..3fa20733 100644 --- a/src/languages/es-ES.js +++ b/src/languages/es-ES.js @@ -192,6 +192,7 @@ export default { pushover: "Pushover", pushy: "Pushy", octopush: "Octopush", + promosms: "PromoSMS", lunasea: "LunaSea", apprise: "Apprise (Support 50+ Notification services)", pushbullet: "Pushbullet", diff --git a/src/languages/et-EE.js b/src/languages/et-EE.js index a6be8232..52439f5f 100644 --- a/src/languages/et-EE.js +++ b/src/languages/et-EE.js @@ -191,6 +191,7 @@ export default { pushover: "Pushover", pushy: "Pushy", octopush: "Octopush", + promosms: "PromoSMS", lunasea: "LunaSea", apprise: "Apprise (vahendab üle 65 teavitusteenust)", pushbullet: "Pushbullet", diff --git a/src/languages/fa.js b/src/languages/fa.js index d686488f..7eed151a 100644 --- a/src/languages/fa.js +++ b/src/languages/fa.js @@ -199,6 +199,7 @@ export default { pushover: "Pushover", pushy: "Pushy", octopush: "Octopush", + promosms: "PromoSMS", lunasea: "LunaSea", apprise: "Apprise (Support 50+ Notification services)", pushbullet: "Pushbullet", diff --git a/src/languages/fr-FR.js b/src/languages/fr-FR.js index 6ef69f0a..9f234f7a 100644 --- a/src/languages/fr-FR.js +++ b/src/languages/fr-FR.js @@ -192,6 +192,7 @@ export default { pushover: "Pushover", pushy: "Pushy", octopush: "Octopush", + promosms: "PromoSMS", lunasea: "LunaSea", apprise: "Apprise (Support 50+ Notification services)", pushbullet: "Pushbullet", diff --git a/src/languages/hu.js b/src/languages/hu.js index 039cf670..47ac72d6 100644 --- a/src/languages/hu.js +++ b/src/languages/hu.js @@ -190,6 +190,7 @@ export default { pushover: "Pushover", pushy: "Pushy", octopush: "Octopush", + promosms: "PromoSMS", lunasea: "LunaSea", apprise: "Apprise (Support 50+ Notification services)", pushbullet: "Pushbullet", diff --git a/src/languages/it-IT.js b/src/languages/it-IT.js index b318c97e..5ddc414f 100644 --- a/src/languages/it-IT.js +++ b/src/languages/it-IT.js @@ -191,6 +191,7 @@ export default { pushover: "Pushover", pushy: "Pushy", octopush: "Octopush", + promosms: "PromoSMS", lunasea: "LunaSea", apprise: "Apprise (Support 50+ Notification services)", pushbullet: "Pushbullet", diff --git a/src/languages/ja.js b/src/languages/ja.js index 5042d18b..f96028e4 100644 --- a/src/languages/ja.js +++ b/src/languages/ja.js @@ -192,6 +192,7 @@ export default { pushover: "Pushover", pushy: "Pushy", octopush: "Octopush", + promosms: "PromoSMS", lunasea: "LunaSea", apprise: "Apprise (Support 50+ Notification services)", pushbullet: "Pushbullet", diff --git a/src/languages/ko-KR.js b/src/languages/ko-KR.js index 6cb86ed2..9d5cb5bd 100644 --- a/src/languages/ko-KR.js +++ b/src/languages/ko-KR.js @@ -192,6 +192,7 @@ export default { pushover: "Pushover", pushy: "Pushy", octopush: "Octopush", + promosms: "PromoSMS", lunasea: "LunaSea", apprise: "Apprise (Support 50+ Notification services)", pushbullet: "Pushbullet", diff --git a/src/languages/nl-NL.js b/src/languages/nl-NL.js index 1303a096..5c322553 100644 --- a/src/languages/nl-NL.js +++ b/src/languages/nl-NL.js @@ -192,6 +192,7 @@ export default { pushover: "Pushover", pushy: "Pushy", octopush: "Octopush", + promosms: "PromoSMS", lunasea: "LunaSea", apprise: "Apprise (Support 50+ Notification services)", pushbullet: "Pushbullet", diff --git a/src/languages/pl.js b/src/languages/pl.js index 9a079a9c..05101c6a 100644 --- a/src/languages/pl.js +++ b/src/languages/pl.js @@ -192,6 +192,7 @@ export default { pushover: "Pushover", pushy: "Pushy", octopush: "Octopush", + promosms: "PromoSMS", lunasea: "LunaSea", apprise: "Apprise (obsługuje 50+ usług powiadamiania)", pushbullet: "Pushbullet", diff --git a/src/languages/pt-BR.js b/src/languages/pt-BR.js index 201314bb..70647fd9 100644 --- a/src/languages/pt-BR.js +++ b/src/languages/pt-BR.js @@ -191,6 +191,7 @@ export default { pushover: "Pushover", pushy: "Pushy", octopush: "Octopush", + promosms: "PromoSMS", lunasea: "LunaSea", apprise: "Apprise (Support 50+ Notification services)", pushbullet: "Pushbullet", diff --git a/src/languages/ru-RU.js b/src/languages/ru-RU.js index f466ff79..2dd3eafb 100644 --- a/src/languages/ru-RU.js +++ b/src/languages/ru-RU.js @@ -196,6 +196,7 @@ export default { pushover: "Pushover", pushy: "Pushy", octopush: "Octopush", + promosms: "PromoSMS", lunasea: "LunaSea", apprise: "Apprise (Support 50+ Notification services)", pushbullet: "Pushbullet", diff --git a/src/languages/sr-latn.js b/src/languages/sr-latn.js index f249f568..9e66aa54 100644 --- a/src/languages/sr-latn.js +++ b/src/languages/sr-latn.js @@ -192,6 +192,7 @@ export default { pushover: "Pushover", pushy: "Pushy", octopush: "Octopush", + promosms: "PromoSMS", lunasea: "LunaSea", apprise: "Apprise (Support 50+ Notification services)", pushbullet: "Pushbullet", diff --git a/src/languages/sr.js b/src/languages/sr.js index 8ea651b7..df8e9899 100644 --- a/src/languages/sr.js +++ b/src/languages/sr.js @@ -192,6 +192,7 @@ export default { pushover: "Pushover", pushy: "Pushy", octopush: "Octopush", + promosms: "PromoSMS", lunasea: "LunaSea", apprise: "Apprise (Support 50+ Notification services)", pushbullet: "Pushbullet", diff --git a/src/languages/sv-SE.js b/src/languages/sv-SE.js index 997d94a7..e29d355c 100644 --- a/src/languages/sv-SE.js +++ b/src/languages/sv-SE.js @@ -192,6 +192,7 @@ export default { pushover: "Pushover", pushy: "Pushy", octopush: "Octopush", + promosms: "PromoSMS", lunasea: "LunaSea", apprise: "Apprise (Support 50+ Notification services)", pushbullet: "Pushbullet", diff --git a/src/languages/tr-TR.js b/src/languages/tr-TR.js index 614ab0ee..8c404a7d 100644 --- a/src/languages/tr-TR.js +++ b/src/languages/tr-TR.js @@ -191,6 +191,7 @@ export default { pushover: "Pushover", pushy: "Pushy", octopush: "Octopush", + promosms: "PromoSMS", lunasea: "LunaSea", apprise: "Apprise (Support 50+ Notification services)", pushbullet: "Pushbullet", diff --git a/src/languages/zh-CN.js b/src/languages/zh-CN.js index 65e8909a..40db94e2 100644 --- a/src/languages/zh-CN.js +++ b/src/languages/zh-CN.js @@ -192,6 +192,7 @@ export default { pushover: "Pushover", pushy: "Pushy", octopush: "Octopush", + promosms: "PromoSMS", lunasea: "LunaSea", apprise: "Apprise (Support 50+ Notification services)", pushbullet: "Pushbullet", diff --git a/src/languages/zh-HK.js b/src/languages/zh-HK.js index ea81f7f3..7f5e2259 100644 --- a/src/languages/zh-HK.js +++ b/src/languages/zh-HK.js @@ -192,6 +192,7 @@ export default { pushover: "Pushover", pushy: "Pushy", octopush: "Octopush", + promosms: "PromoSMS", lunasea: "LunaSea", apprise: "Apprise (支援 50 多種通知)", pushbullet: "Pushbullet", diff --git a/src/mixins/public.js b/src/mixins/public.js index ba8457a0..a3e12f46 100644 --- a/src/mixins/public.js +++ b/src/mixins/public.js @@ -38,11 +38,15 @@ export default { }, baseURL() { + if (this.$root.info.primaryBaseURL) { + return this.$root.info.primaryBaseURL; + } + if (env === "development" || localStorage.dev === "dev") { return axios.defaults.baseURL; } else { return location.protocol + "//" + location.host; } - } + }, } }; diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index 6a72dc82..b0b0012f 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -131,7 +131,7 @@ -

{{ $t("Advanced") }}

+

{{ $t("Advanced") }}

@@ -140,7 +140,7 @@
-
+