node-red-contrib-remote 1.3.3 → 1.4.0
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 +5 -0
- package/nodes/locales/de/remote-config.json +5 -0
- package/nodes/locales/de/remote-notification.json +1 -1
- package/nodes/locales/de/remote-question.json +1 -1
- package/nodes/locales/en-US/remote-config.json +5 -0
- package/nodes/locales/en-US/remote-notification.json +1 -1
- package/nodes/locales/en-US/remote-question.json +1 -1
- package/nodes/remote-access.html +2 -0
- package/nodes/remote-access.js +38 -4
- package/nodes/remote-config.html +6 -0
- package/nodes/remote-config.js +3 -1
- package/nodes/remote-notification.js +9 -3
- package/nodes/remote-question.js +9 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,6 +36,11 @@ You will find more information on [www.remote-red-com](https://www.remote-red.co
|
|
|
36
36
|
|
|
37
37
|
## Version History
|
|
38
38
|
|
|
39
|
+
Version 1.4.0
|
|
40
|
+
- In addition to the QR code, a link is now generated to add an instance in the app.
|
|
41
|
+
- Sending notifications and questions is prevented if msg.playload.send === false.
|
|
42
|
+
- Error catched if a notification or question does not contain a title and body.
|
|
43
|
+
|
|
39
44
|
Version 1.3.3:
|
|
40
45
|
- Improved compatibility for Windows.
|
|
41
46
|
|
|
@@ -46,6 +46,11 @@
|
|
|
46
46
|
"apphelp": {
|
|
47
47
|
"title": "App Hilfe",
|
|
48
48
|
"para1": "Lade die Remote-RED App aus dem Apple AppStore oder Google PlayStore herunter. Verwende in der App die Funktion “Node-RED Instanz hinzufügen” um diesen QR-Code zu scannen."
|
|
49
|
+
},
|
|
50
|
+
"applink": {
|
|
51
|
+
"title": "Alternative: Per Link hinzufügen",
|
|
52
|
+
"para1": "Öffne diesen Link auf Deinem iOS oder Android Gerät, nachdem Du die Remote-RED App installiert hast:",
|
|
53
|
+
"link": "Link zum hinzufügen"
|
|
49
54
|
}
|
|
50
55
|
}
|
|
51
56
|
}
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"title": "Hilfe",
|
|
35
35
|
"para1": "Über diese Node kannst Du eine Push Notification an die Geräte versenden, die mit der gewählten Config-Node verbunden sind. Wähle hierzu eine Config-Node, die Du auch z.B. bereits in einer Access-Node verwendest. Du kannst in mehreren Notification-Nodes die selbe Config-Node verwenden.",
|
|
36
36
|
"para2": "Konfiguriere den Titel und den Text der Benachrichtigung. Die Vorgabewerte gehen davon aus, das im Payload der eingehenden Nachricht die Strings “title” und “body” enthalten sind. Du kannst aber auch feste Texte eingeben oder Flow- bzw. Global-Variablen verwenden.",
|
|
37
|
-
"para3": "Immer sobald eine Message bei der Notification-Node ankommt, wird eine Notification an Deine Geräte versendet."
|
|
37
|
+
"para3": "Immer sobald eine Message bei der Notification-Node ankommt, wird eine Notification an Deine Geräte versendet. Es wird kein Versand durchgeführt, wenn msg.payload.send den Boolean-Wert 'false' enthält."
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"para2": "Wichtig ist, das die Confg-Node auf Deinen lokalen Node-RED Rechner verweist und eine Access-Node damit aktiv ist. Die Basis URL ist dabei irrelevant.",
|
|
39
39
|
"para3": "Konfiguriere den Titel und den Text der Benachrichtigung. Die Vorgabewerte gehen davon aus, das im Payload der eingehenden Nachricht die Strings “title” und “body” enthalten sind. Du kannst aber auch feste Texte eingeben oder Flow- bzw. Global-Variablen verwenden.",
|
|
40
40
|
"para4": "Du kannst bis zu drei Antworten vorgeben. Der Text der Antworten kannst Du direkt als String eingeben oder aus der eingehenden Nachricht übernehmen. Ist der Text leer, wird die Antwort nicht angezeigt. Über den Wert kannst Du angeben, was die Node per msg.payload ausgibt, wenn Du diese Antwort wählst.",
|
|
41
|
-
"para5": "Immer sobald eine Message bei der Question-Node ankommt, wird eine Notification an Deine Geräte versendet."
|
|
41
|
+
"para5": "Immer sobald eine Message bei der Question-Node ankommt, wird eine Notification an Deine Geräte versendet. Es wird kein Versand durchgeführt, wenn msg.payload.send den Boolean-Wert 'false' enthält."
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -46,6 +46,11 @@
|
|
|
46
46
|
"apphelp": {
|
|
47
47
|
"title": "App Help",
|
|
48
48
|
"para1": "Download the Remote-RED app from the Apple AppStore or Google PlayStore. Use the function “Add Node-RED Instance” in the app to scan this QR Code."
|
|
49
|
+
},
|
|
50
|
+
"applink": {
|
|
51
|
+
"title": "Alternative: Add via link",
|
|
52
|
+
"para1": "Open this link on your iOS or Android device after installing the Remote-RED app:",
|
|
53
|
+
"link": "Link to add"
|
|
49
54
|
}
|
|
50
55
|
}
|
|
51
56
|
}
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"title": "Help",
|
|
35
35
|
"para1": "With this node you can send a push notification to the devices connected to the selected config node. Select a config node that you already use in an access node. You can use the same config node in several notification nodes.",
|
|
36
36
|
"para2": "Configure the title and the text of the notification. The default values assume that the payload of the incoming message contains the strings “title” and “body”. You can also enter fixed texts or use flow or global variables.",
|
|
37
|
-
"para3": "Whenever a message arrives at the notification node, a notification is sent to your devices."
|
|
37
|
+
"para3": "Whenever a message arrives at the notification node, a notification is sent to your devices. No send is performed if msg.payload.send contains the boolean value 'false'."
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"para2": "It is important that the confg node points to your local Node-RED computer and that an access node is active with it. The base URL is irrelevant.",
|
|
39
39
|
"para3": "Configure the title and the text of the notification. The default values assume that the payload of the incoming message contains the strings “title” and “body”. You can also enter fixed texts or use flow or global variables.",
|
|
40
40
|
"para4": "You can specify up to three answers. The text of the answers can be entered directly as an string or taken from the incoming message. If the text is empty, the answer is not displayed. You can use the value to specify what the node outputs in msg.payload when you select this answer.",
|
|
41
|
-
"para5": "Whenever a message arrives at the question node, a notification is sent to your devices."
|
|
41
|
+
"para5": "Whenever a message arrives at the question node, a notification is sent to your devices. No send is performed if msg.payload.send contains the boolean value 'false'."
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}
|
package/nodes/remote-access.html
CHANGED
package/nodes/remote-access.js
CHANGED
|
@@ -231,8 +231,8 @@ module.exports = function(RED) {
|
|
|
231
231
|
tryConnect(node);
|
|
232
232
|
|
|
233
233
|
// Post URL for action
|
|
234
|
-
const
|
|
235
|
-
RED.httpNode.post(
|
|
234
|
+
const postUrlAction = `/contrib-remote/action/${node.confignode.instancehash}`;
|
|
235
|
+
RED.httpNode.post(postUrlAction, function(req,res) {
|
|
236
236
|
// Output action as new message
|
|
237
237
|
node.log(`Action '${req.body.action}' received value '${req.body.value}'`);
|
|
238
238
|
const msg = {
|
|
@@ -242,7 +242,28 @@ module.exports = function(RED) {
|
|
|
242
242
|
"value": req.body.value
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
|
-
node.send(msg);
|
|
245
|
+
node.send([msg, null]);
|
|
246
|
+
|
|
247
|
+
// Send OK to app
|
|
248
|
+
const responseData = {
|
|
249
|
+
'status': 'OK'
|
|
250
|
+
};
|
|
251
|
+
res.json(responseData);
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
// Post URL for geofence
|
|
255
|
+
const postUrlGeofence = `/contrib-remote/geofence/${node.confignode.instancehash}`;
|
|
256
|
+
RED.httpNode.post(postUrlGeofence, function(req,res) {
|
|
257
|
+
// Output action as new message
|
|
258
|
+
node.log(`Geofence '${req.body.name}' received enter value '${req.body.enter}'`);
|
|
259
|
+
const msg = {
|
|
260
|
+
"_msgid": RED.util.generateId(),
|
|
261
|
+
"payload": {
|
|
262
|
+
"name": req.body.name,
|
|
263
|
+
"enter": req.body.enter
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
node.send([null, msg]);
|
|
246
267
|
|
|
247
268
|
// Send OK to app
|
|
248
269
|
const responseData = {
|
|
@@ -271,7 +292,20 @@ module.exports = function(RED) {
|
|
|
271
292
|
|
|
272
293
|
// Remove old routes, without a new deploy would break it..
|
|
273
294
|
RED.httpNode._router.stack.forEach(function(route,i,routes) {
|
|
274
|
-
if (route.route &&
|
|
295
|
+
if (route.route && route.route.path === postUrlAction) {
|
|
296
|
+
node.log(` -> Remove Route '${route.route.path}'`);
|
|
297
|
+
routes.splice(i,1);
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
RED.httpNode._router.stack.forEach(function(route,i,routes) {
|
|
301
|
+
if (route.route && route.route.path === postUrlGeofence) {
|
|
302
|
+
node.log(` -> Remove Route '${route.route.path}'`);
|
|
303
|
+
routes.splice(i,1);
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
RED.httpNode._router.stack.forEach(function(route,i,routes) {
|
|
307
|
+
if (route.route && route.route.path === getUrl) {
|
|
308
|
+
node.log(` -> Remove Route '${route.route.path}'`);
|
|
275
309
|
routes.splice(i,1);
|
|
276
310
|
}
|
|
277
311
|
});
|
package/nodes/remote-config.html
CHANGED
|
@@ -130,6 +130,7 @@
|
|
|
130
130
|
if ( data.error == undefined ) {
|
|
131
131
|
// Show QR Code
|
|
132
132
|
document.getElementById('registerRemoteAppQRCode').src = data.qrcode;
|
|
133
|
+
document.getElementById('appLink').setAttribute('href', data.link);
|
|
133
134
|
document.getElementById('registerRemoteAppQRCodeContainer').style.removeProperty('visibility');
|
|
134
135
|
document.getElementById('registerRemoteAppQRCodeContainer').style.removeProperty('height');
|
|
135
136
|
document.getElementById('registerRemoteAppButtonText').innerHTML = document.getElementById('registerRemoteAppButton_next_text').innerHTML;
|
|
@@ -243,6 +244,11 @@
|
|
|
243
244
|
<label data-i18n="remote-config.apphelp.title" style="font-weight: bold;"></label>
|
|
244
245
|
<label data-i18n="remote-config.apphelp.para1"></label>
|
|
245
246
|
</div>
|
|
247
|
+
<div style="max-width: 460px; border-width: 1px; border-style: dashed; border-color: #666; padding: 10px; margin-top: 6px; margin-bottom: 20px;">
|
|
248
|
+
<label data-i18n="remote-config.applink.title" style="font-weight: bold;"></label>
|
|
249
|
+
<label data-i18n="remote-config.applink.para1"></label>
|
|
250
|
+
<a id="appLink" href="" target="_blank"><i><label data-i18n="remote-config.applink.link" style="display: inline; color: #AD1626;"></label></i></a>
|
|
251
|
+
</div>
|
|
246
252
|
</div>
|
|
247
253
|
|
|
248
254
|
<div id="remoteInstanceInputs" style="max-height: 0px;">
|
package/nodes/remote-config.js
CHANGED
|
@@ -82,9 +82,11 @@ module.exports = function(RED) {
|
|
|
82
82
|
const qrCodeString = JSON.stringify(qrCodeData);
|
|
83
83
|
const qrCodeStringBuffer = Buffer.from(qrCodeString);
|
|
84
84
|
const qrCodeStringBase64 = qrCodeStringBuffer.toString('base64');
|
|
85
|
+
const link = 'remotered://add?data=' + qrCodeStringBase64;
|
|
85
86
|
QRCode.toDataURL(qrCodeStringBase64, function (err, url) {
|
|
86
87
|
const responseData = {
|
|
87
|
-
'qrcode': url
|
|
88
|
+
'qrcode': url,
|
|
89
|
+
'link': link
|
|
88
90
|
}
|
|
89
91
|
res.json(responseData);
|
|
90
92
|
});
|
|
@@ -18,11 +18,17 @@ module.exports = function(RED) {
|
|
|
18
18
|
// Act on incomming messages
|
|
19
19
|
node.on('input', function(msg) {
|
|
20
20
|
if (node.confignode != undefined) {
|
|
21
|
+
if (msg.payload.send === false) {
|
|
22
|
+
node.log(`Notification not send (msg.payload.send = false).`)
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
21
25
|
node.limiter.removeTokens(1, function(err, remainingRequests) {
|
|
22
26
|
if (remainingRequests >= 0) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
let title = commons.evaluateValue(RED, config.notificationTitle, config.notificationTitleType, node, msg);
|
|
28
|
+
let body = commons.evaluateValue(RED, config.notificationBody, config.notificationBodyType, node, msg);
|
|
29
|
+
if (title == undefined) title = '';
|
|
30
|
+
if (body == undefined) body = '';
|
|
31
|
+
const notificationEmpty = (title == '' && body == '');
|
|
26
32
|
if (!notificationEmpty) {
|
|
27
33
|
// Title and/or body are filled
|
|
28
34
|
|
package/nodes/remote-question.js
CHANGED
|
@@ -18,11 +18,17 @@ module.exports = function(RED) {
|
|
|
18
18
|
// Act on incomming messages
|
|
19
19
|
node.on('input', function(msg) {
|
|
20
20
|
if (node.confignode != undefined) {
|
|
21
|
+
if (msg.payload.send === false) {
|
|
22
|
+
node.log(`Question not send (msg.payload.send = false).`)
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
21
25
|
node.limiter.removeTokens(1, function(err, remainingRequests) {
|
|
22
26
|
if (remainingRequests >= 0) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
let title = commons.evaluateValue(RED, config.questionTitle, config.questionTitleType, node, msg);
|
|
28
|
+
let body = commons.evaluateValue(RED, config.questionBody, config.questionBodyType, node, msg);
|
|
29
|
+
if (title == undefined) title = '';
|
|
30
|
+
if (body == undefined) body = '';
|
|
31
|
+
const notificationEmpty = (title == '' && body == '');
|
|
26
32
|
if (!notificationEmpty) {
|
|
27
33
|
// Title and/or body are filled, generate question data
|
|
28
34
|
let questionData = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-remote",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Remote services for Node-RED including remote access, push notifications and questions through push notifications.",
|
|
5
5
|
"author": "Thorsten Heilmann",
|
|
6
6
|
"license": "GPL-3.0",
|