@flowfuse/nr-launcher
Advanced tools
Comparing version 2.7.1-eb9c703-202408140935.0 to 2.8.0
@@ -0,1 +1,8 @@ | ||
#### 2.8.0: Release | ||
- Update Project Nodes and File nodes (#279) @hardillb | ||
- First pass at file api (#275) @hardillb | ||
- Fix HealthCheck errors when editor disabled (#277) @hardillb | ||
- Fix flushInterval in context module (#272) @knolleary | ||
#### 2.7.0: Release | ||
@@ -2,0 +9,0 @@ |
@@ -14,2 +14,3 @@ #!/usr/bin/env node | ||
const { AdminInterface } = require('./lib/admin') | ||
const { filesInterface } = require('./lib/files') | ||
@@ -115,2 +116,3 @@ const cmdLineOptions = [ | ||
filesInterface(adminInterface.app, launcher.settings) | ||
// const wss = new ws.Server({ clientTracking: false, noServer: true }) | ||
@@ -117,0 +119,0 @@ // |
@@ -16,2 +16,3 @@ const http = require('http') | ||
const app = express() | ||
this.app = app | ||
this.server = http.createServer(app) | ||
@@ -18,0 +19,0 @@ |
@@ -134,2 +134,4 @@ const fs = require('fs') | ||
this.settings.storageDir = path.normalize(path.join(this.settings.rootDir, this.settings.userDir, 'storage')) | ||
// setup nodeDir to include the path to additional nodes and plugins | ||
@@ -371,3 +373,3 @@ const nodesDir = [] | ||
stdio: ['ignore', 'pipe', 'pipe'], | ||
cwd: path.join(this.settings.rootDir, this.settings.userDir, 'storage') | ||
cwd: this.settings.storageDir | ||
} | ||
@@ -429,2 +431,5 @@ | ||
} | ||
if (this.settings.settings.disableEditor) { | ||
opts.throwHttpErrors = false | ||
} | ||
// Use a HEAD request to minimise data transfer | ||
@@ -431,0 +436,0 @@ const res = await got.head(pollUrl, opts) |
@@ -9,5 +9,4 @@ const got = require('got') | ||
} | ||
})(); | ||
})() | ||
let lastCPUTime = 0 | ||
@@ -18,3 +17,3 @@ | ||
try { | ||
const res = await got.get(url, { | ||
const res = await got.get(url, { | ||
headers: { | ||
@@ -38,8 +37,8 @@ pragma: 'no-cache', | ||
} else if (metric.name === 'process_resident_memory_bytes') { | ||
response.ps = parseInt(metric.metrics[0].value)/(1024*1024) | ||
response.ps = parseInt(metric.metrics[0].value) / (1024 * 1024) | ||
} else if (metric.name === 'process_cpu_seconds_total') { | ||
cpuTime = parseFloat(metric.metrics[0].value) | ||
if (lastCPUTime != 0) { | ||
const cpuTime = parseFloat(metric.metrics[0].value) | ||
if (lastCPUTime !== 0) { | ||
const delta = cpuTime - lastCPUTime | ||
response.cpu = (delta/time) * 100 | ||
response.cpu = (delta / time) * 100 | ||
} | ||
@@ -60,2 +59,2 @@ lastCPUTime = cpuTime | ||
module.exports = sampleResources | ||
module.exports = sampleResources |
@@ -1,5 +0,1 @@ | ||
const os = require('node:os') | ||
const crypto = require('crypto') | ||
const instanceId = crypto.createHash('md5').update(os.hostname()).digest('hex').substring(0, 4) | ||
class SampleBuffer { | ||
@@ -20,3 +16,3 @@ constructor (size = 1000) { | ||
this.buffer[this.head++] = sample | ||
if (this.head == this.size) { | ||
if (this.head === this.size) { | ||
this.head = 0 | ||
@@ -37,5 +33,5 @@ this.wrapped = true | ||
return this.buffer.slice(0, this.head) | ||
} else { | ||
} else { | ||
const result = this.buffer.slice(this.head, this.size) | ||
result.push(...this.buffer.slice(0,this.head)) | ||
result.push(...this.buffer.slice(0, this.head)) | ||
return result | ||
@@ -61,3 +57,3 @@ } | ||
avgLastX (x) { | ||
const samples = this.lastX(x) | ||
const samples = this.lastX(x) | ||
const result = {} | ||
@@ -74,3 +70,3 @@ let skipped = 0 | ||
} | ||
} | ||
} | ||
} | ||
@@ -82,3 +78,3 @@ } else { | ||
for (const [key, value] of Object.entries(result)) { | ||
result[key] = value/(samples.length-skipped) | ||
result[key] = value / (samples.length - skipped) | ||
} | ||
@@ -90,2 +86,2 @@ result.count = samples.length | ||
module.exports = SampleBuffer | ||
module.exports = SampleBuffer |
@@ -162,6 +162,22 @@ const path = require('path') | ||
if (settings.rootDir) { | ||
const uibRoot = path.join(settings.rootDir, settings.userDir, 'storage', 'uibuilder').split(path.sep).join(path.posix.sep) | ||
const uibRoot = path.join(settings.storageDir, 'uibuilder').split(path.sep).join(path.posix.sep) | ||
projectSettings.uibuilder = { uibRoot } | ||
} | ||
if (settings.settings?.httpStatic) { | ||
// This is an array of httpStatic properties - however their path setting | ||
// will currently be relative to cwd. For safety, map them to absolute paths | ||
// and validate they are not traversing out of the storageDir | ||
const httpStatic = [] | ||
settings.settings.httpStatic.forEach(staticSetting => { | ||
staticSetting.path = path.normalize(path.join(settings.storageDir, staticSetting.path)) | ||
if (staticSetting.path.startsWith(settings.storageDir)) { | ||
httpStatic.push(staticSetting) | ||
} | ||
}) | ||
if (httpStatic.length > 0) { | ||
projectSettings.httpStatic = httpStatic | ||
} | ||
} | ||
let contextStorage = '' | ||
@@ -362,3 +378,4 @@ if (settings.fileStore?.url) { | ||
httpAdminCookieOptions: ${JSON.stringify(httpAdminCookieOptions)}, | ||
${projectSettings.uibuilder ? 'uibuilder: ' + JSON.stringify(projectSettings.uibuilder) : ''} | ||
${projectSettings.uibuilder ? 'uibuilder: ' + JSON.stringify(projectSettings.uibuilder) + ',' : ''} | ||
${projectSettings.httpStatic ? 'httpStatic: ' + JSON.stringify(projectSettings.httpStatic) : ''} | ||
} | ||
@@ -365,0 +382,0 @@ ` |
149
package.json
{ | ||
"name": "@flowfuse/nr-launcher", | ||
"version": "2.7.1-eb9c703-202408140935.0", | ||
"description": "FlowFuse Launcher for running Node-RED", | ||
"exports": { | ||
"./auditLogger": "./lib/auditLogger/index.js", | ||
"./adminAuth": "./lib/auth/adminAuth.js", | ||
"./authMiddleware": "./lib/auth/httpAuthMiddleware.js", | ||
"./storage": "./lib/storage/index.js", | ||
"./context": "./lib/context/index.js" | ||
}, | ||
"node-red": { | ||
"plugins": { | ||
"flowfuse-auth": "lib/auth/httpAuthPlugin.js", | ||
"flowfuse-library": "lib/storage/libraryPlugin.js", | ||
"forge-light": "lib/theme/forge-light/forge-light.js", | ||
"forge-dark": "lib/theme/forge-dark/forge-dark.js", | ||
"forge-resources": "lib/resources/resourcePlugin.js" | ||
"name": "@flowfuse/nr-launcher", | ||
"version": "2.8.0", | ||
"description": "FlowFuse Launcher for running Node-RED", | ||
"exports": { | ||
"./auditLogger": "./lib/auditLogger/index.js", | ||
"./adminAuth": "./lib/auth/adminAuth.js", | ||
"./authMiddleware": "./lib/auth/httpAuthMiddleware.js", | ||
"./storage": "./lib/storage/index.js", | ||
"./context": "./lib/context/index.js" | ||
}, | ||
"node-red": { | ||
"plugins": { | ||
"flowfuse-auth": "lib/auth/httpAuthPlugin.js", | ||
"flowfuse-library": "lib/storage/libraryPlugin.js", | ||
"forge-light": "lib/theme/forge-light/forge-light.js", | ||
"forge-dark": "lib/theme/forge-dark/forge-dark.js", | ||
"forge-resources": "lib/resources/resourcePlugin.js" | ||
} | ||
}, | ||
"scripts": { | ||
"test": "mocha 'test/unit/**/*_spec.js'", | ||
"lint": "eslint -c .eslintrc *.js lib/**/*.js test/**/*.js", | ||
"lint:fix": "eslint -c .eslintrc *.js lib/*.js test/**/*.js --fix", | ||
"build-theme": "node lib/theme/scripts/build.js " | ||
}, | ||
"keywords": [ | ||
"FlowFuse" | ||
], | ||
"bin": { | ||
"flowforge-node-red": "./index.js", | ||
"flowfuse-node-red": "./index.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/FlowFuse/nr-launcher.git" | ||
}, | ||
"author": { | ||
"name": "FlowFuse Inc." | ||
}, | ||
"license": "Apache-2.0", | ||
"bugs": { | ||
"url": "https://github.com/FlowFuse/nr-launcher/issues" | ||
}, | ||
"homepage": "https://github.com/FlowFuse/nr-launcher#readme", | ||
"dependencies": { | ||
"@flowfuse/nr-assistant": "^0.1.3", | ||
"@flowfuse/nr-file-nodes": "^0.0.7", | ||
"@flowfuse/nr-project-nodes": "^0.7.2", | ||
"@node-red/util": "^3.1.0", | ||
"body-parser": "^1.20.2", | ||
"command-line-args": "^5.2.1", | ||
"express": "^4.18.2", | ||
"express-session": "^1.18.0", | ||
"got": "^11.8.6", | ||
"json-stringify-safe": "5.0.1", | ||
"memorystore": "^1.6.7", | ||
"multer": "^1.4.5-lts.1", | ||
"oauth": "^0.9.15", | ||
"parse-prometheus-text-format": "^1.1.1", | ||
"passport": "0.6.0", | ||
"passport-oauth2": "^1.6.1", | ||
"prom-client": "^15.0.0", | ||
"ws": "^8.7.0" | ||
}, | ||
"devDependencies": { | ||
"@flowforge/file-server": "git://github.com/FlowFuse/file-server.git", | ||
"eslint": "^8.49.0", | ||
"eslint-config-standard": "^17.1.0", | ||
"eslint-plugin-no-only-tests": "^3.1.0", | ||
"mocha": "^10.2.0", | ||
"sass": "1.66.1", | ||
"should": "^13.2.3", | ||
"sinon": "^17.0.1", | ||
"sqlite3": "^5.1.6", | ||
"yaml": "^2.1.3" | ||
} | ||
}, | ||
"scripts": { | ||
"test": "mocha 'test/unit/**/*_spec.js'", | ||
"lint": "eslint -c .eslintrc *.js lib/*.js test/**/*.js", | ||
"lint:fix": "eslint -c .eslintrc *.js lib/*.js test/**/*.js --fix", | ||
"build-theme": "node lib/theme/scripts/build.js " | ||
}, | ||
"keywords": [ | ||
"FlowFuse" | ||
], | ||
"bin": { | ||
"flowforge-node-red": "./index.js", | ||
"flowfuse-node-red": "./index.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/FlowFuse/nr-launcher.git" | ||
}, | ||
"author": { | ||
"name": "FlowFuse Inc." | ||
}, | ||
"license": "Apache-2.0", | ||
"bugs": { | ||
"url": "https://github.com/FlowFuse/nr-launcher/issues" | ||
}, | ||
"homepage": "https://github.com/FlowFuse/nr-launcher#readme", | ||
"dependencies": { | ||
"@flowfuse/nr-assistant": "nightly", | ||
"@flowfuse/nr-file-nodes": "nightly", | ||
"@flowfuse/nr-project-nodes": "nightly", | ||
"@node-red/util": "^3.1.0", | ||
"body-parser": "^1.20.2", | ||
"command-line-args": "^5.2.1", | ||
"express": "^4.18.2", | ||
"express-session": "^1.18.0", | ||
"got": "^11.8.6", | ||
"json-stringify-safe": "5.0.1", | ||
"memorystore": "^1.6.7", | ||
"oauth": "^0.9.15", | ||
"parse-prometheus-text-format": "^1.1.1", | ||
"passport": "0.6.0", | ||
"passport-oauth2": "^1.6.1", | ||
"prom-client": "^15.0.0", | ||
"ws": "^8.7.0" | ||
}, | ||
"devDependencies": { | ||
"@flowforge/file-server": "git://github.com/FlowFuse/file-server.git", | ||
"eslint": "^8.49.0", | ||
"eslint-config-standard": "^17.1.0", | ||
"eslint-plugin-no-only-tests": "^3.1.0", | ||
"mocha": "^10.2.0", | ||
"sass": "1.66.1", | ||
"should": "^13.2.3", | ||
"sinon": "^17.0.1", | ||
"sqlite3": "^5.1.6", | ||
"yaml": "^2.1.3" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
566277
41
3530
0
18
40
+ Addedmulter@^1.4.5-lts.1
+ Added@flowfuse/nr-assistant@0.1.3(transitive)
+ Added@flowfuse/nr-file-nodes@0.0.7(transitive)
+ Added@flowfuse/nr-project-nodes@0.7.4(transitive)
+ Addedappend-field@1.0.0(transitive)
+ Addedbusboy@1.6.0(transitive)
+ Addedconcat-stream@1.6.2(transitive)
+ Addedcore-util-is@1.0.3(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addedmulter@1.4.5-lts.1(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedreadable-stream@2.3.8(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedstreamsearch@1.1.0(transitive)
+ Addedstring_decoder@1.1.1(transitive)
- Removed@flowfuse/nr-assistant@0.1.4-51c0518-202412161051.0(transitive)
- Removed@flowfuse/nr-file-nodes@0.0.9-1e6a163-202412191018.0(transitive)
- Removed@flowfuse/nr-project-nodes@0.7.5-1fb7208-202412091856.0(transitive)
- Removedstring_decoder@1.3.0(transitive)