twikoo-vercel 1.7.10 → 1.7.12

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.
Files changed (2) hide show
  1. package/api/index.js +3 -1
  2. package/package.json +2 -2
package/api/index.js CHANGED
@@ -39,7 +39,8 @@ const {
39
39
  getConfig,
40
40
  getConfigForAdmin,
41
41
  validate,
42
- checkCommentOwnership
42
+ checkCommentOwnership,
43
+ isValidEmail
43
44
  } = require('twikoo-func/utils')
44
45
  const {
45
46
  jsonParse,
@@ -718,6 +719,7 @@ async function parse (comment, request) {
718
719
  const isAdminUser = isAdmin()
719
720
  const isBloggerMail = equalsMail(comment.mail, config.BLOGGER_EMAIL)
720
721
  if (isBloggerMail && !isAdminUser) throw new Error('请先登录管理面板,再使用博主身份发送评论')
722
+ if (comment.mail && !isValidEmail(comment.mail)) throw new Error('邮箱格式不合法')
721
723
  const hashMethod = config.GRAVATAR_CDN === 'cravatar.cn' ? md5 : sha256
722
724
  const commentDo = {
723
725
  _id: uuidv4().replace(/-/g, ''),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "twikoo-vercel",
3
- "version": "1.7.10",
3
+ "version": "1.7.12",
4
4
  "description": "A simple comment system.",
5
5
  "author": "imaegoo <hello@imaegoo.com> (https://github.com/imaegoo)",
6
6
  "license": "MIT",
@@ -13,7 +13,7 @@
13
13
  "dependencies": {
14
14
  "get-user-ip": "^1.0.1",
15
15
  "mongodb": "^6.3.0",
16
- "twikoo-func": "1.7.10",
16
+ "twikoo-func": "1.7.12",
17
17
  "uuid": "^8.3.2"
18
18
  }
19
19
  }