@blocklet/sdk 1.6.22 → 1.6.25
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/lib/wallet-authenticator.js +10 -1
- package/package.json +10 -10
|
@@ -5,6 +5,8 @@ const getWallet = require('./wallet');
|
|
|
5
5
|
const checkBlockletEnv = require('./util/check-blocklet-env');
|
|
6
6
|
const { AUTH_SERVICE_PREFIX } = require('./util/constants');
|
|
7
7
|
|
|
8
|
+
const env = require('./env');
|
|
9
|
+
|
|
8
10
|
// wraps value in closure or returns closure
|
|
9
11
|
const closure = (value) => (typeof value === 'function' ? value : () => value);
|
|
10
12
|
|
|
@@ -26,14 +28,21 @@ class WalletAuthenticator extends Authenticator {
|
|
|
26
28
|
const info = await closure(options.appInfo)(...args);
|
|
27
29
|
|
|
28
30
|
const { request, baseUrl } = args[0];
|
|
31
|
+
const pathPrefix = request.headers['x-path-prefix'] || '/';
|
|
29
32
|
const groupPathPrefix = request.headers['x-group-path-prefix'] || '/';
|
|
30
33
|
const blockletDid = request.headers['x-blocklet-did'];
|
|
31
34
|
|
|
35
|
+
// Child blocklets should set appInfo.link to exactly the same path as the root blocklet
|
|
36
|
+
let appUrl = baseUrl;
|
|
37
|
+
if (env.isComponent && pathPrefix !== groupPathPrefix) {
|
|
38
|
+
appUrl = joinUrl(joinUrl(appUrl, '/').replace(pathPrefix, groupPathPrefix), '');
|
|
39
|
+
}
|
|
40
|
+
|
|
32
41
|
return {
|
|
33
42
|
name: process.env.BLOCKLET_APP_NAME,
|
|
34
43
|
description: process.env.BLOCKLET_APP_DESCRIPTION,
|
|
35
44
|
...(info || {}),
|
|
36
|
-
link:
|
|
45
|
+
link: appUrl,
|
|
37
46
|
icon: joinUrl(baseUrl, AUTH_SERVICE_PREFIX, `/blocklet/logo/${blockletDid}`),
|
|
38
47
|
updateSubEndpoint: true,
|
|
39
48
|
subscriptionEndpoint: joinUrl(groupPathPrefix, AUTH_SERVICE_PREFIX, 'websocket'),
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.6.
|
|
6
|
+
"version": "1.6.25",
|
|
7
7
|
"description": "graphql client to read/write data on abt node",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -19,15 +19,15 @@
|
|
|
19
19
|
"author": "linchen1987 <linchen.1987@foxmail.com> (http://github.com/linchen1987)",
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@abtnode/client": "1.6.
|
|
23
|
-
"@abtnode/constant": "1.6.
|
|
24
|
-
"@arcblock/did-auth": "^1.14.
|
|
25
|
-
"@arcblock/jwt": "^1.14.
|
|
26
|
-
"@arcblock/ws": "^1.14.
|
|
27
|
-
"@blocklet/meta": "1.6.
|
|
22
|
+
"@abtnode/client": "1.6.25",
|
|
23
|
+
"@abtnode/constant": "1.6.25",
|
|
24
|
+
"@arcblock/did-auth": "^1.14.19",
|
|
25
|
+
"@arcblock/jwt": "^1.14.19",
|
|
26
|
+
"@arcblock/ws": "^1.14.19",
|
|
27
|
+
"@blocklet/meta": "1.6.25",
|
|
28
28
|
"@nedb/core": "^1.2.2",
|
|
29
|
-
"@ocap/mcrypto": "^1.14.
|
|
30
|
-
"@ocap/wallet": "^1.14.
|
|
29
|
+
"@ocap/mcrypto": "^1.14.19",
|
|
30
|
+
"@ocap/wallet": "^1.14.19",
|
|
31
31
|
"axios": "^0.25.0",
|
|
32
32
|
"fs-extra": "^10.0.0",
|
|
33
33
|
"joi": "^17.6.0",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"detect-port": "^1.3.0",
|
|
40
40
|
"jest": "^27.4.5"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "bd2ad7d90fbd1b3786702dfca1ab28dcec9a7bc7"
|
|
43
43
|
}
|