Compare commits

..

13 Commits

Author SHA1 Message Date
Nick O'Leary
0346294c59 Rename package var 2023-01-23 17:50:50 +00:00
Nick O'Leary
8d240ca797 Rename package var to avoid strict more error
Fixes #4017
2023-01-23 17:44:03 +00:00
Nick O'Leary
7dbbafec1b Merge pull request #4000 from node-red/fix-split-stream
Split node: avoid duplicate done call for buffer split
2023-01-23 17:04:31 +00:00
Nick O'Leary
c49330f9d1 Merge pull request #4012 from kazuhitoyokoi/master-addjpn
Add Japanese translations for v3.0.3
2023-01-23 16:58:34 +00:00
Robin Schneider
10324d8260 Fix typos in settings.js (#4013)
* chore: Remove trailing whitespace in settings.js

* chore: Fix typos in settings.js

* chore: Use consistent terminology in settings.js
2023-01-19 09:28:46 +00:00
Kazuhito Yokoi
8f27dae7ea Add Japanese translations for v3.0.3 2023-01-16 00:56:39 +09:00
Nick O'Leary
74794fea09 Split node: avoid duplicate done call for buffer split
Fixes #3982
2023-01-01 22:21:49 +00:00
Nick O'Leary
4d202a7a37 Merge pull request #3971 from node-red/fix-cred-on-global
Ensure credentials object is removed before returning node in getFlow request
2023-01-01 14:09:54 +00:00
Nick O'Leary
e0d71abdc6 Merge pull request #3992 from node-red/fix-mqtt-reconnect
Fix mqtt nodes not reconnecting on modified-flows deploy
2023-01-01 14:09:33 +00:00
Nick O'Leary
550eb6ee2f Merge pull request #3995 from bonanitech/radialMenu
Let themes change radialMenu text colors
2023-01-01 14:06:00 +00:00
Mauricio Bonani
f737162697 Let themes change radialMenu text colors 2022-12-29 09:47:05 -05:00
Nick O'Leary
ce57ba80eb Fix mqtt nodes not reconnected on modified-flows deploy 2022-12-27 14:56:32 +00:00
Nick O'Leary
c18018f017 Ensure credentials object is removed before returning node in getFlow request
Fixes #3953
2022-12-03 23:33:33 +00:00
9 changed files with 80 additions and 52 deletions

View File

@@ -41,6 +41,7 @@
height: 50px;
background: var(--red-ui-secondary-background);
border: 2px solid var(--red-ui-primary-border-color);
color: var(--red-ui-primary-text-color);
text-align: center;
line-height:50px;
@@ -51,7 +52,7 @@
.red-ui-editor-radial-menu-opt-disabled {
border-color: var(--red-ui-tertiary-border-color);
color: var(--red-ui-tertiary-border-color);
color: var(--red-ui-secondary-text-color-disabled);
}
.red-ui-editor-radial-menu-opt-active {
background: var(--red-ui-secondary-background-hover);

View File

@@ -295,7 +295,7 @@ module.exports = function(RED) {
/* mute error - it simply isnt JSON, just leave payload as a string */
}
}
} //else {
} //else {
//leave as buffer
//}
}
@@ -357,7 +357,7 @@ module.exports = function(RED) {
return;
}
done(err);
});
});
} else {
done();
}
@@ -718,9 +718,10 @@ module.exports = function(RED) {
node.deregister = function(mqttNode, done, autoDisconnect) {
delete node.users[mqttNode.id];
if (autoDisconnect && !node.closing && node.connected && Object.keys(node.users).length === 0) {
node.disconnect();
node.disconnect(done);
} else {
done();
}
done();
};
node.canConnect = function() {
return !node.connected && !node.connecting;
@@ -854,7 +855,7 @@ module.exports = function(RED) {
let waitEnd = (client, ms) => {
return new Promise( (resolve, reject) => {
node.closing = true;
if(!client) {
if(!client) {
resolve();
} else {
const t = setTimeout(() => {
@@ -1033,7 +1034,7 @@ module.exports = function(RED) {
/**
* Add event handlers to the MQTT.js client and track them so that
* we do not remove any handlers that the MQTT client uses internally.
* we do not remove any handlers that the MQTT client uses internally.
* Use {@link node._clientRemoveListeners `node._clientRemoveListeners`} to remove handlers
* @param {string} event The name of the event
* @param {function} handler The handler for this event
@@ -1041,11 +1042,11 @@ module.exports = function(RED) {
node._clientOn = function(event, handler) {
node.clientListeners.push({event, handler})
node.client.on(event, handler)
}
}
/**
* Remove event handlers from the MQTT.js client & only the events
* that we attached in {@link node._clientOn `node._clientOn`}.
* Remove event handlers from the MQTT.js client & only the events
* that we attached in {@link node._clientOn `node._clientOn`}.
* * If `event` is omitted, then all events matching `handler` are removed
* * If `handler` is omitted, then all events named `event` are removed
* * If both parameters are omitted, then all events are removed

View File

@@ -251,7 +251,9 @@ module.exports = function(RED) {
}
else {
node.buffer = buff.slice(p,buff.length);
node.pendingDones.push(done);
if (node.buffer.length > 0) {
node.pendingDones.push(done);
}
}
if (node.buffer.length == 0) {
done();

View File

@@ -126,24 +126,38 @@ function loadModuleFiles(modules) {
}
var pluginList;
var nodeList;
return Promise.all(pluginPromises).then(function(results) {
pluginList = results.filter(r => !!r);
return Promise.all(nodePromises)
// Initial plugin load has happened. Ensure modules that provide
// plugins are in the registry now.
for (var module in modules) {
if (modules.hasOwnProperty(module)) {
if (modules[module].plugins && Object.keys(modules[module].plugins).length > 0) {
// Add the modules for plugins
if (!modules[module].err) {
registry.addModule(modules[module]);
}
}
}
}
return loadNodeSetList(pluginList);
}).then(function() {
return Promise.all(nodePromises);
}).then(function(results) {
nodeList = results.filter(r => !!r);
// Initial node load has happened. Ensure remaining modules are in the registry
for (var module in modules) {
if (modules.hasOwnProperty(module)) {
if (!modules[module].err) {
registry.addModule(modules[module]);
if (!modules[module].plugins || Object.keys(modules[module].plugins).length === 0) {
if (!modules[module].err) {
registry.addModule(modules[module]);
}
}
}
}
}).then(function() {
return loadNodeSetList(pluginList);
}).then(function() {
return loadNodeSetList(nodeList);
})
});
}
async function loadPluginTemplate(plugin) {

View File

@@ -106,8 +106,8 @@ function getLocalNodeFiles(dir, skipValidNodeRedModules) {
// when loading local files, if the path is a valid node-red module
// dont include it (will be picked up in scanTreeForNodesModules)
if(skipValidNodeRedModules && files.indexOf("package.json") >= 0) {
const package = getPackageDetails(dir)
if(package.isNodeRedModule) {
const packageDetails = getPackageDetails(dir)
if(packageDetails.isNodeRedModule) {
return {files: [], icons: []};
}
}
@@ -135,17 +135,17 @@ function getLocalNodeFiles(dir, skipValidNodeRedModules) {
return {files: result, icons: icons}
}
function scanDirForNodesModules(dir,moduleName,package) {
function scanDirForNodesModules(dir,moduleName,packageDetails) {
let results = [];
let scopeName;
let files
try {
let isNodeRedModule = false
if(package) {
dir = path.join(package.moduleDir,'..')
files = [path.basename(package.moduleDir)]
moduleName = (package.package ? package.package.name : null) || moduleName
isNodeRedModule = package.isNodeRedModule
if(packageDetails) {
dir = path.join(packageDetails.moduleDir,'..')
files = [path.basename(packageDetails.moduleDir)]
moduleName = (packageDetails.package ? packageDetails.package.name : null) || moduleName
isNodeRedModule = packageDetails.isNodeRedModule
} else {
files = fs.readdirSync(dir);
if (moduleName) {
@@ -159,8 +159,8 @@ function scanDirForNodesModules(dir,moduleName,package) {
// if we have found a package.json, this IS a node_module, lets see if it is a node-red node
if (!isNodeRedModule && files.indexOf('package.json') > -1) {
package = getPackageDetails(dir) // get package details
if(package && package.isNodeRedModule) {
packageDetails = getPackageDetails(dir) // get package details
if(packageDetails && packageDetails.isNodeRedModule) {
isNodeRedModule = true
files = ['package.json'] // shortcut the file scan
}
@@ -179,8 +179,8 @@ function scanDirForNodesModules(dir,moduleName,package) {
} else {
if ((isNodeRedModule || (!moduleName || fn == moduleName)) && (isIncluded(fn) && !isExcluded(fn))) {
try {
const moduleDir = isNodeRedModule ? package.moduleDir : path.join(dir,fn);
const pkg = package || getPackageDetails(moduleDir)
const moduleDir = isNodeRedModule ? packageDetails.moduleDir : path.join(dir,fn);
const pkg = packageDetails || getPackageDetails(moduleDir)
if(pkg.error) {
throw pkg.error
}

View File

@@ -641,6 +641,7 @@ function getFlow(id) {
if (node.type === 'link out') {
delete node.wires;
}
delete node.credentials;
return node;
})
}
@@ -648,7 +649,10 @@ function getFlow(id) {
if (flow.configs) {
var configIds = Object.keys(flow.configs);
result.configs = configIds.map(function(configId) {
return clone(flow.configs[configId]);
const node = clone(flow.configs[configId]);
delete node.credentials;
return node
})
if (result.configs.length === 0) {
delete result.configs;
@@ -660,12 +664,16 @@ function getFlow(id) {
var subflow = clone(flow.subflows[subflowId]);
var nodeIds = Object.keys(subflow.nodes);
subflow.nodes = nodeIds.map(function(id) {
return subflow.nodes[id];
const node = clone(subflow.nodes[id])
delete node.credentials
return node
});
if (subflow.configs) {
var configIds = Object.keys(subflow.configs);
subflow.configs = configIds.map(function(id) {
return subflow.configs[id];
const node = clone(subflow.configs[id])
delete node.credentials
return node
})
}
delete subflow.instances;

View File

@@ -18,7 +18,7 @@ var i18n = require("@node-red/util").i18n;
module.exports = {
"package.json": function(project) {
var package = {
var packageDetails = {
"name": project.name,
"description": project.summary||i18n._("storage.localfilesystem.projects.summary"),
"version": "0.0.1",
@@ -30,11 +30,11 @@ module.exports = {
};
if (project.files) {
if (project.files.flow) {
package['node-red'].settings.flowFile = project.files.flow;
package['node-red'].settings.credentialsFile = project.files.credentials;
packageDetails['node-red'].settings.flowFile = project.files.flow;
packageDetails['node-red'].settings.credentialsFile = project.files.credentials;
}
}
return JSON.stringify(package,"",4);
return JSON.stringify(packageDetails,"",4);
},
"README.md": function(project) {
var content = project.name+"\n"+("=".repeat(project.name.length))+"\n\n";

View File

@@ -20,6 +20,7 @@
"errors-help": "詳細は -v を指定して実行してください",
"missing-modules": "不足しているノードモジュール:",
"node-version-mismatch": "ノードモジュールはこのバージョンではロードできません。必要なバージョン: __version__ ",
"set-has-no-types": "セットに型がありません。 名前: '__name__', モジュール: '__module__', ファイル: '__file__'",
"type-already-registered": "'__type__' はモジュール __module__ で登録済みです",
"removing-modules": "設定からモジュールを削除します",
"added-types": "追加したノード:",
@@ -134,7 +135,8 @@
"flow": {
"unknown-type": "不明なノード: __type__",
"missing-types": "欠落したノード",
"error-loop": "メッセージの例外補足回数が最大値を超えました"
"error-loop": "メッセージの例外補足回数が最大値を超えました",
"non-message-returned": "ノードが __type__ 型のメッセージの送信を試みました"
},
"index": {
"unrecognised-id": "不明なID: __id__",

View File

@@ -181,7 +181,7 @@ module.exports = {
/** Some nodes, such as HTTP In, can be used to listen for incoming http requests.
* By default, these are served relative to '/'. The following property
* can be used to specifiy a different root path. If set to false, this is
* can be used to specify a different root path. If set to false, this is
* disabled.
*/
//httpNodeRoot: '/red-nodes',
@@ -219,17 +219,17 @@ module.exports = {
/** When httpAdminRoot is used to move the UI to a different root path, the
* following property can be used to identify a directory of static content
* that should be served at http://localhost:1880/.
* When httpStaticRoot is set differently to httpAdminRoot, there is no need
* When httpStaticRoot is set differently to httpAdminRoot, there is no need
* to move httpAdminRoot
*/
//httpStatic: '/home/nol/node-red-static/', //single static source
/* OR multiple static sources can be created using an array of objects... */
//httpStatic: [
// {path: '/home/nol/pics/', root: "/img/"},
// {path: '/home/nol/reports/', root: "/doc/"},
// {path: '/home/nol/pics/', root: "/img/"},
// {path: '/home/nol/reports/', root: "/doc/"},
//],
/**
/**
* All static routes will be appended to httpStaticRoot
* e.g. if httpStatic = "/home/nol/docs" and httpStaticRoot = "/static/"
* then "/home/nol/docs" will be served at "/static/"
@@ -256,11 +256,11 @@ module.exports = {
*/
// lang: "de",
/** Configure diagnostics options
/** Configure diagnostics options
* - enabled: When `enabled` is `true` (or unset), diagnostics data will
* be available at http://localhost:1880/diagnostics
* - ui: When `ui` is `true` (or unset), the action `show-system-info` will
* be available to logged in users of node-red editor
* be available at http://localhost:1880/diagnostics
* - ui: When `ui` is `true` (or unset), the action `show-system-info` will
* be available to logged in users of node-red editor
*/
diagnostics: {
/** enable or disable diagnostics endpoint. Must be set to `false` to disable */
@@ -268,10 +268,10 @@ module.exports = {
/** enable or disable diagnostics display in the node-red editor. Must be set to `false` to disable */
ui: true,
},
/** Configure runtimeState options
* - enabled: When `enabled` is `true` flows runtime can be Started/Stoped
* by POSTing to available at http://localhost:1880/flows/state
* - ui: When `ui` is `true`, the action `core:start-flows` and
/** Configure runtimeState options
* - enabled: When `enabled` is `true` flows runtime can be Started/Stopped
* by POSTing to available at http://localhost:1880/flows/state
* - ui: When `ui` is `true`, the action `core:start-flows` and
* `core:stop-flows` will be available to logged in users of node-red editor
* Also, the deploy menu (when set to default) will show a stop or start button
*/
@@ -519,7 +519,7 @@ module.exports = {
*/
//tlsConfigDisableLocalFiles: true,
/** The following property can be used to verify websocket connection attempts.
/** The following property can be used to verify WebSocket connection attempts.
* This allows, for example, the HTTP request headers to be checked to ensure
* they include valid authentication information.
*/