@abtnode/core 1.16.34 → 1.16.35

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/api/team.js CHANGED
@@ -18,7 +18,7 @@ const {
18
18
  SESSION_TTL,
19
19
  } = require('@abtnode/constant');
20
20
  const { isValid: isValidDid } = require('@arcblock/did');
21
- const { BlockletEvents, TeamEvents } = require('@blocklet/constant');
21
+ const { BlockletEvents, TeamEvents, BlockletInternalEvents } = require('@blocklet/constant');
22
22
  const { sendToUser } = require('@blocklet/sdk/lib/util/send-notification');
23
23
  const {
24
24
  createPassportVC,
@@ -1907,6 +1907,12 @@ class TeamAPI extends EventEmitter {
1907
1907
  await this.states.blockletExtras.setSettings(blocklet.meta.did, { session: sessionConfig });
1908
1908
  this.emit(BlockletEvents.updated, { meta: { did: teamDid } });
1909
1909
 
1910
+ // NOTE: we need emit appConfigChanged event to update sessionSalt in blocklet-sdk
1911
+ this.emit(BlockletInternalEvents.appConfigChanged, {
1912
+ appDid: teamDid,
1913
+ configs: [{ key: 'BLOCKLET_APP_SALT', value: sessionConfig.salt }],
1914
+ });
1915
+
1910
1916
  return 1;
1911
1917
  }
1912
1918
  }
