@abtnode/util 1.16.15-beta-58d50c9a → 1.16.15-beta-e143b1cf
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.js +3 -0
- package/lib/user.js +12 -5
- package/package.json +5 -5
package/lib/blocklet.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const path = require('path');
|
|
1
2
|
const { createHash } = require('crypto');
|
|
2
3
|
|
|
3
4
|
const getComponentApiKey = ({ serverSk, app, component } = {}) => {
|
|
@@ -20,4 +21,6 @@ const getComponentApiKey = ({ serverSk, app, component } = {}) => {
|
|
|
20
21
|
|
|
21
22
|
module.exports = {
|
|
22
23
|
getComponentApiKey,
|
|
24
|
+
getAppImageCacheDir: (cacheDir) => path.join(cacheDir, '.services', 'image-filter'),
|
|
25
|
+
getAppOgCacheDir: (cacheDir) => path.join(cacheDir, '.services', 'open-graph'),
|
|
23
26
|
};
|
package/lib/user.js
CHANGED
|
@@ -13,8 +13,10 @@ const {
|
|
|
13
13
|
const md5 = require('./md5');
|
|
14
14
|
const axios = require('./axios');
|
|
15
15
|
|
|
16
|
-
const getAvatarFile = (dataDir, fileName) =>
|
|
17
|
-
path.join(dataDir, USER_AVATAR_DIR, fileName.substring(0, 2), fileName.substring(2));
|
|
16
|
+
const getAvatarFile = (dataDir, fileName) => {
|
|
17
|
+
const result = path.join(dataDir, USER_AVATAR_DIR, fileName.substring(0, 2), fileName.substring(2));
|
|
18
|
+
return result;
|
|
19
|
+
};
|
|
18
20
|
|
|
19
21
|
const getServerAvatarUrl = (baseUrl, info) => {
|
|
20
22
|
if (!baseUrl) {
|
|
@@ -35,7 +37,7 @@ const getServerAvatarUrl = (baseUrl, info) => {
|
|
|
35
37
|
);
|
|
36
38
|
};
|
|
37
39
|
|
|
38
|
-
const getAppAvatarUrl = (baseUrl) => {
|
|
40
|
+
const getAppAvatarUrl = (baseUrl, size = 80) => {
|
|
39
41
|
if (!baseUrl) {
|
|
40
42
|
return '';
|
|
41
43
|
}
|
|
@@ -47,7 +49,7 @@ const getAppAvatarUrl = (baseUrl) => {
|
|
|
47
49
|
// Do nothing;
|
|
48
50
|
}
|
|
49
51
|
|
|
50
|
-
return joinUrl(origin, WELLKNOWN_SERVICE_PATH_PREFIX, `/blocklet/logo?
|
|
52
|
+
return joinUrl(origin, WELLKNOWN_SERVICE_PATH_PREFIX, `/blocklet/logo?imageFilter=resize&h=${size}`);
|
|
51
53
|
};
|
|
52
54
|
|
|
53
55
|
const getUserAvatarUrl = (baseUrl, avatar, info = {}, isServer = false) => {
|
|
@@ -73,7 +75,12 @@ const getUserAvatarUrl = (baseUrl, avatar, info = {}, isServer = false) => {
|
|
|
73
75
|
return joinUrl(origin, prefix, USER_AVATAR_PATH_PREFIX, info.did, filename);
|
|
74
76
|
}
|
|
75
77
|
|
|
76
|
-
return joinUrl(
|
|
78
|
+
return joinUrl(
|
|
79
|
+
origin,
|
|
80
|
+
WELLKNOWN_SERVICE_PATH_PREFIX,
|
|
81
|
+
USER_AVATAR_PATH_PREFIX,
|
|
82
|
+
`${filename}?imageFilter=resize&w=48&h=48`
|
|
83
|
+
);
|
|
77
84
|
};
|
|
78
85
|
|
|
79
86
|
/**
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.15-beta-
|
|
6
|
+
"version": "1.16.15-beta-e143b1cf",
|
|
7
7
|
"description": "ArcBlock's JavaScript utility",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"author": "polunzh <polunzh@gmail.com> (http://github.com/polunzh)",
|
|
19
19
|
"license": "Apache-2.0",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@abtnode/constant": "1.16.15-beta-
|
|
22
|
-
"@abtnode/logger": "1.16.15-beta-
|
|
23
|
-
"@blocklet/constant": "1.16.15-beta-
|
|
21
|
+
"@abtnode/constant": "1.16.15-beta-e143b1cf",
|
|
22
|
+
"@abtnode/logger": "1.16.15-beta-e143b1cf",
|
|
23
|
+
"@blocklet/constant": "1.16.15-beta-e143b1cf",
|
|
24
24
|
"@ocap/client": "1.18.89",
|
|
25
25
|
"@ocap/mcrypto": "1.18.89",
|
|
26
26
|
"@ocap/util": "1.18.89",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"fs-extra": "^10.1.0",
|
|
72
72
|
"jest": "^27.5.1"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "86dcc908f3cb7259d1ca92b9ae75160a6e43509a"
|
|
75
75
|
}
|