@abtnode/core 1.16.43 → 1.16.44-beta-20250512-155818-937e465d
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 +12 -5
- package/lib/blocklet/migration-dist/migration.cjs +1 -1
- package/lib/states/passport.js +3 -5
- package/lib/team/manager.js +31 -15
- package/lib/util/blocklet.js +26 -13
- package/package.json +24 -24
|
@@ -5882,8 +5882,11 @@ class FederatedBlockletManager extends DiskBlockletManager {
|
|
|
5882
5882
|
// get link origin
|
|
5883
5883
|
const { referrer } = context;
|
|
5884
5884
|
let origin = referrer ? new URL(referrer).origin : '';
|
|
5885
|
-
|
|
5886
|
-
|
|
5885
|
+
const nodeInfo = await states.node.read();
|
|
5886
|
+
const blocklet = await this.getBlocklet(teamDid);
|
|
5887
|
+
|
|
5888
|
+
if (!origin || nodeInfo.did !== teamDid) {
|
|
5889
|
+
origin = await this.teamManager.getActionLinkOrigin(teamDid, blocklet);
|
|
5887
5890
|
}
|
|
5888
5891
|
|
|
5889
5892
|
const notificationState = await this.teamAPI.getNotificationState(teamDid);
|
|
@@ -5896,11 +5899,15 @@ class FederatedBlockletManager extends DiskBlockletManager {
|
|
|
5896
5899
|
|
|
5897
5900
|
const notificationFormat = transformNotification(notification, origin);
|
|
5898
5901
|
|
|
5899
|
-
|
|
5902
|
+
this.teamManager.applyComponentMountPoint(
|
|
5903
|
+
teamDid,
|
|
5904
|
+
notificationFormat,
|
|
5905
|
+
notification.componentDid,
|
|
5906
|
+
origin,
|
|
5907
|
+
blocklet
|
|
5908
|
+
);
|
|
5900
5909
|
|
|
5901
5910
|
// const resendReceivers = users.map((u) => u.userInfo.did);
|
|
5902
|
-
const blocklet = await this.getBlocklet(teamDid);
|
|
5903
|
-
const nodeInfo = await states.node.read();
|
|
5904
5911
|
const { wallet } = getBlockletInfo(blocklet, nodeInfo.sk);
|
|
5905
5912
|
const sender = Object.freeze({
|
|
5906
5913
|
appDid: wallet.address,
|
|
@@ -38744,7 +38744,7 @@ module.exports = require("zlib");
|
|
|
38744
38744
|
/***/ ((module) => {
|
|
38745
38745
|
|
|
38746
38746
|
"use strict";
|
|
38747
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@abtnode/core","publishConfig":{"access":"public"},"version":"1.16.
|
|
38747
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@abtnode/core","publishConfig":{"access":"public"},"version":"1.16.43","description":"","main":"lib/index.js","files":["lib"],"scripts":{"lint":"eslint tests lib --ignore-pattern \'tests/assets/*\'","lint:fix":"eslint --fix tests lib","test":"node tools/jest.js","coverage":"npm run test -- --coverage"},"keywords":[],"author":"wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)","license":"Apache-2.0","dependencies":{"@abtnode/analytics":"1.16.43","@abtnode/auth":"1.16.43","@abtnode/certificate-manager":"1.16.43","@abtnode/client":"1.16.43","@abtnode/constant":"1.16.43","@abtnode/cron":"1.16.43","@abtnode/docker-utils":"1.16.43","@abtnode/logger":"1.16.43","@abtnode/models":"1.16.43","@abtnode/queue":"1.16.43","@abtnode/rbac":"1.16.43","@abtnode/router-provider":"1.16.43","@abtnode/static-server":"1.16.43","@abtnode/timemachine":"1.16.43","@abtnode/util":"1.16.43","@arcblock/did":"1.20.8","@arcblock/did-auth":"1.20.8","@arcblock/did-ext":"1.20.8","@arcblock/did-motif":"^1.1.13","@arcblock/did-util":"1.20.8","@arcblock/event-hub":"1.20.8","@arcblock/jwt":"1.20.8","@arcblock/pm2-events":"^0.0.5","@arcblock/validator":"1.20.8","@arcblock/vc":"1.20.8","@blocklet/constant":"1.16.43","@blocklet/did-space-js":"^1.0.51","@blocklet/env":"1.16.43","@blocklet/error":"^0.2.4","@blocklet/meta":"1.16.43","@blocklet/resolver":"1.16.43","@blocklet/sdk":"1.16.43","@blocklet/store":"1.16.43","@blocklet/theme":"^2.13.29","@fidm/x509":"^1.2.1","@ocap/mcrypto":"1.20.8","@ocap/util":"1.20.8","@ocap/wallet":"1.20.8","@slack/webhook":"^5.0.4","archiver":"^7.0.1","axios":"^1.7.9","axon":"^2.0.3","chalk":"^4.1.2","cross-spawn":"^7.0.3","dayjs":"^1.11.13","deep-diff":"^1.0.2","detect-port":"^1.5.1","envfile":"^7.1.0","escape-string-regexp":"^4.0.0","fast-glob":"^3.3.2","filesize":"^10.1.1","flat":"^5.0.2","fs-extra":"^11.2.0","get-port":"^5.1.1","hasha":"^5.2.2","is-base64":"^1.1.0","is-cidr":"4","is-ip":"3","is-url":"^1.2.4","joi":"17.12.2","joi-extension-semver":"^5.0.0","js-yaml":"^4.1.0","kill-port":"^2.0.1","lodash":"^4.17.21","lru-cache":"^11.0.2","node-stream-zip":"^1.15.0","p-all":"^3.0.0","p-limit":"^3.1.0","p-map":"^4.0.0","p-retry":"^4.6.2","p-wait-for":"^3.2.0","rate-limiter-flexible":"^5.0.5","read-last-lines":"^1.8.0","semver":"^7.6.3","sequelize":"^6.35.0","shelljs":"^0.8.5","slugify":"^1.6.6","ssri":"^8.0.1","stream-throttle":"^0.1.3","stream-to-promise":"^3.0.0","systeminformation":"^5.23.3","tail":"^2.2.4","tar":"^6.1.11","transliteration":"^2.3.5","ua-parser-js":"^1.0.2","ufo":"^1.5.3","uuid":"^9.0.1","valid-url":"^1.0.9","which":"^2.0.2","xbytes":"^1.8.0"},"devDependencies":{"expand-tilde":"^2.0.2","express":"^4.18.2","jest":"^29.7.0","unzipper":"^0.10.11"},"gitHead":"e5764f753181ed6a7c615cd4fc6682aacf0cb7cd"}');
|
|
38748
38748
|
|
|
38749
38749
|
/***/ }),
|
|
38750
38750
|
|
package/lib/states/passport.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const { Op } = require('sequelize');
|
|
2
2
|
const { orderBy } = require('lodash');
|
|
3
|
+
const { PASSPORT_STATUS } = require('@abtnode/constant');
|
|
3
4
|
const BaseState = require('./base');
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -97,11 +98,8 @@ class Passport extends BaseState {
|
|
|
97
98
|
|
|
98
99
|
const result = await this.find({
|
|
99
100
|
where: {
|
|
100
|
-
status:
|
|
101
|
-
expirationDate: {
|
|
102
|
-
[Op.ne]: null,
|
|
103
|
-
[Op.lte]: now,
|
|
104
|
-
},
|
|
101
|
+
status: PASSPORT_STATUS.VALID,
|
|
102
|
+
expirationDate: { [Op.ne]: null, [Op.lte]: now },
|
|
105
103
|
},
|
|
106
104
|
});
|
|
107
105
|
|
package/lib/team/manager.js
CHANGED
|
@@ -24,9 +24,11 @@ const {
|
|
|
24
24
|
setupModels,
|
|
25
25
|
} = require('@abtnode/models');
|
|
26
26
|
const { isActivityIncluded } = require('@abtnode/util/lib/notification-preview/util');
|
|
27
|
-
const { joinURL } = require('ufo');
|
|
27
|
+
const { joinURL, withHttps } = require('ufo');
|
|
28
|
+
const { isCustomDomain } = require('@abtnode/util/lib/url-evaluation');
|
|
28
29
|
|
|
29
30
|
const { getDidDomainForBlocklet } = require('@abtnode/util/lib/get-domain-for-blocklet');
|
|
31
|
+
const getBlockletInfo = require('@blocklet/meta/lib/info');
|
|
30
32
|
const { getDomainsByDid } = require('../router/helper');
|
|
31
33
|
const { isCLI, getDbFilePath } = require('../util');
|
|
32
34
|
const { transformNotification } = require('../util/notification');
|
|
@@ -240,24 +242,37 @@ class TeamManager extends EventEmitter {
|
|
|
240
242
|
* 获取消息中链接的 Origin
|
|
241
243
|
* @returns
|
|
242
244
|
*/
|
|
243
|
-
async getActionLinkOrigin(teamDid) {
|
|
245
|
+
async getActionLinkOrigin(teamDid, blocklet) {
|
|
244
246
|
const isServices = teamDid && !this.isNodeTeam(teamDid);
|
|
245
247
|
|
|
246
248
|
if (!isServices && process.env.NODE_ENV === 'development') {
|
|
247
249
|
return process.env.ABT_NODE_BASE_URL || '';
|
|
248
250
|
}
|
|
251
|
+
// 如果有 appUrl 先返回
|
|
252
|
+
if (blocklet) {
|
|
253
|
+
const nodeInfo = await this.states.node.read();
|
|
254
|
+
const blockletInfo = getBlockletInfo(blocklet, nodeInfo.sk);
|
|
255
|
+
if (blockletInfo.appUrl) {
|
|
256
|
+
return blockletInfo.appUrl;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
249
260
|
const domains = await getDomainsByDid(isServices ? teamDid : this.nodeDid);
|
|
261
|
+
const customDomains = domains.filter((d) => isCustomDomain(d));
|
|
262
|
+
|
|
263
|
+
// 优先显示自定义域名
|
|
264
|
+
if (customDomains.length) {
|
|
265
|
+
return withHttps(customDomains[0]);
|
|
266
|
+
}
|
|
250
267
|
|
|
251
268
|
// 如果存在域名,则返回第一个域名
|
|
252
269
|
if (domains.length) {
|
|
253
|
-
return
|
|
270
|
+
return withHttps(domains[0]);
|
|
254
271
|
}
|
|
255
272
|
|
|
256
273
|
// 如果消息是 services 的消息
|
|
257
274
|
if (isServices) {
|
|
258
|
-
return
|
|
259
|
-
did: teamDid,
|
|
260
|
-
})}`;
|
|
275
|
+
return withHttps(getDidDomainForBlocklet({ did: teamDid }));
|
|
261
276
|
}
|
|
262
277
|
|
|
263
278
|
return process.env.ABT_NODE_BASE_URL || '';
|
|
@@ -378,10 +393,9 @@ class TeamManager extends EventEmitter {
|
|
|
378
393
|
/**
|
|
379
394
|
* 获取 component 的挂载点
|
|
380
395
|
*/
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
const component = blockletInfo.children?.find((x) => x.meta.did === componentDid);
|
|
396
|
+
getComponentMountPoint(teamDid, componentDid, blocklet) {
|
|
397
|
+
if (blocklet && componentDid && componentDid !== teamDid) {
|
|
398
|
+
const component = blocklet.children?.find((x) => x.meta.did === componentDid);
|
|
385
399
|
if (component) {
|
|
386
400
|
return component.mountPoint;
|
|
387
401
|
}
|
|
@@ -393,9 +407,9 @@ class TeamManager extends EventEmitter {
|
|
|
393
407
|
/**
|
|
394
408
|
* 根据 component 的挂载点,将 activity 中的链接拼接为完整的URL
|
|
395
409
|
*/
|
|
396
|
-
|
|
397
|
-
if (isActivityIncluded(notification) && componentDid && teamDid && origin) {
|
|
398
|
-
const mountPoint =
|
|
410
|
+
applyComponentMountPoint(teamDid, notification, componentDid, origin, blocklet) {
|
|
411
|
+
if (isActivityIncluded(notification) && componentDid && teamDid && origin && blocklet) {
|
|
412
|
+
const mountPoint = this.getComponentMountPoint(teamDid, componentDid, blocklet);
|
|
399
413
|
// 使用辅助函数处理URL构建
|
|
400
414
|
const applyMountPoint = (url) => (url ? joinURL(origin, mountPoint, url) : url);
|
|
401
415
|
|
|
@@ -426,11 +440,13 @@ class TeamManager extends EventEmitter {
|
|
|
426
440
|
});
|
|
427
441
|
}
|
|
428
442
|
|
|
429
|
-
const
|
|
443
|
+
const blocklet = await this.states.blocklet.getBlocklet(teamDid);
|
|
444
|
+
|
|
445
|
+
const origin = await this.getActionLinkOrigin(teamDid, blocklet);
|
|
430
446
|
|
|
431
447
|
const notification = transformNotification(doc, origin);
|
|
432
448
|
|
|
433
|
-
|
|
449
|
+
this.applyComponentMountPoint(teamDid, notification, doc.componentDid, origin, blocklet);
|
|
434
450
|
|
|
435
451
|
this.emit(EVENTS.NOTIFICATION_CREATE_QUEUED, {
|
|
436
452
|
channels: payload.channels || defaultChannel,
|
package/lib/util/blocklet.js
CHANGED
|
@@ -1686,12 +1686,33 @@ const getConfigFromPreferences = (blocklet) => {
|
|
|
1686
1686
|
return result;
|
|
1687
1687
|
};
|
|
1688
1688
|
|
|
1689
|
+
const shouldEnableSlpDomain = ({ mode, launcher }) => {
|
|
1690
|
+
if (process.env.ABT_NODE_ENABLE_SLP_DOMAIN === 'true') {
|
|
1691
|
+
return true;
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
if (process.env.ABT_NODE_ENABLE_SLP_DOMAIN === 'false') {
|
|
1695
|
+
return false;
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
return isInServerlessMode({ mode }) && !!launcher;
|
|
1699
|
+
};
|
|
1700
|
+
|
|
1689
1701
|
const getBlockletURLForLauncher = ({ blocklet, nodeInfo }) => {
|
|
1690
|
-
const
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
didDomain
|
|
1694
|
-
|
|
1702
|
+
const enableSlpDomain = shouldEnableSlpDomain({ mode: nodeInfo.mode, launcher: nodeInfo.launcher });
|
|
1703
|
+
let didDomain = '';
|
|
1704
|
+
if (enableSlpDomain) {
|
|
1705
|
+
didDomain = getDidDomainForBlocklet({
|
|
1706
|
+
// eslint-disable-next-line no-use-before-define
|
|
1707
|
+
did: getSlpDid(nodeInfo.did, blocklet.appPid),
|
|
1708
|
+
didDomain: nodeInfo.slpDomain,
|
|
1709
|
+
});
|
|
1710
|
+
} else {
|
|
1711
|
+
didDomain = getDidDomainForBlocklet({
|
|
1712
|
+
did: blocklet.appPid,
|
|
1713
|
+
didDomain: nodeInfo.didDomain,
|
|
1714
|
+
});
|
|
1715
|
+
}
|
|
1695
1716
|
|
|
1696
1717
|
return `https://${didDomain}`;
|
|
1697
1718
|
};
|
|
@@ -2213,14 +2234,6 @@ const getComponentNamesWithVersion = (app = {}, componentDids = []) => {
|
|
|
2213
2234
|
return str;
|
|
2214
2235
|
};
|
|
2215
2236
|
|
|
2216
|
-
const shouldEnableSlpDomain = ({ mode, launcher }) => {
|
|
2217
|
-
if (process.env.ABT_NODE_ENABLE_SLP_DOMAIN === 'true') {
|
|
2218
|
-
return true;
|
|
2219
|
-
}
|
|
2220
|
-
|
|
2221
|
-
return isInServerlessMode({ mode }) && !!launcher;
|
|
2222
|
-
};
|
|
2223
|
-
|
|
2224
2237
|
const getSlpDid = (serverDid, appPid) => {
|
|
2225
2238
|
if (!serverDid || !appPid) {
|
|
2226
2239
|
throw new Error('serverDid and appPid is required');
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.
|
|
6
|
+
"version": "1.16.44-beta-20250512-155818-937e465d",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -19,21 +19,21 @@
|
|
|
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.
|
|
23
|
-
"@abtnode/auth": "1.16.
|
|
24
|
-
"@abtnode/certificate-manager": "1.16.
|
|
25
|
-
"@abtnode/client": "1.16.
|
|
26
|
-
"@abtnode/constant": "1.16.
|
|
27
|
-
"@abtnode/cron": "1.16.
|
|
28
|
-
"@abtnode/docker-utils": "1.16.
|
|
29
|
-
"@abtnode/logger": "1.16.
|
|
30
|
-
"@abtnode/models": "1.16.
|
|
31
|
-
"@abtnode/queue": "1.16.
|
|
32
|
-
"@abtnode/rbac": "1.16.
|
|
33
|
-
"@abtnode/router-provider": "1.16.
|
|
34
|
-
"@abtnode/static-server": "1.16.
|
|
35
|
-
"@abtnode/timemachine": "1.16.
|
|
36
|
-
"@abtnode/util": "1.16.
|
|
22
|
+
"@abtnode/analytics": "1.16.44-beta-20250512-155818-937e465d",
|
|
23
|
+
"@abtnode/auth": "1.16.44-beta-20250512-155818-937e465d",
|
|
24
|
+
"@abtnode/certificate-manager": "1.16.44-beta-20250512-155818-937e465d",
|
|
25
|
+
"@abtnode/client": "1.16.44-beta-20250512-155818-937e465d",
|
|
26
|
+
"@abtnode/constant": "1.16.44-beta-20250512-155818-937e465d",
|
|
27
|
+
"@abtnode/cron": "1.16.44-beta-20250512-155818-937e465d",
|
|
28
|
+
"@abtnode/docker-utils": "1.16.44-beta-20250512-155818-937e465d",
|
|
29
|
+
"@abtnode/logger": "1.16.44-beta-20250512-155818-937e465d",
|
|
30
|
+
"@abtnode/models": "1.16.44-beta-20250512-155818-937e465d",
|
|
31
|
+
"@abtnode/queue": "1.16.44-beta-20250512-155818-937e465d",
|
|
32
|
+
"@abtnode/rbac": "1.16.44-beta-20250512-155818-937e465d",
|
|
33
|
+
"@abtnode/router-provider": "1.16.44-beta-20250512-155818-937e465d",
|
|
34
|
+
"@abtnode/static-server": "1.16.44-beta-20250512-155818-937e465d",
|
|
35
|
+
"@abtnode/timemachine": "1.16.44-beta-20250512-155818-937e465d",
|
|
36
|
+
"@abtnode/util": "1.16.44-beta-20250512-155818-937e465d",
|
|
37
37
|
"@arcblock/did": "1.20.8",
|
|
38
38
|
"@arcblock/did-auth": "1.20.8",
|
|
39
39
|
"@arcblock/did-ext": "1.20.8",
|
|
@@ -44,15 +44,15 @@
|
|
|
44
44
|
"@arcblock/pm2-events": "^0.0.5",
|
|
45
45
|
"@arcblock/validator": "1.20.8",
|
|
46
46
|
"@arcblock/vc": "1.20.8",
|
|
47
|
-
"@blocklet/constant": "1.16.
|
|
47
|
+
"@blocklet/constant": "1.16.44-beta-20250512-155818-937e465d",
|
|
48
48
|
"@blocklet/did-space-js": "^1.0.51",
|
|
49
|
-
"@blocklet/env": "1.16.
|
|
49
|
+
"@blocklet/env": "1.16.44-beta-20250512-155818-937e465d",
|
|
50
50
|
"@blocklet/error": "^0.2.4",
|
|
51
|
-
"@blocklet/meta": "1.16.
|
|
52
|
-
"@blocklet/resolver": "1.16.
|
|
53
|
-
"@blocklet/sdk": "1.16.
|
|
54
|
-
"@blocklet/store": "1.16.
|
|
55
|
-
"@blocklet/theme": "^2.13.
|
|
51
|
+
"@blocklet/meta": "1.16.44-beta-20250512-155818-937e465d",
|
|
52
|
+
"@blocklet/resolver": "1.16.44-beta-20250512-155818-937e465d",
|
|
53
|
+
"@blocklet/sdk": "1.16.44-beta-20250512-155818-937e465d",
|
|
54
|
+
"@blocklet/store": "1.16.44-beta-20250512-155818-937e465d",
|
|
55
|
+
"@blocklet/theme": "^2.13.29",
|
|
56
56
|
"@fidm/x509": "^1.2.1",
|
|
57
57
|
"@ocap/mcrypto": "1.20.8",
|
|
58
58
|
"@ocap/util": "1.20.8",
|
|
@@ -116,5 +116,5 @@
|
|
|
116
116
|
"jest": "^29.7.0",
|
|
117
117
|
"unzipper": "^0.10.11"
|
|
118
118
|
},
|
|
119
|
-
"gitHead": "
|
|
119
|
+
"gitHead": "562fc0ac82df09c8fc50f27811565de331bda84d"
|
|
120
120
|
}
|