@@ -64,6 +64,7 @@ const { titleSchema, updateMountPointSchema, environmentNameSchema } = require('
64
64
  const { emailConfigSchema } = require('@blocklet/sdk/lib/validators/email');
65
65
  const { encrypt } = require('@blocklet/sdk/lib/security');
66
66
  const Lock = require('@abtnode/util/lib/lock');
67
+ const { generateRandomString } = require('@abtnode/models/lib/util');
67
68
  const { getComponentApiKey, getBlockletLogos } = require('@abtnode/util/lib/blocklet');
68
69
 
69
70
  const {
@@ -1490,7 +1491,14 @@ class DiskBlockletManager extends BaseBlockletManager {
1490
1491
 
1491
1492
  // Get blocklet by blockletDid or appDid
1492
1493
  async detail(
1493
- { did, attachConfig = true, attachRuntimeInfo, attachDiskInfo = false, useCache, getOptionalComponents },
1494
+ {
1495
+ did,
1496
+ attachConfig = true,
1497
+ attachRuntimeInfo = false,
1498
+ attachDiskInfo = false,
1499
+ useCache = false,
1500
+ getOptionalComponents = false,
1501
+ },
1494
1502
  context
1495
1503
  ) {
1496
1504
  if (!did) {
@@ -3620,7 +3628,9 @@ class DiskBlockletManager extends BaseBlockletManager {
3620
3628
  if (['eth', 'ethereum'].includes(customChainType)) {
3621
3629
  chainTypeEnv.value = 'ethereum';
3622
3630
  }
3631
+
3623
3632
  await states.blockletExtras.setConfigs(blocklet.meta.did, [chainTypeEnv]);
3633
+ await states.blockletExtras.setSettings(blocklet.meta.did, { session: { salt: generateRandomString(16) } });
3624
3634
 
3625
3635
  return blocklet;
3626
3636
  }
@@ -244,6 +244,7 @@ const createRelease = async ({
244
244
  blockletSupport,
245
245
  blockletCommunity,
246
246
  blockletRepository,
247
+ blockletVideos,
247
248
  blockletScreenshots,
248
249
  blockletComponents,
249
250
  blockletResourceType,
@@ -498,7 +498,9 @@ module.exports = ({
498
498
  listen(teamAPI, TeamEvents[key], onEvent);
499
499
  });
500
500
 
501
+ listen(teamAPI, BlockletInternalEvents.appConfigChanged, onEvent);
501
502
  listen(teamAPI, BlockletEvents.updated, onEvent);
503
+
502
504
  listen(teamManager, BlockletEvents.storeChange, onEvent);
503
505
  listen(teamManager, EVENTS.NOTIFICATION_BLOCKLET_CREATE, onEvent);
504
506
 
@@ -358,6 +358,7 @@ const getAppSystemEnvironments = (blocklet, nodeInfo, dataDirs) => {
358
358
  BLOCKLET_APP_URL: appUrl,
359
359
  BLOCKLET_APP_DATA_DIR: path.join(dataDirs.data, blocklet.meta.name),
360
360
  BLOCKLET_APP_TENANT_MODE: result.tenantMode || BLOCKLET_TENANT_MODES.SINGLE,
361
+ BLOCKLET_APP_SALT: blocklet.settings?.session?.salt || '',
361
362
  };
362
363
  };
363
364
 
@@ -14,7 +14,6 @@ const {
14
14
  getAvatarByUrl,
15
15
  getAppAvatarUrl,
16
16
  } = require('@abtnode/util/lib/user');
17
- const { Hasher } = require('@ocap/mcrypto');
18
17
  const { getDisplayName } = require('@blocklet/meta/lib/util');
19
18
  const getBlockletInfo = require('@blocklet/meta/lib/info');
20
19
  const { getBlockletLogos } = require('@abtnode/util/lib/blocklet');
@@ -208,7 +207,7 @@ const setupAppOwner = async ({ node, sessionId, justCreate = false, context }) =
208
207
  launcherUrl,
209
208
  launcherSessionId,
210
209
  } = session;
211
- const [info, blocklet] = await Promise.all([states.node.read(), states.blocklet.getBlocklet(appDid)]);
210
+ const [info, blocklet] = await Promise.all([states.node.read(), node.getBlocklet({ did: appDid })]);
212
211
  if (!blocklet) {
213
212
  throw new Error(`Blocklet not found in server: ${appDid}`);
214
213
  }
@@ -216,11 +215,10 @@ const setupAppOwner = async ({ node, sessionId, justCreate = false, context }) =
216
215
  // 安装后 blocklet.environments 可能不会立即有值,可以从 node.getBlockletEnvironments 获取
217
216
  if (isEmpty(blocklet.environments)) {
218
217
  const { all } = await node.getBlockletEnvironments(appDid);
219
-
220
218
  blocklet.environments = all;
221
219
  }
222
220
 
223
- const { wallet } = getBlockletInfo(blocklet, info.sk);
221
+ const { wallet, secret } = getBlockletInfo(blocklet, info.sk);
224
222
  const appUrl = blocklet.environments.find((x) => x.key === 'BLOCKLET_APP_URL').value;
225
223
  const dataDir = blocklet.environments.find((x) => x.key === 'BLOCKLET_DATA_DIR').value;
226
224
  const serverDataDir = path.join(node.dataDirs.data, NODE_DATA_DIR_NAME);
@@ -311,13 +309,12 @@ const setupAppOwner = async ({ node, sessionId, justCreate = false, context }) =
311
309
  logger.info('Create owner for blocklet', { appDid, ownerDid, sessionId });
312
310
 
313
311
  // create owner login token that can be used to login on blocklet site
314
- const appSecret = Hasher.SHA3.hash256(Buffer.concat([wallet.secretKey, wallet.address].map((v) => Buffer.from(v))));
315
312
  const setupToken = createAuthToken({
316
313
  did: ownerDid,
317
314
  passport,
318
315
  role,
319
316
  fullName: appOwnerProfile?.fullName,
320
- secret: appSecret,
317
+ secret,
321
318
  expiresIn: '1h',
322
319
  elevated: true,
323
320
  });
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.34",
6
+ "version": "1.16.35",
7
7
  "description": "",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -19,19 +19,19 @@
19
19
  "author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
20
20
  "license": "Apache-2.0",
21
21
  "dependencies": {
22
- "@abtnode/analytics": "1.16.34",
23
- "@abtnode/auth": "1.16.34",
24
- "@abtnode/certificate-manager": "1.16.34",
25
- "@abtnode/constant": "1.16.34",
26
- "@abtnode/cron": "1.16.34",
27
- "@abtnode/logger": "1.16.34",
28
- "@abtnode/models": "1.16.34",
29
- "@abtnode/queue": "1.16.34",
30
- "@abtnode/rbac": "1.16.34",
31
- "@abtnode/router-provider": "1.16.34",
32
- "@abtnode/static-server": "1.16.34",
33
- "@abtnode/timemachine": "1.16.34",
34
- "@abtnode/util": "1.16.34",
22
+ "@abtnode/analytics": "1.16.35",
23
+ "@abtnode/auth": "1.16.35",
24
+ "@abtnode/certificate-manager": "1.16.35",
25
+ "@abtnode/constant": "1.16.35",
26
+ "@abtnode/cron": "1.16.35",
27
+ "@abtnode/logger": "1.16.35",
28
+ "@abtnode/models": "1.16.35",
29
+ "@abtnode/queue": "1.16.35",
30
+ "@abtnode/rbac": "1.16.35",
31
+ "@abtnode/router-provider": "1.16.35",
32
+ "@abtnode/static-server": "1.16.35",
33
+ "@abtnode/timemachine": "1.16.35",
34
+ "@abtnode/util": "1.16.35",
35
35
  "@arcblock/did": "1.18.162",
36
36
  "@arcblock/did-auth": "1.18.162",
37
37
  "@arcblock/did-ext": "^1.18.162",
@@ -42,13 +42,13 @@
42
42
  "@arcblock/pm2-events": "^0.0.5",
43
43
  "@arcblock/validator": "^1.18.162",
44
44
  "@arcblock/vc": "1.18.162",
45
- "@blocklet/constant": "1.16.34",
45
+ "@blocklet/constant": "1.16.35",
46
46
  "@blocklet/did-space-js": "^0.5.82",
47
- "@blocklet/env": "1.16.34",
48
- "@blocklet/meta": "1.16.34",
49
- "@blocklet/resolver": "1.16.34",
50
- "@blocklet/sdk": "1.16.34",
51
- "@blocklet/store": "1.16.34",
47
+ "@blocklet/env": "1.16.35",
48
+ "@blocklet/meta": "1.16.35",
49
+ "@blocklet/resolver": "1.16.35",
50
+ "@blocklet/sdk": "1.16.35",
51
+ "@blocklet/store": "1.16.35",
52
52
  "@fidm/x509": "^1.2.1",
53
53
  "@ocap/mcrypto": "1.18.162",
54
54
  "@ocap/util": "1.18.162",
@@ -108,5 +108,5 @@
108
108
  "jest": "^29.7.0",
109
109
  "unzipper": "^0.10.11"
110
110
  },
111
- "gitHead": "843b12c2cbf9c11497dea690783735f0a83551c9"
111
+ "gitHead": "a1888a5814c97a1cf6adfcee4e4d0721eabba7c3"
112
112
  }