Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@flowfuse/nr-launcher

Package Overview
Dependencies
Maintainers
0
Versions
214
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flowfuse/nr-launcher - npm Package Compare versions

Comparing version 2.11.1-31ab49b-202412121112.0 to 2.11.1-4bacf40-202412181407.0

24

lib/admin.js

@@ -56,5 +56,18 @@ const http = require('http')

} else if (request.body.cmd === 'restart') {
await launcher.stop()
setTimeout(async () => {
// Update the settings
if (launcher.state === States.RUNNING ||
launcher.state === States.CRASHED ||
launcher.state === States.SAFE
) {
await launcher.stop()
setTimeout(async () => {
// Update the settings
try {
await launcher.loadSettings()
await launcher.start(request.body.safe ? States.SAFE : States.RUNNING)
} catch (error) {
await launcher.logAuditEvent('start-failed', { error })
}
response.send({})
}, 2000)
} else if (launcher.state === States.STOPPED) {
try {

@@ -67,3 +80,6 @@ await launcher.loadSettings()

response.send({})
}, 2000)
} else {
// Might need a different response
response.send({})
}
} else if (request.body.cmd === 'start') {

@@ -70,0 +86,0 @@ if (launcher.getState() === States.RUNNING) {

24

lib/launcher.js

@@ -9,2 +9,3 @@ const fs = require('fs')

const resourceSample = require('./resources/sample')
const hasProperty = (object, property) => !!(object && Object.prototype.hasOwnProperty.call(object, property))

@@ -90,2 +91,4 @@ /** The point at which we check to see if we are in a boot loop */

this.memoryAuditLogged = 0
this.disableAutoSafeMode = false
}

@@ -106,3 +109,3 @@

try {
newSettings = await got(settingsURL, {
newSettings = await got.get(settingsURL, {
headers: {

@@ -155,3 +158,8 @@ authorization: `Bearer ${this.options.token}`

this.settings.nodesDir = nodesDir
if (hasProperty(this.settings, 'disableAutoSafeMode') && typeof this.settings.disableAutoSafeMode === 'boolean') {
this.disableAutoSafeMode = this.settings.disableAutoSafeMode
}
if (this.disableAutoSafeMode === true) {
this.logBuffer.add({ level: 'system', msg: 'Auto Safe Mode is disabled.' })
}
const settingsFileContent = getSettingsFile(this.settings)

@@ -471,4 +479,4 @@ const settingsPath = path.join(this.settings.rootDir, this.settings.userDir, 'settings.js')

// if start count == MAX_RESTART_COUNT, then check for boot loop
if (this.startTimes.length === MAX_RESTART_COUNT) {
// if auto-safe-mode is not disabled && start count == MAX_RESTART_COUNT, then check for boot loop
if (this.disableAutoSafeMode !== true && this.startTimes.length === MAX_RESTART_COUNT) {
// calculate the average runtime

@@ -603,3 +611,9 @@ const avg = this.runDurations.reduce((a, b) => a + b, 0) / this.runDurations.length

this.state = States.CRASHED
await this.logAuditEvent('crashed')
// get last 20 lines of log
// NOTE: the log is added to the body in a specific property that should not actually
// be logged but rather extrated and examined to provide better reporting
// NOTE: 20 is typically enough to see the likes of Out Of Memory errors entries
const __launcherLog = this.getLog()?.toArray()?.slice(-20) || []
const body = { __launcherLog, info: { code, signal, info: 'Node-RED exited with non zero exit code' } }
await this.logAuditEvent('crashed', body)

@@ -606,0 +620,0 @@ // Only restart if our target state is not stopped

{
"name": "@flowfuse/nr-launcher",
"version": "2.11.1-31ab49b-202412121112.0",
"version": "2.11.1-4bacf40-202412181407.0",
"description": "FlowFuse Launcher for running Node-RED",

@@ -47,3 +47,3 @@ "exports": {

"dependencies": {
"@flowfuse/nr-assistant": "0.1.4-28c205c-202410210622.0",
"@flowfuse/nr-assistant": "0.1.4-51c0518-202412161051.0",
"@flowfuse/nr-file-nodes": "0.0.8-76589f2-202412091856.0",

@@ -50,0 +50,0 @@ "@flowfuse/nr-project-nodes": "0.7.5-1fb7208-202412091856.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc