chrome-webstore-upload-keys 1.1.1 → 1.1.3
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/cli.js +7 -10
- package/dist/index.js +7 -10
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -55,8 +55,8 @@ async function getRefreshToken() {
|
|
|
55
55
|
const request = await fetch('https://accounts.google.com/o/oauth2/token', {
|
|
56
56
|
method: 'POST',
|
|
57
57
|
body: new URLSearchParams([
|
|
58
|
-
['client_id', group.clientId],
|
|
59
|
-
['client_secret', group.clientSecret],
|
|
58
|
+
['client_id', group.clientId.trim()],
|
|
59
|
+
['client_secret', group.clientSecret.trim()],
|
|
60
60
|
['code', code],
|
|
61
61
|
['grant_type', 'authorization_code'],
|
|
62
62
|
['redirect_uri', serverUrl], // Unused but required
|
|
@@ -83,7 +83,7 @@ function getLoginUrl(clientId) {
|
|
|
83
83
|
const url = new URL('https://accounts.google.com/o/oauth2/auth');
|
|
84
84
|
url.searchParams.set('response_type', 'code');
|
|
85
85
|
url.searchParams.set('access_type', 'offline');
|
|
86
|
-
url.searchParams.set('client_id', clientId);
|
|
86
|
+
url.searchParams.set('client_id', clientId.trim());
|
|
87
87
|
url.searchParams.set('scope', 'https://www.googleapis.com/auth/chromewebstore');
|
|
88
88
|
url.searchParams.set('redirect_uri', serverUrl);
|
|
89
89
|
return url.href;
|
|
@@ -92,10 +92,6 @@ function getLoginUrl(clientId) {
|
|
|
92
92
|
p.intro('Follow the steps at this URL to generate the API keys, then enter them below to generate the refresh token.\n https://github.com/fregante/chrome-webstore-upload-keys');
|
|
93
93
|
const group = await p.group(
|
|
94
94
|
{
|
|
95
|
-
// ExtensionId: () => p.text({
|
|
96
|
-
// message: 'Extension ID:',
|
|
97
|
-
// placeholder: 'e.g. bdeobgpddfaegbjfinhldnkfeieakdaf, it’s in the Chrome Web Store URL',
|
|
98
|
-
// }),
|
|
99
95
|
clientId: () => p.text({
|
|
100
96
|
message: 'Client ID:',
|
|
101
97
|
placeholder: 'e.g. 960453266371-2qcq5fppm3d5e.apps.googleusercontent.com',
|
|
@@ -124,16 +120,17 @@ await tasks([
|
|
|
124
120
|
{
|
|
125
121
|
title: 'Opening the login page in the browser',
|
|
126
122
|
async task() {
|
|
123
|
+
const instructions = 'Complete the process in the browser. Follow its steps and warnings (this is your own personal app)';
|
|
127
124
|
if (group.open) {
|
|
128
125
|
await open(getLoginUrl(group.clientId));
|
|
129
|
-
return
|
|
126
|
+
return instructions;
|
|
130
127
|
}
|
|
131
128
|
|
|
132
|
-
return
|
|
129
|
+
return instructions + '\n\n ' + getLoginUrl(group.clientId);
|
|
133
130
|
},
|
|
134
131
|
},
|
|
135
132
|
{
|
|
136
|
-
title: 'Waiting for you
|
|
133
|
+
title: 'Waiting for you in the browser',
|
|
137
134
|
async task() {
|
|
138
135
|
code = await approvalCode.promise;
|
|
139
136
|
return 'Approval code received from Google';
|
package/dist/index.js
CHANGED
|
@@ -301,8 +301,8 @@ async function getRefreshToken() {
|
|
|
301
301
|
const request = await fetch('https://accounts.google.com/o/oauth2/token', {
|
|
302
302
|
method: 'POST',
|
|
303
303
|
body: new URLSearchParams([
|
|
304
|
-
['client_id', group.clientId],
|
|
305
|
-
['client_secret', group.clientSecret],
|
|
304
|
+
['client_id', group.clientId.trim()],
|
|
305
|
+
['client_secret', group.clientSecret.trim()],
|
|
306
306
|
['code', code],
|
|
307
307
|
['grant_type', 'authorization_code'],
|
|
308
308
|
['redirect_uri', serverUrl], // Unused but required
|
|
@@ -329,7 +329,7 @@ function getLoginUrl(clientId) {
|
|
|
329
329
|
const url = new URL('https://accounts.google.com/o/oauth2/auth');
|
|
330
330
|
url.searchParams.set('response_type', 'code');
|
|
331
331
|
url.searchParams.set('access_type', 'offline');
|
|
332
|
-
url.searchParams.set('client_id', clientId);
|
|
332
|
+
url.searchParams.set('client_id', clientId.trim());
|
|
333
333
|
url.searchParams.set('scope', 'https://www.googleapis.com/auth/chromewebstore');
|
|
334
334
|
url.searchParams.set('redirect_uri', serverUrl);
|
|
335
335
|
return url.href;
|
|
@@ -338,10 +338,6 @@ function getLoginUrl(clientId) {
|
|
|
338
338
|
_clack_prompts__WEBPACK_IMPORTED_MODULE_2__/* .intro */ .mf('Follow the steps at this URL to generate the API keys, then enter them below to generate the refresh token.\n https://github.com/fregante/chrome-webstore-upload-keys');
|
|
339
339
|
const group = await _clack_prompts__WEBPACK_IMPORTED_MODULE_2__/* .group */ .ru(
|
|
340
340
|
{
|
|
341
|
-
// ExtensionId: () => p.text({
|
|
342
|
-
// message: 'Extension ID:',
|
|
343
|
-
// placeholder: 'e.g. bdeobgpddfaegbjfinhldnkfeieakdaf, it’s in the Chrome Web Store URL',
|
|
344
|
-
// }),
|
|
345
341
|
clientId: () => _clack_prompts__WEBPACK_IMPORTED_MODULE_2__/* .text */ .fL({
|
|
346
342
|
message: 'Client ID:',
|
|
347
343
|
placeholder: 'e.g. 960453266371-2qcq5fppm3d5e.apps.googleusercontent.com',
|
|
@@ -370,16 +366,17 @@ await tasks([
|
|
|
370
366
|
{
|
|
371
367
|
title: 'Opening the login page in the browser',
|
|
372
368
|
async task() {
|
|
369
|
+
const instructions = 'Complete the process in the browser. Follow its steps and warnings (this is your own personal app)';
|
|
373
370
|
if (group.open) {
|
|
374
371
|
await (0,openurl__WEBPACK_IMPORTED_MODULE_3__/* .open */ .b)(getLoginUrl(group.clientId));
|
|
375
|
-
return
|
|
372
|
+
return instructions;
|
|
376
373
|
}
|
|
377
374
|
|
|
378
|
-
return
|
|
375
|
+
return instructions + '\n\n ' + getLoginUrl(group.clientId);
|
|
379
376
|
},
|
|
380
377
|
},
|
|
381
378
|
{
|
|
382
|
-
title: 'Waiting for you
|
|
379
|
+
title: 'Waiting for you in the browser',
|
|
383
380
|
async task() {
|
|
384
381
|
code = await approvalCode.promise;
|
|
385
382
|
return 'Approval code received from Google';
|