Commit Graph

63 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
ea5953a397 Fix test 2026-02-21 20:27:55 +01:00
Girish Ramakrishnan
c176ac600b migrate tests to node:test 2026-02-19 10:13:22 +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
a9ae34b149 community: download iconUrl
also rename existing db field appStoreIcon to packageIcon
2026-02-06 19:13:55 +01:00
Girish Ramakrishnan
6869380500 Fix tests 2025-10-07 10:01:35 +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
Girish Ramakrishnan
fddbe6a574 Fixup tests 2025-08-04 23:11:50 +02:00
Girish Ramakrishnan
547d8ae113 filesystem: rename backupFolder to backupDir 2025-08-02 10:37:37 +02:00
Girish Ramakrishnan
83ab701d02 eventlog: add backup target eventlog 2025-07-25 12:23:41 +02:00
Girish Ramakrishnan
3f07bb5c3a backup targets: add test for all routes 2025-07-25 11:29:00 +02:00
Girish Ramakrishnan
276db17f0c backups: use a real targetId 2025-07-25 08:12:27 +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
9780db6fa0 add backup targets table 2025-07-24 17:32:16 +02:00
Girish Ramakrishnan
8bf8c278f0 system: add tests for fs usage route 2025-07-17 01:42:28 +02:00
Girish Ramakrishnan
7214ce2ede support: remove ssh manipulation routes
this is now moved entirely to cloudron-support --enable-remote-access.

this emphasizes more that users have to get ssh access to the server before
we can do anything about it. it's far too simple for people to click this
button.

we have now also added clear terms to understand what remote access entails.
(what happens if support personnel makes a mistake. who is liable? etc)
2025-07-16 17:53:19 +02:00
Girish Ramakrishnan
6ac0cd421a use the @cloudron/superagent module 2025-07-10 10:56:05 +02:00
Girish Ramakrishnan
227da8dce4 test: remove double uninit of db 2025-06-19 10:24:17 +02:00
Girish Ramakrishnan
d112d6308c move tokens.ID_ into oidcClients.ID_ 2025-06-12 00:25:28 +02:00
Girish Ramakrishnan
1ca8eeeb50 split oidc into server and clients 2025-06-11 22:26:23 +02:00
Girish Ramakrishnan
7b9504c5b4 test: add provision test 2025-06-06 13:39:30 +02:00
Girish Ramakrishnan
2b52e21ccf test: fix appstore test 2025-06-06 13:39:30 +02:00
Girish Ramakrishnan
28a1c254d9 activation: move registration into provision model code 2025-06-06 09:31:31 +02:00
Girish Ramakrishnan
1bbdabc42f registry config: create table and migrate existing setting 2025-05-07 15:56:13 +02:00
Girish Ramakrishnan
5342dae5b3 tokens: add ip restriction 2025-03-07 17:50:50 +01:00
Girish Ramakrishnan
8e58349bfa replace with custom superagent based on fetch API 2025-02-15 15:14:09 +01:00
Girish Ramakrishnan
bd44bb4534 groups: add app access tests 2025-02-12 14:21:46 +01:00
Girish Ramakrishnan
c6e93b9870 test: enable nock as needed 2025-02-06 15:01:59 +01:00
Girish Ramakrishnan
f973536f7f archives: add eventlog 2024-12-10 11:10:35 +01:00
Girish Ramakrishnan
d34b102e52 mandatory2fa: fix workflow when using external LDAP
* Always allow the mandatory 2fa setting to be saved
* Show warning for user if they have no 2fa setup and if not external 2fa
* If they get locked out anyway, they have to use CLI tool
* redirect for mandatory 2fa only if not external 2fa as well
2024-06-12 12:26:40 +02:00
Girish Ramakrishnan
cef0b6d0d8 test: bump retries 2024-01-11 16:31:12 +01:00
Girish Ramakrishnan
4b1b38be63 make tests work again 2023-08-14 11:08:38 +05:30
Girish Ramakrishnan
57772662aa move provisioning routes into /provision/ 2023-08-10 16:52:10 +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
500d2361ec replace delay.js with timers/promises 2023-05-14 10:53:50 +02:00
Girish Ramakrishnan
456da972e9 stop the oidc server, if it is running 2023-03-27 11:39:34 +02:00
Girish Ramakrishnan
1f8b907bf1 tests: stop the auto-started oidc server 2023-03-26 16:34:14 +02:00
Johannes Zellner
46c233bad6 oidc: Add clients manage routes 2023-03-21 13:54:40 +01:00
Girish Ramakrishnan
f728971479 add test that only owner can open tickets 2022-11-23 17:56:24 +01:00
Johannes Zellner
5184e017c9 Error the task waited for fails in tests 2022-09-19 18:20:27 +02:00
Girish Ramakrishnan
43f86674b4 Remove delay module 2022-04-15 07:52:35 -05:00
Girish Ramakrishnan
70695b1b0f backups: set label of backup and control it's retention 2022-04-02 19:30:54 -07:00
Girish Ramakrishnan
656dca7c66 rename cloudron_token to appstore_api_token 2022-03-31 22:18:08 -07:00
Girish Ramakrishnan
bf51bc25e9 dnsConfig -> domainConfig
this prepares for the incoming settings.getDnsConfig()
2022-01-05 22:56:10 -08:00
Girish Ramakrishnan
515b1db9d0 Fix tests 2021-11-17 11:35:44 -08:00
Johannes Zellner
8c9c19d07d Fixup appstore route related tests 2021-10-12 14:55:30 +02:00