tkserver 1.6.36 → 1.6.37

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 (3) hide show
  1. package/index.js +2 -1
  2. package/mongo.js +2 -1
  3. package/package.json +2 -2
package/index.js CHANGED
@@ -659,12 +659,13 @@ async function parse (comment, request) {
659
659
  const isAdminUser = isAdmin(request.body.accessToken)
660
660
  const isBloggerMail = equalsMail(comment.mail, config.BLOGGER_EMAIL)
661
661
  if (isBloggerMail && !isAdminUser) throw new Error('请先登录管理面板,再使用博主身份发送评论')
662
+ const hashMethod = this.gravatarCdn === 'cravatar.cn' ? md5 : sha256
662
663
  const commentDo = {
663
664
  _id: uuidv4().replace(/-/g, ''),
664
665
  uid: request.body.accessToken,
665
666
  nick: comment.nick ? comment.nick : '匿名',
666
667
  mail: comment.mail ? comment.mail : '',
667
- mailMd5: comment.mail ? sha256(normalizeMail(comment.mail)) : '',
668
+ mailMd5: comment.mail ? hashMethod(normalizeMail(comment.mail)) : '',
668
669
  link: comment.link ? comment.link : '',
669
670
  ua: comment.ua,
670
671
  ip: getIp(request),
package/mongo.js CHANGED
@@ -638,12 +638,13 @@ async function parse (comment, request) {
638
638
  const isAdminUser = isAdmin(request.body.accessToken)
639
639
  const isBloggerMail = equalsMail(comment.mail, config.BLOGGER_EMAIL)
640
640
  if (isBloggerMail && !isAdminUser) throw new Error('请先登录管理面板,再使用博主身份发送评论')
641
+ const hashMethod = this.gravatarCdn === 'cravatar.cn' ? md5 : sha256
641
642
  const commentDo = {
642
643
  _id: uuidv4().replace(/-/g, ''),
643
644
  uid: request.body.accessToken,
644
645
  nick: comment.nick ? comment.nick : '匿名',
645
646
  mail: comment.mail ? comment.mail : '',
646
- mailMd5: comment.mail ? sha256(normalizeMail(comment.mail)) : '',
647
+ mailMd5: comment.mail ? hashMethod(normalizeMail(comment.mail)) : '',
647
648
  link: comment.link ? comment.link : '',
648
649
  ua: comment.ua,
649
650
  ip: getIp(request),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tkserver",
3
- "version": "1.6.36",
3
+ "version": "1.6.37",
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.6.36",
34
+ "twikoo-func": "1.6.37",
35
35
  "uuid": "^8.3.2"
36
36
  }
37
37
  }