Skip to content

Commit 1bf9532

Browse files
committed
feat: v5.2.3
1 parent 16d9d76 commit 1bf9532

File tree

12 files changed

+45
-34
lines changed

12 files changed

+45
-34
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "surmon.me",
3-
"version": "5.2.2",
3+
"version": "5.2.3",
44
"description": "Surmon.me blog",
55
"author": "Surmon",
66
"license": "MIT",

src/components/comment/list/item.vue

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import { getCommentUrlHashById } from '/@/constants/element-anchor'
88
import { APP_CONFIG } from '/@/configs/app.config'
99
import { getGravatarByHash, getDisqusAvatarByUsername } from '/@/transforms/avatar'
10-
import { getPageURL, getAssetURL, getProxyURL, getOriginalProxyURL } from '/@/transforms/url'
10+
import { getPageURL, getAssetURL, getCdnProxyURL, getOriginalProxyURL } from '/@/transforms/url'
1111
import { getExtendValue } from '/@/transforms/state'
1212
import { firstUpperCase } from '/@/transforms/text'
1313
import { scrollToAnchor } from '/@/utils/scroller'
@@ -40,7 +40,7 @@
4040
(e: CommentEvents.CancelReply, commentId: number): void
4141
}>()
4242
43-
const { route, i18n: _i18n, cdnDomain } = useEnhancer()
43+
const { route, i18n: _i18n, cdnDomain, isCNUser } = useEnhancer()
4444
const commentStore = useCommentStore()
4545
const identityStore = useIdentityStore()
4646
const isDeleting = computed(() => commentStore.deleting)
@@ -62,11 +62,15 @@
6262
})
6363
6464
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+
}
7074
})
7175
7276
const authorURL = computed(() => {

src/components/comment/publisher/publisher.vue

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import { GAEventCategories } from '/@/constants/google-analytics'
99
import { useIdentityStore, UserType } from '/@/stores/identity'
1010
import { getGravatarByHash, getDisqusAvatarByUsername } from '/@/transforms/avatar'
11-
import { getAssetURL, getProxyURL, getOriginalProxyURL } from '/@/transforms/url'
11+
import { getAssetURL, getCdnProxyURL, getOriginalProxyURL } from '/@/transforms/url'
1212
import { CommentEvents } from '../helper'
1313
1414
enum PublisherEvents {
@@ -36,18 +36,21 @@
3636
(e: PublisherEvents.UpdateProfile, profile: Author): void
3737
}>()
3838
39-
const { i18n: _i18n, gtag, cdnDomain } = useEnhancer()
39+
const { i18n: _i18n, gtag, cdnDomain, isCNUser } = useEnhancer()
4040
const { user } = storeToRefs(useIdentityStore())
4141
const defaultAvatar = getAssetURL(cdnDomain, APP_CONFIG.default_comment_avatar)
4242
const avatar = computed(() => {
4343
// local user
4444
if (user.value.type === UserType.Local) {
4545
const hash = user.value.localProfile?.email_hash
46-
return hash ? getProxyURL(cdnDomain, getGravatarByHash(hash)) : defaultAvatar
46+
if (!hash) return defaultAvatar
47+
const gravatar = getGravatarByHash(hash)
48+
return isCNUser ? getCdnProxyURL(cdnDomain, gravatar) : gravatar
4749
}
4850
// disqus user
4951
if (user.value.type === UserType.Disqus) {
50-
return getOriginalProxyURL(getDisqusAvatarByUsername(user.value.disqusProfile?.username))
52+
const avatar = getDisqusAvatarByUsername(user.value.disqusProfile?.username)
53+
return isCNUser ? getOriginalProxyURL(avatar) : avatar
5154
}
5255
// temp user
5356
return defaultAvatar

src/components/common/uimage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import { defineComponent, ref, h } from 'vue'
88
import { useEnhancer } from '/@/app/enhancer'
9-
import { getAssetURL, getProxyURL } from '/@/transforms/url'
9+
import { getAssetURL, getCdnProxyURL } from '/@/transforms/url'
1010
import { isClient } from '/@/configs/app.env'
1111

1212
export default defineComponent({
@@ -48,7 +48,7 @@ export default defineComponent({
4848
imageSrc = getAssetURL(cdnDomain, src)
4949
}
5050
if (proxy) {
51-
imageSrc = getProxyURL(cdnDomain, src)
51+
imageSrc = getCdnProxyURL(cdnDomain, src)
5252
}
5353
if (defer && !deferRenderable.value) {
5454
// render a placeholder image (1x1 pixel transparent PNG)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useCdnDomain } from '/@/app/context'
2-
import { getProxyURL } from '/@/transforms/url'
2+
import { getCdnProxyURL } from '/@/transforms/url'
33

44
export const useCoverArtURL = (url?: string) => {
5-
return url ? getProxyURL(useCdnDomain(), `${url}?param=300y300`) : url
5+
return url ? getCdnProxyURL(useCdnDomain(), `${url}?param=300y300`) : url
66
}

src/pages/about/desktop/media/instagram.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import { useInstagramLatestMediasStore } from '/@/stores/media'
66
import { isVideoMediaIns, isAlbumMediaIns, getInstagramCoverURL } from '/@/transforms/media'
77
import type { InstagramMediaItem } from '/@/server/getters/instagram'
8-
import { getProxyURL } from '/@/transforms/url'
8+
import { getCdnProxyURL } from '/@/transforms/url'
99
1010
const fetching = ref(true)
1111
const { goLink } = useStores()
@@ -14,7 +14,7 @@
1414
const igMedias = computed(() => igLatestMediasStore.data?.data.slice(0, 23) ?? [])
1515
const getMediaThumbnail = (media: InstagramMediaItem) => {
1616
const url = getInstagramCoverURL(media)
17-
return isCNUser ? getProxyURL(cdnDomain, url) : url
17+
return isCNUser ? getCdnProxyURL(cdnDomain, url) : url
1818
}
1919
2020
onMounted(() => {

src/pages/photography/gallery.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import { isImageMediaIns, isVideoMediaIns, isAlbumMediaIns } from '/@/transforms/media'
55
import type { InstagramMediaItem } from '/@/server/getters/instagram'
66
import { IDENTITIES } from '/@/configs/app.config'
7-
import { getProxyURL } from '/@/transforms/url'
7+
import { getCdnProxyURL } from '/@/transforms/url'
88
import InstagramAlbum from './album.vue'
99
1010
defineProps<{
@@ -20,7 +20,7 @@
2020
}
2121
2222
const getMediaUrl = (url: string) => {
23-
return isCNUser ? getProxyURL(cdnDomain, url) : url
23+
return isCNUser ? getCdnProxyURL(cdnDomain, url) : url
2424
}
2525
</script>
2626

src/pages/photography/grid.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { ref, computed } from 'vue'
44
import { useEnhancer } from '/@/app/enhancer'
55
import { GAEventCategories } from '/@/constants/google-analytics'
6-
import { getProxyURL } from '/@/transforms/url'
6+
import { getCdnProxyURL } from '/@/transforms/url'
77
import { isVideoMediaIns, isAlbumMediaIns, getInstagramCoverURL } from '/@/transforms/media'
88
import type { InstagramMediaItem } from '/@/server/getters/instagram'
99
import InsGallery from './gallery.vue'
@@ -36,7 +36,7 @@
3636
3737
const getMediaThumbnail = (media: InstagramMediaItem) => {
3838
const url = getInstagramCoverURL(media)
39-
return isCNUser ? getProxyURL(cdnDomain, url) : url
39+
return isCNUser ? getCdnProxyURL(cdnDomain, url) : url
4040
}
4141
</script>
4242

src/pages/snippets/threads.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ import { shallowRef } from 'vue'
22
import { useEnhancer } from '/@/app/enhancer'
33
import type { ThreadsMediaListResponse } from '/@/server/getters/threads'
44
import { TunnelModule } from '/@/constants/tunnel'
5-
import { getProxyURL } from '/@/transforms/url'
5+
import { getCdnProxyURL } from '/@/transforms/url'
66
import { delayPromise } from '/@/utils/delayer'
77
import { isClient } from '/@/configs/app.env'
88
import tunnel from '/@/services/tunnel'
99

1010
export const useThreadsMediaUrl = (url?: string) => {
1111
if (!url) return null
1212
const { cdnDomain, isCNUser } = useEnhancer()
13-
return isCNUser ? getProxyURL(cdnDomain, url) : url
13+
return isCNUser ? getCdnProxyURL(cdnDomain, url) : url
1414
}
1515

1616
export const useThreadsMediasRequest = () => {

src/pages/youtube/videos.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import { isClient } from '/@/configs/app.env'
55
import { GAEventCategories } from '/@/constants/google-analytics'
66
import { TunnelModule } from '/@/constants/tunnel'
7-
import { getProxyURL } from '/@/transforms/url'
7+
import { getCdnProxyURL } from '/@/transforms/url'
88
import { delayPromise } from '/@/utils/delayer'
99
import tunnel from '/@/services/tunnel'
1010
import ListSwiper from './swiper.vue'
@@ -38,7 +38,7 @@
3838
3939
const getThumbnailURL = (thumbnails: any) => {
4040
const url = thumbnails.high?.url || thumbnails.medium?.url || thumbnails.defult?.url
41-
return url ? getProxyURL(cdnDomain, url) : ''
41+
return url ? getCdnProxyURL(cdnDomain, url) : ''
4242
}
4343
4444
const handleView = (video: any) => {

0 commit comments

Comments
 (0)