diff options
| author | tamaina <tamaina@hotmail.co.jp> | 2023-04-12 10:58:56 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-12 10:58:56 +0900 |
| commit | 81d2c5a4a7355af8a385893136e12e618a8b92d2 (patch) | |
| tree | c9276e4468000c4d07262f13154a69852b56d57d /packages/frontend/src/components/global | |
| parent | refactor: サウンド関連の設定をpizzaxに移行 (#8105) (diff) | |
| download | misskey-81d2c5a4a7355af8a385893136e12e618a8b92d2.tar.gz misskey-81d2c5a4a7355af8a385893136e12e618a8b92d2.tar.bz2 misskey-81d2c5a4a7355af8a385893136e12e618a8b92d2.zip | |
enhance: カスタム絵文字関連の変更 (#9794)
* PackedNoteなどのemojisはプロキシしていないURLを返すように
* MFMでx3/x4もしくはscale.x/yが2.5以上に指定されていた場合にはオリジナル品質の絵文字を使用する
* update CHANGELOG.md
* fix changelog
* ??
* wip
* fix
* merge
* Update packages/frontend/src/scripts/media-proxy.ts
Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
* merge
* calc scale
---------
Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
Diffstat (limited to 'packages/frontend/src/components/global')
| -rw-r--r-- | packages/frontend/src/components/global/MkCustomEmoji.vue | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/packages/frontend/src/components/global/MkCustomEmoji.vue b/packages/frontend/src/components/global/MkCustomEmoji.vue index 84aae1cff8..0cb31ffcba 100644 --- a/packages/frontend/src/components/global/MkCustomEmoji.vue +++ b/packages/frontend/src/components/global/MkCustomEmoji.vue @@ -5,7 +5,7 @@ <script lang="ts" setup> import { computed } from 'vue'; -import { getStaticImageUrl } from '@/scripts/media-proxy'; +import { getProxiedImageUrl, getStaticImageUrl } from '@/scripts/media-proxy'; import { defaultStore } from '@/store'; import { customEmojis } from '@/custom-emojis'; @@ -15,25 +15,38 @@ const props = defineProps<{ noStyle?: boolean; host?: string | null; url?: string; + useOriginalSize?: boolean; }>(); const customEmojiName = computed(() => (props.name[0] === ':' ? props.name.substr(1, props.name.length - 2) : props.name).replace('@.', '')); +const isLocal = computed(() => !props.host && (customEmojiName.value.endsWith('@.') || !customEmojiName.value.includes('@'))); const rawUrl = computed(() => { if (props.url) { return props.url; } - if (props.host == null && !customEmojiName.value.includes('@')) { + if (isLocal.value) { return customEmojis.value.find(x => x.name === customEmojiName.value)?.url ?? null; } return props.host ? `/emoji/${customEmojiName.value}@${props.host}.webp` : `/emoji/${customEmojiName.value}.webp`; }); -const url = computed(() => - defaultStore.reactiveState.disableShowingAnimatedImages.value && rawUrl.value - ? getStaticImageUrl(rawUrl.value) - : rawUrl.value, -); +const url = computed(() => { + if (rawUrl.value == null) return null; + + const proxied = + (rawUrl.value.startsWith('/emoji/') || (props.useOriginalSize && isLocal.value)) + ? rawUrl.value + : getProxiedImageUrl( + rawUrl.value, + props.useOriginalSize ? undefined : 'emoji', + false, + true, + ); + return defaultStore.reactiveState.disableShowingAnimatedImages.value + ? getStaticImageUrl(proxied) + : proxied; +}); const alt = computed(() => `:${customEmojiName.value}:`); let errored = $ref(url.value == null); |