@abtnode/core 1.7.23 → 1.7.26

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.
@@ -686,7 +686,8 @@ class BlockletManager extends BaseBlockletManager {
686
686
  try {
687
687
  const blocklet = await this.ensureBlocklet(did);
688
688
  return blocklet;
689
- } catch {
689
+ } catch (e) {
690
+ logger.error('get blocklet detail error', { error: e.message });
690
691
  return null;
691
692
  }
692
693
  }
@@ -1318,6 +1319,15 @@ class BlockletManager extends BaseBlockletManager {
1318
1319
  blocklet = { ...cachedBlocklet, ...blocklet };
1319
1320
  }
1320
1321
 
1322
+ // 处理 domainAliases#value SLOT_FOR_IP_DNS_SITE
1323
+ if (blocklet?.site?.domainAliases?.length) {
1324
+ const nodeIp = await getAccessibleExternalNodeIp(nodeInfo);
1325
+ blocklet.site.domainAliases = blocklet.site.domainAliases.map((x) => ({
1326
+ ...x,
1327
+ value: util.replaceDomainSlot({ domain: x.value, context, nodeIp }),
1328
+ }));
1329
+ }
1330
+
1321
1331
  blocklet.interfaces = await this.getBlockletInterfaces({ blocklet, nodeInfo, context });
1322
1332
 
1323
1333
  if (!fromCache) {
package/lib/util/index.js CHANGED
@@ -68,6 +68,21 @@ const getInterfaceUrl = ({ baseUrl, url }) => {
68
68
 
69
69
  const trimSlash = (str = '') => str.replace(/^\/+/, '').replace(/\/+$/, '');
70
70
 
71
+ const replaceDomainSlot = ({ domain, context = {}, nodeIp }) => {
72
+ let processed = domain;
73
+ if (processed.includes(SLOT_FOR_IP_DNS_SITE)) {
74
+ const ipRegex = /\d+[-.]\d+[-.]\d+[-.]\d+/;
75
+ const match = ipRegex.exec(context.hostname);
76
+ if (match) {
77
+ const ip = match[0];
78
+ processed = replaceSlotToIp(processed, ip);
79
+ } else if (nodeIp) {
80
+ processed = replaceSlotToIp(processed, nodeIp);
81
+ }
82
+ }
83
+ return processed;
84
+ };
85
+
71
86
  const getBlockletHost = ({ domain, context, nodeIp }) => {
72
87
  const { protocol, port } = context || {};
73
88
 
@@ -80,16 +95,7 @@ const getBlockletHost = ({ domain, context, nodeIp }) => {
80
95
  tmpDomain = context.hostname || '';
81
96
  }
82
97
 
83
- if (tmpDomain.includes(SLOT_FOR_IP_DNS_SITE)) {
84
- const ipRegex = /\d+[-.]\d+[-.]\d+[-.]\d+/;
85
- const match = ipRegex.exec(context.hostname);
86
- if (match) {
87
- const ip = match[0];
88
- tmpDomain = replaceSlotToIp(tmpDomain, ip);
89
- } else if (nodeIp) {
90
- tmpDomain = replaceSlotToIp(tmpDomain, nodeIp);
91
- }
92
- }
98
+ tmpDomain = replaceDomainSlot({ domain: tmpDomain, context, nodeIp });
93
99
 
94
100
  if (!port) {
95
101
  return tmpDomain;
@@ -541,6 +547,7 @@ const lib = {
541
547
  isBeforeInstalled,
542
548
  getInterfaceUrl,
543
549
  getBlockletBaseUrls,
550
+ replaceDomainSlot,
544
551
  getBlockletHost,
545
552
  getBlockletInterfaces,
546
553
  isRoutingEnabled,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.7.23",
6
+ "version": "1.7.26",
7
7
  "description": "",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -19,30 +19,30 @@
19
19
  "author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
- "@abtnode/certificate-manager": "1.7.23",
23
- "@abtnode/constant": "1.7.23",
24
- "@abtnode/cron": "1.7.23",
25
- "@abtnode/db": "1.7.23",
26
- "@abtnode/logger": "1.7.23",
27
- "@abtnode/queue": "1.7.23",
28
- "@abtnode/rbac": "1.7.23",
29
- "@abtnode/router-provider": "1.7.23",
30
- "@abtnode/static-server": "1.7.23",
31
- "@abtnode/timemachine": "1.7.23",
32
- "@abtnode/util": "1.7.23",
33
- "@arcblock/did": "^1.16.15",
34
- "@arcblock/did-motif": "^1.1.9",
35
- "@arcblock/did-util": "^1.16.15",
36
- "@arcblock/event-hub": "1.16.15",
22
+ "@abtnode/certificate-manager": "1.7.26",
23
+ "@abtnode/constant": "1.7.26",
24
+ "@abtnode/cron": "1.7.26",
25
+ "@abtnode/db": "1.7.26",
26
+ "@abtnode/logger": "1.7.26",
27
+ "@abtnode/queue": "1.7.26",
28
+ "@abtnode/rbac": "1.7.26",
29
+ "@abtnode/router-provider": "1.7.26",
30
+ "@abtnode/static-server": "1.7.26",
31
+ "@abtnode/timemachine": "1.7.26",
32
+ "@abtnode/util": "1.7.26",
33
+ "@arcblock/did": "1.17.0",
34
+ "@arcblock/did-motif": "^1.1.10",
35
+ "@arcblock/did-util": "1.17.0",
36
+ "@arcblock/event-hub": "1.17.0",
37
37
  "@arcblock/pm2-events": "^0.0.5",
38
- "@arcblock/vc": "^1.16.15",
39
- "@blocklet/meta": "1.7.23",
38
+ "@arcblock/vc": "1.17.0",
39
+ "@blocklet/meta": "1.7.26",
40
40
  "@fidm/x509": "^1.2.1",
41
41
  "@nedb/core": "^1.2.2",
42
42
  "@nedb/multi": "^1.2.2",
43
- "@ocap/mcrypto": "^1.16.15",
44
- "@ocap/util": "^1.16.15",
45
- "@ocap/wallet": "^1.16.15",
43
+ "@ocap/mcrypto": "1.17.0",
44
+ "@ocap/util": "1.17.0",
45
+ "@ocap/wallet": "1.17.0",
46
46
  "@slack/webhook": "^5.0.3",
47
47
  "axios": "^0.27.2",
48
48
  "axon": "^2.0.3",
@@ -80,5 +80,5 @@
80
80
  "express": "^4.17.1",
81
81
  "jest": "^27.4.5"
82
82
  },
83
- "gitHead": "aa13838b7597bce11851d0b902575f861aa1ab34"
83
+ "gitHead": "b7ef9b4ddb18f7a0c3898177fe06d9cefe966566"
84
84
  }