Commit Graph

516 Commits

Author SHA1 Message Date
Johannes Zellner 43acecfc6e mailPasswords table should work with oidc clients not apps 2026-02-18 15:17:08 +01:00
Johannes Zellner 9bac099339 Add mailPassword table
This table stores email credentials for users using apps which use the
email addon
2026-02-18 10:12: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
Johannes Zellner 5724ca73b4 Add passkey support 2026-02-13 17:18:56 +01:00
Girish Ramakrishnan 88a44ee065 oidc: add alg to the jwks keys 2026-02-12 19:42:00 +01:00
Girish Ramakrishnan e9c3e42aa6 appPassword: add expiry 2026-02-12 16:23:31 +01:00
Girish Ramakrishnan 5276321ade integrity: add integrity check fields and initial UI 2026-02-08 23:26:57 +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 d6eb6d3e3e community: store versionsUrl in the database 2026-02-05 19:32:29 +01:00
Johannes Zellner f0fb420a8d Skip checklist db migration script if no owner exists 2026-02-03 18:41:39 +01:00
Johannes Zellner d04afc26e7 Add db migration to ensure done checklist items have an owner and timestamp 2026-02-01 13:57:55 +01:00
Girish Ramakrishnan efccf2729b start moving openssl commands into openssl.js 2026-01-17 15:28:44 +01:00
Girish Ramakrishnan 2b362d8eaf users: add note about invitationToken
this is a one time token that is valid until the account is set up.
this is the reason it has no expiry time.
2026-01-17 09:44:43 +01:00
Girish Ramakrishnan 22cb7f7d8f addons is optional 2025-12-18 18:30:30 +01:00
Girish Ramakrishnan 6247cece94 backup site: create info dir of the clone site 2025-11-17 09:08:46 +01:00
Girish Ramakrishnan 417f5c3610 backup site: fix migration with mixed formats 2025-11-16 12:07:44 +01:00
Girish Ramakrishnan d894de0784 cloudflare: ensure defaultProxyStatus in older configs
in Cloudron 9, we introduced an automated domain credentials check.
when checking with older cloudflare configs, this fails.
2025-11-10 10:18:32 +01:00
Girish Ramakrishnan 2da99673cd do not store "null" as string in database
in other news, JSON.parse('null') returns null.
2025-11-04 09:02:58 +01:00
Girish Ramakrishnan 1b33b2c48c migrate old backup tasks to new type 2025-10-06 14:52:29 +02:00
Girish Ramakrishnan f44ff12a5f Fix ordering of columns 2025-10-01 12:49:09 +02:00
Girish Ramakrishnan ab0f8fc081 backupsite: remove bc- prefix from id 2025-10-01 10:27:20 +02:00
Johannes Zellner 3bfa7b1cdd Column is called enableForUpdates 2025-09-23 21:23:33 +02:00
Girish Ramakrishnan 50d37ad752 Fix consistent use of enabledForUpdates -> enableForUpdates 2025-09-23 16:43:17 +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 4686e38a5e schema: add contentsJson to backupSites 2025-09-22 17:05:01 +02:00
Girish Ramakrishnan 305441ea28 backups: remove noop backend
the noop backend is migrated into 0 sites config.

when the updater code sees that there is no site to backup, it will
just fail. user has to manually update with skipBackup flag.
2025-09-22 16:44:12 +02:00
Girish Ramakrishnan 4c3a8e1fd7 backup site: add contents
it is a json that can be one of the three:

* null - include everything
* include - only include these ids
* exclude - everything except these ids
2025-09-22 13:28:16 +02:00
Girish Ramakrishnan c5b7264f1a rename backupTargets to backupSites 2025-09-12 10:32:37 +02:00
Girish Ramakrishnan fd2705a49d schema: more missing fields 2025-08-14 20:28:34 +05:30
Girish Ramakrishnan 935c9a50ab schema: add missing fields 2025-08-14 19:58:30 +05:30
Girish Ramakrishnan f2225ff6b6 fs.rmdirSync { recursive: true } is deprecated 2025-08-14 13:43:41 +05:30
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 d3b77c3be1 rsync: delete any existing rsync cache files 2025-08-14 10:40:36 +05:30
Girish Ramakrishnan 2e16dd983f backups: stash the stats to the backups table 2025-08-12 20:21:54 +05:30
Girish Ramakrishnan 47fc9561ab backups (tgz): save integrity information
we generate a signing key pair for each target. Initially, I had this
as global. We needed a route to return the public key and putting it
under backup target seemed natural. Since we delete the backups when
we delete a target, we lose all the signing hashes. So, it's fine to lose
the key pair on target delete.
2025-08-12 19:00:29 +05:30
Girish Ramakrishnan f8d74bbb6d backuptarget: add default at provisioning time (again)
we clear the db in the tests. the tests run the setup again and again.
so, it's easier to add default values in provision time instead of
migration.
2025-08-06 11:11:11 +02:00
Girish Ramakrishnan c4ee21bdb0 Revert "provision: add default backup target after setup"
This reverts commit 1a0d1f7d79.

20171205124434-settings-default-backupConfig.js already adds the default
2025-08-05 13:41:26 +02:00
Girish Ramakrishnan 1a0d1f7d79 provision: add default backup target after setup 2025-08-04 14:33:12 +02:00
Girish Ramakrishnan 132132307f backuptarget: rename label to name 2025-08-04 14:28:37 +02:00
Girish Ramakrishnan 5c1147bfa4 backupTargets: id is not used in config 2025-08-04 09:49:06 +02:00
Girish Ramakrishnan 547d8ae113 filesystem: rename backupFolder to backupDir 2025-08-02 10:37:37 +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 ff6cbf6628 backups: encode extension into the remotePath 2025-08-01 20:42:12 +02:00
Girish Ramakrishnan 53e9925880 backups: make id, provider a backend specific setting
the backend can stash whatever values it wants in the config.
just like the DNS backends, we make verifyConfig return a sanitized config.
added benefit is that extra user fields (via API) are also not dumped into the db.
2025-08-01 18:55:04 +02:00
Girish Ramakrishnan ae3a34287a backup target: create snapshot and cache files per target
snapshot file tracks the snapshot directory. when app gets deleted,
the cleaner will remove the upstream snapshot directory when it runs.

cache files are used in rsync logic to track what was uploading into
snapshot in the previous run without needing to rescan upstream.
2025-07-30 11:44:42 +02:00
Girish Ramakrishnan cbc73f5c9a remove uuid module
built into node.js now
2025-07-28 12:54:09 +02:00
Girish Ramakrishnan 3f07bb5c3a backup targets: add test for all routes 2025-07-25 11:29:00 +02:00
Girish Ramakrishnan 94dd1eb0c2 backups: add setPrimary route 2025-07-25 09:43:26 +02:00
Girish Ramakrishnan 69cd766f88 backups: run cron schedule per target 2025-07-25 08:36:09 +02:00