@abtnode/core 1.8.14 → 1.8.15
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 +24 -26
- package/package.json +15 -15
|
@@ -217,7 +217,7 @@ class BlockletManager extends BaseBlockletManager {
|
|
|
217
217
|
* @param {{
|
|
218
218
|
* url: string;
|
|
219
219
|
* sync: boolean = false;
|
|
220
|
-
*
|
|
220
|
+
* downloadTokenList: Array<{did: string, token: string};
|
|
221
221
|
* }} params
|
|
222
222
|
* @param {{
|
|
223
223
|
* [key: string]: any
|
|
@@ -228,20 +228,16 @@ class BlockletManager extends BaseBlockletManager {
|
|
|
228
228
|
async install(params, context = {}) {
|
|
229
229
|
logger.debug('install blocklet', { params, context });
|
|
230
230
|
|
|
231
|
-
|
|
232
|
-
const info = await states.node.read();
|
|
231
|
+
const info = await states.node.read();
|
|
233
232
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}),
|
|
243
|
-
});
|
|
244
|
-
}
|
|
233
|
+
context.headers = Object.assign(context?.headers || {}, {
|
|
234
|
+
'x-server-did': info.did,
|
|
235
|
+
'x-server-public-key': info.pk,
|
|
236
|
+
'x-server-signature': sign(info.did, info.sk, {
|
|
237
|
+
exp: (Date.now() + 5 * 60 * 1000) / 1000,
|
|
238
|
+
}),
|
|
239
|
+
});
|
|
240
|
+
context.downloadTokenList = params.downloadTokenList || [];
|
|
245
241
|
|
|
246
242
|
const source = getSourceFromInstallParams(params);
|
|
247
243
|
if (typeof context.startImmediately === 'undefined') {
|
|
@@ -289,7 +285,7 @@ class BlockletManager extends BaseBlockletManager {
|
|
|
289
285
|
* @param {ConfigEntry} configs pre configs
|
|
290
286
|
*/
|
|
291
287
|
async installComponent(
|
|
292
|
-
{ rootDid, mountPoint, url, file, did, diffVersion, deleteSet, title, name, configs,
|
|
288
|
+
{ rootDid, mountPoint, url, file, did, diffVersion, deleteSet, title, name, configs, downloadTokenList },
|
|
293
289
|
context = {}
|
|
294
290
|
) {
|
|
295
291
|
logger.debug('start install component', { rootDid, mountPoint, url });
|
|
@@ -308,7 +304,7 @@ class BlockletManager extends BaseBlockletManager {
|
|
|
308
304
|
did,
|
|
309
305
|
name,
|
|
310
306
|
configs,
|
|
311
|
-
|
|
307
|
+
downloadTokenList,
|
|
312
308
|
});
|
|
313
309
|
}
|
|
314
310
|
|
|
@@ -1889,7 +1885,7 @@ class BlockletManager extends BaseBlockletManager {
|
|
|
1889
1885
|
name: inputName,
|
|
1890
1886
|
did: inputDid,
|
|
1891
1887
|
configs,
|
|
1892
|
-
|
|
1888
|
+
downloadTokenList,
|
|
1893
1889
|
}) {
|
|
1894
1890
|
const blocklet = await this._getBlockletForInstallation(rootDid);
|
|
1895
1891
|
if (!blocklet) {
|
|
@@ -1909,14 +1905,12 @@ class BlockletManager extends BaseBlockletManager {
|
|
|
1909
1905
|
...context,
|
|
1910
1906
|
headers: {
|
|
1911
1907
|
'x-server-did': info.did,
|
|
1912
|
-
'x-download-token': downloadToken,
|
|
1913
|
-
// FIXME: 先保证兼容性,后续删除
|
|
1914
|
-
'x-server-publick-key': info.pk,
|
|
1915
1908
|
'x-server-public-key': info.pk,
|
|
1916
1909
|
'x-server-signature': sign(info.did, info.sk, {
|
|
1917
1910
|
exp: (Date.now() + 5 * 60 * 1000) / 1000,
|
|
1918
1911
|
}),
|
|
1919
1912
|
},
|
|
1913
|
+
downloadTokenList: downloadTokenList || [],
|
|
1920
1914
|
};
|
|
1921
1915
|
}
|
|
1922
1916
|
|
|
@@ -2482,14 +2476,12 @@ class BlockletManager extends BaseBlockletManager {
|
|
|
2482
2476
|
...context,
|
|
2483
2477
|
headers: {
|
|
2484
2478
|
'x-server-did': info.did,
|
|
2485
|
-
'x-download-token': blocklet?.tokens?.paidBlockletDownloadToken,
|
|
2486
|
-
// FIXME: 先保证兼容性,后续删除
|
|
2487
|
-
'x-server-publick-key': info.pk,
|
|
2488
2479
|
'x-server-public-key': info.pk,
|
|
2489
2480
|
'x-server-signature': sign(info.did, info.sk, {
|
|
2490
2481
|
exp: (Date.now() + 5 * 60 * 1000) / 1000,
|
|
2491
2482
|
}),
|
|
2492
2483
|
},
|
|
2484
|
+
downloadTokenList: blocklet?.tokens?.downloadTokenList || [],
|
|
2493
2485
|
};
|
|
2494
2486
|
}
|
|
2495
2487
|
|
|
@@ -2726,10 +2718,10 @@ class BlockletManager extends BaseBlockletManager {
|
|
|
2726
2718
|
// Update dynamic component meta in blocklet settings
|
|
2727
2719
|
await this._ensureDynamicChildrenInSettings(blocklet);
|
|
2728
2720
|
|
|
2729
|
-
if (context?.
|
|
2721
|
+
if (context?.downloadTokenList?.length) {
|
|
2730
2722
|
await states.blocklet.updateBlocklet(did, {
|
|
2731
2723
|
tokens: {
|
|
2732
|
-
|
|
2724
|
+
downloadTokenList: context.downloadTokenList,
|
|
2733
2725
|
},
|
|
2734
2726
|
});
|
|
2735
2727
|
}
|
|
@@ -2968,7 +2960,13 @@ class BlockletManager extends BaseBlockletManager {
|
|
|
2968
2960
|
}
|
|
2969
2961
|
ctrlStore[rootDid].set(did, cancelCtrl);
|
|
2970
2962
|
|
|
2971
|
-
|
|
2963
|
+
const headers = context.headers ? cloneDeep(context.headers) : {};
|
|
2964
|
+
const exist = (context.downloadTokenList || []).find((x) => x.did === did);
|
|
2965
|
+
if (exist) {
|
|
2966
|
+
headers['x-download-token'] = exist.token;
|
|
2967
|
+
}
|
|
2968
|
+
|
|
2969
|
+
await downloadFile(url, path.join(cwd, tarballName), { cancelCtrl }, { ...context, headers });
|
|
2972
2970
|
|
|
2973
2971
|
if (ctrlStore[rootDid]) {
|
|
2974
2972
|
ctrlStore[rootDid].delete(did);
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.8.
|
|
6
|
+
"version": "1.8.15",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -19,17 +19,17 @@
|
|
|
19
19
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@abtnode/certificate-manager": "1.8.
|
|
23
|
-
"@abtnode/constant": "1.8.
|
|
24
|
-
"@abtnode/cron": "1.8.
|
|
25
|
-
"@abtnode/db": "1.8.
|
|
26
|
-
"@abtnode/logger": "1.8.
|
|
27
|
-
"@abtnode/queue": "1.8.
|
|
28
|
-
"@abtnode/rbac": "1.8.
|
|
29
|
-
"@abtnode/router-provider": "1.8.
|
|
30
|
-
"@abtnode/static-server": "1.8.
|
|
31
|
-
"@abtnode/timemachine": "1.8.
|
|
32
|
-
"@abtnode/util": "1.8.
|
|
22
|
+
"@abtnode/certificate-manager": "1.8.15",
|
|
23
|
+
"@abtnode/constant": "1.8.15",
|
|
24
|
+
"@abtnode/cron": "1.8.15",
|
|
25
|
+
"@abtnode/db": "1.8.15",
|
|
26
|
+
"@abtnode/logger": "1.8.15",
|
|
27
|
+
"@abtnode/queue": "1.8.15",
|
|
28
|
+
"@abtnode/rbac": "1.8.15",
|
|
29
|
+
"@abtnode/router-provider": "1.8.15",
|
|
30
|
+
"@abtnode/static-server": "1.8.15",
|
|
31
|
+
"@abtnode/timemachine": "1.8.15",
|
|
32
|
+
"@abtnode/util": "1.8.15",
|
|
33
33
|
"@arcblock/did": "1.17.17",
|
|
34
34
|
"@arcblock/did-motif": "^1.1.10",
|
|
35
35
|
"@arcblock/did-util": "1.17.17",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"@arcblock/jwt": "^1.17.17",
|
|
38
38
|
"@arcblock/pm2-events": "^0.0.5",
|
|
39
39
|
"@arcblock/vc": "1.17.17",
|
|
40
|
-
"@blocklet/meta": "1.8.
|
|
41
|
-
"@blocklet/sdk": "1.8.
|
|
40
|
+
"@blocklet/meta": "1.8.15",
|
|
41
|
+
"@blocklet/sdk": "1.8.15",
|
|
42
42
|
"@fidm/x509": "^1.2.1",
|
|
43
43
|
"@nedb/core": "^1.3.4",
|
|
44
44
|
"@nedb/multi": "^1.3.4",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"express": "^4.18.1",
|
|
82
82
|
"jest": "^27.5.1"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "57106db1b559b906734df5b8eac7ce87cae72980"
|
|
85
85
|
}
|