Merge branch 'dev' into fix_html_tags

This commit is contained in:
Nick O'Leary
2024-09-11 15:27:45 +01:00
committed by GitHub
37 changed files with 557 additions and 204 deletions

View File

@@ -108,12 +108,13 @@ in your Node-RED user directory (${RED.settings.userDir}).
if (n.proxy && proxyConfig) {
proxyOptions.env = {
no_proxy: (proxyConfig.noproxy || []).join(','),
http_proxy: (proxyConfig.url)
http_proxy: (proxyConfig.url),
https_proxy: (proxyConfig.url)
}
}
return getProxyForUrl(url, proxyOptions)
}
let prox = getProxy(nodeUrl || '')
let prox = nodeUrl ? getProxy(nodeUrl) : null
let timingLog = false;
if (RED.settings.hasOwnProperty("httpRequestTimingLog")) {
@@ -534,9 +535,7 @@ in your Node-RED user directory (${RED.settings.userDir}).
opts.headers[clSet] = opts.headers['content-length'];
delete opts.headers['content-length'];
}
if (!opts.headers.hasOwnProperty('user-agent')) {
opts.headers['user-agent'] = 'Mozilla/5.0 (Node-RED)';
}
if (proxyUrl) {
const match = proxyUrl.match(/^(https?:\/\/)?(.+)?:([0-9]+)?/i);
if (match) {
@@ -566,7 +565,7 @@ in your Node-RED user directory (${RED.settings.userDir}).
//need both incase of http -> https redirect
opts.agent = {
http: new HttpProxyAgent(proxyOptions),
https: new HttpProxyAgent(proxyOptions)
https: new HttpsProxyAgent(proxyOptions)
};
} else {

View File

@@ -17,7 +17,11 @@
<script type="text/html" data-template-name="split">
<!-- <div class="form-row"><span data-i18n="[html]split.intro"></span></div> -->
<div class="form-row">
<label for="node-input-property"><i class="fa fa-forward"></i> <span data-i18n="split.split"></span></label>
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></span></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]node-red:common.label.name">
</div>
<div class="form-row">
<label for="node-input-property"><i class="fa fa-forward"></i> <span data-i18n="split.splitThe"></span></label>
<input type="text" id="node-input-property" style="width:70%;">
</div>
<div class="form-row"><span data-i18n="[html]split.strBuff"></span></div>
@@ -43,10 +47,6 @@
<label for="node-input-addname-cb" style="width:auto;" data-i18n="split.addname"></label>
<input type="text" id="node-input-addname" style="width:70%">
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></span></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]node-red:common.label.name">
</div>
</script>
<script type="text/javascript">
@@ -122,6 +122,10 @@
<script type="text/html" data-template-name="join">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
</div>
<div class="form-row">
<label data-i18n="join.mode.mode"></label>
<select id="node-input-mode" style="width:200px;">
@@ -157,6 +161,12 @@
<input type="text" id="node-input-joiner" style="width:70%">
<input type="hidden" id="node-input-joinerType">
</div>
<div class="form-row">
<input type="checkbox" id="node-input-useparts" style="margin-left:8px; margin-right:8px; vertical-align:baseline; width:auto;">
<label for="node-input-useparts" style="width:auto;" data-i18n="join.useparts"></label>
</div>
<div class="form-row node-row-trigger" id="trigger-row">
<label style="width:auto;" data-i18n="join.send"></label>
<ul>
@@ -195,10 +205,6 @@
<label for="node-input-reduceRight" data-i18n="join.reduce.right" style="width:70%; margin-left:10px;"></label>
</div>
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
</div>
<div class="form-tips form-tips-auto hide" data-i18n="[html]join.tip"></div>
</script>
@@ -234,6 +240,7 @@
},
joiner: { value:"\\n"},
joinerType: { value:"str"},
useparts: { value:false },
accumulate: { value:"false" },
timeout: {value:""},
count: {value:""},
@@ -259,6 +266,12 @@
},
oneditprepare: function() {
var node = this;
$("#node-input-useparts").on("change", function(e) {
if (node.useparts === undefined) {
node.useparts = true;
$("#node-input-useparts").attr('checked', true);
}
});
$("#node-input-mode").on("change", function(e) {
var val = $(this).val();

View File

@@ -444,6 +444,8 @@ module.exports = function(RED) {
this.count = Number(n.count || 0);
this.joiner = n.joiner||"";
this.joinerType = n.joinerType||"str";
if (n.useparts === undefined) { this.useparts = true; }
else { this.useparts = n.useparts || false; }
this.reduce = (this.mode === "reduce");
if (this.reduce) {
@@ -611,7 +613,7 @@ module.exports = function(RED) {
return;
}
if (node.mode === 'custom' && msg.hasOwnProperty('parts')) {
if (node.mode === 'custom' && msg.hasOwnProperty('parts') && node.useparts === false ) {
if (msg.parts.hasOwnProperty('parts')) {
msg.parts = { parts: msg.parts.parts };
}

View File

@@ -36,6 +36,10 @@
<label style="margin-left: 10px; width: 175px;" for="node-input-overlap" data-i18n="batch.count.overlap"></label>
<input type="text" id="node-input-overlap" style="width: 50px;">
</div>
<div class="form-row">
<input type="checkbox" id="node-input-honourParts" style="margin-left: 10px; margin-right:10px; vertical-align:top; width:auto;">
<label for="node-input-honourParts" style="width:auto;" data-i18n="batch.honourParts"></label>
</div>
</div>
<div class="node-row-msg-interval">
@@ -45,7 +49,7 @@
<span data-i18n="batch.interval.seconds"></span>
</div>
<div class="form-row">
<input type="checkbox" id="node-input-allowEmptySequence" style="margin-left:20px; margin-right: 10px; vertical-align:top; width:auto;">
<input type="checkbox" id="node-input-allowEmptySequence" style="margin-left:20px; margin-right:10px; vertical-align:top; width:auto;">
<label for="node-input-allowEmptySequence" style="width:auto;" data-i18n="batch.interval.empty"></label>
</div>
</div>
@@ -101,6 +105,7 @@
}
},
allowEmptySequence: {value:false},
honourParts: {value:false},
topics: {value:[{topic:""}]}
},
inputs:1,

View File

@@ -181,6 +181,8 @@ module.exports = function(RED) {
RED.nodes.createNode(this,n);
var node = this;
var mode = n.mode || "count";
var eof = false;
node.honourParts = n.honourParts || false;
node.pending_count = 0;
if (mode === "count") {
@@ -201,9 +203,12 @@ module.exports = function(RED) {
return;
}
var queue = node.pending;
if (node.honourParts && msg.hasOwnProperty("parts")) {
if (msg.parts.index + 1 === msg.parts.count) { eof = true; }
}
queue.push({msg, send, done});
node.pending_count++;
if (queue.length === count) {
if (queue.length === count || eof === true) {
send_msgs(node, queue, is_overlap);
for (let i = 0; i < queue.length-overlap; i++) {
queue[i].done();
@@ -211,6 +216,7 @@ module.exports = function(RED) {
node.pending =
(overlap === 0) ? [] : queue.slice(-overlap);
node.pending_count = 0;
eof = false;
}
var max_msgs = max_kept_msgs_count(node);
if ((max_msgs > 0) && (node.pending_count > max_msgs)) {