Commit Graph

207 Commits

Author SHA1 Message Date
Girish Ramakrishnan
01d0c738bc replace debug() with our custom logger
mostly we want trace() and log(). trace() can be enabled whenever
we want by flipping a flag and restarting box
2026-03-12 23:08:35 +05:30
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
Johannes Zellner
e05fef18a0 Only check subscription once a day again 2025-09-29 16:26:01 +02:00
Johannes Zellner
38267a26c1 Send some metrics 2025-09-29 16:16:22 +02:00
Girish Ramakrishnan
c5b7264f1a rename backupTargets to backupSites 2025-09-12 10:32:37 +02:00
Johannes Zellner
fdc4ddf316 disk usage update cron job is no more 2025-08-21 11:17:01 +02:00
Johannes Zellner
a8ed7eb914 backuptarget.list() needs arguments 2025-08-21 11:10:27 +02:00
Johannes Zellner
fd509a9099 Fix variable shadowing 2025-08-21 11:07:37 +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
b2c94adabf cron: fix cleanup task 2025-07-25 14:54:51 +02:00
Girish Ramakrishnan
69cd766f88 backups: run cron schedule per target 2025-07-25 08:36:09 +02:00
Girish Ramakrishnan
3aafbd2ccb backups: add backup multiple targets 2025-07-25 01:30:27 +02:00
Girish Ramakrishnan
100bea981d constants: rename AUTOUPDATE_PATTERN_NEVER to CRON_PATTERN_NEVER 2025-07-24 21:47:46 +02:00
Girish Ramakrishnan
931311f11f rename backups to backuptargets 2025-07-24 18:54:10 +02:00
Johannes Zellner
ce63dbde1b Check current subscription status once a day 2025-07-16 22:11:11 +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
1ffad1ebaf updater: move the auto update logic into updater 2025-06-20 19:10:25 +02:00
Girish Ramakrishnan
2db99e7807 refactor: rename updater functions to have box in them 2025-06-20 19:04:55 +02:00
Girish Ramakrishnan
1ca8eeeb50 split oidc into server and clients 2025-06-11 22:26:23 +02:00
Girish Ramakrishnan
048afdc232 merge the collectd logic into metrics.js
this is to prepare for live streaming of metrics
2025-05-21 16:32:52 +02:00
Girish Ramakrishnan
4615418000 graphs: replace collectd with our custom collector
collectd (with the python plugin) seems semi-abandoned. replace
with our own. we have more control over how to collect things instead
of relying on random plugins.
2025-05-20 12:19:40 +02:00
Johannes Zellner
b7b738c92b Add cron job to cleanup exired oidc objects 2025-03-05 11:48:33 +01:00
Girish Ramakrishnan
12794a499d domains: validate domain configs in a cron
no email notification yet, we have to rework this notifications/eventlog stuff
2025-02-17 19:11:11 +01:00
Girish Ramakrishnan
dd5e4adc73 replace underscore with our own
we only need like 5 simple functions
2025-02-13 14:14:34 +01:00
Girish Ramakrishnan
9c7e9e25ca scheduler: respect cloudron timezone setting 2025-01-02 10:11:14 +01:00
Girish Ramakrishnan
8a640c8219 better app autoupdate logs 2024-08-10 11:04:17 +02:00
Girish Ramakrishnan
d137cdf881 update cron module
CronJob -> CronJob.from
CronJob(time) -> CronTime
2024-04-19 18:31:47 +02:00
Girish Ramakrishnan
2d03941745 cron: clean old jobs variable properly 2024-01-23 10:19:56 +01:00
Girish Ramakrishnan
257dc4e271 external ldap: run syncer every 4 hours
hardcoded for now but we should make this configurable
2024-01-13 15:53:14 +01:00
Girish Ramakrishnan
fa842034ed update: continue to update apps if box update never starts
https://forum.cloudron.io/topic/10699/no-automatic-app-updates-with-pending-box-update
2023-12-28 12:16:03 +01:00
Johannes Zellner
2484cf490b Ensure dyndns every 10min 2023-09-13 16:14:25 +02:00
Girish Ramakrishnan
1c714bc1f2 lint 2023-08-29 06:11:12 +05:30
Johannes Zellner
24981e1f81 Fix renew certs call from cron 2023-08-28 23:55:13 +02:00
Girish Ramakrishnan
5eaae1c960 system: fix crash updating disk usage 2023-08-26 08:05:52 +05:30
Girish Ramakrishnan
2cdbf4d2c5 move server routes into /system 2023-08-04 13:42:21 +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
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
a19e502198 settings: move dynamic dns to network
and add tests
2023-08-02 23:02:40 +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
23f0eba1bd dyndns: run as a task
this lets us display logs
2023-07-08 21:21:06 +05:30
Girish Ramakrishnan
8c59528cc2 eventlog: keep 3 months 2023-02-21 10:38:15 +01:00
Girish Ramakrishnan
77a5f01585 reverseproxy: rebuild only when needed
re-creating nginx configs is only needed in 3 cases:
* provider changes. we create a rebuild file for this
* nginx config is somehow corrupt by external changes. user can click ui button

on startup, dashboard also always creates the nginx configs. so it's always up to provide the button
2022-11-29 18:17:53 +01:00
Girish Ramakrishnan
0843baad8b reverseproxy: remove options from renewCerts 2022-11-14 08:13:47 +01:00
Girish Ramakrishnan
3d6cdf8ff3 run disk usage task once a day 2022-11-09 15:21:53 +01:00
Girish Ramakrishnan
c07fe4195f eventlog: preserve last 2 months 2022-10-01 11:01:41 +02:00