@abtnode/blocklet-services 1.17.2-beta-20251112-085154-0103b877 → 1.17.2-beta-20251113-212234-9e640edd
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.
|
@@ -83,7 +83,7 @@ function checkFederatedCallLegacy({ mode = 'all', allowStatus = ['approved', 're
|
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
const { signer, data } = req.body;
|
|
86
|
+
const { signer, data } = req.body || {};
|
|
87
87
|
|
|
88
88
|
if (!signer || !data) {
|
|
89
89
|
res.status(400).send('missing signer or signed data');
|
|
@@ -4,6 +4,7 @@ const {
|
|
|
4
4
|
PASSPORT_LOG_ACTION,
|
|
5
5
|
PASSPORT_STATUS,
|
|
6
6
|
SESSION_TTL,
|
|
7
|
+
FEDERATED,
|
|
7
8
|
} = require('@abtnode/constant');
|
|
8
9
|
const { LOGIN_PROVIDER } = require('@blocklet/constant');
|
|
9
10
|
const pick = require('lodash/pick');
|
|
@@ -29,7 +30,7 @@ const { createTokenFn, getDidConnectVersion } = require('../util');
|
|
|
29
30
|
const checkUser = require('../middlewares/check-user');
|
|
30
31
|
|
|
31
32
|
const prefix = `${WELLKNOWN_SERVICE_PATH_PREFIX}/api/user-session`;
|
|
32
|
-
const limit = pLimit(
|
|
33
|
+
const limit = pLimit(FEDERATED.SYNC_LIMIT);
|
|
33
34
|
|
|
34
35
|
const userInfoBlackList = ['extra.walletDeviceId', 'extra.walletDeviceMessageToken', 'extra.device'];
|
|
35
36
|
|
|
@@ -134,7 +134,7 @@ const init = ({ node, notificationService }) => {
|
|
|
134
134
|
{
|
|
135
135
|
maxRetries: 1,
|
|
136
136
|
retryDelay: 0,
|
|
137
|
-
maxTimeout: 60 * 1000,
|
|
137
|
+
maxTimeout: 10 * 60 * 1000, // throw timeout error after 10 minutes
|
|
138
138
|
id: (job) => (job ? md5(`${job.email}_${job.notificationId}`) : ''),
|
|
139
139
|
enableScheduledJob: true,
|
|
140
140
|
},
|
|
@@ -179,6 +179,10 @@ const init = ({ node, notificationService }) => {
|
|
|
179
179
|
})
|
|
180
180
|
: null;
|
|
181
181
|
|
|
182
|
+
logger.info('Start send to email', {
|
|
183
|
+
email,
|
|
184
|
+
notificationId: job.notificationId,
|
|
185
|
+
});
|
|
182
186
|
await notificationService.sendToMail.exec({
|
|
183
187
|
sender,
|
|
184
188
|
receiver: email,
|
|
@@ -197,6 +201,10 @@ const init = ({ node, notificationService }) => {
|
|
|
197
201
|
pushOnly: input.pushOnly,
|
|
198
202
|
options,
|
|
199
203
|
});
|
|
204
|
+
logger.info('End send to email', {
|
|
205
|
+
email,
|
|
206
|
+
notificationId: job.notificationId,
|
|
207
|
+
});
|
|
200
208
|
} catch (error) {
|
|
201
209
|
logger.warn('Failed to send to email', { notificationId: job.notificationId, error });
|
|
202
210
|
}
|
|
@@ -211,7 +219,7 @@ const init = ({ node, notificationService }) => {
|
|
|
211
219
|
{
|
|
212
220
|
maxRetries: 3,
|
|
213
221
|
retryDelay: 10 * 1000,
|
|
214
|
-
maxTimeout:
|
|
222
|
+
maxTimeout: 10 * 60 * 1000, // throw timeout error after 10 minutes
|
|
215
223
|
id: (job) => (job ? md5(`${job.url}_${job.notificationId}`) : ''),
|
|
216
224
|
enableScheduledJob: true,
|
|
217
225
|
},
|
|
@@ -235,6 +243,10 @@ const init = ({ node, notificationService }) => {
|
|
|
235
243
|
throw new Error('Invalid webhook');
|
|
236
244
|
}
|
|
237
245
|
|
|
246
|
+
logger.info('Start send to webhook', {
|
|
247
|
+
url: webhook.url,
|
|
248
|
+
notificationId: job.notificationId,
|
|
249
|
+
});
|
|
238
250
|
await notificationService.sendToWebhook.exec({
|
|
239
251
|
sender,
|
|
240
252
|
receiver: receivers,
|
|
@@ -247,8 +259,12 @@ const init = ({ node, notificationService }) => {
|
|
|
247
259
|
},
|
|
248
260
|
pushOnly: input.pushOnly,
|
|
249
261
|
});
|
|
262
|
+
logger.info('End send to webhook', {
|
|
263
|
+
url: webhook.url,
|
|
264
|
+
notificationId: job.notificationId,
|
|
265
|
+
});
|
|
250
266
|
} catch (error) {
|
|
251
|
-
logger.warn('Failed to send to webhook', { url: job.url, notificationId: job.
|
|
267
|
+
logger.warn('Failed to send to webhook', { url: job.url, notificationId: job.notificationId, error });
|
|
252
268
|
}
|
|
253
269
|
}
|
|
254
270
|
);
|
|
@@ -577,7 +593,12 @@ const init = ({ node, notificationService }) => {
|
|
|
577
593
|
throw new Error('Invalid receiver user');
|
|
578
594
|
}
|
|
579
595
|
|
|
580
|
-
|
|
596
|
+
// FIXME: @liushuang: notification.id.startsWith('NOTIF-') HACK 的处理方式,是一个兜底行为。
|
|
597
|
+
// notificationId:存在为空的情况,比如 connect, hi,passthrough 消息时,是没有 id, 此时 pushOnly 为 true
|
|
598
|
+
// 为了避免在这里非 db 生成的ID进入插入操作,这里使用一个标识,避免插入脏数据
|
|
599
|
+
|
|
600
|
+
// 不在队列内生成 notificationId 的原因是避免队列重复执行导致相同消息生成不同ID
|
|
601
|
+
if (!job.pushOnly && !notification.id.startsWith('NOTIF-')) {
|
|
581
602
|
// 如果添加失败,那么需要终止执行推送
|
|
582
603
|
await insertToNotificationReceiver(nodeInfo, userInfo, teamDid, notification.id, channels);
|
|
583
604
|
logger.info('notification receiver created successfully', {
|
|
@@ -608,11 +629,6 @@ const init = ({ node, notificationService }) => {
|
|
|
608
629
|
}
|
|
609
630
|
}
|
|
610
631
|
|
|
611
|
-
// 如果 notification 没有 id,则生成一个, wallet 要基于这唯一个ID进行处理
|
|
612
|
-
if (!notification.id) {
|
|
613
|
-
notification.id = nanoid();
|
|
614
|
-
}
|
|
615
|
-
|
|
616
632
|
notification.type = notification.type || 'notification';
|
|
617
633
|
|
|
618
634
|
const baseParams = {
|
|
@@ -716,6 +732,14 @@ const init = ({ node, notificationService }) => {
|
|
|
716
732
|
});
|
|
717
733
|
throw new Error('No users found');
|
|
718
734
|
}
|
|
735
|
+
// 如果 notification 没有 id,则生成一个, wallet 要基于这唯一个ID进行处理
|
|
736
|
+
// 同时避免 queue 重复导致的 id 重复问题
|
|
737
|
+
// 需要在 queue 中区分这个 notificationId 是否存在数据库中,如果不存在,则不进行插入
|
|
738
|
+
// 不存在 notificationId 的情况,是发送 connect, hi,passthrough 消息时,没有 id 的情况
|
|
739
|
+
if (!notification.id) {
|
|
740
|
+
// 按照逻辑,如果ID不存在的时候,pushOnly 一定为 true,为了避免出现问题,这里使用一个标识,避免插入脏数据
|
|
741
|
+
notification.id = `NOTIF-${nanoid()}`;
|
|
742
|
+
}
|
|
719
743
|
|
|
720
744
|
users.forEach((userInfo) => {
|
|
721
745
|
const receiverDid = userInfo.did;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.17.2-beta-
|
|
6
|
+
"version": "1.17.2-beta-20251113-212234-9e640edd",
|
|
7
7
|
"description": "Provide unified services for every blocklet",
|
|
8
8
|
"main": "api/index.js",
|
|
9
9
|
"files": [
|
|
@@ -32,17 +32,17 @@
|
|
|
32
32
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
33
33
|
"license": "Apache-2.0",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@abtnode/analytics": "1.17.2-beta-
|
|
36
|
-
"@abtnode/auth": "1.17.2-beta-
|
|
37
|
-
"@abtnode/connect-storage": "1.17.2-beta-
|
|
38
|
-
"@abtnode/constant": "1.17.2-beta-
|
|
39
|
-
"@abtnode/core": "1.17.2-beta-
|
|
40
|
-
"@abtnode/cron": "1.17.2-beta-
|
|
41
|
-
"@abtnode/db-cache": "1.17.2-beta-
|
|
42
|
-
"@abtnode/logger": "1.17.2-beta-
|
|
43
|
-
"@abtnode/models": "1.17.2-beta-
|
|
44
|
-
"@abtnode/router-templates": "1.17.2-beta-
|
|
45
|
-
"@abtnode/util": "1.17.2-beta-
|
|
35
|
+
"@abtnode/analytics": "1.17.2-beta-20251113-212234-9e640edd",
|
|
36
|
+
"@abtnode/auth": "1.17.2-beta-20251113-212234-9e640edd",
|
|
37
|
+
"@abtnode/connect-storage": "1.17.2-beta-20251113-212234-9e640edd",
|
|
38
|
+
"@abtnode/constant": "1.17.2-beta-20251113-212234-9e640edd",
|
|
39
|
+
"@abtnode/core": "1.17.2-beta-20251113-212234-9e640edd",
|
|
40
|
+
"@abtnode/cron": "1.17.2-beta-20251113-212234-9e640edd",
|
|
41
|
+
"@abtnode/db-cache": "1.17.2-beta-20251113-212234-9e640edd",
|
|
42
|
+
"@abtnode/logger": "1.17.2-beta-20251113-212234-9e640edd",
|
|
43
|
+
"@abtnode/models": "1.17.2-beta-20251113-212234-9e640edd",
|
|
44
|
+
"@abtnode/router-templates": "1.17.2-beta-20251113-212234-9e640edd",
|
|
45
|
+
"@abtnode/util": "1.17.2-beta-20251113-212234-9e640edd",
|
|
46
46
|
"@arcblock/did": "^1.27.4",
|
|
47
47
|
"@arcblock/did-connect-js": "^1.27.4",
|
|
48
48
|
"@arcblock/did-ext": "^1.27.4",
|
|
@@ -52,18 +52,18 @@
|
|
|
52
52
|
"@arcblock/jwt": "^1.27.4",
|
|
53
53
|
"@arcblock/validator": "^1.27.4",
|
|
54
54
|
"@arcblock/ws": "^1.27.4",
|
|
55
|
-
"@blocklet/constant": "1.17.2-beta-
|
|
55
|
+
"@blocklet/constant": "1.17.2-beta-20251113-212234-9e640edd",
|
|
56
56
|
"@blocklet/dbhub": "^0.2.9",
|
|
57
|
-
"@blocklet/env": "1.17.2-beta-
|
|
57
|
+
"@blocklet/env": "1.17.2-beta-20251113-212234-9e640edd",
|
|
58
58
|
"@blocklet/error": "^0.3.2",
|
|
59
59
|
"@blocklet/form-builder": "^0.1.12",
|
|
60
60
|
"@blocklet/form-collector": "^0.1.8",
|
|
61
|
-
"@blocklet/images": "1.17.2-beta-
|
|
62
|
-
"@blocklet/js-sdk": "1.17.2-beta-
|
|
63
|
-
"@blocklet/meta": "1.17.2-beta-
|
|
64
|
-
"@blocklet/rate-limit": "1.17.2-beta-
|
|
65
|
-
"@blocklet/sdk": "1.17.2-beta-
|
|
66
|
-
"@blocklet/server-js": "1.17.2-beta-
|
|
61
|
+
"@blocklet/images": "1.17.2-beta-20251113-212234-9e640edd",
|
|
62
|
+
"@blocklet/js-sdk": "1.17.2-beta-20251113-212234-9e640edd",
|
|
63
|
+
"@blocklet/meta": "1.17.2-beta-20251113-212234-9e640edd",
|
|
64
|
+
"@blocklet/rate-limit": "1.17.2-beta-20251113-212234-9e640edd",
|
|
65
|
+
"@blocklet/sdk": "1.17.2-beta-20251113-212234-9e640edd",
|
|
66
|
+
"@blocklet/server-js": "1.17.2-beta-20251113-212234-9e640edd",
|
|
67
67
|
"@blocklet/theme": "^3.2.3",
|
|
68
68
|
"@blocklet/theme-builder": "0.4.8",
|
|
69
69
|
"@blocklet/uploader-server": "^0.3.9",
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
"whatwg-url": "14.0.0"
|
|
124
124
|
},
|
|
125
125
|
"devDependencies": {
|
|
126
|
-
"@abtnode/ux": "1.17.2-beta-
|
|
126
|
+
"@abtnode/ux": "1.17.2-beta-20251113-212234-9e640edd",
|
|
127
127
|
"@arcblock/bridge": "^3.2.3",
|
|
128
128
|
"@arcblock/did-connect-react": "^3.2.3",
|
|
129
129
|
"@arcblock/icons": "^3.2.3",
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"@blocklet/did-space-react": "^1.2.2",
|
|
134
134
|
"@blocklet/launcher-layout": "^3.2.3",
|
|
135
135
|
"@blocklet/payment-react": "^1.22.10",
|
|
136
|
-
"@blocklet/tracker": "1.17.2-beta-
|
|
136
|
+
"@blocklet/tracker": "1.17.2-beta-20251113-212234-9e640edd",
|
|
137
137
|
"@blocklet/ui-react": "^3.2.3",
|
|
138
138
|
"@blocklet/uploader": "^0.3.9",
|
|
139
139
|
"@emotion/react": "^11.14.0",
|
|
@@ -213,5 +213,5 @@
|
|
|
213
213
|
"url": "https://github.com/ArcBlock/blocklet-server/issues",
|
|
214
214
|
"email": "shijun@arcblock.io"
|
|
215
215
|
},
|
|
216
|
-
"gitHead": "
|
|
216
|
+
"gitHead": "ee25481c457076c9c7aa7f094dc1771301065f5a"
|
|
217
217
|
}
|