@abtnode/blocklet-services 1.16.45-beta-20250627-075343-5af3ad9a → 1.16.45-beta-20250628-221915-2d6b9a34

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.
@@ -21,6 +21,7 @@ const { parse } = require('@abtnode/core/lib/util/ua');
21
21
  const getRequestIP = require('@abtnode/util/lib/get-request-ip');
22
22
  const { formatError, CustomError } = require('@blocklet/error');
23
23
  const { xss } = require('@blocklet/xss');
24
+ const { createRateLimiter } = require('@blocklet/rate-limit');
24
25
  const { withQuery, joinURL } = require('ufo');
25
26
  const cors = require('cors');
26
27
  const createTranslator = require('@abtnode/util/lib/translate');
@@ -1196,29 +1197,35 @@ module.exports = {
1196
1197
  res.json({ verified: false, id: undefined });
1197
1198
  }
1198
1199
  });
1199
- server.post(`${prefixApi}/email/login`, ensureBlocklet(), ensureCors, async (req, res) => {
1200
- const { action = 'login' } = req.body;
1201
- const actionMap = {
1202
- login: loginEmail,
1203
- invite: inviteEmail,
1204
- };
1205
- if (!actionMap[action]) {
1206
- logger.error('Failed to login by email', { error: 'action not exist', action });
1207
- throw new Error(`action not exist: ${action}`);
1208
- }
1200
+ server.post(
1201
+ `${prefixApi}/email/login`,
1202
+ ensureBlocklet(),
1203
+ ensureCors,
1204
+ createRateLimiter({ limit: process.env.ABT_NODE_EMAIL_VERIFY_RATE_LIMIT || 5, prefix: '/email/login' }),
1205
+ async (req, res) => {
1206
+ const { action = 'login' } = req.body;
1207
+ const actionMap = {
1208
+ login: loginEmail,
1209
+ invite: inviteEmail,
1210
+ };
1211
+ if (!actionMap[action]) {
1212
+ logger.error('Failed to login by email', { error: 'action not exist', action });
1213
+ throw new Error(`action not exist: ${action}`);
1214
+ }
1209
1215
 
1210
- try {
1211
- const result = await actionMap[action](req, node, options);
1212
- res.json(result);
1213
- } catch (err) {
1214
- logger.error('Failed login email', { error: err, action });
1215
- if (err instanceof CustomError) {
1216
- res.status(err.code).send(err.message);
1217
- return;
1216
+ try {
1217
+ const result = await actionMap[action](req, node, options);
1218
+ res.json(result);
1219
+ } catch (err) {
1220
+ logger.error('Failed login email', { error: err, action });
1221
+ if (err instanceof CustomError) {
1222
+ res.status(err.code).send(err.message);
1223
+ return;
1224
+ }
1225
+ throw err;
1218
1226
  }
1219
- throw err;
1220
1227
  }
1221
- });
1228
+ );
1222
1229
 
1223
1230
  server.put(`${prefixApi}/notification/webhook`, checkUser, ensureBlocklet(), async (req, res) => {
1224
1231
  const { value, error } = webhookSetSchema.validate(req.body);
@@ -195,7 +195,14 @@ const init = ({ node }) => {
195
195
  createEmailLimiter({ getEmail: (req) => req.body.email }),
196
196
  onStartEmailVerify
197
197
  );
198
- app.post(`${WELLKNOWN_SERVICE_PATH_PREFIX}/api/kyc/email/verify`, onEndEmailVerify);
198
+ app.post(
199
+ `${WELLKNOWN_SERVICE_PATH_PREFIX}/api/kyc/email/verify`,
200
+ createRateLimiter({
201
+ limit: process.env.ABT_NODE_EMAIL_VERIFY_RATE_LIMIT || 5,
202
+ prefix: '/api/kyc/email/verify',
203
+ }),
204
+ onEndEmailVerify
205
+ );
199
206
  app.post(`${WELLKNOWN_SERVICE_PATH_PREFIX}/api/kyc/status`, onCheckKycStatus);
200
207
  },
201
208
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.45-beta-20250627-075343-5af3ad9a",
6
+ "version": "1.16.45-beta-20250628-221915-2d6b9a34",
7
7
  "description": "Provide unified services for every blocklet",
8
8
  "main": "api/index.js",
9
9
  "files": [
@@ -33,18 +33,18 @@
33
33
  "author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
34
34
  "license": "Apache-2.0",
35
35
  "dependencies": {
36
- "@abtnode/analytics": "1.16.45-beta-20250627-075343-5af3ad9a",
37
- "@abtnode/auth": "1.16.45-beta-20250627-075343-5af3ad9a",
38
- "@abtnode/client": "1.16.45-beta-20250627-075343-5af3ad9a",
39
- "@abtnode/connect-storage": "1.16.45-beta-20250627-075343-5af3ad9a",
40
- "@abtnode/constant": "1.16.45-beta-20250627-075343-5af3ad9a",
41
- "@abtnode/core": "1.16.45-beta-20250627-075343-5af3ad9a",
42
- "@abtnode/cron": "1.16.45-beta-20250627-075343-5af3ad9a",
43
- "@abtnode/db-cache": "1.16.45-beta-20250627-075343-5af3ad9a",
44
- "@abtnode/logger": "1.16.45-beta-20250627-075343-5af3ad9a",
45
- "@abtnode/models": "1.16.45-beta-20250627-075343-5af3ad9a",
46
- "@abtnode/router-templates": "1.16.45-beta-20250627-075343-5af3ad9a",
47
- "@abtnode/util": "1.16.45-beta-20250627-075343-5af3ad9a",
36
+ "@abtnode/analytics": "1.16.45-beta-20250628-221915-2d6b9a34",
37
+ "@abtnode/auth": "1.16.45-beta-20250628-221915-2d6b9a34",
38
+ "@abtnode/client": "1.16.45-beta-20250628-221915-2d6b9a34",
39
+ "@abtnode/connect-storage": "1.16.45-beta-20250628-221915-2d6b9a34",
40
+ "@abtnode/constant": "1.16.45-beta-20250628-221915-2d6b9a34",
41
+ "@abtnode/core": "1.16.45-beta-20250628-221915-2d6b9a34",
42
+ "@abtnode/cron": "1.16.45-beta-20250628-221915-2d6b9a34",
43
+ "@abtnode/db-cache": "1.16.45-beta-20250628-221915-2d6b9a34",
44
+ "@abtnode/logger": "1.16.45-beta-20250628-221915-2d6b9a34",
45
+ "@abtnode/models": "1.16.45-beta-20250628-221915-2d6b9a34",
46
+ "@abtnode/router-templates": "1.16.45-beta-20250628-221915-2d6b9a34",
47
+ "@abtnode/util": "1.16.45-beta-20250628-221915-2d6b9a34",
48
48
  "@arcblock/did": "1.20.14",
49
49
  "@arcblock/did-auth": "1.20.14",
50
50
  "@arcblock/did-ext": "1.20.14",
@@ -54,19 +54,19 @@
54
54
  "@arcblock/jwt": "1.20.14",
55
55
  "@arcblock/validator": "1.20.14",
56
56
  "@arcblock/ws": "1.20.14",
57
- "@blocklet/constant": "1.16.45-beta-20250627-075343-5af3ad9a",
57
+ "@blocklet/constant": "1.16.45-beta-20250628-221915-2d6b9a34",
58
58
  "@blocklet/dbhub": "^0.2.9",
59
59
  "@blocklet/did-space-js": "^1.0.62",
60
- "@blocklet/env": "1.16.45-beta-20250627-075343-5af3ad9a",
60
+ "@blocklet/env": "1.16.45-beta-20250628-221915-2d6b9a34",
61
61
  "@blocklet/error": "^0.2.5",
62
62
  "@blocklet/form-builder": "^0.1.12",
63
63
  "@blocklet/form-collector": "^0.1.8",
64
- "@blocklet/images": "1.16.45-beta-20250627-075343-5af3ad9a",
65
- "@blocklet/js-sdk": "1.16.45-beta-20250627-075343-5af3ad9a",
64
+ "@blocklet/images": "1.16.45-beta-20250628-221915-2d6b9a34",
65
+ "@blocklet/js-sdk": "1.16.45-beta-20250628-221915-2d6b9a34",
66
66
  "@blocklet/mcp": "^1.10.2",
67
- "@blocklet/meta": "1.16.45-beta-20250627-075343-5af3ad9a",
68
- "@blocklet/rate-limit": "1.16.45-beta-20250627-075343-5af3ad9a",
69
- "@blocklet/sdk": "1.16.45-beta-20250627-075343-5af3ad9a",
67
+ "@blocklet/meta": "1.16.45-beta-20250628-221915-2d6b9a34",
68
+ "@blocklet/rate-limit": "1.16.45-beta-20250628-221915-2d6b9a34",
69
+ "@blocklet/sdk": "1.16.45-beta-20250628-221915-2d6b9a34",
70
70
  "@blocklet/theme": "^2.13.70",
71
71
  "@blocklet/theme-builder": "^0.2.0",
72
72
  "@blocklet/uploader-server": "^0.1.101",
@@ -121,7 +121,7 @@
121
121
  "whatwg-url": "14.0.0"
122
122
  },
123
123
  "devDependencies": {
124
- "@abtnode/ux": "1.16.45-beta-20250627-075343-5af3ad9a",
124
+ "@abtnode/ux": "1.16.45-beta-20250628-221915-2d6b9a34",
125
125
  "@arcblock/bridge": "^2.13.70",
126
126
  "@arcblock/did-connect": "^2.13.70",
127
127
  "@arcblock/icons": "^2.13.70",
@@ -129,7 +129,7 @@
129
129
  "@arcblock/ux": "^2.13.70",
130
130
  "@blocklet/launcher-layout": "^2.13.70",
131
131
  "@blocklet/payment-react": "^1.18.56",
132
- "@blocklet/tracker": "1.16.45-beta-20250627-075343-5af3ad9a",
132
+ "@blocklet/tracker": "1.16.45-beta-20250628-221915-2d6b9a34",
133
133
  "@blocklet/ui-react": "^2.13.70",
134
134
  "@blocklet/uploader": "^0.1.95",
135
135
  "@emotion/react": "^11.11.4",
@@ -207,5 +207,5 @@
207
207
  "url": "https://github.com/ArcBlock/blocklet-server/issues",
208
208
  "email": "shijun@arcblock.io"
209
209
  },
210
- "gitHead": "9a6e725b4831161020f627cddbb36173d2348306"
210
+ "gitHead": "af045bf41dea3533252fc097214cfbe8c1f2c756"
211
211
  }