1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Merge branch 'master' into dev

This commit is contained in:
Nick O'Leary 2021-10-06 09:12:16 +01:00
commit 8042fe4e2b
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
7 changed files with 17 additions and 10 deletions

View File

@ -14,5 +14,5 @@
"name": "Dave Conway-Jones" "name": "Dave Conway-Jones"
} }
], ],
"main": "./lib/index.js" "main": "./index.js"
} }

View File

@ -258,7 +258,7 @@ RED.sidebar.help = (function() {
var div = $('<div>',{class:"red-ui-node-list-item"}); var div = $('<div>',{class:"red-ui-node-list-item"});
var icon = RED.utils.createNodeIcon(n).appendTo(div); var icon = RED.utils.createNodeIcon(n).appendTo(div);
var label = n.name; var label = n.name;
if (!label && n._def.paletteLabel) { if (!label && n._def && n._def.paletteLabel) {
try { try {
label = (typeof n._def.paletteLabel === "function" ? n._def.paletteLabel.call(n._def) : n._def.paletteLabel)||""; label = (typeof n._def.paletteLabel === "function" ? n._def.paletteLabel.call(n._def) : n._def.paletteLabel)||"";
} catch (err) { } catch (err) {

View File

@ -372,12 +372,13 @@ module.exports = function(RED) {
socket.setKeepAlive(true,120000); socket.setKeepAlive(true,120000);
if (socketTimeout !== null) { socket.setTimeout(socketTimeout); } if (socketTimeout !== null) { socket.setTimeout(socketTimeout); }
node.log(RED._("tcpin.status.connection-from",{host:socket.remoteAddress, port:socket.remotePort})); node.log(RED._("tcpin.status.connection-from",{host:socket.remoteAddress, port:socket.remotePort}));
connectedSockets.push(socket);
node.status({text:RED._("tcpin.status.connections",{count:connectedSockets.length})});
socket.on('timeout', function() { socket.on('timeout', function() {
node.log(RED._("tcpin.errors.timeout",{port:node.port})); node.log(RED._("tcpin.errors.timeout",{port:node.port}));
socket.end(); socket.end();
}); });
socket.on('data', function(d) {
// console.log("DATA",d)
});
socket.on('close',function() { socket.on('close',function() {
node.log(RED._("tcpin.status.connection-closed",{host:socket.remoteAddress, port:socket.remotePort})); node.log(RED._("tcpin.status.connection-closed",{host:socket.remoteAddress, port:socket.remotePort}));
connectedSockets.splice(connectedSockets.indexOf(socket),1); connectedSockets.splice(connectedSockets.indexOf(socket),1);
@ -388,6 +389,8 @@ module.exports = function(RED) {
connectedSockets.splice(connectedSockets.indexOf(socket),1); connectedSockets.splice(connectedSockets.indexOf(socket),1);
node.status({text:RED._("tcpin.status.connections",{count:connectedSockets.length})}); node.status({text:RED._("tcpin.status.connections",{count:connectedSockets.length})});
}); });
connectedSockets.push(socket);
node.status({text:RED._("tcpin.status.connections",{count:connectedSockets.length})});
}); });
node.on("input", function(msg, nodeSend, nodeDone) { node.on("input", function(msg, nodeSend, nodeDone) {

View File

@ -178,7 +178,7 @@ module.exports = function(RED) {
var sock; var sock;
var p = this.outport || this.port || "0"; var p = this.outport || this.port || "0";
node.tout = setTimeout(function() { node.tout = setTimeout(function() {
if (udpInputPortsInUse[p]) { if ((p != 0) && udpInputPortsInUse[p]) {
sock = udpInputPortsInUse[p]; sock = udpInputPortsInUse[p];
if (node.multicast != "false") { if (node.multicast != "false") {
sock.setBroadcast(true); sock.setBroadcast(true);

View File

@ -47,5 +47,9 @@
<code>{{global.name}}</code>, or for persistable store <code>store</code> use <code>{{flow[store].name}}</code> or <code>{{global.name}}</code>, or for persistable store <code>store</code> use <code>{{flow[store].name}}</code> or
<code>{{global[store].name}}</code>. <code>{{global[store].name}}</code>.
<p><b>Note: </b>By default, <i>mustache</i> will escape any non-alphanumeric or HTML entities in the values it substitutes. <p><b>Note: </b>By default, <i>mustache</i> will escape any non-alphanumeric or HTML entities in the values it substitutes.
To prevent this, use <code>{{{triple}}}</code> braces. To prevent this, use <code>{{{triple}}}</code> braces.</p>
<p>If you need to use <code>{{ }}</code> within your content, you can change the characters
used to mark the templated sections. For example, to use <code>[[ ]]</code>
instead, add the following line to the top of the template:</p>
<pre>{{=[[ ]]=}}</pre>
</script> </script>

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
**/ **/
var fs = require('fs-extra'); var fs = require('fs');
var fspath = require('path'); var fspath = require('path');
var runtime; var runtime;
@ -25,7 +25,7 @@ var exampleFlows = null;
async function getFlowsFromPath(path) { async function getFlowsFromPath(path) {
var result = {}; var result = {};
var validFiles = []; var validFiles = [];
return fs.readdir(path).then(files => { return fs.promises.readdir(path).then(files => {
var promises = []; var promises = [];
if (files) { if (files) {
files.forEach(function(file) { files.forEach(function(file) {

View File

@ -23,7 +23,7 @@
var i18n = require("i18next"); var i18n = require("i18next");
var path = require("path"); var path = require("path");
var fs = require("fs-extra"); var fs = require("fs");
var defaultLang = "en-US"; var defaultLang = "en-US";
@ -89,7 +89,7 @@ async function readFile(lng, ns) {
return resourceCache[ns][lng]; return resourceCache[ns][lng];
} else if (resourceMap[ns]) { } else if (resourceMap[ns]) {
const file = path.join(resourceMap[ns].basedir, lng, resourceMap[ns].file); const file = path.join(resourceMap[ns].basedir, lng, resourceMap[ns].file);
const content = await fs.readFile(file, "utf8"); const content = await fs.promises.readFile(file, "utf8");
resourceCache[ns] = resourceCache[ns] || {}; resourceCache[ns] = resourceCache[ns] || {};
resourceCache[ns][lng] = JSON.parse(content.replace(/^\uFEFF/, '')); resourceCache[ns][lng] = JSON.parse(content.replace(/^\uFEFF/, ''));
var baseLng = lng.split('-')[0]; var baseLng = lng.split('-')[0];