Commit Graph

887 Commits

Author SHA1 Message Date
Girish Ramakrishnan
2597402496 make build work across server restart
tmp files disappear on server restart
2026-02-14 19:37:14 +01:00
Girish Ramakrishnan
e9f96593c3 reorder functions for no-use-before-define 2026-02-14 16:34:34 +01:00
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
c3d3c3a6e9 app: if repo changes, do not autoupdate 2026-02-09 15:51:47 +01:00
Girish Ramakrishnan
a9ae34b149 community: download iconUrl
also rename existing db field appStoreIcon to packageIcon
2026-02-06 19:13:55 +01:00
Girish Ramakrishnan
aa362477e8 community: validate the url in the dialog 2026-02-05 22:40:37 +01:00
Girish Ramakrishnan
d6eb6d3e3e community: store versionsUrl in the database 2026-02-05 19:32:29 +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
Girish Ramakrishnan
a1b4fdf624 csp: allow multiple lines and add presets 2026-01-13 17:39:00 +01:00
Girish Ramakrishnan
c448322367 backups: fix download 2025-12-06 11:19:05 +01:00
Girish Ramakrishnan
620974217a restore: teardown pseudo backup site 2025-12-05 16:12:59 +01:00
Girish Ramakrishnan
cc8db71ecf apps: typo caused invalid backupId 2025-11-26 14:39:16 +01:00
Girish Ramakrishnan
bbdfbe1ab7 restore: when restoring apps, use the latest backup id
this ignores the user provided site information. the site contents may or may
not contain this app.
2025-11-25 18:12:54 +01:00
Johannes Zellner
610651066a Fix tgz app backup download
Fixes #868
2025-11-05 18:14:48 +01:00
Girish Ramakrishnan
5bd6001f95 boxerror: details is not a subobject 2025-10-17 20:42:19 +02:00
Girish Ramakrishnan
54cd9c7afa Use JSON query to remove the app id from site
the original regexp does not work for leading comma like [ "box", "appid" ]
2025-09-30 19:43:08 +02:00
Girish Ramakrishnan
edcffd3417 Remove app from backup sites when uninstalled 2025-09-30 18:22:22 +02:00
Girish Ramakrishnan
5dd5a20fc1 code -> sqlCode 2025-09-29 12:18:26 +02:00
Girish Ramakrishnan
19df2e0baa ER_DUP_ENTRY is passed as code and not in message 2025-09-24 10:50:25 +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
c5b7264f1a rename backupTargets to backupSites 2025-09-12 10:32:37 +02:00
Johannes Zellner
12e4441227 BoxError always needs a second argument 2025-08-21 11:20:18 +02:00
Johannes Zellner
5f9789f99f Enforce app count limit during installation 2025-08-20 20:03:09 +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
1d1197e18a restore: use PENDING_RESTORE instead of PENDING_IMPORT 2025-08-05 12:46:50 +02:00
Girish Ramakrishnan
36ab052dda restore: import with the latest backup on cloudron restore
in previous versions, the single backup target was replaced during
restore. we cannot do this anymore with multiple backup targets.

during cloudron restore, a pseudo target is created and all the apps
are restored using this backup target.
2025-08-04 23:24:06 +02:00
Girish Ramakrishnan
ead6d9c7d3 Fix app import 2025-08-02 20:42:12 +02:00
Girish Ramakrishnan
c935744f4c backups: root ~~canal~~ path surgery
remove rootPath and getBackupFilePath from the backup target and
make this backend specific.
2025-08-02 10:15:34 +02:00
Girish Ramakrishnan
a01e1bad0f backuptarget: pseudo target for import and restore 2025-08-02 00:06:47 +02:00
Girish Ramakrishnan
7192439b2c no need for format specific getBackupFilePath 2025-08-01 20:49:11 +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
a1a683ec56 import: use inPlace flag 2025-08-01 13:22:12 +02:00
Girish Ramakrishnan
cbc73f5c9a remove uuid module
built into node.js now
2025-07-28 12:54:09 +02:00
Girish Ramakrishnan
373ef5b7e1 import: make the ui work again 2025-07-28 12:12:43 +02:00
Girish Ramakrishnan
fc4da4408c backups: fix app restore with tgz 2025-07-25 13:39:09 +02:00
Girish Ramakrishnan
59aaabecc7 backups: the get route was accidentally removed 2025-07-25 11:56:31 +02:00
Girish Ramakrishnan
62017b3ff5 backup: rename back backuplisting.js to backups.js
this was a transitional rename till I figured out how to split
it in backuptargets.js
2025-07-25 01:37:19 +02:00
Girish Ramakrishnan
3aafbd2ccb backups: add backup multiple targets 2025-07-25 01:30:27 +02:00
Girish Ramakrishnan
931311f11f rename backups to backuptargets 2025-07-24 18:54:10 +02:00
Girish Ramakrishnan
5e456f378b backups: split listing and targets 2025-07-24 18:21:48 +02:00
Johannes Zellner
68a8c964ea If we have app.error we always have an app.error.details object 2025-07-23 15:40:25 +02:00
Johannes Zellner
6c1045c545 error installationState is in the error details 2025-07-23 15:31:25 +02:00
Girish Ramakrishnan
48559d3358 tasks: distinguish runtime crash vs task error in worker 2025-07-18 20:02:06 +02:00
Girish Ramakrishnan
7e0803c4b4 clean up task locks 2025-07-18 18:12:07 +02:00
Girish Ramakrishnan
0fa281083e apps: backup is not a state anymore
this is launched as a separate task
2025-07-18 14:14:54 +02:00
Girish Ramakrishnan
989d843fcb shell: make shell.sudo promise based and waitable 2025-07-16 22:04:24 +02:00
Girish Ramakrishnan
313256adff use @cloudron/manifest-format 2025-07-10 11:17:04 +02:00