iobroker.gotify-ws 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -41,6 +41,7 @@ Spotify-WS currently supports the following notification services
41
41
 
42
42
  * e-mail
43
43
  * Matrix
44
+ * Notification-Manager
44
45
  * Pushover
45
46
  * Discord
46
47
  * Signal
@@ -64,6 +65,10 @@ You can then configure a notification service of your choice for forwarding.
64
65
  ---
65
66
  <!-- ### **WORK IN PROGRESS** -->
66
67
  ## Changelog
68
+ ### 0.1.2 (2024-06-26)
69
+ * (simatec) Fix io-package
70
+ * (simatec) Notification-Manager added
71
+
67
72
  ### 0.1.1 (2024-06-19)
68
73
  * (simatec) Fix Branch
69
74
 
@@ -13,6 +13,7 @@
13
13
  "If you like this project and would like to support its development, you are welcome to leave a donation.": "If you like this project and would like to support its development, you are welcome to leave a donation.",
14
14
  "Matrix Instance": "Matrix Instance",
15
15
  "Notification Settings": "Notification Settings",
16
+ "Notification-Manager Instance": "Notification-Manager Instance",
16
17
  "Notification type": "Notification type",
17
18
  "Pushover Instance": "Pushover Instance",
18
19
  "Signal Instance": "Signal Instance",
@@ -42,14 +42,14 @@
42
42
  "label": "Gotify Port"
43
43
  },
44
44
  "token": {
45
- "type": "text",
45
+ "type": "password",
46
+ "visible": true,
46
47
  "label": "Gotify Token",
47
48
  "sm": 12,
48
49
  "md": 8,
49
50
  "lg": 4,
50
51
  "validator": "data.token",
51
52
  "validatorNoSaveOnError": true,
52
- "placeholder": "XXXxxXXXxxxXXXX",
53
53
  "help": "Gotify Token"
54
54
  },
55
55
  "notificationSettings": {
@@ -74,6 +74,10 @@
74
74
  "label": "Matrix",
75
75
  "value": "matrix-org"
76
76
  },
