fix(route/bsky): render video thumbnail (#17345)

This commit is contained in:
Tony
2024-10-29 01:01:04 +08:00
committed by GitHub
parent f2d0b7260d
commit 8a12d896fc
2 changed files with 6 additions and 4 deletions
+2 -2
View File
@@ -62,8 +62,8 @@ async function handler(ctx) {
description: art(path.join(__dirname, 'templates/post.art'), {
text: post.record.text.replaceAll('\n', '<br>'),
embed: post.embed,
// embed.$type "app.bsky.embed.record#view" and "app.bsky.embed.recordWithMedia#view"
// are not handled
// embed.$type "app.bsky.embed.record#view" and "app.bsky.embed.recordWithMedia#view" are not handled
// "app.bsky.embed.video#view" is rendered as image
}),
author: post.author.displayName,
pubDate: parseDate(post.record.createdAt),
+4 -2
View File
@@ -3,11 +3,13 @@
{{ /if }}
{{ if embed }}
{{ if embed.$type == 'app.bsky.embed.images#view'}}
{{ if embed.$type === 'app.bsky.embed.images#view' }}
{{ each embed.images i }}
<img src="{{ i.fullsize }}" alt="{{ i.alt }}"><br>
{{ /each }}
{{ else if embed.$type == 'app.bsky.embed.external#view' }}
{{ else if embed.$type === 'app.bsky.embed.video#view' }}
<img src="{{ embed.thumbnail }}"><br>
{{ else if embed.$type === 'app.bsky.embed.external#view' }}
<a href="{{ embed.external.uri }}"><b>{{ embed.external.title }}</b><br>
{{ embed.external.description }}
</a>