cloudron 4.12.4 → 4.12.8
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/package.json +2 -2
- package/src/actions.js +12 -5
- package/src/templates/Dockerfile.ejs +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudron",
|
|
3
|
-
"version": "4.12.
|
|
3
|
+
"version": "4.12.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Cloudron Commandline Tool",
|
|
6
6
|
"main": "main.js",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"underscore": "^1.13.1"
|
|
43
43
|
},
|
|
44
44
|
"engines": {
|
|
45
|
-
"node": ">=
|
|
45
|
+
"node": ">= 14.x.x"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"expect.js": "^0.3.1",
|
package/src/actions.js
CHANGED
|
@@ -250,13 +250,18 @@ function startApp(app, options, callback) {
|
|
|
250
250
|
}
|
|
251
251
|
|
|
252
252
|
async function authenticate(adminFqdn, username, password, options) {
|
|
253
|
+
assert.strictEqual(typeof adminFqdn, 'string');
|
|
254
|
+
assert.strictEqual(typeof username, 'string');
|
|
255
|
+
assert.strictEqual(typeof password, 'string');
|
|
256
|
+
assert.strictEqual(typeof options, 'object');
|
|
257
|
+
|
|
253
258
|
let totpToken;
|
|
254
259
|
|
|
255
260
|
const { rejectUnauthorized, askForTotpToken } = options;
|
|
256
261
|
if (askForTotpToken) totpToken = readlineSync.question('2FA Token: ', {});
|
|
257
262
|
|
|
258
263
|
const request = superagent.post(`https://${adminFqdn}/api/v1/cloudron/login`)
|
|
259
|
-
.timeout(
|
|
264
|
+
.timeout(60000)
|
|
260
265
|
.send({ username, password, totpToken })
|
|
261
266
|
.ok(() => true)
|
|
262
267
|
.set('User-Agent', 'cloudron-cli');
|
|
@@ -264,10 +269,10 @@ async function authenticate(adminFqdn, username, password, options) {
|
|
|
264
269
|
const response = await request; // this triggers the request
|
|
265
270
|
if (response.status === 401) {
|
|
266
271
|
if (response.body.message === 'A totpToken must be provided') {
|
|
267
|
-
return await authenticate(username, password, { rejectUnauthorized, askForTotpToken: true });
|
|
272
|
+
return await authenticate(adminFqdn, username, password, { rejectUnauthorized, askForTotpToken: true });
|
|
268
273
|
} else if (response.body.message === 'Invalid totpToken') {
|
|
269
274
|
console.log('Invalid 2FA Token'.red);
|
|
270
|
-
return await authenticate(username, password, { rejectUnauthorized, askForTotpToken: true });
|
|
275
|
+
return await authenticate(adminFqdn, username, password, { rejectUnauthorized, askForTotpToken: true });
|
|
271
276
|
} else {
|
|
272
277
|
throw new Error('Invalid credentials');
|
|
273
278
|
}
|
|
@@ -290,7 +295,7 @@ async function login(adminFqdn, options) {
|
|
|
290
295
|
let token = config.token();
|
|
291
296
|
if (token) { // check if the token is not expired
|
|
292
297
|
const [error, response] = await safe(superagent.get(`https://${adminFqdn}/api/v1/profile?access_token=${token}`)
|
|
293
|
-
.timeout(
|
|
298
|
+
.timeout(60000)
|
|
294
299
|
.ok(() => true));
|
|
295
300
|
if (error) return exit(error);
|
|
296
301
|
if (response.status === 200) {
|
|
@@ -316,6 +321,8 @@ async function login(adminFqdn, options) {
|
|
|
316
321
|
config.setToken(token);
|
|
317
322
|
config.setAllowSelfsigned(options.parent.allowSelfsigned || options.parent.acceptSelfsigned);
|
|
318
323
|
config.set('cloudrons.default', adminFqdn);
|
|
324
|
+
|
|
325
|
+
console.log('Login successful.'.green);
|
|
319
326
|
}
|
|
320
327
|
|
|
321
328
|
function logout() {
|
|
@@ -1157,7 +1164,7 @@ function backupList(options) {
|
|
|
1157
1164
|
response.body.backups.forEach(function (backup) {
|
|
1158
1165
|
t.cell('Id', backup.id);
|
|
1159
1166
|
t.cell('Creation Time', backup.creationTime);
|
|
1160
|
-
t.cell('Version', backup.
|
|
1167
|
+
t.cell('Version', backup.packageVersion);
|
|
1161
1168
|
|
|
1162
1169
|
t.newRow();
|
|
1163
1170
|
});
|