77
+ {
78
+ "label": "Notification-Manager",
79
+ "value": "notification-manager"
80
+ },
77
81
  {
78
82
  "label": "Pushover",
79
83
  "value": "pushover"
@@ -136,14 +140,25 @@
136
140
  "matrixInstance": {
137
141
  "type": "selectSendTo",
138
142
  "command": "sendToInstance",
139
- "jsonData": "{ \"type\": \"matrix\" }",
140
- "hidden": "data.notificationType !== 'matrix'",
143
+ "jsonData": "{ \"type\": \"matrix-org\" }",
144
+ "hidden": "data.notificationType !== 'matrix-org'",
141
145
  "label": "Matrix Instance",
142
146
  "sm": 12,
143
147
  "md": 8,
144
148
  "lg": 4,
145
149
  "help": "Matrix Instance"
146
150
  },
151
+ "notificationManagerInstance": {
152
+ "type": "selectSendTo",
153
+ "command": "sendToInstance",
154
+ "jsonData": "{ \"type\": \"notification-manager\" }",
155
+ "hidden": "data.notificationType !== 'notification-manager'",
156
+ "label": "Notification-Manager Instance",
157
+ "sm": 12,
158
+ "md": 8,
159
+ "lg": 4,
160
+ "help": "Notification-Manager Instance"
161
+ },
147
162
  "pushoverInstance": {
148
163
  "type": "selectSendTo",
149
164
  "command": "sendToInstance",
package/io-package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "gotify-ws",
4
- "version": "0.1.1",
4
+ "version": "0.1.2",
5
5
  "news": {
6
+ "0.1.2": {
7
+ "en": "(simatec) Fix io-package\n(simatec) Notification-Manager added",
8
+ "de": "(simatec)\n(simatec) Notification-Manager hinzugefügt",
9
+ "ru": "Fix io-package\n(simatec)",
10
+ "pt": "(simatec) Fix io-package\n(simatec) Notificação-Manager adicionado",
11
+ "nl": "Fix io-package\n(simatec) Notification-Manager toegevoegd",
12
+ "fr": "(simatec) Correction de l'emballage\n(simatec) Avis-Gestionnaire ajouté",
13
+ "it": "(simatec) Fissare io-package\n(simatec) Notificazione-Manager aggiunto",
14
+ "es": "(simatec) Fija io-paquete\n(simatec) Notification-Manager añadido",
15
+ "pl": "(simatec) Napraw pakiet jo-\n(simatec) Notification-Manager dodany",
16
+ "uk": "(simatec) Фіксація io-package\n(simatec) Notification-Manager додано",
17
+ "zh-cn": "(静电)\n(simatec) 通知管理器添加"
18
+ },
6
19
  "0.1.1": {
7
20
  "en": "(simatec) Fix Branch",
8
21
  "de": "(simatec)",
@@ -79,14 +92,15 @@
79
92
  "Whatsapp",
80
93
  "Discord",
81
94
  "Mail",
82
- "Pushover"
95
+ "Pushover",
96
+ "Notification-Manager",
97
+ "Signal"
83
98
  ],
84
99
  "licenseInformation": {
85
100
  "license": "MIT",
86
101
  "type": "free"
87
102
  },
88
103
  "platform": "Javascript/Node.js",
89
- "main": "main.js",
90
104
  "icon": "gotify-ws.png",
91
105
  "enabled": true,
92
106
  "messagebox": true,
@@ -98,6 +112,7 @@
98
112
  "compact": true,
99
113
  "connectionType": "local",
100
114
  "dataSource": "poll",
115
+ "tier": 2,
101
116
  "adminUI": {
102
117
  "config": "json"
103
118
  },
@@ -115,22 +130,28 @@
115
130
  "native": {
116
131
  "ip": "",
117
132
  "port": 8080,
118
- "token": "",
119
- "notificationType": "telegram",
120
- "emailInstance": "email.0",
121
- "matrixInstance": "matrix.0",
122
- "pushoverInstance": "pushover.0",
123
- "discordInstance": "discord.0",
124
- "signalInstance": "signal-cmb.0",
125
- "telegramInstance": "telegram.0",
133
+ "notificationType": "notification-manager",
134
+ "emailInstance": "",
135
+ "matrixInstance": "",
136
+ "notificationManagerInstance": "",
137
+ "pushoverInstance": "",
138
+ "discordInstance": "",
139
+ "signalInstance": "",
140
+ "telegramInstance": "",
126
141
  "telegramUser": "allTelegramUsers",
127
- "whatsappInstance": "whatsapp-cmb.0",
142
+ "whatsappInstance": "",
128
143
  "emailReceiver": "xxx@xxx.com",
129
144
  "emailSender": "xxx@xxx.com",
130
145
  "pushoverDeviceID": "",
131
146
  "pushoverSilentNotice": false,
132
147
  "discordTarget": "none"
133
148
  },
149
+ "encryptedNative": [
150
+ "token"
151
+ ],
152
+ "protectedNative": [
153
+ "token"
154
+ ],
134
155
  "objects": [],
135
156
  "instanceObjects": [
136
157
  {
package/main.js CHANGED
@@ -21,6 +21,7 @@ class GotifyWs extends utils.Adapter {
21
21
  name: adapterName,
22
22
  });
23
23
  this.on('ready', this.onReady.bind(this));
24
+ // @ts-ignore
24
25
  this.on('message', this.onMessage.bind(this));
25
26
  this.on('unload', this.onUnload.bind(this));
26
27
  }
@@ -171,6 +172,7 @@ class GotifyWs extends utils.Adapter {
171
172
 
172
173
  ws = new WebSocket(uri, {
173
174
  headers: {
175
+ // @ts-ignore
174
176
  'X-Gotify-Key': this.config.token,
175
177
  },
176
178
  });
@@ -218,7 +220,7 @@ class GotifyWs extends utils.Adapter {
218
220
  line.title != '' ? `<b>${line.title.replace(/[`]/g, '')}</b>` : '<b>Gotifi WS Message</b>';
219
221
 
220
222
  try {
221
- this.sendTo(this.config.telegramInstance, 'send', {
223
+ await this.sendToAsync(this.config.telegramInstance, 'send', {
222
224
  parse_mode: 'HTML',
223
225
  text: `${title != '' ? `${title}\n` : ''}${formatMessage}`,
224
226
  });
@@ -236,7 +238,7 @@ class GotifyWs extends utils.Adapter {
236
238
  line.title != '' ? `<b>${line.title.replace(/[`]/g, '')}</b>` : '<b>Gotifi WS Message</b>';
237
239
 
238
240
  try {
239
- this.sendTo(this.config.telegramInstance, 'send', {
241
+ await this.sendToAsync(this.config.telegramInstance, 'send', {
240
242
  user: this.config.telegramUser,
241
243
  parse_mode: 'HTML',
242
244
  text: `${title != '' ? `${title}\n` : ''}${formatMessage}`,
@@ -253,7 +255,7 @@ class GotifyWs extends utils.Adapter {
253
255
  const title = line.title != '' ? line.title.replace(/[`]/g, '') : 'Gotifi WS Message';
254
256
 
255
257
  try {
256
- this.sendTo(this.config.emailInstance, 'send', {
258
+ await this.sendToAsync(this.config.emailInstance, 'send', {
257
259
  text: formatMessage,
258
260
  to: this.config.emailReceiver,
259
261
  subject: title,
@@ -276,7 +278,7 @@ class GotifyWs extends utils.Adapter {
276
278
  line.title != '' ? `<b>${line.title.replace(/[`]/g, '')}</b>` : '<b>Gotifi WS Message</b>';
277
279
 
278
280
  try {
279
- this.sendTo(this.config.pushoverInstance, 'send', {
281
+ await this.sendToAsync(this.config.pushoverInstance, 'send', {
280
282
  message: `${title != '' ? `${title}\n` : ''}${formatMessage}`,
281
283
  sound: '',
282
284
  priority: -1,
@@ -294,7 +296,7 @@ class GotifyWs extends utils.Adapter {
294
296
  line.title != '' ? `<b>${line.title.replace(/[`]/g, '')}</b>` : '<b>Gotifi WS Message</b>';
295
297
 
296
298
  try {
297
- this.sendTo(this.config.pushoverInstance, 'send', {
299
+ await this.sendToAsync(this.config.pushoverInstance, 'send', {
298
300
  message: `${title != '' ? `${title}\n` : ''}${formatMessage}`,
299
301
  sound: '',
300
302
  title: title,
@@ -313,7 +315,7 @@ class GotifyWs extends utils.Adapter {
313
315
  const title = line.title != '' ? `*${line.title.replace(/[`]/g, '')}*` : '*Gotifi WS Message*';
314
316
 
315
317
  try {
316
- this.sendTo(this.config.whatsappInstance, 'send', {
318
+ await this.sendToAsync(this.config.whatsappInstance, 'send', {
317
319
  text: `${title != '' ? `${title}\n` : ''}${formatMessage}`,
318
320
  });
319
321
  } catch (err) {
@@ -321,6 +323,22 @@ class GotifyWs extends utils.Adapter {
321
323
  }
322
324
  }
323
325
  break;
326
+ case 'notification-manager':
327
+ if (this.config.notificationManagerInstance) {
328
+ const message = line.message.replace(/[`]/g, '');
329
+ const formatMessage = message.replace(/[']/g, '"');
330
+ const title = line.title != '' ? `<b>${line.title.replace(/[`]/g, '')}</b>` : '<b>Gotifi WS Message</b>';
331
+
332
+ try {
333
+ await this.sendToAsync(this.config.notificationManagerInstance, 'registerUserNotification', {
334
+ category: 'notify',
335
+ message: `${title != '' ? `${title}\n` : ''}${formatMessage}`,
336
+ });
337
+ } catch (err) {
338
+ this.log.warn(`Error sending Notification-Manager message: ${err}`);
339
+ }
340
+ }
341
+ break;
324
342
  case 'signal-cmb':
325
343
  if (this.config.signalInstance) {
326
344
  const message = line.message.replace(/[`]/g, '');
@@ -328,7 +346,7 @@ class GotifyWs extends utils.Adapter {
328
346
  const title = line.title != '' ? line.title.replace(/[`]/g, '') : 'Gotifi WS Message';
329
347
 
330
348
  try {
331
- this.sendTo(this.config.signalInstance, 'send', {
349
+ await this.sendToAsync(this.config.signalInstance, 'send', {
332
350
  text: `${title != '' ? `${title}\n` : ''}${formatMessage}`,
333
351
  });
334
352
  } catch (err) {
@@ -336,7 +354,7 @@ class GotifyWs extends utils.Adapter {
336
354
  }
337
355
  }
338
356
  break;
339
- case 'matrix':
357
+ case 'matrix-org':
340
358
  if (this.config.matrixInstance) {
341
359
  const message = line.message.replace(/[`]/g, '');
342
360
  const formatMessage = message.replace(/[']/g, '"');
@@ -344,7 +362,7 @@ class GotifyWs extends utils.Adapter {
344
362
  line.title != '' ? `<b>${line.title.replace(/[`]/g, '')}</b>` : '<b>Gotifi WS Message</b>';
345
363
 
346
364
  try {
347
- this.sendTo(this.config.matrixInstance, {
365
+ await this.sendToAsync(this.config.matrixInstance, {
348
366
  html: `${title != '' ? `${title}\n` : ''}${formatMessage}`,
349
367
  });
350
368
  } catch (err) {
@@ -362,7 +380,7 @@ class GotifyWs extends utils.Adapter {
362
380
  if (this.config.discordTarget.match(/^\d+$/)) {
363
381
  // send to a single user
364
382
  try {
365
- this.sendTo(this.config.discordInstance, 'sendMessage', {
383
+ await this.sendToAsync(this.config.discordInstance, 'sendMessage', {
366
384
  userId: this.config.discordTarget,
367
385
  content: `${title != '' ? `${title}\n` : ''}${formatMessage}`,
368
386
  });
@@ -373,7 +391,7 @@ class GotifyWs extends utils.Adapter {
373
391
  // send to a server channel
374
392
  const [serverId, channelId] = this.config.discordTarget.split('/');
375
393
  try {
376
- this.sendTo(this.config.discordInstance, 'sendMessage', {
394
+ await this.sendToAsync(this.config.discordInstance, 'sendMessage', {
377
395
  serverId,
378
396
  channelId,
379
397
  content: `${title != '' ? `${title}\n` : ''}${formatMessage}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.gotify-ws",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Gotify web socket for connection to various notification systems",
5
5
  "author": {
6
6
  "name": "simatec",
@@ -15,7 +15,9 @@
15
15
  "Whatsapp",
16
16
  "Discord",
17
17
  "Mail",
18
- "Pushover"
18
+ "Pushover",
19
+ "Notification-Manager",
20
+ "Signal"
19
21
  ],
20
22
  "repository": {
21
23
  "type": "git",