cloudron 8.0.2 → 8.1.1
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 +0 -10
- package/package.json +1 -1
- package/src/appstore-actions.js +8 -57
- package/src/build-actions.js +4 -1
package/bin/cloudron
CHANGED
|
@@ -29,16 +29,6 @@ program.option('--server <server>', 'Cloudron domain')
|
|
|
29
29
|
const appstoreCommand = program.command('appstore').description('Commands for publishing to the Appstore')
|
|
30
30
|
.option('--appstore-token <token>', 'AppStore token');
|
|
31
31
|
|
|
32
|
-
appstoreCommand.command('login')
|
|
33
|
-
.description('Login to the appstore')
|
|
34
|
-
.option('-e, --email <email>', 'Email address')
|
|
35
|
-
.option('-p, --password <password>', 'Password (unsafe)')
|
|
36
|
-
.action(appstoreActions.login);
|
|
37
|
-
|
|
38
|
-
appstoreCommand.command('logout')
|
|
39
|
-
.description('Logout from the appstore')
|
|
40
|
-
.action(appstoreActions.logout);
|
|
41
|
-
|
|
42
32
|
appstoreCommand.command('info')
|
|
43
33
|
.description('List info of published app')
|
|
44
34
|
.option('--appstore-id <appid@version>', 'Appstore id and version')
|
package/package.json
CHANGED
package/src/appstore-actions.js
CHANGED
|
@@ -5,7 +5,6 @@ import fs from 'fs';
|
|
|
5
5
|
import { exit, locateManifest, parseChangelog } from './helper.js';
|
|
6
6
|
import manifestFormat from '@cloudron/manifest-format';
|
|
7
7
|
import path from 'path';
|
|
8
|
-
import * as readline from './readline.js';
|
|
9
8
|
import safe from '@cloudron/safetydance';
|
|
10
9
|
import superagent from '@cloudron/superagent';
|
|
11
10
|
import Table from 'easy-table';
|
|
@@ -13,7 +12,7 @@ import Table from 'easy-table';
|
|
|
13
12
|
const NO_MANIFEST_FOUND_ERROR_STRING = 'No CloudronManifest.json found';
|
|
14
13
|
|
|
15
14
|
function requestError(response) {
|
|
16
|
-
if (response.status === 401) return 'Invalid token.
|
|
15
|
+
if (response.status === 401) return 'Invalid token.';
|
|
17
16
|
|
|
18
17
|
return `${response.status} message: ${response.body?.message || response.text || JSON.stringify(response.body)}`; // body is sometimes just a string like in 401
|
|
19
18
|
}
|
|
@@ -30,10 +29,6 @@ function createRequest(method, apiPath, options) {
|
|
|
30
29
|
return request;
|
|
31
30
|
}
|
|
32
31
|
|
|
33
|
-
function createUrl(api) {
|
|
34
|
-
return config.appStoreOrigin() + api;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
32
|
// the app argument allows us in the future to get by name or id
|
|
38
33
|
async function getAppstoreId(appstoreId) {
|
|
39
34
|
if (appstoreId) return appstoreId.split('@');
|
|
@@ -47,54 +42,6 @@ async function getAppstoreId(appstoreId) {
|
|
|
47
42
|
return [manifest.id, manifest.version];
|
|
48
43
|
}
|
|
49
44
|
|
|
50
|
-
async function authenticate(options) { // maybe we can use options.token to valid using a profile call?
|
|
51
|
-
if (!options.hideBanner) {
|
|
52
|
-
const webDomain = config.appStoreOrigin().replace('https://api.', '');
|
|
53
|
-
console.log(`${webDomain} login` + ` (If you do not have one, sign up at https://${webDomain}/console.html#/register)`);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const email = options.email || await readline.question('Email: ', {});
|
|
57
|
-
const password = options.password || await readline.question('Password: ', { noEchoBack: true });
|
|
58
|
-
|
|
59
|
-
config.setAppStoreToken(null);
|
|
60
|
-
|
|
61
|
-
const response = await superagent.post(createUrl('/api/v1/login')).auth(email, password).send({ totpToken: options.totpToken }).ok(() => true);
|
|
62
|
-
if (response.status === 401 && response.body.message.indexOf('TOTP') !== -1) {
|
|
63
|
-
if (response.body.message === 'TOTP token missing') console.log('A 2FA TOTP Token is required for this account.');
|
|
64
|
-
|
|
65
|
-
options.totpToken = await readline.question('2FA token: ', {});
|
|
66
|
-
options.email = email;
|
|
67
|
-
options.password = password;
|
|
68
|
-
options.hideBanner = true;
|
|
69
|
-
|
|
70
|
-
return await authenticate(options); // try again with top set
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (response.status !== 200) {
|
|
74
|
-
console.log('Login failed.');
|
|
75
|
-
|
|
76
|
-
options.hideBanner = true;
|
|
77
|
-
options.email = '';
|
|
78
|
-
options.password = '';
|
|
79
|
-
|
|
80
|
-
return await authenticate(options);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
config.setAppStoreToken(response.body.accessToken);
|
|
84
|
-
|
|
85
|
-
console.log('Login successful.');
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
async function login(localOptions, cmd) {
|
|
89
|
-
const options = cmd.optsWithGlobals();
|
|
90
|
-
await authenticate(options);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function logout() {
|
|
94
|
-
config.setAppStoreToken(null);
|
|
95
|
-
console.log('Done.');
|
|
96
|
-
}
|
|
97
|
-
|
|
98
45
|
async function info(localOptions, cmd) {
|
|
99
46
|
const options = cmd.optsWithGlobals();
|
|
100
47
|
const [id, version] = await getAppstoreId(options.appstoreId);
|
|
@@ -238,19 +185,25 @@ async function verifyManifest(localOptions, cmd) {
|
|
|
238
185
|
const appConfig = config.getCwdConfig(sourceDir);
|
|
239
186
|
|
|
240
187
|
// image can be passed in options for buildbot
|
|
188
|
+
let missingDockerImage = false;
|
|
241
189
|
if (options.image) {
|
|
242
190
|
manifest.dockerImage = options.image;
|
|
243
191
|
} else {
|
|
244
192
|
manifest.dockerImage = appConfig.dockerImage;
|
|
245
193
|
}
|
|
246
194
|
|
|
247
|
-
if (!manifest.dockerImage)
|
|
195
|
+
if (!manifest.dockerImage) {
|
|
196
|
+
missingDockerImage = true;
|
|
197
|
+
manifest.dockerImage = `cloudron/${manifest.id}:${manifest.version}`;
|
|
198
|
+
}
|
|
248
199
|
|
|
249
200
|
// ensure we remove the docker hub handle
|
|
250
201
|
if (manifest.dockerImage.indexOf('docker.io/') === 0) manifest.dockerImage = manifest.dockerImage.slice('docker.io/'.length);
|
|
251
202
|
|
|
252
203
|
const error = manifestFormat.checkAppstoreRequirements(manifest);
|
|
253
204
|
if (error) return exit(error);
|
|
205
|
+
|
|
206
|
+
if (missingDockerImage) return exit('No docker image found, run `cloudron build` first');
|
|
254
207
|
}
|
|
255
208
|
|
|
256
209
|
async function checkDockerHub(dockerImage) {
|
|
@@ -471,8 +424,6 @@ async function notify() {
|
|
|
471
424
|
}
|
|
472
425
|
|
|
473
426
|
export default {
|
|
474
|
-
login,
|
|
475
|
-
logout,
|
|
476
427
|
info,
|
|
477
428
|
listVersions,
|
|
478
429
|
submit,
|
package/src/build-actions.js
CHANGED
|
@@ -313,7 +313,10 @@ async function build(localOptions, cmd) {
|
|
|
313
313
|
config.setCwdConfig(sourceDir, appConfig);
|
|
314
314
|
}
|
|
315
315
|
|
|
316
|
-
|
|
316
|
+
const gitCommit = safe.child_process.execSync('git rev-parse HEAD', { encoding: 'utf8' })?.trim(); // when the build gets saved, save the gitCommit also
|
|
317
|
+
if (safe.error) console.log('No git repository found. Continuing without commit sha info.');
|
|
318
|
+
|
|
319
|
+
appConfig.gitCommit = gitCommit || '';
|
|
317
320
|
if (buildServiceConfig.type === 'remote' && buildServiceConfig.url) {
|
|
318
321
|
console.log('Building using remote build service at %s', buildServiceConfig.url);
|
|
319
322
|
await buildRemote(manifest, sourceDir, appConfig, options, buildServiceConfig);
|