twikoo-func 1.6.7 → 1.6.9
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.
- package/index.js +2 -1
- package/package.json +1 -1
- package/utils/index.js +11 -2
package/index.js
CHANGED
|
@@ -19,6 +19,7 @@ const {
|
|
|
19
19
|
getUrlsQuery,
|
|
20
20
|
parseComment,
|
|
21
21
|
parseCommentForAdmin,
|
|
22
|
+
getMailMd5,
|
|
22
23
|
getAvatar,
|
|
23
24
|
isQQ,
|
|
24
25
|
addQQMailSuffix,
|
|
@@ -778,7 +779,7 @@ async function getRecentComments (event) {
|
|
|
778
779
|
href: comment.href,
|
|
779
780
|
nick: comment.nick,
|
|
780
781
|
avatar: getAvatar(comment, config),
|
|
781
|
-
mailMd5:
|
|
782
|
+
mailMd5: getMailMd5(comment),
|
|
782
783
|
link: comment.link,
|
|
783
784
|
comment: comment.comment,
|
|
784
785
|
commentText: $(comment.comment).text(),
|
package/package.json
CHANGED
package/utils/index.js
CHANGED
|
@@ -55,7 +55,7 @@ const fn = {
|
|
|
55
55
|
id: comment._id.toString(),
|
|
56
56
|
nick: comment.nick,
|
|
57
57
|
avatar: comment.avatar,
|
|
58
|
-
mailMd5:
|
|
58
|
+
mailMd5: fn.getMailMd5(comment),
|
|
59
59
|
link: comment.link,
|
|
60
60
|
comment: comment.comment,
|
|
61
61
|
os: displayOs,
|
|
@@ -116,13 +116,22 @@ const fn = {
|
|
|
116
116
|
}
|
|
117
117
|
return url.substring(x)
|
|
118
118
|
},
|
|
119
|
+
getMailMd5 (comment) {
|
|
120
|
+
if (comment.mailMd5) {
|
|
121
|
+
return comment.mailMd5
|
|
122
|
+
}
|
|
123
|
+
if (comment.mail) {
|
|
124
|
+
return md5(comment.mail)
|
|
125
|
+
}
|
|
126
|
+
return md5(comment.nick)
|
|
127
|
+
},
|
|
119
128
|
getAvatar (comment, config) {
|
|
120
129
|
if (comment.avatar) {
|
|
121
130
|
return comment.avatar
|
|
122
131
|
} else {
|
|
123
132
|
const gravatarCdn = config.GRAVATAR_CDN || 'cravatar.cn'
|
|
124
133
|
const defaultGravatar = config.DEFAULT_GRAVATAR || 'identicon'
|
|
125
|
-
const mailMd5 =
|
|
134
|
+
const mailMd5 = fn.getMailMd5(comment)
|
|
126
135
|
return `https://${gravatarCdn}/avatar/${mailMd5}?d=${defaultGravatar}`
|
|
127
136
|
}
|
|
128
137
|
},
|