tkserver 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/index.js +3 -1
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -40,7 +40,8 @@ const {
40
40
  getConfig,
41
41
  getConfigForAdmin,
42
42
  validate,
43
- checkCommentOwnership
43
+ checkCommentOwnership,
44
+ isValidEmail
44
45
  } = require('twikoo-func/utils')
45
46
  const {
46
47
  jsonParse,
@@ -716,6 +717,7 @@ async function parse (comment, request) {
716
717
  const isAdminUser = isAdmin(request.body.accessToken)
717
718
  const isBloggerMail = equalsMail(comment.mail, config.BLOGGER_EMAIL)
718
719
  if (isBloggerMail && !isAdminUser) throw new Error('请先登录管理面板,再使用博主身份发送评论')
720
+ if (comment.mail && !isValidEmail(comment.mail)) throw new Error('邮箱格式不合法')
719
721
  const hashMethod = config.GRAVATAR_CDN === 'cravatar.cn' ? md5 : sha256
720
722
  const commentDo = {
721
723
  _id: uuidv4().replace(/-/g, ''),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tkserver",
3
- "version": "1.7.10",
3
+ "version": "1.7.12",
4
4
  "description": "A simple comment system.",
5
5
  "keywords": [
6
6
  "twikoo",
@@ -31,7 +31,7 @@
31
31
  "get-user-ip": "^1.0.1",
32
32
  "lokijs": "^1.5.12",
33
33
  "mongodb": "^6.3.0",
34
- "twikoo-func": "1.7.10",
34
+ "twikoo-func": "1.7.12",
35
35
  "uuid": "^8.3.2"
36
36
  }
37
37
  }