@node-red/nodes 4.1.2 → 4.1.3
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/core/common/25-status.js
CHANGED
|
@@ -20,13 +20,15 @@ module.exports = function(RED) {
|
|
|
20
20
|
function StatusNode(n) {
|
|
21
21
|
RED.nodes.createNode(this,n);
|
|
22
22
|
var node = this;
|
|
23
|
-
this.scope = n.scope
|
|
23
|
+
this.scope = n.scope;
|
|
24
24
|
|
|
25
25
|
// auto-filter out any directly connected nodes to avoid simple loopback
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
this.scope
|
|
26
|
+
if (Array.isArray(this.scope)) {
|
|
27
|
+
const w = this.wires.flat();
|
|
28
|
+
for (let i = 0; i < this.scope.length; i++) {
|
|
29
|
+
if (w.includes(this.scope[i])) {
|
|
30
|
+
this.scope.splice(i, 1);
|
|
31
|
+
}
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
34
|
|
|
@@ -192,7 +192,8 @@ module.exports = function(RED) {
|
|
|
192
192
|
}
|
|
193
193
|
done();
|
|
194
194
|
}, delayvar, () => done());
|
|
195
|
-
|
|
195
|
+
if (Object.keys(msg).length === 2 && msg.hasOwnProperty("flush")) { id.clear(); }
|
|
196
|
+
else { node.idList.push(id); }
|
|
196
197
|
if (msg.hasOwnProperty("reset")) { clearDelayList(true); }
|
|
197
198
|
if (msg.hasOwnProperty("flush")) { flushDelayList(msg.flush); done(); }
|
|
198
199
|
if (delayvar >= 0) {
|
package/core/network/05-tls.html
CHANGED
|
@@ -167,12 +167,15 @@
|
|
|
167
167
|
$("#tls-config-button-cert-clear").on("click", function() {
|
|
168
168
|
clearNameData("cert");
|
|
169
169
|
});
|
|
170
|
+
RED.popover.tooltip($("#tls-config-button-cert-clear"), RED._("common.label.delete"));
|
|
170
171
|
$("#tls-config-button-key-clear").on("click", function() {
|
|
171
172
|
clearNameData("key");
|
|
172
173
|
});
|
|
174
|
+
RED.popover.tooltip($("#tls-config-button-key-clear"), RED._("common.label.delete"));
|
|
173
175
|
$("#tls-config-button-ca-clear").on("click", function() {
|
|
174
176
|
clearNameData("ca");
|
|
175
177
|
});
|
|
178
|
+
RED.popover.tooltip($("#tls-config-button-ca-clear"), RED._("common.label.delete"));
|
|
176
179
|
|
|
177
180
|
if (RED.settings.tlsConfigDisableLocalFiles) {
|
|
178
181
|
$("#node-config-row-uselocalfiles").hide();
|
|
@@ -143,15 +143,6 @@ in your Node-RED user directory (${RED.settings.userDir}).
|
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
/**
|
|
147
|
-
* @param {Object} headersObject
|
|
148
|
-
* @param {string} name
|
|
149
|
-
* @return {any} value
|
|
150
|
-
*/
|
|
151
|
-
const getHeaderValue = (headersObject, name) => {
|
|
152
|
-
const asLowercase = name.toLowercase();
|
|
153
|
-
return headersObject[Object.keys(headersObject).find(k => k.toLowerCase() === asLowercase)];
|
|
154
|
-
}
|
|
155
146
|
this.count = 0;
|
|
156
147
|
this.on("input",function(msg,nodeSend,nodeDone) {
|
|
157
148
|
node.count++;
|
|
@@ -256,34 +247,42 @@ in your Node-RED user directory (${RED.settings.userDir}).
|
|
|
256
247
|
opts.hooks = {
|
|
257
248
|
beforeRequest: [
|
|
258
249
|
options => {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
250
|
+
try {
|
|
251
|
+
// Whilst HTTP headers are meant to be case-insensitive,
|
|
252
|
+
// in the real world, there are servers that aren't so compliant.
|
|
253
|
+
// GOT will lower case all headers given a chance, so we need
|
|
254
|
+
// to restore the case of any headers the user has set.
|
|
255
|
+
Object.keys(options.headers).forEach(h => {
|
|
256
|
+
if (originalHeaderMap[h] && originalHeaderMap[h] !== h) {
|
|
257
|
+
options.headers[originalHeaderMap[h]] = options.headers[h];
|
|
258
|
+
delete options.headers[h];
|
|
259
|
+
}
|
|
260
|
+
})
|
|
261
|
+
if (node.insecureHTTPParser) {
|
|
262
|
+
// Setting the property under _unixOptions as pretty
|
|
263
|
+
// much the only hack available to get got to apply
|
|
264
|
+
// a core http option it doesn't think we should be
|
|
265
|
+
// allowed to set
|
|
266
|
+
options._unixOptions = { ...options.unixOptions, insecureHTTPParser: true }
|
|
267
267
|
}
|
|
268
|
-
})
|
|
269
|
-
|
|
270
|
-
// Setting the property under _unixOptions as pretty
|
|
271
|
-
// much the only hack available to get got to apply
|
|
272
|
-
// a core http option it doesn't think we should be
|
|
273
|
-
// allowed to set
|
|
274
|
-
options._unixOptions = { ...options.unixOptions, insecureHTTPParser: true }
|
|
268
|
+
} catch (err) {
|
|
269
|
+
node.warn("Error in beforeRequest hook: " + err.message);
|
|
275
270
|
}
|
|
276
271
|
}
|
|
277
272
|
],
|
|
278
273
|
beforeRedirect: [
|
|
279
274
|
(options, response) => {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
275
|
+
try {
|
|
276
|
+
let redirectInfo = {
|
|
277
|
+
location: response.headers.location
|
|
278
|
+
}
|
|
279
|
+
if (response.headers.hasOwnProperty('set-cookie')) {
|
|
280
|
+
redirectInfo.cookies = extractCookies(response.headers['set-cookie']);
|
|
281
|
+
}
|
|
282
|
+
redirectList.push(redirectInfo)
|
|
283
|
+
} catch (err) {
|
|
284
|
+
node.warn("Error processing redirect: " + err.message);
|
|
285
285
|
}
|
|
286
|
-
redirectList.push(redirectInfo)
|
|
287
286
|
}
|
|
288
287
|
]
|
|
289
288
|
}
|
|
@@ -422,25 +421,30 @@ in your Node-RED user directory (${RED.settings.userDir}).
|
|
|
422
421
|
let digestCreds = this.credentials;
|
|
423
422
|
let sentCreds = false;
|
|
424
423
|
opts.hooks.afterResponse = [(response, retry) => {
|
|
425
|
-
|
|
426
|
-
if (
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
424
|
+
try {
|
|
425
|
+
if (response.statusCode === 401) {
|
|
426
|
+
if (sentCreds) {
|
|
427
|
+
return response
|
|
428
|
+
}
|
|
429
|
+
const requestUrl = new URL(response.request.requestUrl);
|
|
430
|
+
const options = { headers: {} }
|
|
431
|
+
const normalisedHeaders = {};
|
|
432
|
+
Object.keys(response.headers).forEach(k => {
|
|
433
|
+
normalisedHeaders[k.toLowerCase()] = response.headers[k]
|
|
434
|
+
})
|
|
435
|
+
if (normalisedHeaders['www-authenticate']) {
|
|
436
|
+
let authHeader = buildDigestHeader(digestCreds.user,digestCreds.password, response.request.options.method, requestUrl.pathname + requestUrl.search, normalisedHeaders['www-authenticate'])
|
|
437
|
+
options.headers.Authorization = authHeader;
|
|
438
|
+
}
|
|
439
|
+
// response.request.options.merge(options)
|
|
440
|
+
sentCreds = true;
|
|
441
|
+
return retry(options);
|
|
438
442
|
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
443
|
+
return response
|
|
444
|
+
} catch (err) {
|
|
445
|
+
node.warn("Digest authentication failed: " + err.message);
|
|
446
|
+
return response;
|
|
442
447
|
}
|
|
443
|
-
return response
|
|
444
448
|
}];
|
|
445
449
|
} else if (this.authType === "bearer") {
|
|
446
450
|
opts.headers.Authorization = `Bearer ${this.credentials.password||""}`
|
|
@@ -688,6 +692,7 @@ in your Node-RED user directory (${RED.settings.userDir}).
|
|
|
688
692
|
if (!sendErrorsToCatch) {
|
|
689
693
|
nodeSend(msg);
|
|
690
694
|
}
|
|
695
|
+
node.count--;
|
|
691
696
|
nodeDone();
|
|
692
697
|
});
|
|
693
698
|
});
|
|
@@ -720,13 +725,29 @@ in your Node-RED user directory (${RED.settings.userDir}).
|
|
|
720
725
|
|
|
721
726
|
function extractCookies(setCookie) {
|
|
722
727
|
var cookies = {};
|
|
728
|
+
if (!Array.isArray(setCookie)) {
|
|
729
|
+
return cookies;
|
|
730
|
+
}
|
|
723
731
|
setCookie.forEach(function(c) {
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
732
|
+
try {
|
|
733
|
+
if (typeof c !== 'string') {
|
|
734
|
+
return;
|
|
735
|
+
}
|
|
736
|
+
var parsedCookie = cookie.parse(c);
|
|
737
|
+
var eq_idx = c.indexOf('=');
|
|
738
|
+
if (eq_idx === -1) {
|
|
739
|
+
return;
|
|
740
|
+
}
|
|
741
|
+
var key = c.substr(0, eq_idx).trim()
|
|
742
|
+
if (!key) {
|
|
743
|
+
return;
|
|
744
|
+
}
|
|
745
|
+
parsedCookie.value = parsedCookie[key];
|
|
746
|
+
delete parsedCookie[key];
|
|
747
|
+
cookies[key] = parsedCookie;
|
|
748
|
+
} catch (err) {
|
|
749
|
+
// Skip malformed cookies
|
|
750
|
+
}
|
|
730
751
|
});
|
|
731
752
|
return cookies;
|
|
732
753
|
}
|
|
@@ -778,6 +799,9 @@ in your Node-RED user directory (${RED.settings.userDir}).
|
|
|
778
799
|
}
|
|
779
800
|
|
|
780
801
|
function buildDigestHeader(user, pass, method, path, authHeader) {
|
|
802
|
+
if (!authHeader || typeof authHeader !== 'string') {
|
|
803
|
+
throw new Error("Invalid or missing WWW-Authenticate header");
|
|
804
|
+
}
|
|
781
805
|
var challenge = {}
|
|
782
806
|
var re = /([a-z0-9_-]+)=(?:"([^"]+)"|([a-z0-9_-]+))/gi
|
|
783
807
|
for (;;) {
|
|
@@ -787,6 +811,12 @@ in your Node-RED user directory (${RED.settings.userDir}).
|
|
|
787
811
|
}
|
|
788
812
|
challenge[match[1]] = match[2] || match[3]
|
|
789
813
|
}
|
|
814
|
+
if (!challenge.nonce) {
|
|
815
|
+
throw new Error("Invalid digest challenge: missing nonce");
|
|
816
|
+
}
|
|
817
|
+
if (!challenge.realm) {
|
|
818
|
+
throw new Error("Invalid digest challenge: missing realm");
|
|
819
|
+
}
|
|
790
820
|
var qop = /(^|,)\s*auth\s*($|,)/.test(challenge.qop) && 'auth'
|
|
791
821
|
var nc = qop && '00000001'
|
|
792
822
|
var cnonce = qop && uuid().replace(/-/g, '')
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<script type="text/html" data-template-name="file">
|
|
3
3
|
<div class="form-row node-input-filename">
|
|
4
4
|
<label for="node-input-filename"><i class="fa fa-file"></i> <span data-i18n="file.label.filename"></span></label>
|
|
5
|
-
<input id="node-input-filename" type="text">
|
|
5
|
+
<input id="node-input-filename" type="text" style="width: 100% !important;">
|
|
6
6
|
<input type="hidden" id="node-input-filenameType">
|
|
7
7
|
</div>
|
|
8
8
|
<div class="form-row">
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
<script type="text/html" data-template-name="file in">
|
|
39
39
|
<div class="form-row">
|
|
40
40
|
<label for="node-input-filename"><i class="fa fa-file"></i> <span data-i18n="file.label.filename"></span></label>
|
|
41
|
-
<input id="node-input-filename" type="text">
|
|
41
|
+
<input id="node-input-filename" type="text" style="width: 100% !important;">
|
|
42
42
|
<input type="hidden" id="node-input-filenameType">
|
|
43
43
|
</div>
|
|
44
44
|
<div class="form-row">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node-red/nodes",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"acorn": "8.15.0",
|
|
19
19
|
"acorn-walk": "8.3.4",
|
|
20
20
|
"ajv": "8.17.1",
|
|
21
|
-
"body-parser": "1.20.
|
|
21
|
+
"body-parser": "1.20.4",
|
|
22
22
|
"cheerio": "1.0.0-rc.10",
|
|
23
23
|
"content-type": "1.0.5",
|
|
24
24
|
"cookie-parser": "1.4.7",
|