mirror of
https://github.com/elk-zone/elk.git
synced 2024-12-05 03:59:59 +03:00
improve
This commit is contained in:
parent
cab3ed4ad4
commit
4e81d0e27d
1 changed files with 11 additions and 7 deletions
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue