iobroker.gotify-ws 0.1.0 → 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 +8 -0
- package/admin/i18n/en/translations.json +1 -0
- package/admin/jsonConfig.json +19 -4
- package/io-package.json +48 -14
- package/main.js +29 -11
- package/package.json +4 -2
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,13 @@ 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
|
+
|
|
72
|
+
### 0.1.1 (2024-06-19)
|
|
73
|
+
* (simatec) Fix Branch
|
|
74
|
+
|
|
67
75
|
### 0.1.0 (2024-06-19)
|
|
68
76
|
* (simatec) First Release
|
|
69
77
|
|
|
@@ -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",
|
package/admin/jsonConfig.json
CHANGED
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"label": "Gotify Port"
|
|
43
43
|
},
|
|
44
44
|
"token": {
|
|
45
|
-
"type": "
|
|
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,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "gotify-ws",
|
|
4
|
-
"version": "0.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
|
+
},
|
|
19
|
+
"0.1.1": {
|
|
20
|
+
"en": "(simatec) Fix Branch",
|
|
21
|
+
"de": "(simatec)",
|
|
22
|
+
"ru": "(simatec) Fix Branch",
|
|
23
|
+
"pt": "(simatec) Fix Branch",
|
|
24
|
+
"nl": "Fix Branch",
|
|
25
|
+
"fr": "Branche de réparation",
|
|
26
|
+
"it": "(simatec) Fix Branch",
|
|
27
|
+
"es": "(simatec) Fix Branch",
|
|
28
|
+
"pl": "Fix Branch",
|
|
29
|
+
"uk": "(simatec) Фіксація відділення",
|
|
30
|
+
"zh-cn": "(同声)"
|
|
31
|
+
},
|
|
6
32
|
"0.1.0": {
|
|
7
33
|
"en": "(simatec) First Release",
|
|
8
34
|
"de": "(simatec) Erste Veröffentlichung",
|
|
@@ -66,25 +92,27 @@
|
|
|
66
92
|
"Whatsapp",
|
|
67
93
|
"Discord",
|
|
68
94
|
"Mail",
|
|
69
|
-
"Pushover"
|
|
95
|
+
"Pushover",
|
|
96
|
+
"Notification-Manager",
|
|
97
|
+
"Signal"
|
|
70
98
|
],
|
|
71
99
|
"licenseInformation": {
|
|
72
100
|
"license": "MIT",
|
|
73
101
|
"type": "free"
|
|
74
102
|
},
|
|
75
103
|
"platform": "Javascript/Node.js",
|
|
76
|
-
"main": "main.js",
|
|
77
104
|
"icon": "gotify-ws.png",
|
|
78
105
|
"enabled": true,
|
|
79
106
|
"messagebox": true,
|
|
80
|
-
"extIcon": "https://raw.githubusercontent.com/simatec/ioBroker.gotify-ws/
|
|
81
|
-
"readme": "https://github.com/simatec/ioBroker.gotify-ws/blob/
|
|
107
|
+
"extIcon": "https://raw.githubusercontent.com/simatec/ioBroker.gotify-ws/master/admin/gotify-ws.png",
|
|
108
|
+
"readme": "https://github.com/simatec/ioBroker.gotify-ws/blob/master/README.md",
|
|
82
109
|
"loglevel": "info",
|
|
83
110
|
"mode": "daemon",
|
|
84
111
|
"type": "messaging",
|
|
85
112
|
"compact": true,
|
|
86
113
|
"connectionType": "local",
|
|
87
114
|
"dataSource": "poll",
|
|
115
|
+
"tier": 2,
|
|
88
116
|
"adminUI": {
|
|
89
117
|
"config": "json"
|
|
90
118
|
},
|
|
@@ -102,22 +130,28 @@
|
|
|
102
130
|
"native": {
|
|
103
131
|
"ip": "",
|
|
104
132
|
"port": 8080,
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
"
|
|
109
|
-
"pushoverInstance": "
|
|
110
|
-
"discordInstance": "
|
|
111
|
-
"signalInstance": "
|
|
112
|
-
"telegramInstance": "
|
|
133
|
+
"notificationType": "notification-manager",
|
|
134
|
+
"emailInstance": "",
|
|
135
|
+
"matrixInstance": "",
|
|
136
|
+
"notificationManagerInstance": "",
|
|
137
|
+
"pushoverInstance": "",
|
|
138
|
+
"discordInstance": "",
|
|
139
|
+
"signalInstance": "",
|
|
140
|
+
"telegramInstance": "",
|
|
113
141
|
"telegramUser": "allTelegramUsers",
|
|
114
|
-
"whatsappInstance": "
|
|
142
|
+
"whatsappInstance": "",
|
|
115
143
|
"emailReceiver": "xxx@xxx.com",
|
|
116
144
|
"emailSender": "xxx@xxx.com",
|
|
117
145
|
"pushoverDeviceID": "",
|
|
118
146
|
"pushoverSilentNotice": false,
|
|
119
147
|
"discordTarget": "none"
|
|
120
148
|
},
|
|
149
|
+
"encryptedNative": [
|
|
150
|
+
"token"
|
|
151
|
+
],
|
|
152
|
+
"protectedNative": [
|
|
153
|
+
"token"
|
|
154
|
+
],
|
|
121
155
|
"objects": [],
|
|
122
156
|
"instanceObjects": [
|
|
123
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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",
|