This commit is contained in:
Shinigami92 2022-12-10 23:27:06 +01:00
parent cab3ed4ad4
commit 4e81d0e27d

View file

@ -15,13 +15,17 @@ const description = $computed(() => props.card.description ? props.card.descript
// TODO: handle card.type: 'photo' | 'video' | 'rich';
$fetch<string>('/api/og-image', {
params: { cardUrl: props.card.url },
}).then((ogImageUrl) => {
// Only override if ogImageUrl is not empty
if (ogImageUrl)
image.value = ogImageUrl
}).catch(() => {})
// Only try to fetch og:image if the card.image is already provided from mastodon
// We only want to improve the image quality
if (image.value) {
$fetch<string>('/api/og-image', {
params: { cardUrl: props.card.url },
}).then((ogImageUrl) => {
// Only override if ogImageUrl is not empty
if (ogImageUrl)
image.value = ogImageUrl
}).catch(() => {})
}
</script>
<template>