From 4e81d0e27d3a549a04f8263d5c5ec70b121c6185 Mon Sep 17 00:00:00 2001 From: Shinigami92 Date: Sat, 10 Dec 2022 23:27:06 +0100 Subject: [PATCH] improve --- components/status/StatusPreviewCard.vue | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/components/status/StatusPreviewCard.vue b/components/status/StatusPreviewCard.vue index 83fbcc7c..53f60a5c 100644 --- a/components/status/StatusPreviewCard.vue +++ b/components/status/StatusPreviewCard.vue @@ -15,13 +15,17 @@ const description = $computed(() => props.card.description ? props.card.descript // TODO: handle card.type: 'photo' | 'video' | 'rich'; -$fetch('/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('/api/og-image', { + params: { cardUrl: props.card.url }, + }).then((ogImageUrl) => { + // Only override if ogImageUrl is not empty + if (ogImageUrl) + image.value = ogImageUrl + }).catch(() => {}) +}