@abtnode/auth 1.16.31-beta-4246ab25 → 1.16.31-beta-a0cc72cf

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.
Files changed (2) hide show
  1. package/lib/launcher.js +8 -3
  2. package/package.json +9 -9
package/lib/launcher.js CHANGED
@@ -14,10 +14,11 @@ const LAUNCHER_BLOCKLET_DID = 'z8iZkFBbrVQxZHvcWWB3Sa2TrfGmSeFz9MSU7';
14
14
  const schema = Joi.object({
15
15
  launcherSessionId: Joi.string().required(),
16
16
  launcherUrl: Joi.string().uri().required(),
17
+ locale: Joi.string().optional(),
17
18
  });
18
19
 
19
20
  // eslint-disable-next-line require-await
20
- const doRequest = async (serverSk, { launcherUrl, pathname, payload, method = 'post' }) => {
21
+ const doRequest = async (serverSk, { launcherUrl, pathname, payload, method = 'post', locale = 'en' }) => {
21
22
  if (!serverSk) {
22
23
  throw new Error('serverSk is required to request launcher');
23
24
  }
@@ -34,13 +35,16 @@ const doRequest = async (serverSk, { launcherUrl, pathname, payload, method = 'p
34
35
 
35
36
  const url = joinURL(baseURL, mountPoint.mountPoint, pathname);
36
37
 
38
+ let params = method === 'get' ? payload : {};
39
+ params = { ...(params || {}), locale };
40
+
37
41
  logger.info('do launcher request', { url, method, payload });
38
42
 
39
43
  const { data } = await axios({
40
44
  method,
41
45
  url,
42
46
  data: method !== 'get' ? payload : {},
43
- params: method === 'get' ? payload : {},
47
+ params,
44
48
  headers: {
45
49
  'x-server-sig': toBase58(wallet.sign(stableStringify(payload))),
46
50
  },
@@ -70,13 +74,14 @@ const getLauncherSession = async (serverSk, params) => {
70
74
  return { error: formatError(error) };
71
75
  }
72
76
 
73
- const { launcherSessionId, launcherUrl } = params;
77
+ const { launcherSessionId, launcherUrl, locale } = params;
74
78
  try {
75
79
  const result = await doRequest(serverSk, {
76
80
  launcherUrl: launcherUrl || 'https://launcher.arcblock.io/',
77
81
  pathname: `/api/launches/${launcherSessionId}`,
78
82
  payload: {},
79
83
  method: 'get',
84
+ locale,
80
85
  });
81
86
  return { error: '', launcherSession: result.launch };
82
87
  } catch (err) {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.31-beta-4246ab25",
6
+ "version": "1.16.31-beta-a0cc72cf",
7
7
  "description": "Simple lib to manage auth in ABT Node",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -20,17 +20,17 @@
20
20
  "author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
21
21
  "license": "Apache-2.0",
22
22
  "dependencies": {
23
- "@abtnode/constant": "1.16.31-beta-4246ab25",
24
- "@abtnode/logger": "1.16.31-beta-4246ab25",
25
- "@abtnode/util": "1.16.31-beta-4246ab25",
23
+ "@abtnode/constant": "1.16.31-beta-a0cc72cf",
24
+ "@abtnode/logger": "1.16.31-beta-a0cc72cf",
25
+ "@abtnode/util": "1.16.31-beta-a0cc72cf",
26
26
  "@arcblock/did": "1.18.135",
27
27
  "@arcblock/jwt": "^1.18.135",
28
- "@arcblock/nft-display": "^2.10.27",
28
+ "@arcblock/nft-display": "^2.10.28",
29
29
  "@arcblock/validator": "^1.18.135",
30
30
  "@arcblock/vc": "1.18.135",
31
- "@blocklet/constant": "1.16.31-beta-4246ab25",
32
- "@blocklet/meta": "1.16.31-beta-4246ab25",
33
- "@blocklet/sdk": "1.16.31-beta-4246ab25",
31
+ "@blocklet/constant": "1.16.31-beta-a0cc72cf",
32
+ "@blocklet/meta": "1.16.31-beta-a0cc72cf",
33
+ "@blocklet/sdk": "1.16.31-beta-a0cc72cf",
34
34
  "@ocap/client": "^1.18.135",
35
35
  "@ocap/mcrypto": "1.18.135",
36
36
  "@ocap/util": "1.18.135",
@@ -50,5 +50,5 @@
50
50
  "devDependencies": {
51
51
  "jest": "^29.7.0"
52
52
  },
53
- "gitHead": "ef93705b89033e4cd5fed458b64521d0a994a1d0"
53
+ "gitHead": "d1eec814979a4086fc5efd7c719687b76c972ec6"
54
54
  }