@abtnode/blocklet-services 1.16.18-beta-bb4ebacc → 1.16.18-beta-41b7fdb1
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/api/libs/image.js +19 -12
- package/api/routes/federated.js +4 -1
- package/api/routes/oauth.js +11 -2
- package/api/routes/user.js +4 -4
- package/build/asset-manifest.json +17 -17
- package/build/index.html +1 -1
- package/build/service-worker.js +1 -1
- package/build/static/css/{5547.5f9be15f.chunk.css → 5547.e016de4c.chunk.css} +3 -3
- package/build/static/js/4076.f5369a1d.chunk.js +2 -0
- package/build/static/js/{4461.26253c6a.chunk.js → 4461.3cd698bf.chunk.js} +2 -2
- package/build/static/js/5547.570ded36.chunk.js +3 -0
- package/build/static/js/{5547.d68bfde3.chunk.js.LICENSE.txt → 5547.570ded36.chunk.js.LICENSE.txt} +2 -3
- package/build/static/js/{5569.a7e151fc.chunk.js → 5569.e4bfe697.chunk.js} +2 -2
- package/build/static/js/6218.4f3036a7.chunk.js +2 -0
- package/build/static/js/{6629.376863d2.chunk.js → 6629.a4a3fb70.chunk.js} +3 -3
- package/build/static/js/main.bf370e0c.js +3 -0
- package/build/static/js/{main.36b0deea.js.LICENSE.txt → main.bf370e0c.js.LICENSE.txt} +1 -1
- package/package.json +23 -23
- package/build/static/js/4076.5ca97365.chunk.js +0 -2
- package/build/static/js/5547.d68bfde3.chunk.js +0 -3
- package/build/static/js/6218.9a4feced.chunk.js +0 -2
- package/build/static/js/main.36b0deea.js +0 -3
- /package/build/static/js/{6629.376863d2.chunk.js.LICENSE.txt → 6629.a4a3fb70.chunk.js.LICENSE.txt} +0 -0
package/api/libs/image.js
CHANGED
|
@@ -128,6 +128,8 @@ const isImageRequest = (req) => {
|
|
|
128
128
|
return true;
|
|
129
129
|
};
|
|
130
130
|
|
|
131
|
+
const getImageContentType = (extension) => (extension === 'svg' ? 'image/svg+xml' : `image/${extension}`);
|
|
132
|
+
|
|
131
133
|
const tasks = {};
|
|
132
134
|
const processAndRespond = (req, res, cacheDir, getSrc, ext, sendOptions = { maxAge: '356d', immutable: true }) => {
|
|
133
135
|
if (fs.existsSync(cacheDir) === false) {
|
|
@@ -159,7 +161,7 @@ const processAndRespond = (req, res, cacheDir, getSrc, ext, sendOptions = { maxA
|
|
|
159
161
|
const cacheKey = md5(stringify({ target: req.target, path: req.originalUrl, params }));
|
|
160
162
|
const destPath = getCacheFilePath(cacheDir, `${cacheKey}.${params.f || extension}`);
|
|
161
163
|
if (fs.existsSync(destPath)) {
|
|
162
|
-
res.header('Content-Type',
|
|
164
|
+
res.header('Content-Type', getImageContentType(params.f || extension));
|
|
163
165
|
res.sendFile(destPath, sendOptions);
|
|
164
166
|
return;
|
|
165
167
|
}
|
|
@@ -176,7 +178,7 @@ const processAndRespond = (req, res, cacheDir, getSrc, ext, sendOptions = { maxA
|
|
|
176
178
|
tasks[cacheKey]
|
|
177
179
|
.then(() => {
|
|
178
180
|
logger.info('image filter succeed', { params, url: req.originalUrl, destPath });
|
|
179
|
-
res.header('Content-Type',
|
|
181
|
+
res.header('Content-Type', getImageContentType(params.f || extension));
|
|
180
182
|
res.sendFile(destPath, sendOptions);
|
|
181
183
|
})
|
|
182
184
|
.catch((err) => {
|
|
@@ -192,6 +194,21 @@ const processAndRespond = (req, res, cacheDir, getSrc, ext, sendOptions = { maxA
|
|
|
192
194
|
|
|
193
195
|
const processImage = (src, extension, dest, params) => {
|
|
194
196
|
return new Promise((resolve, reject) => {
|
|
197
|
+
// output stream
|
|
198
|
+
const out = fs.createWriteStream(dest);
|
|
199
|
+
out.on('close', () => {
|
|
200
|
+
resolve(dest);
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
out.on('error', (err) => {
|
|
204
|
+
reject(err);
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
if (extension === 'svg') {
|
|
208
|
+
src.pipe(out);
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
|
|
195
212
|
const {
|
|
196
213
|
imageFilter,
|
|
197
214
|
w: width,
|
|
@@ -251,16 +268,6 @@ const processImage = (src, extension, dest, params) => {
|
|
|
251
268
|
pipeline.negate();
|
|
252
269
|
}
|
|
253
270
|
|
|
254
|
-
// output stream
|
|
255
|
-
const out = fs.createWriteStream(dest);
|
|
256
|
-
out.on('close', () => {
|
|
257
|
-
resolve(dest);
|
|
258
|
-
});
|
|
259
|
-
|
|
260
|
-
out.on('error', (err) => {
|
|
261
|
-
reject(err);
|
|
262
|
-
});
|
|
263
|
-
|
|
264
271
|
pipeline[format || EXTENSIONS[extension]]({ quality, progressive: !!progressive, force: true });
|
|
265
272
|
|
|
266
273
|
pipeline.on('error', (err) => {
|
package/api/routes/federated.js
CHANGED
|
@@ -339,7 +339,10 @@ module.exports = {
|
|
|
339
339
|
pendingUserList.push(
|
|
340
340
|
limitSync(async () => {
|
|
341
341
|
await syncFnMaps[user.action]?.(
|
|
342
|
-
{
|
|
342
|
+
{
|
|
343
|
+
...user,
|
|
344
|
+
sourceAppPid: user.sourceAppPid === teamDid ? null : user.sourceAppPid,
|
|
345
|
+
},
|
|
343
346
|
{ node, teamDid, dataDir }
|
|
344
347
|
);
|
|
345
348
|
})
|
package/api/routes/oauth.js
CHANGED
|
@@ -64,7 +64,7 @@ function getAuthClient(blocklet, provider) {
|
|
|
64
64
|
|
|
65
65
|
async function login(req, node, options) {
|
|
66
66
|
const blocklet = await req.getBlocklet();
|
|
67
|
-
const { token, locale = 'en', provider, componentId, sourceAppPid, visitorId } = req.body;
|
|
67
|
+
const { token, locale = 'en', provider, componentId, sourceAppPid = null, visitorId } = req.body;
|
|
68
68
|
|
|
69
69
|
if (!blocklet.settings?.owner) {
|
|
70
70
|
throw new ApiError(400, t('oauthCantBeOwner', locale));
|
|
@@ -264,7 +264,15 @@ async function login(req, node, options) {
|
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
async function invite(req, node, options) {
|
|
267
|
-
const {
|
|
267
|
+
const {
|
|
268
|
+
locale,
|
|
269
|
+
inviteId,
|
|
270
|
+
token,
|
|
271
|
+
baseUrl,
|
|
272
|
+
provider = LOGIN_PROVIDER.AUTH0,
|
|
273
|
+
sourceAppPid = null,
|
|
274
|
+
visitorId,
|
|
275
|
+
} = req.body;
|
|
268
276
|
const blocklet = await req.getBlocklet();
|
|
269
277
|
let userWallet;
|
|
270
278
|
let oauthInfo;
|
|
@@ -390,6 +398,7 @@ async function invite(req, node, options) {
|
|
|
390
398
|
syncData.users.push({
|
|
391
399
|
...syncUserData,
|
|
392
400
|
action: 'connectAccount',
|
|
401
|
+
// HACK: @zhanghan 这里会造成 master 中的用户也增加 sourceAppPid 字段,需要在 sync 接收端处理
|
|
393
402
|
sourceAppPid: sourceAppPid || masterSite?.appPid,
|
|
394
403
|
});
|
|
395
404
|
}
|
package/api/routes/user.js
CHANGED
|
@@ -102,7 +102,7 @@ async function composeProfileData({ avatar, fullName, email }, { node, req, team
|
|
|
102
102
|
|
|
103
103
|
async function loginWallet(
|
|
104
104
|
{ did, pk, avatar, email, fullName },
|
|
105
|
-
{ node, req, locale, componentId, teamDid, updateInfo = true, sourceAppPid }
|
|
105
|
+
{ node, req, locale, componentId, teamDid, updateInfo = true, sourceAppPid = null }
|
|
106
106
|
) {
|
|
107
107
|
const provider = LOGIN_PROVIDER.WALLET;
|
|
108
108
|
const { error } = loginWalletSchema.validate({
|
|
@@ -162,7 +162,7 @@ async function loginWallet(
|
|
|
162
162
|
|
|
163
163
|
async function loginOAuth(
|
|
164
164
|
{ provider, id, avatar, email, fullName },
|
|
165
|
-
{ node, req, locale, componentId, teamDid, blockletWallet, updateInfo = true, sourceAppPid }
|
|
165
|
+
{ node, req, locale, componentId, teamDid, blockletWallet, updateInfo = true, sourceAppPid = null }
|
|
166
166
|
) {
|
|
167
167
|
const { error } = loginOAuthSchema.validate({
|
|
168
168
|
provider,
|
|
@@ -232,7 +232,7 @@ async function login(req, node, options) {
|
|
|
232
232
|
locale = 'en',
|
|
233
233
|
updateInfo = true,
|
|
234
234
|
visitorId,
|
|
235
|
-
sourceAppPid,
|
|
235
|
+
sourceAppPid = null,
|
|
236
236
|
} = req.body;
|
|
237
237
|
|
|
238
238
|
const componentId = req.get('x-blocklet-component-id');
|
|
@@ -356,7 +356,7 @@ module.exports = {
|
|
|
356
356
|
* @summary 暂时不允许用户注册,只允许登录
|
|
357
357
|
*/
|
|
358
358
|
server.post(`${prefixApi}/loginByWallet`, async (req, res) => {
|
|
359
|
-
const { userDid, signature, walletOS, nonce, visitorId, passportId, sourceAppPid, locale } = req.body;
|
|
359
|
+
const { userDid, signature, walletOS, nonce, visitorId, passportId, sourceAppPid = null, locale } = req.body;
|
|
360
360
|
const { error } = loginUserWalletSchema.validate({
|
|
361
361
|
userDid,
|
|
362
362
|
signature,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"files": {
|
|
3
3
|
"main.css": "/.well-known/service/static/static/css/main.7ea79dc8.css",
|
|
4
|
-
"main.js": "/.well-known/service/static/static/js/main.
|
|
4
|
+
"main.js": "/.well-known/service/static/static/js/main.bf370e0c.js",
|
|
5
5
|
"static/js/9314.f0add972.chunk.js": "/.well-known/service/static/static/js/9314.f0add972.chunk.js",
|
|
6
|
-
"static/js/6218.
|
|
7
|
-
"static/js/4076.
|
|
6
|
+
"static/js/6218.4f3036a7.chunk.js": "/.well-known/service/static/static/js/6218.4f3036a7.chunk.js",
|
|
7
|
+
"static/js/4076.f5369a1d.chunk.js": "/.well-known/service/static/static/js/4076.f5369a1d.chunk.js",
|
|
8
8
|
"static/js/6658.98f9956d.chunk.js": "/.well-known/service/static/static/js/6658.98f9956d.chunk.js",
|
|
9
9
|
"static/js/3025.7c99c058.chunk.js": "/.well-known/service/static/static/js/3025.7c99c058.chunk.js",
|
|
10
10
|
"static/js/7858.52930f63.chunk.js": "/.well-known/service/static/static/js/7858.52930f63.chunk.js",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"static/js/6032.1001afd3.chunk.js": "/.well-known/service/static/static/js/6032.1001afd3.chunk.js",
|
|
21
21
|
"static/js/4882.0435e418.chunk.js": "/.well-known/service/static/static/js/4882.0435e418.chunk.js",
|
|
22
22
|
"static/js/5434.523d071d.chunk.js": "/.well-known/service/static/static/js/5434.523d071d.chunk.js",
|
|
23
|
-
"static/css/5547.
|
|
24
|
-
"static/js/5547.
|
|
23
|
+
"static/css/5547.e016de4c.chunk.css": "/.well-known/service/static/static/css/5547.e016de4c.chunk.css",
|
|
24
|
+
"static/js/5547.570ded36.chunk.js": "/.well-known/service/static/static/js/5547.570ded36.chunk.js",
|
|
25
25
|
"static/js/3033.9fe46d7f.chunk.js": "/.well-known/service/static/static/js/3033.9fe46d7f.chunk.js",
|
|
26
26
|
"static/js/3842.e1bb702b.chunk.js": "/.well-known/service/static/static/js/3842.e1bb702b.chunk.js",
|
|
27
27
|
"static/js/3131.99541aca.chunk.js": "/.well-known/service/static/static/js/3131.99541aca.chunk.js",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"static/js/4023.5fe8180a.chunk.js": "/.well-known/service/static/static/js/4023.5fe8180a.chunk.js",
|
|
42
42
|
"static/js/8792.0f55707c.chunk.js": "/.well-known/service/static/static/js/8792.0f55707c.chunk.js",
|
|
43
43
|
"static/js/3076.28658ffc.chunk.js": "/.well-known/service/static/static/js/3076.28658ffc.chunk.js",
|
|
44
|
-
"static/js/5569.
|
|
44
|
+
"static/js/5569.e4bfe697.chunk.js": "/.well-known/service/static/static/js/5569.e4bfe697.chunk.js",
|
|
45
45
|
"static/js/2801.33d2f238.chunk.js": "/.well-known/service/static/static/js/2801.33d2f238.chunk.js",
|
|
46
|
-
"static/js/4461.
|
|
46
|
+
"static/js/4461.3cd698bf.chunk.js": "/.well-known/service/static/static/js/4461.3cd698bf.chunk.js",
|
|
47
47
|
"static/js/5509.a196d497.chunk.js": "/.well-known/service/static/static/js/5509.a196d497.chunk.js",
|
|
48
48
|
"static/js/5683.051a03c1.chunk.js": "/.well-known/service/static/static/js/5683.051a03c1.chunk.js",
|
|
49
49
|
"static/js/7006.bb90b167.chunk.js": "/.well-known/service/static/static/js/7006.bb90b167.chunk.js",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"static/js/556.e1875260.chunk.js": "/.well-known/service/static/static/js/556.e1875260.chunk.js",
|
|
59
59
|
"static/js/2940.ce32ab3f.chunk.js": "/.well-known/service/static/static/js/2940.ce32ab3f.chunk.js",
|
|
60
60
|
"static/js/840.5bc210dd.chunk.js": "/.well-known/service/static/static/js/840.5bc210dd.chunk.js",
|
|
61
|
-
"static/js/6629.
|
|
61
|
+
"static/js/6629.a4a3fb70.chunk.js": "/.well-known/service/static/static/js/6629.a4a3fb70.chunk.js",
|
|
62
62
|
"static/js/9997.540afd6e.chunk.js": "/.well-known/service/static/static/js/9997.540afd6e.chunk.js",
|
|
63
63
|
"static/js/2838.ec459fda.chunk.js": "/.well-known/service/static/static/js/2838.ec459fda.chunk.js",
|
|
64
64
|
"static/js/3953.ddf8be86.chunk.js": "/.well-known/service/static/static/js/3953.ddf8be86.chunk.js",
|
|
@@ -119,10 +119,10 @@
|
|
|
119
119
|
"index.html": "/.well-known/service/static/index.html",
|
|
120
120
|
"static/media/space-connected.svg": "/.well-known/service/static/static/media/space-connected.9a4e18fd2bc7d065191b0d241a131c28.svg",
|
|
121
121
|
"main.7ea79dc8.css.map": "/.well-known/service/static/static/css/main.7ea79dc8.css.map",
|
|
122
|
-
"main.
|
|
122
|
+
"main.bf370e0c.js.map": "/.well-known/service/static/static/js/main.bf370e0c.js.map",
|
|
123
123
|
"9314.f0add972.chunk.js.map": "/.well-known/service/static/static/js/9314.f0add972.chunk.js.map",
|
|
124
|
-
"6218.
|
|
125
|
-
"4076.
|
|
124
|
+
"6218.4f3036a7.chunk.js.map": "/.well-known/service/static/static/js/6218.4f3036a7.chunk.js.map",
|
|
125
|
+
"4076.f5369a1d.chunk.js.map": "/.well-known/service/static/static/js/4076.f5369a1d.chunk.js.map",
|
|
126
126
|
"6658.98f9956d.chunk.js.map": "/.well-known/service/static/static/js/6658.98f9956d.chunk.js.map",
|
|
127
127
|
"3025.7c99c058.chunk.js.map": "/.well-known/service/static/static/js/3025.7c99c058.chunk.js.map",
|
|
128
128
|
"7858.52930f63.chunk.js.map": "/.well-known/service/static/static/js/7858.52930f63.chunk.js.map",
|
|
@@ -138,8 +138,8 @@
|
|
|
138
138
|
"6032.1001afd3.chunk.js.map": "/.well-known/service/static/static/js/6032.1001afd3.chunk.js.map",
|
|
139
139
|
"4882.0435e418.chunk.js.map": "/.well-known/service/static/static/js/4882.0435e418.chunk.js.map",
|
|
140
140
|
"5434.523d071d.chunk.js.map": "/.well-known/service/static/static/js/5434.523d071d.chunk.js.map",
|
|
141
|
-
"5547.
|
|
142
|
-
"5547.
|
|
141
|
+
"5547.e016de4c.chunk.css.map": "/.well-known/service/static/static/css/5547.e016de4c.chunk.css.map",
|
|
142
|
+
"5547.570ded36.chunk.js.map": "/.well-known/service/static/static/js/5547.570ded36.chunk.js.map",
|
|
143
143
|
"3033.9fe46d7f.chunk.js.map": "/.well-known/service/static/static/js/3033.9fe46d7f.chunk.js.map",
|
|
144
144
|
"3842.e1bb702b.chunk.js.map": "/.well-known/service/static/static/js/3842.e1bb702b.chunk.js.map",
|
|
145
145
|
"3131.99541aca.chunk.js.map": "/.well-known/service/static/static/js/3131.99541aca.chunk.js.map",
|
|
@@ -159,9 +159,9 @@
|
|
|
159
159
|
"4023.5fe8180a.chunk.js.map": "/.well-known/service/static/static/js/4023.5fe8180a.chunk.js.map",
|
|
160
160
|
"8792.0f55707c.chunk.js.map": "/.well-known/service/static/static/js/8792.0f55707c.chunk.js.map",
|
|
161
161
|
"3076.28658ffc.chunk.js.map": "/.well-known/service/static/static/js/3076.28658ffc.chunk.js.map",
|
|
162
|
-
"5569.
|
|
162
|
+
"5569.e4bfe697.chunk.js.map": "/.well-known/service/static/static/js/5569.e4bfe697.chunk.js.map",
|
|
163
163
|
"2801.33d2f238.chunk.js.map": "/.well-known/service/static/static/js/2801.33d2f238.chunk.js.map",
|
|
164
|
-
"4461.
|
|
164
|
+
"4461.3cd698bf.chunk.js.map": "/.well-known/service/static/static/js/4461.3cd698bf.chunk.js.map",
|
|
165
165
|
"5509.a196d497.chunk.js.map": "/.well-known/service/static/static/js/5509.a196d497.chunk.js.map",
|
|
166
166
|
"5683.051a03c1.chunk.js.map": "/.well-known/service/static/static/js/5683.051a03c1.chunk.js.map",
|
|
167
167
|
"7006.bb90b167.chunk.js.map": "/.well-known/service/static/static/js/7006.bb90b167.chunk.js.map",
|
|
@@ -176,7 +176,7 @@
|
|
|
176
176
|
"556.e1875260.chunk.js.map": "/.well-known/service/static/static/js/556.e1875260.chunk.js.map",
|
|
177
177
|
"2940.ce32ab3f.chunk.js.map": "/.well-known/service/static/static/js/2940.ce32ab3f.chunk.js.map",
|
|
178
178
|
"840.5bc210dd.chunk.js.map": "/.well-known/service/static/static/js/840.5bc210dd.chunk.js.map",
|
|
179
|
-
"6629.
|
|
179
|
+
"6629.a4a3fb70.chunk.js.map": "/.well-known/service/static/static/js/6629.a4a3fb70.chunk.js.map",
|
|
180
180
|
"9997.540afd6e.chunk.js.map": "/.well-known/service/static/static/js/9997.540afd6e.chunk.js.map",
|
|
181
181
|
"2838.ec459fda.chunk.js.map": "/.well-known/service/static/static/js/2838.ec459fda.chunk.js.map",
|
|
182
182
|
"3953.ddf8be86.chunk.js.map": "/.well-known/service/static/static/js/3953.ddf8be86.chunk.js.map",
|
|
@@ -216,6 +216,6 @@
|
|
|
216
216
|
},
|
|
217
217
|
"entrypoints": [
|
|
218
218
|
"static/css/main.7ea79dc8.css",
|
|
219
|
-
"static/js/main.
|
|
219
|
+
"static/js/main.bf370e0c.js"
|
|
220
220
|
]
|
|
221
221
|
}
|
package/build/index.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico?imageFilter=resize&w=32"/><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0"/><meta name="theme-color" content="#000000"/><title>Blocklet Service</title><link rel="manifest" href="/.well-known/service/manifest.json"/><script src="/.well-known/service/api/env"></script><script src="/__blocklet__.js"></script><script defer="defer" src="/.well-known/service/static/static/js/main.
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico?imageFilter=resize&w=32"/><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0"/><meta name="theme-color" content="#000000"/><title>Blocklet Service</title><link rel="manifest" href="/.well-known/service/manifest.json"/><script src="/.well-known/service/api/env"></script><script src="/__blocklet__.js"></script><script defer="defer" src="/.well-known/service/static/static/js/main.bf370e0c.js"></script><link href="/.well-known/service/static/static/css/main.7ea79dc8.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|