cloudron 4.14.0 → 4.14.4
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 +1 -0
- package/package.json +2 -2
- package/src/actions.js +20 -11
- package/src/appstore-actions.js +14 -0
package/bin/cloudron
CHANGED
|
@@ -27,6 +27,7 @@ function collectArgs(value, collected) {
|
|
|
27
27
|
return collected;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
// TODO when updating to commander v8 we require https://github.com/tj/commander.js/pull/1670
|
|
30
31
|
program.version(version)
|
|
31
32
|
.option('--server <server>', 'Cloudron domain')
|
|
32
33
|
.option('--token <token>', 'Cloudron token')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudron",
|
|
3
|
-
"version": "4.14.
|
|
3
|
+
"version": "4.14.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Cloudron Commandline Tool",
|
|
6
6
|
"main": "main.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"author": "Cloudron Developers <support@cloudron.io>",
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"async": "^3.2.3",
|
|
21
|
-
"cloudron-manifestformat": "^5.15.
|
|
21
|
+
"cloudron-manifestformat": "^5.15.2",
|
|
22
22
|
"commander": "^6.1.0",
|
|
23
23
|
"debug": "^4.3.3",
|
|
24
24
|
"delay": "^5.0.0",
|
package/src/actions.js
CHANGED
|
@@ -67,6 +67,10 @@ const NO_APP_FOUND_ERROR_STRING = 'Could not determine app. Use --app to specify
|
|
|
67
67
|
// options for the request module
|
|
68
68
|
function requestOptions(options) {
|
|
69
69
|
const adminFqdn = options.parent.server || config.apiEndpoint();
|
|
70
|
+
|
|
71
|
+
// ensure config can return the correct section
|
|
72
|
+
config.setActive(adminFqdn);
|
|
73
|
+
|
|
70
74
|
const token = options.parent.token || config.token();
|
|
71
75
|
const rejectUnauthorized = !(options.parent.allowSelfsigned || options.parent.acceptSelfsigned || config.allowSelfsigned());
|
|
72
76
|
|
|
@@ -82,7 +86,7 @@ function createRequest(method, apiPath, options) {
|
|
|
82
86
|
if (url.includes('?')) url += '&'; else url += '?';
|
|
83
87
|
url += `access_token=${token}`;
|
|
84
88
|
const request = superagent(method, url);
|
|
85
|
-
if (rejectUnauthorized) request.disableTLSCerts();
|
|
89
|
+
if (!rejectUnauthorized) request.disableTLSCerts();
|
|
86
90
|
request.ok(() => true);
|
|
87
91
|
return request;
|
|
88
92
|
}
|
|
@@ -364,11 +368,15 @@ async function login(adminFqdn, options) {
|
|
|
364
368
|
|
|
365
369
|
config.setActive(adminFqdn);
|
|
366
370
|
|
|
371
|
+
const rejectUnauthorized = !(options.parent.allowSelfsigned || options.parent.acceptSelfsigned);
|
|
367
372
|
let token = config.token();
|
|
368
373
|
if (token) { // check if the token is not expired
|
|
369
|
-
const
|
|
374
|
+
const request = superagent.get(`https://${adminFqdn}/api/v1/profile?access_token=${token}`)
|
|
370
375
|
.timeout(60000)
|
|
371
|
-
.ok(() => true)
|
|
376
|
+
.ok(() => true);
|
|
377
|
+
if (!rejectUnauthorized) request.disableTLSCerts();
|
|
378
|
+
|
|
379
|
+
const [error, response] = await safe(request);
|
|
372
380
|
if (error) return exit(error);
|
|
373
381
|
if (response.status === 200) {
|
|
374
382
|
console.log('Existing token still valid.');
|
|
@@ -381,7 +389,6 @@ async function login(adminFqdn, options) {
|
|
|
381
389
|
if (!token) {
|
|
382
390
|
const username = options.username || readlineSync.question('Username: ', {});
|
|
383
391
|
const password = options.password || readlineSync.question('Password: ', { noEchoBack: true });
|
|
384
|
-
const rejectUnauthorized = !(options.parent.allowSelfsigned || options.parent.acceptSelfsigned);
|
|
385
392
|
|
|
386
393
|
const [error, result] = await safe(authenticate(adminFqdn, username, password, { rejectUnauthorized, askForTotpToken: false }));
|
|
387
394
|
if (error) return exit(`Failed to login: ${error.message}`);
|
|
@@ -646,12 +653,14 @@ async function configure(options) {
|
|
|
646
653
|
const domainObject = await selectDomain(location, options);
|
|
647
654
|
|
|
648
655
|
const secondaryDomains = {};
|
|
649
|
-
app.secondaryDomains
|
|
650
|
-
secondaryDomains
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
656
|
+
if (app.secondaryDomains) { // only valid post 7.1
|
|
657
|
+
app.secondaryDomains.forEach(sd => {
|
|
658
|
+
secondaryDomains[sd.environmentVariable] = {
|
|
659
|
+
subdomain: sd.subdomain,
|
|
660
|
+
domain: sd.domain
|
|
661
|
+
};
|
|
662
|
+
});
|
|
663
|
+
}
|
|
655
664
|
|
|
656
665
|
const data = {
|
|
657
666
|
location: domainObject.subdomain, // LEGACY
|
|
@@ -969,7 +978,7 @@ async function inspect(options) {
|
|
|
969
978
|
for (const app of response.body.apps) {
|
|
970
979
|
const response2 = await createRequest('GET', `/api/v1/apps/${app.id}`, options);
|
|
971
980
|
if (response2.statusCode !== 200) return exit(`Failed to list app: ${requestError(response2)}`);
|
|
972
|
-
response2.body.location = response2.body.subdomain; // LEGACY support
|
|
981
|
+
response2.body.location = response2.body.location || response2.body.subdomain; // LEGACY support
|
|
973
982
|
apps.push(response2.body);
|
|
974
983
|
}
|
|
975
984
|
|
package/src/appstore-actions.js
CHANGED
|
@@ -367,6 +367,19 @@ function approveVersion(appstoreId, version) {
|
|
|
367
367
|
|
|
368
368
|
console.log('Approved.');
|
|
369
369
|
console.log('');
|
|
370
|
+
|
|
371
|
+
superagentEnd(function () {
|
|
372
|
+
return superagent.get(createUrl('/api/v1/developers/apps/' + appstoreId + '/versions/' + version)).query({ accessToken: config.appStoreToken() });
|
|
373
|
+
}, function (error, result) {
|
|
374
|
+
if (error && !error.response) exit(util.format('Failed to list apps: %s', error.message));
|
|
375
|
+
if (result.statusCode !== 200) exit(util.format('Failed to list apps: %s message: %s', result.statusCode, result.text));
|
|
376
|
+
|
|
377
|
+
console.log('Changelog for forum update: ' + result.body.manifest.forumUrl);
|
|
378
|
+
console.log('');
|
|
379
|
+
console.log('[' + version + ']');
|
|
380
|
+
console.log(result.body.manifest.changelog);
|
|
381
|
+
console.log('');
|
|
382
|
+
});
|
|
370
383
|
});
|
|
371
384
|
}
|
|
372
385
|
|
|
@@ -505,6 +518,7 @@ function approve(options) {
|
|
|
505
518
|
if (!version) return exit('--appstore-id must be of the format id@version');
|
|
506
519
|
|
|
507
520
|
console.log('Approving ' + id + '@' + version);
|
|
521
|
+
|
|
508
522
|
approveVersion(id, version);
|
|
509
523
|
});
|
|
510
524
|
}
|