node-red-contrib-remote 1.5.0 → 1.5.1
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 +4 -0
- package/nodes/remote-commons.js +6 -1
- package/nodes/remote-notification.js +4 -6
- package/nodes/remote-question.js +10 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,6 +36,10 @@ 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.5.1
|
|
40
|
+
- Added support for running Node-RED with a self signed https certificate.
|
|
41
|
+
- Notifications and Questions will automatically convert values to string if a string is needed (e.g. title and body).
|
|
42
|
+
|
|
39
43
|
Version 1.5.0
|
|
40
44
|
- Geofencing! You can add geofences in the apps. Entering and leaving them will trigger a message on the new output of the remote access node.
|
|
41
45
|
- Adding server location in Asia.
|
package/nodes/remote-commons.js
CHANGED
|
@@ -8,6 +8,7 @@ module.exports = {
|
|
|
8
8
|
createAxiosInstance: function() {
|
|
9
9
|
var filepath = path.join(__dirname, 'resources', 'ca.cer');
|
|
10
10
|
const httpsAgent = new https.Agent({
|
|
11
|
+
rejectUnauthorized: false,
|
|
11
12
|
ca: fs.readFileSync(filepath),
|
|
12
13
|
checkServerIdentity: function(host, cert) {
|
|
13
14
|
const pubkeyPinned = 'YHGEo54+LKxdpCuSAFt+Zwx/RVSHER96vM/Rh0/zcQ4=';
|
|
@@ -26,11 +27,15 @@ module.exports = {
|
|
|
26
27
|
return pjson.version;
|
|
27
28
|
},
|
|
28
29
|
|
|
29
|
-
evaluateValue: function(RED, value, type, node, msg) {
|
|
30
|
+
evaluateValue: function(RED, value, type, node, msg, tostring) {
|
|
30
31
|
// Evaluates the value
|
|
31
32
|
let evalValue = ''
|
|
32
33
|
try {
|
|
33
34
|
evalValue = RED.util.evaluateNodeProperty(value, type, node, msg);
|
|
35
|
+
if (tostring) {
|
|
36
|
+
if (evalValue == undefined) evalValue = '';
|
|
37
|
+
evalValue = String(evalValue);
|
|
38
|
+
}
|
|
34
39
|
} catch (e) {
|
|
35
40
|
node.error(`Error evaluating value: ${e}`)
|
|
36
41
|
}
|
|
@@ -24,10 +24,8 @@ module.exports = function(RED) {
|
|
|
24
24
|
}
|
|
25
25
|
node.limiter.removeTokens(1, function(err, remainingRequests) {
|
|
26
26
|
if (remainingRequests >= 0) {
|
|
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 = '';
|
|
27
|
+
let title = commons.evaluateValue(RED, config.notificationTitle, config.notificationTitleType, node, msg, true);
|
|
28
|
+
let body = commons.evaluateValue(RED, config.notificationBody, config.notificationBodyType, node, msg, true);
|
|
31
29
|
const notificationEmpty = (title == '' && body == '');
|
|
32
30
|
if (!notificationEmpty) {
|
|
33
31
|
// Title and/or body are filled
|
|
@@ -40,7 +38,7 @@ module.exports = function(RED) {
|
|
|
40
38
|
// Sound configured or computed?
|
|
41
39
|
let sound = config.notificationSound
|
|
42
40
|
if (sound === 'computed') {
|
|
43
|
-
sound = commons.evaluateValue(RED, config.notificationSoundComputed, config.notificationSoundComputedType, node, msg);
|
|
41
|
+
sound = commons.evaluateValue(RED, config.notificationSoundComputed, config.notificationSoundComputedType, node, msg, true);
|
|
44
42
|
}
|
|
45
43
|
|
|
46
44
|
// Call API to send notification
|
|
@@ -77,7 +75,7 @@ module.exports = function(RED) {
|
|
|
77
75
|
});
|
|
78
76
|
} else {
|
|
79
77
|
// To big...
|
|
80
|
-
node.error("
|
|
78
|
+
node.error("xxxThe message exceeded 3600 bytes. Can´t send.");
|
|
81
79
|
|
|
82
80
|
// Output status if configured so
|
|
83
81
|
if ( config.output == 2 ) {
|
package/nodes/remote-question.js
CHANGED
|
@@ -24,10 +24,8 @@ module.exports = function(RED) {
|
|
|
24
24
|
}
|
|
25
25
|
node.limiter.removeTokens(1, function(err, remainingRequests) {
|
|
26
26
|
if (remainingRequests >= 0) {
|
|
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 = '';
|
|
27
|
+
let title = commons.evaluateValue(RED, config.questionTitle, config.questionTitleType, node, msg, true);
|
|
28
|
+
let body = commons.evaluateValue(RED, config.questionBody, config.questionBodyType, node, msg, true);
|
|
31
29
|
const notificationEmpty = (title == '' && body == '');
|
|
32
30
|
if (!notificationEmpty) {
|
|
33
31
|
// Title and/or body are filled, generate question data
|
|
@@ -37,19 +35,20 @@ module.exports = function(RED) {
|
|
|
37
35
|
"questiontype" : 1,
|
|
38
36
|
"answers": [
|
|
39
37
|
{
|
|
40
|
-
"text": commons.evaluateValue(RED, config.questionAnswerOne, config.questionAnswerOneType, node, msg),
|
|
41
|
-
"value": commons.evaluateValue(RED, config.questionAnswerOneValue, config.questionAnswerOneValueType, node, msg)
|
|
38
|
+
"text": commons.evaluateValue(RED, config.questionAnswerOne, config.questionAnswerOneType, node, msg, true),
|
|
39
|
+
"value": commons.evaluateValue(RED, config.questionAnswerOneValue, config.questionAnswerOneValueType, node, msg, false)
|
|
42
40
|
},
|
|
43
41
|
{
|
|
44
|
-
"text": commons.evaluateValue(RED, config.questionAnswerTwo, config.questionAnswerTwoType, node, msg),
|
|
45
|
-
"value": commons.evaluateValue(RED, config.questionAnswerTwoValue, config.questionAnswerTwoValueType, node, msg)
|
|
42
|
+
"text": commons.evaluateValue(RED, config.questionAnswerTwo, config.questionAnswerTwoType, node, msg, true),
|
|
43
|
+
"value": commons.evaluateValue(RED, config.questionAnswerTwoValue, config.questionAnswerTwoValueType, node, msg, false)
|
|
46
44
|
},
|
|
47
45
|
{
|
|
48
|
-
"text": commons.evaluateValue(RED, config.questionAnswerThree, config.questionAnswerThreeType, node, msg),
|
|
49
|
-
"value": commons.evaluateValue(RED, config.questionAnswerThreeValue, config.questionAnswerThreeValueType, node, msg)
|
|
46
|
+
"text": commons.evaluateValue(RED, config.questionAnswerThree, config.questionAnswerThreeType, node, msg, true),
|
|
47
|
+
"value": commons.evaluateValue(RED, config.questionAnswerThreeValue, config.questionAnswerThreeValueType, node, msg, false)
|
|
50
48
|
}
|
|
51
49
|
]
|
|
52
50
|
};
|
|
51
|
+
node.log(`questionData: ${JSON.stringify(questionData)}`)
|
|
53
52
|
|
|
54
53
|
// Content smaller than 3600 bytes? FCM max size (complete payload) is 4000 bytes.
|
|
55
54
|
if (title.length + body.length + JSON.stringify(questionData).length <= 3600) {
|
|
@@ -59,7 +58,7 @@ module.exports = function(RED) {
|
|
|
59
58
|
// Sound configured or computed?
|
|
60
59
|
let sound = config.questionSound
|
|
61
60
|
if (sound === 'computed') {
|
|
62
|
-
sound = commons.evaluateValue(RED, config.questionSoundComputed, config.questionSoundComputedType, node, msg);
|
|
61
|
+
sound = commons.evaluateValue(RED, config.questionSoundComputed, config.questionSoundComputedType, node, msg, true);
|
|
63
62
|
}
|
|
64
63
|
|
|
65
64
|
// Call API to send notification
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-remote",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Remote-RED is an ecosystem to bring remote access, push notification and geofencing to Node-RED. There are also additional functions like directly answer on a notification and homescreen widgets.",
|
|
5
5
|
"author": "Thorsten Heilmann",
|
|
6
6
|
"license": "GPL-3.0",
|