@shoplifter/cli 0.1.11 → 0.1.12
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/dist/auth.js +3 -1
- package/dist/release-manifest.json +1 -1
- package/package.json +4 -4
package/dist/auth.js
CHANGED
|
@@ -47,7 +47,9 @@ export async function login(channelCode) {
|
|
|
47
47
|
const origin = apiOrigin();
|
|
48
48
|
const grant = await response(await fetch(new URL('/shoplifter-cli/device', origin), { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ scopes: ['read', 'content', 'source'] }), signal: AbortSignal.timeout(15000) }));
|
|
49
49
|
const url = new URL(grant.verificationUri);
|
|
50
|
-
|
|
50
|
+
const loopback = (value) => value.protocol === 'http:' && ['localhost', '127.0.0.1', '[::1]'].includes(value.hostname);
|
|
51
|
+
const localDashboard = loopback(origin) && loopback(url) && url.hostname === origin.hostname;
|
|
52
|
+
if (url.username || url.password || url.origin !== origin.origin && !localDashboard || !/^[A-F0-9]{10}$/.test(grant.userCode))
|
|
51
53
|
throw new Error('Invalid CLI approval response');
|
|
52
54
|
url.searchParams.set('code', grant.userCode);
|
|
53
55
|
if (channelCode)
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shoplifter/cli",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"shoplifterRuntimeVersion": "0.3.
|
|
5
|
-
"shoplifterContractVersion": "0.3.
|
|
3
|
+
"version": "0.1.12",
|
|
4
|
+
"shoplifterRuntimeVersion": "0.3.3",
|
|
5
|
+
"shoplifterContractVersion": "0.3.2",
|
|
6
6
|
"private": false,
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"repository": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"ignore": "^7.0.14",
|
|
35
35
|
"tar-stream": "3.2.2",
|
|
36
36
|
"reflect-metadata": "^0.1.14",
|
|
37
|
-
"@shoplifter/presentation-contract": "0.3.
|
|
37
|
+
"@shoplifter/presentation-contract": "0.3.2"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/node": "^24.19.2",
|