Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Dashboard v2 max upload size #310

Merged
merged 3 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/runtimeSettings.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const path = require('path')
const bytes = require('bytes')
function getSettingsFile (settings) {
const projectSettings = {
credentialSecret: '',
Expand Down Expand Up @@ -71,6 +72,13 @@ function getSettingsFile (settings) {
} else if (!authMiddlewareRequired && settings.settings.dashboardIFrame) {
dashboardSettings.push('middleware: [ DashboardIFrameMiddleware ]')
}
if (settings.settings.apiMaxLength) {
try {
dashboardSettings.push(`maxHttpBufferSize: ${bytes(settings.settings.apiMaxLength)}`)
} catch (err) {
// failed to parse
}
}
projectSettings.dashboardUI = `ui: { ${dashboardSettings.join(', ')}},`
}
if (settings.settings.disableEditor !== undefined) {
Expand Down
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"@flowfuse/nr-project-nodes": "^0.7.4",
"@node-red/util": "^3.1.0",
"body-parser": "^1.20.2",
"bytes": "^3.1.2",
"command-line-args": "^5.2.1",
"express": "^4.21.0",
"express-session": "^1.18.0",
Expand Down
2 changes: 1 addition & 1 deletion test/unit/lib/runtimeSettings_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ describe('Runtime Settings', function () {
const settings = await loadSettings(result)
settings.should.have.property('credentialSecret', 'foo')
settings.should.have.property('httpAdminRoot', '/red')
settings.should.have.property('ui', { path: '/dash' })
settings.should.have.property('ui', { path: '/dash', maxHttpBufferSize: 123 })
settings.should.have.property('disableEditor', true)
settings.should.have.property('apiMaxLength', '123')
settings.should.have.property('debugMaxLength', 456)
Expand Down
Loading