@abtnode/core 1.16.52-beta-20250924-093428-bd3f0d8c → 1.16.52-beta-20250924-135333-541024a8
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.
|
@@ -2607,13 +2607,13 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
2607
2607
|
},
|
|
2608
2608
|
{
|
|
2609
2609
|
name: 'stop-expired-external-blocklet',
|
|
2610
|
-
time: '0 */
|
|
2610
|
+
time: '0 */10 * * * *', // 每10分钟
|
|
2611
2611
|
options: { runOnInit: false },
|
|
2612
2612
|
fn: () => this.stopExpiredBlocklets(),
|
|
2613
2613
|
},
|
|
2614
2614
|
{
|
|
2615
2615
|
name: 'clean-expired-blocklet-data',
|
|
2616
|
-
time: '0 10
|
|
2616
|
+
time: '0 10 * * * *', // 每小时
|
|
2617
2617
|
options: { runOnInit: false },
|
|
2618
2618
|
fn: () => this.cleanExpiredBlocklets(),
|
|
2619
2619
|
},
|
|
@@ -3379,8 +3379,8 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
3379
3379
|
}
|
|
3380
3380
|
|
|
3381
3381
|
return installedBlocklet;
|
|
3382
|
-
} catch (
|
|
3383
|
-
logger.error('blocklet onInstall error', {
|
|
3382
|
+
} catch (error) {
|
|
3383
|
+
logger.error('blocklet onInstall error', { error });
|
|
3384
3384
|
return null;
|
|
3385
3385
|
}
|
|
3386
3386
|
}
|
|
@@ -5147,7 +5147,7 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
5147
5147
|
}
|
|
5148
5148
|
|
|
5149
5149
|
// 订阅终止后需要再保留一段时间数据
|
|
5150
|
-
if (!launcher.isDataRetentionExceeded(launcherSession
|
|
5150
|
+
if (!launcher.isDataRetentionExceeded(launcherSession)) {
|
|
5151
5151
|
logger.info('skip cleaning the non-exceed redemption blocklet', {
|
|
5152
5152
|
blockletDid: did,
|
|
5153
5153
|
controller: data.controller,
|
|
@@ -131,6 +131,19 @@ const installApplicationFromGeneral = async ({
|
|
|
131
131
|
try {
|
|
132
132
|
await states.blockletExtras.addMeta({ did, meta: { did, name }, controller });
|
|
133
133
|
await manager._setConfigsFromMeta(did);
|
|
134
|
+
if (context.bindDomainCap && context.domainNftDid) {
|
|
135
|
+
await states.blockletExtras.setSettings(did, {
|
|
136
|
+
bindDomainCap: context.bindDomainCap,
|
|
137
|
+
domainNftDid: context.domainNftDid,
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
logger.info('set domain cap and nft did in blocklet extras', {
|
|
141
|
+
did,
|
|
142
|
+
bindDomainCap: context.bindDomainCap,
|
|
143
|
+
domainNftDid: context.domainNftDid,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
134
147
|
await states.blockletExtras.setConfigs(did, [
|
|
135
148
|
{
|
|
136
149
|
key: BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SK,
|
package/lib/router/helper.js
CHANGED
|
@@ -1220,6 +1220,55 @@ module.exports = function getRouterHelpers({
|
|
|
1220
1220
|
);
|
|
1221
1221
|
logger.info('add routing site', { site: domainGroup });
|
|
1222
1222
|
|
|
1223
|
+
const bindDomainCap = await states.blockletExtras.getSettings(blocklet.meta.did, 'bindDomainCap');
|
|
1224
|
+
const nftDid = await states.blockletExtras.getSettings(blocklet.meta.did, 'domainNftDid');
|
|
1225
|
+
const domainAlias = bindDomainCap?.cap?.domain;
|
|
1226
|
+
|
|
1227
|
+
if (bindDomainCap && nftDid && domainAlias) {
|
|
1228
|
+
logger.info('bind cap and nft did domain alias', {
|
|
1229
|
+
did: blocklet.meta.did,
|
|
1230
|
+
domainAlias,
|
|
1231
|
+
nftDid,
|
|
1232
|
+
chainHost: context.domainChainHost,
|
|
1233
|
+
});
|
|
1234
|
+
|
|
1235
|
+
const site = await states.site.findOneByBlocklet(blocklet.meta.did);
|
|
1236
|
+
|
|
1237
|
+
await routerManager
|
|
1238
|
+
.addDomainAlias(
|
|
1239
|
+
{
|
|
1240
|
+
id: site?.id,
|
|
1241
|
+
type: 'nft-domain',
|
|
1242
|
+
domainAlias,
|
|
1243
|
+
nftDid,
|
|
1244
|
+
},
|
|
1245
|
+
context
|
|
1246
|
+
)
|
|
1247
|
+
.then(() => {
|
|
1248
|
+
logger.info('bind domain alias', {
|
|
1249
|
+
did: blocklet.meta.did,
|
|
1250
|
+
domainAlias,
|
|
1251
|
+
nftDid,
|
|
1252
|
+
chainHost: context.domainChainHost,
|
|
1253
|
+
});
|
|
1254
|
+
})
|
|
1255
|
+
.catch((error) => {
|
|
1256
|
+
logger.error('bind domain alias failed', {
|
|
1257
|
+
error,
|
|
1258
|
+
did: blocklet.meta.did,
|
|
1259
|
+
domainAlias,
|
|
1260
|
+
nftDid,
|
|
1261
|
+
});
|
|
1262
|
+
});
|
|
1263
|
+
|
|
1264
|
+
logger.info('bind cap and nft did domain alias done', {
|
|
1265
|
+
did: blocklet.meta.did,
|
|
1266
|
+
domainAlias,
|
|
1267
|
+
nftDid,
|
|
1268
|
+
chainHost: context.domainChainHost,
|
|
1269
|
+
});
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1223
1272
|
return true;
|
|
1224
1273
|
}
|
|
1225
1274
|
|
package/lib/router/manager.js
CHANGED
|
@@ -337,7 +337,13 @@ class RouterManager extends EventEmitter {
|
|
|
337
337
|
const blocklet = await states.blocklet.getBlocklet(did);
|
|
338
338
|
const nodeInfo = await states.node.read();
|
|
339
339
|
|
|
340
|
-
await updateNFTDomainRecord({
|
|
340
|
+
await updateNFTDomainRecord({
|
|
341
|
+
name: domain,
|
|
342
|
+
value: didDomain.value,
|
|
343
|
+
blocklet,
|
|
344
|
+
nodeInfo,
|
|
345
|
+
bindCap: context.bindDomainCap,
|
|
346
|
+
});
|
|
341
347
|
logger.info('update nft domain record', { domain, didDomain, nftDid, id });
|
|
342
348
|
}
|
|
343
349
|
|
package/lib/util/launcher.js
CHANGED
|
@@ -432,6 +432,7 @@ const getLauncherSession = async ({ launcherUrl, launcherSessionId, external = t
|
|
|
432
432
|
'reservedUntil',
|
|
433
433
|
'userDid',
|
|
434
434
|
'walletDid',
|
|
435
|
+
'metadata',
|
|
435
436
|
]);
|
|
436
437
|
}
|
|
437
438
|
|
|
@@ -514,8 +515,27 @@ const isBlockletTerminated = async (blockletDid, controller) => {
|
|
|
514
515
|
return status === LAUNCH_SESSION_STATUS.terminated;
|
|
515
516
|
};
|
|
516
517
|
|
|
517
|
-
const isDataRetentionExceeded = (
|
|
518
|
-
|
|
518
|
+
const isDataRetentionExceeded = (launcherSession) => {
|
|
519
|
+
if (!launcherSession) {
|
|
520
|
+
return false;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
if (!launcherSession.terminatedAt) {
|
|
524
|
+
return false;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
const { terminatedAt } = launcherSession;
|
|
528
|
+
const exceeded =
|
|
529
|
+
!!terminatedAt && dayjs().diff(dayjs(terminatedAt), 'days') > SERVERLESS_BLOCKLET_DATA_RETENTION_DAYS;
|
|
530
|
+
|
|
531
|
+
if (!exceeded) {
|
|
532
|
+
logger.info('blocklet data retention not exceeded, check terminateImmediately', { launcherSession });
|
|
533
|
+
|
|
534
|
+
return launcherSession.metadata.terminateImmediately === true;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
return exceeded;
|
|
538
|
+
};
|
|
519
539
|
|
|
520
540
|
const launchBlockletByLauncher = async (node, extraParams, context) => {
|
|
521
541
|
logger.debug('launchBlockletByLauncher', { extraParams, context });
|
|
@@ -532,10 +552,18 @@ const launchBlockletByLauncher = async (node, extraParams, context) => {
|
|
|
532
552
|
// generate owner key pair
|
|
533
553
|
const info = await states.node.read();
|
|
534
554
|
const user = await getLauncherUser(info.sk, extraParams);
|
|
555
|
+
|
|
535
556
|
const userWallet = fromAppDid(`email|${user.email}`, appWallet.secretKey);
|
|
536
557
|
|
|
537
558
|
let data = {};
|
|
538
559
|
|
|
560
|
+
if (extraParams.bindDomainCap && extraParams.domainNftDid) {
|
|
561
|
+
context.bindDomainCap = JSON.parse(extraParams.bindDomainCap);
|
|
562
|
+
context.domainNftDid = extraParams.domainNftDid;
|
|
563
|
+
|
|
564
|
+
logger.info('bind domain cap', { bindDomainCap: extraParams.bindCap, domainNftDid: extraParams.domainNftDid });
|
|
565
|
+
}
|
|
566
|
+
|
|
539
567
|
const handler = createLaunchBlockletHandler(node, 'launcher');
|
|
540
568
|
await handler(
|
|
541
569
|
{
|
package/lib/util/router.js
CHANGED
|
@@ -29,7 +29,7 @@ const getNFTDomainHeaders = ({ wallet, payload }) => ({
|
|
|
29
29
|
'x-blocklet-sig': toBase58(wallet.sign(stableStringify(payload))),
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
-
const updateNFTDomainRecord = async ({ name, value, blocklet, nodeInfo }) => {
|
|
32
|
+
const updateNFTDomainRecord = async ({ name, value, blocklet, nodeInfo, bindCap }) => {
|
|
33
33
|
const { wallet } = getBlockletInfo(blocklet, nodeInfo.sk);
|
|
34
34
|
|
|
35
35
|
const payload = {
|
|
@@ -42,6 +42,15 @@ const updateNFTDomainRecord = async ({ name, value, blocklet, nodeInfo }) => {
|
|
|
42
42
|
},
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
+
let proof;
|
|
46
|
+
if (bindCap) {
|
|
47
|
+
proof = wallet.sign(stableStringify(`${bindCap.cap.sessionId}|${bindCap.cap.domain}`));
|
|
48
|
+
|
|
49
|
+
payload.bindCap = bindCap;
|
|
50
|
+
payload.proof = proof;
|
|
51
|
+
payload.delegateePk = wallet.publicKey;
|
|
52
|
+
}
|
|
53
|
+
|
|
45
54
|
const nftDomainServiceUrl = await getDidDomainServiceURL(nodeInfo.nftDomainUrl);
|
|
46
55
|
|
|
47
56
|
try {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.52-beta-20250924-
|
|
6
|
+
"version": "1.16.52-beta-20250924-135333-541024a8",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -20,21 +20,21 @@
|
|
|
20
20
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@abtnode/analytics": "1.16.52-beta-20250924-
|
|
24
|
-
"@abtnode/auth": "1.16.52-beta-20250924-
|
|
25
|
-
"@abtnode/certificate-manager": "1.16.52-beta-20250924-
|
|
26
|
-
"@abtnode/constant": "1.16.52-beta-20250924-
|
|
27
|
-
"@abtnode/cron": "1.16.52-beta-20250924-
|
|
28
|
-
"@abtnode/db-cache": "1.16.52-beta-20250924-
|
|
29
|
-
"@abtnode/docker-utils": "1.16.52-beta-20250924-
|
|
30
|
-
"@abtnode/logger": "1.16.52-beta-20250924-
|
|
31
|
-
"@abtnode/models": "1.16.52-beta-20250924-
|
|
32
|
-
"@abtnode/queue": "1.16.52-beta-20250924-
|
|
33
|
-
"@abtnode/rbac": "1.16.52-beta-20250924-
|
|
34
|
-
"@abtnode/router-provider": "1.16.52-beta-20250924-
|
|
35
|
-
"@abtnode/static-server": "1.16.52-beta-20250924-
|
|
36
|
-
"@abtnode/timemachine": "1.16.52-beta-20250924-
|
|
37
|
-
"@abtnode/util": "1.16.52-beta-20250924-
|
|
23
|
+
"@abtnode/analytics": "1.16.52-beta-20250924-135333-541024a8",
|
|
24
|
+
"@abtnode/auth": "1.16.52-beta-20250924-135333-541024a8",
|
|
25
|
+
"@abtnode/certificate-manager": "1.16.52-beta-20250924-135333-541024a8",
|
|
26
|
+
"@abtnode/constant": "1.16.52-beta-20250924-135333-541024a8",
|
|
27
|
+
"@abtnode/cron": "1.16.52-beta-20250924-135333-541024a8",
|
|
28
|
+
"@abtnode/db-cache": "1.16.52-beta-20250924-135333-541024a8",
|
|
29
|
+
"@abtnode/docker-utils": "1.16.52-beta-20250924-135333-541024a8",
|
|
30
|
+
"@abtnode/logger": "1.16.52-beta-20250924-135333-541024a8",
|
|
31
|
+
"@abtnode/models": "1.16.52-beta-20250924-135333-541024a8",
|
|
32
|
+
"@abtnode/queue": "1.16.52-beta-20250924-135333-541024a8",
|
|
33
|
+
"@abtnode/rbac": "1.16.52-beta-20250924-135333-541024a8",
|
|
34
|
+
"@abtnode/router-provider": "1.16.52-beta-20250924-135333-541024a8",
|
|
35
|
+
"@abtnode/static-server": "1.16.52-beta-20250924-135333-541024a8",
|
|
36
|
+
"@abtnode/timemachine": "1.16.52-beta-20250924-135333-541024a8",
|
|
37
|
+
"@abtnode/util": "1.16.52-beta-20250924-135333-541024a8",
|
|
38
38
|
"@aigne/aigne-hub": "^0.8.10",
|
|
39
39
|
"@arcblock/did": "1.24.0",
|
|
40
40
|
"@arcblock/did-connect-js": "1.24.0",
|
|
@@ -46,15 +46,15 @@
|
|
|
46
46
|
"@arcblock/pm2-events": "^0.0.5",
|
|
47
47
|
"@arcblock/validator": "1.24.0",
|
|
48
48
|
"@arcblock/vc": "1.24.0",
|
|
49
|
-
"@blocklet/constant": "1.16.52-beta-20250924-
|
|
49
|
+
"@blocklet/constant": "1.16.52-beta-20250924-135333-541024a8",
|
|
50
50
|
"@blocklet/did-space-js": "^1.1.24",
|
|
51
|
-
"@blocklet/env": "1.16.52-beta-20250924-
|
|
51
|
+
"@blocklet/env": "1.16.52-beta-20250924-135333-541024a8",
|
|
52
52
|
"@blocklet/error": "^0.2.5",
|
|
53
|
-
"@blocklet/meta": "1.16.52-beta-20250924-
|
|
54
|
-
"@blocklet/resolver": "1.16.52-beta-20250924-
|
|
55
|
-
"@blocklet/sdk": "1.16.52-beta-20250924-
|
|
56
|
-
"@blocklet/server-js": "1.16.52-beta-20250924-
|
|
57
|
-
"@blocklet/store": "1.16.52-beta-20250924-
|
|
53
|
+
"@blocklet/meta": "1.16.52-beta-20250924-135333-541024a8",
|
|
54
|
+
"@blocklet/resolver": "1.16.52-beta-20250924-135333-541024a8",
|
|
55
|
+
"@blocklet/sdk": "1.16.52-beta-20250924-135333-541024a8",
|
|
56
|
+
"@blocklet/server-js": "1.16.52-beta-20250924-135333-541024a8",
|
|
57
|
+
"@blocklet/store": "1.16.52-beta-20250924-135333-541024a8",
|
|
58
58
|
"@blocklet/theme": "^3.1.41",
|
|
59
59
|
"@fidm/x509": "^1.2.1",
|
|
60
60
|
"@ocap/mcrypto": "1.24.0",
|
|
@@ -119,5 +119,5 @@
|
|
|
119
119
|
"jest": "^29.7.0",
|
|
120
120
|
"unzipper": "^0.10.11"
|
|
121
121
|
},
|
|
122
|
-
"gitHead": "
|
|
122
|
+
"gitHead": "49da2436236dcd95eac44d785d6d2847efd3c643"
|
|
123
123
|
}
|