mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Merge branch 'dev' into pr_2971
This commit is contained in:
@@ -272,7 +272,7 @@ var api = module.exports = {
|
||||
} catch(error) {
|
||||
runtime.log.audit({event: "nodes.remove",module:opts.module,error:error.code||"unexpected_error",message:error.toString()}, opts.req);
|
||||
error.status = 400;
|
||||
throw err;
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -319,7 +319,7 @@ var api = module.exports = {
|
||||
} catch(error) {
|
||||
runtime.log.audit({event: "nodes.module.set",module:mod,enabled:opts.enabled,error:error.code||"unexpected_error",message:error.toString()}, opts.req);
|
||||
error.status = 400;
|
||||
throw err;
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -366,7 +366,7 @@ var api = module.exports = {
|
||||
} catch(error) {
|
||||
runtime.log.audit({event: "nodes.info.set",id:id,enabled:enabled,error:error.code||"unexpected_error",message:error.toString()}, opts.req);
|
||||
error.status = 400;
|
||||
throw err;
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
|
||||
|
@@ -58,7 +58,7 @@ var api = module.exports = {
|
||||
* @memberof @node-red/runtime_plugins
|
||||
*/
|
||||
getPluginConfigs: async function(opts) {
|
||||
if (/[^a-z\-]/i.test(opts.lang)) {
|
||||
if (/[^0-9a-z=\-\*]/i.test(opts.lang)) {
|
||||
throw new Error("Invalid language: "+opts.lang)
|
||||
return;
|
||||
}
|
||||
|
@@ -95,6 +95,9 @@ function createNode(flow,config) {
|
||||
} else if (nodeTypeConstructor) {
|
||||
// console.log(nodeTypeConstructor)
|
||||
var subflowConfig = parseConfig([nodeTypeConstructor.subflow].concat(nodeTypeConstructor.subflow.flow));
|
||||
var subflowInstanceConfig = subflowConfig.subflows[nodeTypeConstructor.subflow.id];
|
||||
delete subflowConfig.subflows[nodeTypeConstructor.subflow.id];
|
||||
subflowInstanceConfig.subflows = subflowConfig.subflows;
|
||||
var instanceConfig = clone(config);
|
||||
instanceConfig.env = clone(nodeTypeConstructor.subflow.env);
|
||||
|
||||
@@ -124,7 +127,7 @@ function createNode(flow,config) {
|
||||
nodeTypeConstructor.type,
|
||||
flow,
|
||||
flow.global,
|
||||
subflowConfig.subflows[nodeTypeConstructor.subflow.id],
|
||||
subflowInstanceConfig,
|
||||
instanceConfig
|
||||
);
|
||||
subflow.start();
|
||||
|
@@ -63,6 +63,27 @@ var server;
|
||||
*/
|
||||
function init(userSettings,httpServer,_adminApi) {
|
||||
server = httpServer;
|
||||
|
||||
if (server && server.on) {
|
||||
// Add a listener to the upgrade event so that we can properly timeout connection
|
||||
// attempts that do not get handled by any nodes in the user's flow.
|
||||
// See #2956
|
||||
server.on('upgrade',(request, socket, head) => {
|
||||
// Add a no-op handler to the error event in case nothing upgrades this socket
|
||||
// before the remote end closes it. This ensures we don't get as uncaughtException
|
||||
socket.on("error", err => {})
|
||||
setTimeout(function() {
|
||||
// If this request has been handled elsewhere, the upgrade will have
|
||||
// been completed and bytes written back to the client.
|
||||
// If nothing has been written on the socket, nothing has handled the
|
||||
// upgrade, so we can consider this an unhandled upgrade.
|
||||
if (socket.bytesWritten === 0) {
|
||||
socket.destroy();
|
||||
}
|
||||
},userSettings.inboundWebSocketTimeout || 5000)
|
||||
});
|
||||
}
|
||||
|
||||
userSettings.version = getVersion();
|
||||
settings.init(userSettings);
|
||||
|
||||
@@ -199,7 +220,7 @@ var reinstallTimeout;
|
||||
function reinstallModules(moduleList) {
|
||||
const promises = [];
|
||||
const reinstallList = [];
|
||||
const installRetry = 30000;
|
||||
var installRetry = 30000;
|
||||
if (settings.hasOwnProperty('autoInstallModulesRetry')) {
|
||||
log.warn(log._("server.deprecatedOption",{old:"autoInstallModulesRetry", new:"externalModules.autoInstallRetry"}));
|
||||
installRetry = settings.autoInstallModulesRetry;
|
||||
|
@@ -338,12 +338,14 @@ Node.prototype.close = function(removed) {
|
||||
}
|
||||
}
|
||||
if (promises.length > 0) {
|
||||
return Promise.all(promises).then(function() {
|
||||
return Promise.all(promises).then(() => {
|
||||
this.removeAllListeners("input")
|
||||
if (this._context) {
|
||||
return context.delete(this._alias||this.id,this.z);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.removeAllListeners("input")
|
||||
if (this._context) {
|
||||
return context.delete(this._alias||this.id,this.z);
|
||||
}
|
||||
|
@@ -343,7 +343,11 @@ var api = module.exports = {
|
||||
if (newCreds) {
|
||||
delete node.credentials;
|
||||
var savedCredentials = credentialCache[nodeID] || {};
|
||||
if (/^subflow(:|$)/.test(nodeType)) {
|
||||
// Need to check the type of constructor for this node.
|
||||
// - Function : regular node
|
||||
// - !Function: subflow module
|
||||
|
||||
if (/^subflow(:|$)/.test(nodeType) || typeof runtime.nodes.getType(nodeType) !== 'function') {
|
||||
for (cred in newCreds) {
|
||||
if (newCreds.hasOwnProperty(cred)) {
|
||||
if (newCreds[cred] === "__PWRD__") {
|
||||
|
@@ -612,8 +612,15 @@ async function saveFlows(flows, user) {
|
||||
var workflowMode = (gitSettings.workflow||{}).mode || settings.editorTheme.projects.workflow.mode;
|
||||
if (workflowMode === 'auto') {
|
||||
return activeProject.stageFile([flowsFullPath, credentialsFile]).then(() => {
|
||||
return activeProject.commit(user,{message:"Update flow files"})
|
||||
})
|
||||
return activeProject.status(user, false).then((result) => {
|
||||
const items = Object.values(result.files || {});
|
||||
// check if saved flow make modification to repository
|
||||
if (items.findIndex((item) => (item.status === "M ")) < 0) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
return activeProject.commit(user,{message:"Update flow files"})
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user