From c3adc956d76f342f017d134b52a6b4deebb3467f Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Mon, 1 Mar 2021 18:24:16 +0000 Subject: [PATCH] Add functionExternalModules to settings and default to false --- .../@node-red/nodes/core/function/10-function.html | 2 +- .../@node-red/nodes/core/function/10-function.js | 2 +- packages/node_modules/node-red/settings.js | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/node_modules/@node-red/nodes/core/function/10-function.html b/packages/node_modules/@node-red/nodes/core/function/10-function.html index 86402ad1b..76bcc9556 100644 --- a/packages/node_modules/@node-red/nodes/core/function/10-function.html +++ b/packages/node_modules/@node-red/nodes/core/function/10-function.html @@ -523,7 +523,7 @@ $("#node-input-noerr").val(noerr); this.noerr = noerr; - if (RED.settings.functionExternalModules !== false) { + if (RED.settings.functionExternalModules === true) { var libs = $("#node-input-libs-container").editableList("items"); node.libs = []; libs.each(function(i) { diff --git a/packages/node_modules/@node-red/nodes/core/function/10-function.js b/packages/node_modules/@node-red/nodes/core/function/10-function.js index 1097e9d1f..debcb3515 100644 --- a/packages/node_modules/@node-red/nodes/core/function/10-function.js +++ b/packages/node_modules/@node-red/nodes/core/function/10-function.js @@ -97,7 +97,7 @@ module.exports = function(RED) { node.fin = n.finalize ? n.finalize.trim() : ""; node.libs = n.libs || []; - if (RED.settings.functionExternalModules === false && node.libs.length > 0) { + if (RED.settings.functionExternalModules !== true && node.libs.length > 0) { throw new Error("Function node not allowed to load external modules"); } diff --git a/packages/node_modules/node-red/settings.js b/packages/node_modules/node-red/settings.js index cac6a2ce7..084060deb 100644 --- a/packages/node_modules/node-red/settings.js +++ b/packages/node_modules/node-red/settings.js @@ -41,7 +41,7 @@ module.exports = { // Timeout in milliseconds for HTTP request connections // defaults to 120 seconds //httpRequestTimeout: 120000, - + // Maximum buffer size for the exec node // defaults to 10Mb //execMaxBufferSize: 10000000, @@ -243,6 +243,10 @@ module.exports = { // jfive:require("johnny-five"), // j5board:require("johnny-five").Board({repl:false}) }, + + // Allow the Function node to load additional npm modules + functionExternalModules: false, + // `global.keys()` returns a list of all properties set in global context. // This allows them to be displayed in the Context Sidebar within the editor. // In some circumstances it is not desirable to expose them to the editor. The