Merge branch 'dev' into pr_2949

This commit is contained in:
Nick O'Leary 2021-04-27 10:45:33 +01:00
commit 06090d8de1
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
9 changed files with 24 additions and 20 deletions

View File

@ -13,6 +13,7 @@ matrix:
- node_js: "12" - node_js: "12"
script: script:
- ./node_modules/.bin/grunt no-coverage - ./node_modules/.bin/grunt no-coverage
allow_failures:
- node_js: "16" - node_js: "16"
script: script:
- ./node_modules/.bin/grunt no-coverage - ./node_modules/.bin/grunt no-coverage

View File

@ -37,7 +37,7 @@
"cookie": "0.4.1", "cookie": "0.4.1",
"cookie-parser": "1.4.5", "cookie-parser": "1.4.5",
"cors": "2.8.5", "cors": "2.8.5",
"cron": "1.7.2", "cronosjs": "1.7.1",
"denque": "1.5.0", "denque": "1.5.0",
"express": "4.17.1", "express": "4.17.1",
"express-session": "1.17.1", "express-session": "1.17.1",

View File

@ -16,7 +16,7 @@
module.exports = function(RED) { module.exports = function(RED) {
"use strict"; "use strict";
var cron = require("cron"); const {scheduleTask} = require("cronosjs");
function InjectNode(n) { function InjectNode(n) {
RED.nodes.createNode(this,n); RED.nodes.createNode(this,n);
@ -85,7 +85,7 @@ module.exports = function(RED) {
if (RED.settings.verbose) { if (RED.settings.verbose) {
this.log(RED._("inject.crontab", this)); this.log(RED._("inject.crontab", this));
} }
this.cronjob = new cron.CronJob(this.crontab, function() { node.emit("input", {}); }, null, true); this.cronjob = scheduleTask(this.crontab,() => { node.emit("input", {})});
} }
}; };

View File

@ -22,7 +22,7 @@
"cookie-parser": "1.4.5", "cookie-parser": "1.4.5",
"cookie": "0.4.1", "cookie": "0.4.1",
"cors": "2.8.5", "cors": "2.8.5",
"cron": "1.7.2", "cronosjs": "1.7.1",
"denque": "1.5.0", "denque": "1.5.0",
"fs-extra": "9.1.0", "fs-extra": "9.1.0",
"fs.notify": "0.0.4", "fs.notify": "0.0.4",

View File

@ -181,6 +181,9 @@ function start() {
if (settings.settingsFile) { if (settings.settingsFile) {
log.info(log._("runtime.paths.settings",{path:settings.settingsFile})); log.info(log._("runtime.paths.settings",{path:settings.settingsFile}));
} }
if (settings.httpRoot !== undefined) {
log.warn(log._("server.deprecatedOption",{old:"httpRoot", new: "httpNodeRoot/httpAdminRoot"}));
}
if (settings.httpStatic) { if (settings.httpStatic) {
log.info(log._("runtime.paths.httpStatic",{path:path.resolve(settings.httpStatic)})); log.info(log._("runtime.paths.httpStatic",{path:path.resolve(settings.httpStatic)}));
} }

View File

@ -38,6 +38,8 @@ var activeProject;
var globalGitUser = false; var globalGitUser = false;
var usingHostName = false;
function init(_settings, _runtime) { function init(_settings, _runtime) {
settings = _settings; settings = _settings;
runtime = _runtime; runtime = _runtime;
@ -77,6 +79,7 @@ function init(_settings, _runtime) {
} else { } else {
flowsFile = 'flows_'+require('os').hostname()+'.json'; flowsFile = 'flows_'+require('os').hostname()+'.json';
flowsFullPath = fspath.join(settings.userDir,flowsFile); flowsFullPath = fspath.join(settings.userDir,flowsFile);
usingHostName = true;
} }
var ffExt = fspath.extname(flowsFullPath); var ffExt = fspath.extname(flowsFullPath);
var ffBase = fspath.basename(flowsFullPath,ffExt); var ffBase = fspath.basename(flowsFullPath,ffExt);
@ -526,7 +529,7 @@ async function getFlows() {
if (projectsEnabled) { if (projectsEnabled) {
log.info(log._("storage.localfilesystem.projects.projects-directory", {projectsDirectory: projectsDir})); log.info(log._("storage.localfilesystem.projects.projects-directory", {projectsDirectory: projectsDir}));
} }
if (activeProject) { if (activeProject) {
// At this point activeProject will be a string, so go load it and // At this point activeProject will be a string, so go load it and
// swap in an instance of Project // swap in an instance of Project
@ -541,6 +544,7 @@ async function getFlows() {
} else { } else {
projectLogMessages.forEach(log.warn); projectLogMessages.forEach(log.warn);
} }
if (usingHostName) { log.warn(log._("storage.localfilesystem.warn_name")) };
log.info(log._("storage.localfilesystem.flows-file",{path:flowsFullPath})); log.info(log._("storage.localfilesystem.flows-file",{path:flowsFullPath}));
} }
} }

View File

@ -42,7 +42,7 @@
"uninstall-failed-long": "Uninstall of module __name__ failed:", "uninstall-failed-long": "Uninstall of module __name__ failed:",
"uninstalled": "Uninstalled module: __name__" "uninstalled": "Uninstalled module: __name__"
}, },
"deprecatedOption": "Use of __old__ is deprecated. Use __new__ instead", "deprecatedOption": "Use of __old__ is DEPRECATED. Use __new__ instead",
"unable-to-listen": "Unable to listen on __listenpath__", "unable-to-listen": "Unable to listen on __listenpath__",
"port-in-use": "Error: port in use", "port-in-use": "Error: port in use",
"uncaught-exception": "Uncaught Exception:", "uncaught-exception": "Uncaught Exception:",
@ -50,7 +50,7 @@
"now-running": "Server now running at __listenpath__", "now-running": "Server now running at __listenpath__",
"failed-to-start": "Failed to start server:", "failed-to-start": "Failed to start server:",
"headless-mode": "Running in headless mode", "headless-mode": "Running in headless mode",
"httpadminauth-deprecated": "use of httpAdminAuth is deprecated. Use adminAuth instead", "httpadminauth-deprecated": "Use of httpAdminAuth is DEPRECATED. Use adminAuth instead",
"https": { "https": {
"refresh-interval": "Refreshing https settings every __interval__ hours", "refresh-interval": "Refreshing https settings every __interval__ hours",
"settings-refreshed": "Server https settings have been refreshed", "settings-refreshed": "Server https settings have been refreshed",
@ -159,6 +159,7 @@
"restore": "Restoring __type__ file backup : __path__", "restore": "Restoring __type__ file backup : __path__",
"restore-fail": "Restoring __type__ file backup failed : __message__", "restore-fail": "Restoring __type__ file backup failed : __message__",
"fsync-fail": "Flushing file __path__ to disk failed : __message__", "fsync-fail": "Flushing file __path__ to disk failed : __message__",
"warn_name": "Flows file name not set. Generating name using hostname.",
"projects": { "projects": {
"changing-project": "Setting active project : __project__", "changing-project": "Setting active project : __project__",
"active-project": "Active project : __project__", "active-project": "Active project : __project__",

View File

@ -263,7 +263,6 @@ httpsPromise.then(function(startupHttps) {
settings.httpAdminRoot = false; settings.httpAdminRoot = false;
settings.httpNodeRoot = false; settings.httpNodeRoot = false;
} else { } else {
settings.httpRoot = settings.httpRoot||"/";
settings.disableEditor = settings.disableEditor||false; settings.disableEditor = settings.disableEditor||false;
} }

View File

@ -12,6 +12,13 @@
**/ **/
module.exports = { module.exports = {
// The file containing the flows. If not set, it defaults to flows_<hostname>.json
flowFile: 'flows.json',
// To enabled pretty-printing of the flow within the flow file, set the following
// property to true:
//flowFilePretty: true,
// the tcp port that the Node-RED web server is listening on // the tcp port that the Node-RED web server is listening on
uiPort: process.env.PORT || 1880, uiPort: process.env.PORT || 1880,
@ -61,13 +68,6 @@ module.exports = {
// Colourise the console output of the debug node // Colourise the console output of the debug node
//debugUseColors: true, //debugUseColors: true,
// The file containing the flows. If not set, it defaults to flows_<hostname>.json
//flowFile: 'flows.json',
// To enabled pretty-printing of the flow within the flow file, set the following
// property to true:
//flowFilePretty: true,
// By default, credentials are encrypted in storage using a generated key. To // By default, credentials are encrypted in storage using a generated key. To
// specify your own secret, set the following property. // specify your own secret, set the following property.
// If you want to disable encryption of credentials, set this property to false. // If you want to disable encryption of credentials, set this property to false.
@ -96,10 +96,6 @@ module.exports = {
// disabled. // disabled.
//httpNodeRoot: '/red-nodes', //httpNodeRoot: '/red-nodes',
// The following property can be used in place of 'httpAdminRoot' and 'httpNodeRoot',
// to apply the same root to both parts.
//httpRoot: '/red',
// When httpAdminRoot is used to move the UI to a different root path, the // 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 // following property can be used to identify a directory of static content
// that should be served at http://localhost:1880/. // that should be served at http://localhost:1880/.
@ -110,7 +106,7 @@ module.exports = {
//apiMaxLength: '5mb', //apiMaxLength: '5mb',
// If you installed the optional node-red-dashboard you can set it's path // If you installed the optional node-red-dashboard you can set it's path
// relative to httpRoot // relative to httpNodeRoot
// Other optional properties include // Other optional properties include
// readOnly:{boolean}, // readOnly:{boolean},
// middleware:{function or array}, (req,res,next) - http middleware // middleware:{function or array}, (req,res,next) - http middleware