Commit Graph

352 Commits

Author SHA1 Message Date
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 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 3aafbd2ccb backups: add backup multiple targets 2025-07-25 01:30:27 +02:00
Girish Ramakrishnan 1bbdabc42f registry config: create table and migrate existing setting 2025-05-07 15:56:13 +02:00
Johannes Zellner 91d3980e3b Add cloudron background branding apis 2024-04-03 17:27:22 +02:00
Johannes Zellner 8927634636 Remove supportConfig route 2023-12-03 16:46:15 +01:00
Johannes Zellner cca3138f05 Remove appstore web token api 2023-12-02 18:20:13 +01:00
Girish Ramakrishnan de7879afb5 store subdomain in database instead of fqdn
this makes it more consistent with the locations table
2023-08-16 21:58:56 +05:30
Girish Ramakrishnan cd9d49116e backups: move limits and storage into separate keys 2023-08-15 10:48:56 +05:30
Girish Ramakrishnan eee49a8291 move dashboard setting into dashboard.js 2023-08-11 21:04:10 +05:30
Girish Ramakrishnan 67ee82abb9 remove settings.dashboardOrigin 2023-08-04 22:10:14 +05:30
Girish Ramakrishnan 4cdf37b060 settings: move mailFqdn/Domain into mailServer 2023-08-04 22:02:24 +05:30
Girish Ramakrishnan fb9d8c23e1 move appstore urls into appstore.js 2023-08-04 15:41:41 +05:30
Girish Ramakrishnan 6aad89ae6e demo is just a constant, not a setting 2023-08-04 14:13:30 +05:30
Girish Ramakrishnan d79d24efad remove settings route entirely, redundant by now 2023-08-04 14:03:04 +05:30
Girish Ramakrishnan da73067315 rename change notifiers to have handle prefix 2023-08-04 11:54:15 +05:30
Girish Ramakrishnan e73b75e4b5 settings: move backup settings 2023-08-04 11:54:12 +05:30
Girish Ramakrishnan 77c66d9a02 settings: move provider to provision 2023-08-04 11:01:45 +05:30
Girish Ramakrishnan 775246946a settings: move language and tz into cloudron.js 2023-08-04 10:58:04 +05:30
Girish Ramakrishnan 5603b9e811 move updater routes and settings under /api/v1/updater 2023-08-03 15:35:27 +05:30
Girish Ramakrishnan bbc6ba1a35 settings: move service setting into services.js
this also introduces getJson/setJson
2023-08-03 11:50:00 +05:30
Girish Ramakrishnan d12e6ee2b3 settings: make user_directory setting route 2023-08-03 08:29:12 +05:30
Girish Ramakrishnan d475df8d63 settings: rename to directory_server_config 2023-08-03 07:35:14 +05:30
Girish Ramakrishnan 92a103d635 settings: move ipv6/ipv4 config into network
this also rename sysinfo_config to ipv4_config
2023-08-03 06:40:04 +05:30
Girish Ramakrishnan c97441f7d9 settings: remove cookie secret default 2023-08-03 02:48:24 +05:30
Girish Ramakrishnan 67e4c90d37 settings: move directory server config to it's own route 2023-08-03 02:48:21 +05:30
Girish Ramakrishnan 4a34c390f8 settings: move externaldap setting 2023-08-03 02:43:26 +05:30
Girish Ramakrishnan a19e502198 settings: move dynamic dns to network
and add tests
2023-08-02 23:02:40 +05:30
Girish Ramakrishnan fccc2d04a9 settings: move support config to support 2023-08-02 23:02:40 +05:30
Girish Ramakrishnan eb4213d61d settings: cloudronId is only ever set
we use subscription API to get the cloudronId, never from database
2023-08-02 23:02:40 +05:30
Girish Ramakrishnan e0d07c3c19 settings: move branding settings into branding.js 2023-08-02 23:02:40 +05:30
Girish Ramakrishnan 85a73af303 settings: remove appstore listing config
this is not used anymore
2023-08-02 23:02:40 +05:30
Girish Ramakrishnan be4c3575fb settings: move web/api token to appstore 2023-08-02 23:02:40 +05:30
Girish Ramakrishnan e1fd369c6d settings: move cookie secret into oidc 2023-08-02 23:02:40 +05:30
Girish Ramakrishnan 77e6b69a63 settings: remove unstable apps key
it's not used anymore
2023-08-02 23:02:40 +05:30
Girish Ramakrishnan c7f2a04e8c settings: move reverse proxy config 2023-08-02 23:02:39 +05:30
Girish Ramakrishnan c4a8255fdd settings: move firewall config to network 2023-08-02 23:02:39 +05:30
Girish Ramakrishnan 8fe992318e settings: move trusted ip setting to reverseproxy 2023-08-02 23:02:39 +05:30
Girish Ramakrishnan 0722692210 graphs: always show /var/backups size
often this has old backups
2023-08-01 17:38:48 +05:30
Johannes Zellner e13d905f32 Store OpenID cookie secret in settings db and make it unique per instance 2023-07-25 12:40:05 +02:00
Girish Ramakrishnan a28ca8fed2 backups: Clean cache if anything other than limits changes 2023-07-13 12:46:42 +05:30
Girish Ramakrishnan 68e56f903d validate encryption password separately 2023-07-13 12:42:38 +05:30
Girish Ramakrishnan c86059e070 backups: move limits into a sub object
fixes #817
2023-07-13 12:17:57 +05:30
Girish Ramakrishnan 9cebde3005 backups: split config and policy
keeping them together makes the test/validation quite complicated.
for example, when policy is changed, we test the storage backends

part of #817
2023-07-13 11:07:06 +05:30
Girish Ramakrishnan e6ba2a6e7a replace usage of _.extend with Object.assign 2023-05-25 11:45:14 +02:00
Girish Ramakrishnan b26c8d20cd network: add trusted ips
This allows the user to set trusted ips to Cloudflare or some other CDN
and have the logs have the correct IPs.

fixes #801
2023-05-13 16:15:47 +02:00
Girish Ramakrishnan a237b11ff7 timezone: set default tz to UTC 2023-05-07 20:51:02 +02:00
Girish Ramakrishnan 883915c9d3 backups: move mount status to separate route 2023-04-30 17:21:18 +02:00
Girish Ramakrishnan b2d072f2e6 backups: always test the mount
It's possible that the current credentials do not work. For example,
CIFS is disabled in hetzner's control panel. In such cases, we skip the
mount check and then fail later in some filesystem error. This misleads
the user.

https://forum.cloudron.io/topic/8391/cloudronbackup-folder-disappears-when-trying-to-restore
2023-01-24 15:06:15 +01:00