@abtnode/core 1.7.23 → 1.7.24
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/blocklet/manager/disk.js +11 -1
- package/lib/util/index.js +17 -10
- package/package.json +15 -15
|
@@ -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
|
-
|
|
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.
|
|
6
|
+
"version": "1.7.24",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -19,24 +19,24 @@
|
|
|
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
|
-
"@abtnode/constant": "1.7.
|
|
24
|
-
"@abtnode/cron": "1.7.
|
|
25
|
-
"@abtnode/db": "1.7.
|
|
26
|
-
"@abtnode/logger": "1.7.
|
|
27
|
-
"@abtnode/queue": "1.7.
|
|
28
|
-
"@abtnode/rbac": "1.7.
|
|
29
|
-
"@abtnode/router-provider": "1.7.
|
|
30
|
-
"@abtnode/static-server": "1.7.
|
|
31
|
-
"@abtnode/timemachine": "1.7.
|
|
32
|
-
"@abtnode/util": "1.7.
|
|
22
|
+
"@abtnode/certificate-manager": "1.7.24",
|
|
23
|
+
"@abtnode/constant": "1.7.24",
|
|
24
|
+
"@abtnode/cron": "1.7.24",
|
|
25
|
+
"@abtnode/db": "1.7.24",
|
|
26
|
+
"@abtnode/logger": "1.7.24",
|
|
27
|
+
"@abtnode/queue": "1.7.24",
|
|
28
|
+
"@abtnode/rbac": "1.7.24",
|
|
29
|
+
"@abtnode/router-provider": "1.7.24",
|
|
30
|
+
"@abtnode/static-server": "1.7.24",
|
|
31
|
+
"@abtnode/timemachine": "1.7.24",
|
|
32
|
+
"@abtnode/util": "1.7.24",
|
|
33
33
|
"@arcblock/did": "^1.16.15",
|
|
34
|
-
"@arcblock/did-motif": "^1.1.
|
|
34
|
+
"@arcblock/did-motif": "^1.1.10",
|
|
35
35
|
"@arcblock/did-util": "^1.16.15",
|
|
36
36
|
"@arcblock/event-hub": "1.16.15",
|
|
37
37
|
"@arcblock/pm2-events": "^0.0.5",
|
|
38
38
|
"@arcblock/vc": "^1.16.15",
|
|
39
|
-
"@blocklet/meta": "1.7.
|
|
39
|
+
"@blocklet/meta": "1.7.24",
|
|
40
40
|
"@fidm/x509": "^1.2.1",
|
|
41
41
|
"@nedb/core": "^1.2.2",
|
|
42
42
|
"@nedb/multi": "^1.2.2",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"express": "^4.17.1",
|
|
81
81
|
"jest": "^27.4.5"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "904178e4dd0cd14c2a0a8b9131708c7ec68351e1"
|
|
84
84
|
}
|