cloudron 5.11.11 → 5.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/cloudron CHANGED
@@ -170,7 +170,7 @@ program.command('install')
170
170
  .option('-a, --alias-domains [domain,...]', 'Alias domains')
171
171
  .option('--appstore-id <appid[@version]>', 'Use app from the store')
172
172
  .option('--no-sso', 'Disable Cloudron SSO [false]')
173
- .option('--debug [cmd]', 'Enable debug mode')
173
+ .option('--debug [cmd...]', 'Enable debug mode', false)
174
174
  .option('--readonly', 'Mount filesystem readonly. Default is read/write in debug mode.')
175
175
  .action(actions.install);
176
176
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudron",
3
- "version": "5.11.11",
3
+ "version": "5.12.0",
4
4
  "license": "MIT",
5
5
  "description": "Cloudron Commandline Tool",
6
6
  "main": "main.js",
package/src/actions.js CHANGED
@@ -243,13 +243,7 @@ async function waitForTask(taskId, options) {
243
243
  const response = await createRequest('GET', `/api/v1/tasks/${taskId}`, options);
244
244
  if (response.statusCode !== 200) throw new Error(`Failed to get task: ${requestError(response)}`);
245
245
 
246
- // TODO remove later, for now keep old behavior on if `pending` is missing
247
- if (typeof response.body.pending === 'undefined') {
248
- // note: for queued tasks, 'active' returns false
249
- if (response.body.error || response.body.percent === 100) return response.body; // task errored or done
250
- } else {
251
- if (!response.body.pending && !response.body.active) return response.body;
252
- }
246
+ if (!response.body.active) return response.body;
253
247
 
254
248
  let message = response.body.message || '';
255
249
 
@@ -510,16 +504,6 @@ function queryPortBindings(app, manifest) {
510
504
  return portBindings;
511
505
  }
512
506
 
513
- // this function can fail on many levels
514
- function parseDebugCommand(cmd) {
515
- // hack for commander
516
- if (typeof cmd !== 'string' || cmd === '') return [ '/bin/bash', '-c', 'echo "Debug mode. Use cloudron exec to debug. Sleeping" && sleep 100000' ];
517
-
518
- if (cmd == 'default') return null; // another hack
519
-
520
- return cmd.split(' '); // yet another hack
521
- }
522
-
523
507
  async function downloadManifest(appstoreId) {
524
508
  const [ id, version ] = appstoreId.split('@');
525
509
 
@@ -646,10 +630,11 @@ async function install(localOptions, cmd) {
646
630
  // the sso only applies for apps which allow optional sso
647
631
  if (manifest.optionalSso) data.sso = options.sso;
648
632
 
649
- if (options.debug) {
633
+ if (options.debug) { // 'true' when no args. otherwise, array
634
+ const debugCmd = options.debug === true ? [ '/bin/bash', '-c', 'echo "Repair mode. Use the webterminal or cloudron exec to repair. Sleeping" && sleep infinity' ] : options.debug;
650
635
  data.debugMode = {
651
636
  readonlyRootfs: options.readonly ? true : false,
652
- cmd: parseDebugCommand(options.debug)
637
+ cmd: debugCmd
653
638
  };
654
639
  data.memoryLimit = -1;
655
640
  options.wait = false; // in debug mode, health check never succeeds
@@ -835,10 +820,12 @@ async function debug(args, localOptions, cmd) {
835
820
  const app = await getApp(options);
836
821
  if (!app) return exit(NO_APP_FOUND_ERROR_STRING);
837
822
 
823
+ const debugCmd = args.length === 0 ? [ '/bin/bash', '-c', 'echo "Repair mode. Use the webterminal or cloudron exec to repair. Sleeping" && sleep infinity' ] : args;
824
+
838
825
  const data = {
839
826
  debugMode: options.disable ? null : {
840
827
  readonlyRootfs: options.readonly ? true : false,
841
- cmd: parseDebugCommand(args.join(' ').trim())
828
+ cmd: debugCmd
842
829
  }
843
830
  };
844
831