@abtnode/core 1.7.22 → 1.7.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/blocklet/manager/disk.js +11 -1
- package/lib/states/audit-log.js +1 -3
- 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/states/audit-log.js
CHANGED
|
@@ -9,7 +9,6 @@ const logger = require('@abtnode/logger')('@abtnode/core:states:audit-log');
|
|
|
9
9
|
const BaseState = require('./base');
|
|
10
10
|
|
|
11
11
|
const { parse } = require('../util/ua');
|
|
12
|
-
const { lookup } = require('../util/ip');
|
|
13
12
|
|
|
14
13
|
const getServerInfo = (info) => `[${info.name}](${joinUrl(info.routing.adminPath, '/settings/about')})`;
|
|
15
14
|
const getBlockletInfo = (blocklet, info) => `[${getDisplayName(blocklet)} v${blocklet.meta.version}](${joinUrl(info.routing.adminPath, '/blocklets/', blocklet.meta.did, '/overview')})`; // prettier-ignore
|
|
@@ -374,7 +373,7 @@ class AuditLogState extends BaseState {
|
|
|
374
373
|
|
|
375
374
|
try {
|
|
376
375
|
const { ip, ua, user } = context;
|
|
377
|
-
const [info,
|
|
376
|
+
const [info, uaInfo] = await Promise.all([node.states.node.read(), parse(ua)]);
|
|
378
377
|
|
|
379
378
|
const data = await this.asyncDB.insert({
|
|
380
379
|
scope: getScope(args) || info.did, // server or blocklet did
|
|
@@ -384,7 +383,6 @@ class AuditLogState extends BaseState {
|
|
|
384
383
|
actor: pick(user.actual || user, ['did', 'fullName', 'role']),
|
|
385
384
|
extra: args,
|
|
386
385
|
env: pick(uaInfo, ['browser', 'os', 'device']),
|
|
387
|
-
geo: pick(geoInfo || { country: '', city: '' }, ['country', 'city']),
|
|
388
386
|
ip,
|
|
389
387
|
ua,
|
|
390
388
|
});
|
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.25",
|
|
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.25",
|
|
23
|
+
"@abtnode/constant": "1.7.25",
|
|
24
|
+
"@abtnode/cron": "1.7.25",
|
|
25
|
+
"@abtnode/db": "1.7.25",
|
|
26
|
+
"@abtnode/logger": "1.7.25",
|
|
27
|
+
"@abtnode/queue": "1.7.25",
|
|
28
|
+
"@abtnode/rbac": "1.7.25",
|
|
29
|
+
"@abtnode/router-provider": "1.7.25",
|
|
30
|
+
"@abtnode/static-server": "1.7.25",
|
|
31
|
+
"@abtnode/timemachine": "1.7.25",
|
|
32
|
+
"@abtnode/util": "1.7.25",
|
|
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.25",
|
|
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": "a500728739278c8a9464cf631a811ddfc4838fad"
|
|
84
84
|
}
|