|
7 | 7 | import { getCommentUrlHashById } from '/@/constants/element-anchor' |
8 | 8 | import { APP_CONFIG } from '/@/configs/app.config' |
9 | 9 | import { getGravatarByHash, getDisqusAvatarByUsername } from '/@/transforms/avatar' |
10 | | - import { getPageURL, getAssetURL, getProxyURL, getOriginalProxyURL } from '/@/transforms/url' |
| 10 | + import { getPageURL, getAssetURL, getCdnProxyURL, getOriginalProxyURL } from '/@/transforms/url' |
11 | 11 | import { getExtendValue } from '/@/transforms/state' |
12 | 12 | import { firstUpperCase } from '/@/transforms/text' |
13 | 13 | import { scrollToAnchor } from '/@/utils/scroller' |
|
40 | 40 | (e: CommentEvents.CancelReply, commentId: number): void |
41 | 41 | }>() |
42 | 42 |
|
43 | | - const { route, i18n: _i18n, cdnDomain } = useEnhancer() |
| 43 | + const { route, i18n: _i18n, cdnDomain, isCNUser } = useEnhancer() |
44 | 44 | const commentStore = useCommentStore() |
45 | 45 | const identityStore = useIdentityStore() |
46 | 46 | const isDeleting = computed(() => commentStore.deleting) |
|
62 | 62 | }) |
63 | 63 |
|
64 | 64 | const authorAvatar = computed(() => { |
65 | | - return disqusUsername.value |
66 | | - ? getOriginalProxyURL(getDisqusAvatarByUsername(disqusUsername.value)) |
67 | | - : props.comment.author.email_hash |
68 | | - ? getProxyURL(cdnDomain, getGravatarByHash(props.comment.author.email_hash)) |
69 | | - : getAssetURL(cdnDomain, APP_CONFIG.default_comment_avatar) |
| 65 | + if (disqusUsername.value) { |
| 66 | + const avatar = getDisqusAvatarByUsername(disqusUsername.value) |
| 67 | + return isCNUser ? getOriginalProxyURL(avatar) : avatar |
| 68 | + } else { |
| 69 | + const emailHash = props.comment.author.email_hash |
| 70 | + if (!emailHash) return getAssetURL(cdnDomain, APP_CONFIG.default_comment_avatar) |
| 71 | + const gravatar = getGravatarByHash(emailHash) |
| 72 | + return isCNUser ? getCdnProxyURL(cdnDomain, gravatar) : gravatar |
| 73 | + } |
70 | 74 | }) |
71 | 75 |
|
72 | 76 | const authorURL = computed(() => { |
|
0 commit comments