Girish Ramakrishnan
36aa641cb9
migrate to "export default"
...
also, set no-use-before-define in linter
2026-02-14 15:43:24 +01:00
Girish Ramakrishnan
96dc79cfe6
Migrate codebase from CommonJS to ES Modules
...
- Convert all require()/module.exports to import/export across 260+ files
- Add "type": "module" to package.json to enable ESM by default
- Add migrations/package.json with "type": "commonjs" to keep db-migrate compatible
- Convert eslint.config.js to ESM with sourceType: "module"
- Replace __dirname/__filename with import.meta.dirname/import.meta.filename
- Replace require.main === module with process.argv[1] === import.meta.filename
- Remove 'use strict' directives (implicit in ESM)
- Convert dynamic require() in switch statements to static import lookup maps
(dns.js, domains.js, backupformats.js, backupsites.js, network.js)
- Extract self-referencing exports.CONSTANT patterns into standalone const
declarations (apps.js, services.js, locks.js, users.js, mail.js, etc.)
- Lazify SERVICES object in services.js to avoid circular dependency TDZ issues
- Add clearMailQueue() to mailer.js for ESM-safe queue clearing in tests
- Add _setMockApp() to ldapserver.js for ESM-safe test mocking
- Add _setMockResolve() wrapper to dig.js for ESM-safe DNS mocking in tests
- Convert backupupload.js to use dynamic imports so --check exits before
loading the module graph (which requires BOX_ENV)
- Update check-install to use ESM import for infra_version.js
- Convert scripts/ (hotfix, release, remote_hotfix.js, find-unused-translations)
- All 1315 tests passing
Migration stats (AI-assisted using Cursor with Claude):
- Wall clock time: ~3-4 hours
- Assistant completions: ~80-100
- Estimated token usage: ~1-2M tokens
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-02-14 15:11:45 +01:00
Girish Ramakrishnan
ae09c19b69
filemanager: open terminal in cwd
2026-02-12 20:30:57 +01:00
Girish Ramakrishnan
d6eb6d3e3e
community: store versionsUrl in the database
2026-02-05 19:32:29 +01:00
Johannes Zellner
aa84cb0079
Actually make multiplart also optional
2026-01-28 14:17:22 +01:00
Johannes Zellner
a7929e142f
Build local image for updates in apptask
2026-01-27 22:01:18 +01:00
Johannes Zellner
fd0d65b8ce
Keep the app source archive with the app instance data dir
2026-01-27 22:01:18 +01:00
Johannes Zellner
ef2a94c2c8
use local/id:version-ts as docker image tag for locally built apps
2026-01-27 22:01:18 +01:00
Johannes Zellner
b43daf2f08
Use the uploaded app source tarball to build a local docker image
2026-01-27 22:01:18 +01:00
Johannes Zellner
280f628746
Accept json body or formdata in app install route
2026-01-27 22:01:18 +01:00
Girish Ramakrishnan
0dd6446f3e
apps: add route to list sites for operators
...
the main backup listing route is only available for admins
2025-10-14 14:22:41 +02:00
Girish Ramakrishnan
5157789774
backups: add per site enabledForUpdates flag
...
previously, we had a singleton 'main' flag to indicate a site can
be used for updates. with this new approach, we can get rid of the
'primary' concept. each site can be used for updates or not.
2025-09-22 18:03:01 +02:00
Girish Ramakrishnan
12e073e8cf
use node: prefix for requires
...
mostly because code is being autogenerated by all the AI stuff using
this prefix. it's also used in the stack trace.
2025-08-14 12:55:35 +05:30
Girish Ramakrishnan
ead6d9c7d3
Fix app import
2025-08-02 20:42:12 +02:00
Girish Ramakrishnan
ea419509f1
backups: add setup/teardown
...
1. add setup, teardown hooks
2. move the managed mount setup and teardown to filesystem backend
3. remove this vague storage.js
we should convert storageApi into a real object, so we don't have to
keep passing apiConfig around
2025-08-01 15:36:25 +02:00
Girish Ramakrishnan
373ef5b7e1
import: make the ui work again
2025-07-28 12:12:43 +02:00
Girish Ramakrishnan
04de621e37
Fix crash when req.query handling
...
https://expressjs.com/en/5x/api.html#req.query
"As req.query’s shape is based on user-controlled input, all properties and values in this object
are untrusted and should be validated before trusting"
In essence, req.query.xx can be an array OR an array of strings.
2025-07-13 13:21:38 +02:00
Girish Ramakrishnan
bba48f455e
use @connect-lastmile
2025-07-10 11:00:31 +02:00
Girish Ramakrishnan
6b2e98b9be
metrics: fix up app graphs after api changes
2025-07-07 20:09:09 +02:00
Girish Ramakrishnan
4cf1739604
metrics: overlay app metrics over system metrics
2025-07-07 19:12:57 +02:00
Girish Ramakrishnan
53d85ac7a2
metrics: set objectMode to avoid lots of JSON
2025-07-04 22:42:05 +02:00
Girish Ramakrishnan
813409a8fb
graphs: directly stream docker stats
...
docker stats API caches the stat and reading it frequently gives back the same value.
this trips our "rate" code into thinking rate is 0.
one approach was to persist polling like we do now and ignore entries based on stats.read.
this works fine but the streaming approach seems better since we don't need to poll anymore.
2025-07-04 00:03:43 +02:00
Girish Ramakrishnan
a357f5a1b8
apps: add live metrics route
2025-07-01 12:23:38 +02:00
Girish Ramakrishnan
6b8b69d324
metrics: rename functions
2025-07-01 11:10:21 +02:00
Girish Ramakrishnan
2486aee24d
AppsView: updateInfo is now part of app object
2025-06-26 16:57:55 +02:00
Girish Ramakrishnan
19c9d7d59d
updateInfo: move updateInfo into apps table
...
this has many advantages:
* easy to deliver the updateInfo via the apps object
* after updating, the task can clear it
* when apps are deleted, the info is automatically gone
otherwise, it's a mess of deps between apps/updater/apptask/rest routes
box update info is still in a file
2025-06-26 15:47:15 +02:00
Girish Ramakrishnan
abd640d36b
merge updatechecker into updater
2025-06-26 14:00:30 +02:00
Girish Ramakrishnan
e0af49f638
appstore: automatic is not stableOnly
2025-06-25 18:17:29 +02:00
Girish Ramakrishnan
c44926c2cd
redis: disable by default when optional
...
this simply increases complexity of local setups since redis is
only used as a cache and not for persistent data
2025-06-14 10:40:48 +02:00
Johannes Zellner
2e4bc5e218
Start using req.resources = { app, volume, ...} pattern
...
Reason was that req.app was clashing with expressjs v5 which
stores the main expressjs app object there
2025-06-10 11:02:43 +02:00
Girish Ramakrishnan
a93c85ebc9
profile: drop gravatar support
...
gravatar is owned by an external entity (Automattic) and we have an
unnecessary dep to this service. users can just upload a profile pic
2025-06-08 18:12:40 +02:00
Girish Ramakrishnan
8779de448d
rename /graphs route to /metrics
2025-05-21 16:26:36 +02:00
Girish Ramakrishnan
892ff38a3f
graphs: make interval configurable
2025-05-20 20:46:35 +02:00
Girish Ramakrishnan
68431ae357
rename functions to avoid mistakes
...
the remove fields are not clear enough. we sent notes by mistake to
normal users. changing the name and passing role as the argument
will avoid these errors
2024-12-19 12:24:08 +01:00
Girish Ramakrishnan
449dd4730f
archive: return the id in archive route
2024-12-17 14:33:36 +01:00
Girish Ramakrishnan
41b302b0b9
apps: unarchive can call add() on it's own
...
all this because the sso flag is not allowed with optionalSso :/
2024-12-10 19:09:29 +01:00
Girish Ramakrishnan
fbe334e7d7
install/unarchive: add support for various fields
2024-12-10 18:39:16 +01:00
Girish Ramakrishnan
0e181cdc82
archive: implement unarchive
...
made a separate route instead of reusing install route. this was
because we want to copy over all the old app config as much as
possible.
2024-12-10 16:49:19 +01:00
Girish Ramakrishnan
9200e6fc63
add archives api
2024-12-09 22:39:28 +01:00
Girish Ramakrishnan
710bd270d7
apps: add archive action
2024-12-09 18:51:49 +01:00
Johannes Zellner
8493022f75
Allow apps to specify custom devices
2024-12-05 14:21:07 +01:00
Girish Ramakrishnan
7ebf5ca16a
Bring back upload route to keep e2e happy
...
let's maybe remove it in next release
2024-07-23 08:28:44 +02:00
Johannes Zellner
185c16c3e2
remove apps upload api in favor of sftp container api
2024-07-22 16:20:15 +02:00
Girish Ramakrishnan
c85c0558b9
multipart: cleanup files after reading their contents
...
one idea is just use express.raw() . however, we have to implement some
file size limit there.
one case this does not handle is aborted uploads from a box.service restart.
for this rare case, a server reboot will clean up /tmp anyway.
2024-07-19 23:11:26 +02:00
Girish Ramakrishnan
aeddaa4566
apps: rework portBindings
...
ports is REST API input . Map of env var to the host port
portBinding is the database structure. Map of env var to host port, count, type etc
also, rename portCount -> count in various places to keep things consistent
2024-07-17 00:25:47 +02:00
Girish Ramakrishnan
8f1f3cea18
doc: add import fields
2024-06-25 13:41:21 +02:00
Johannes Zellner
20396a8c7d
Adjust checklist item api to support audits trail
2024-06-24 19:09:03 +02:00
Girish Ramakrishnan
692be297b3
app proxy: protect code accessing containerId
2024-06-10 11:23:29 +02:00
Johannes Zellner
49243822af
dashboard: show app checklist
2024-04-19 14:17:54 +02:00
Girish Ramakrishnan
f11becfcc8
async'ify
...
crazy this has gone unnoticed for so long!
2024-04-10 18:52:39 +02:00