cloudron 8.0.2 → 8.1.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 +1 -11
- package/package.json +1 -1
- package/src/appstore-actions.js +8 -56
- package/src/build-actions.js +4 -1
package/bin/cloudron
CHANGED
|
@@ -27,17 +27,7 @@ program.option('--server <server>', 'Cloudron domain')
|
|
|
27
27
|
.option('--no-wait', 'Do not wait for the operation to finish');
|
|
28
28
|
|
|
29
29
|
const appstoreCommand = program.command('appstore').description('Commands for publishing to the Appstore')
|
|
30
|
-
.
|
|
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);
|
|
30
|
+
.requiredOption('--appstore-token <token>', 'AppStore token');
|
|
41
31
|
|
|
42
32
|
appstoreCommand.command('info')
|
|
43
33
|
.description('List info of published app')
|
package/package.json
CHANGED
package/src/appstore-actions.js
CHANGED
|
@@ -13,7 +13,7 @@ import Table from 'easy-table';
|
|
|
13
13
|
const NO_MANIFEST_FOUND_ERROR_STRING = 'No CloudronManifest.json found';
|
|
14
14
|
|
|
15
15
|
function requestError(response) {
|
|
16
|
-
if (response.status === 401) return 'Invalid token.
|
|
16
|
+
if (response.status === 401) return 'Invalid token.';
|
|
17
17
|
|
|
18
18
|
return `${response.status} message: ${response.body?.message || response.text || JSON.stringify(response.body)}`; // body is sometimes just a string like in 401
|
|
19
19
|
}
|
|
@@ -30,10 +30,6 @@ function createRequest(method, apiPath, options) {
|
|
|
30
30
|
return request;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
function createUrl(api) {
|
|
34
|
-
return config.appStoreOrigin() + api;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
33
|
// the app argument allows us in the future to get by name or id
|
|
38
34
|
async function getAppstoreId(appstoreId) {
|
|
39
35
|
if (appstoreId) return appstoreId.split('@');
|
|
@@ -47,54 +43,6 @@ async function getAppstoreId(appstoreId) {
|
|
|
47
43
|
return [manifest.id, manifest.version];
|
|
48
44
|
}
|
|
49
45
|
|
|
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
46
|
async function info(localOptions, cmd) {
|
|
99
47
|
const options = cmd.optsWithGlobals();
|
|
100
48
|
const [id, version] = await getAppstoreId(options.appstoreId);
|
|
@@ -238,19 +186,25 @@ async function verifyManifest(localOptions, cmd) {
|
|
|
238
186
|
const appConfig = config.getCwdConfig(sourceDir);
|
|
239
187
|
|
|
240
188
|
// image can be passed in options for buildbot
|
|
189
|
+
let missingDockerImage = false;
|
|
241
190
|
if (options.image) {
|
|
242
191
|
manifest.dockerImage = options.image;
|
|
243
192
|
} else {
|
|
244
193
|
manifest.dockerImage = appConfig.dockerImage;
|
|
245
194
|
}
|
|
246
195
|
|
|
247
|
-
if (!manifest.dockerImage)
|
|
196
|
+
if (!manifest.dockerImage) {
|
|
197
|
+
missingDockerImage = true;
|
|
198
|
+
manifest.dockerImage = `cloudron/${manifest.id}:${manifest.version}`;
|
|
199
|
+
}
|
|
248
200
|
|
|
249
201
|
// ensure we remove the docker hub handle
|
|
250
202
|
if (manifest.dockerImage.indexOf('docker.io/') === 0) manifest.dockerImage = manifest.dockerImage.slice('docker.io/'.length);
|
|
251
203
|
|
|
252
204
|
const error = manifestFormat.checkAppstoreRequirements(manifest);
|
|
253
205
|
if (error) return exit(error);
|
|
206
|
+
|
|
207
|
+
if (missingDockerImage) return exit('No docker image found, run `cloudron build` first');
|
|
254
208
|
}
|
|
255
209
|
|
|
256
210
|
async function checkDockerHub(dockerImage) {
|
|
@@ -471,8 +425,6 @@ async function notify() {
|
|
|
471
425
|
}
|
|
472
426
|
|
|
473
427
|
export default {
|
|
474
|
-
login,
|
|
475
|
-
logout,
|
|
476
428
|
info,
|
|
477
429
|
listVersions,
|
|
478
430
|
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);
|