Skip to content

Commit 67069b1

Browse files
committed
feat: support video preview
1 parent b06e53e commit 67069b1

2 files changed

Lines changed: 33 additions & 2 deletions

File tree

app/components/global/BlueskyPostEmbed.client.vue

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@ interface BlueskyPost {
3737
uri: string
3838
author: PostAuthor
3939
record: { text: string; createdAt: string }
40-
embed?: { $type: string; images?: EmbedImage[]; external?: EmbedExternal }
40+
embed?: {
41+
$type: string
42+
images?: EmbedImage[]
43+
external?: EmbedExternal
44+
thumbnail?: string
45+
aspectRatio?: { width: number; height: number }
46+
}
4147
likeCount?: number
4248
replyCount?: number
4349
repostCount?: number
@@ -88,6 +94,7 @@ const { data: post, status } = useAsyncData(
8894
)
8995
9096
const postUrl = computed(() => {
97+
console.log('postValue', post.value)
9198
// Prefer the explicit URL prop if provided
9299
if (props.url) return props.url
93100
@@ -182,6 +189,25 @@ const postUrl = computed(() => {
182189
</div>
183190
</template>
184191

192+
<!-- Embedded video -->
193+
<template v-if="post.embed?.thumbnail">
194+
<div class="relative block mb-3 p-0.5 bg-bg-muted rounded-lg">
195+
<img
196+
:src="post.embed.thumbnail"
197+
alt=""
198+
class="w-full rounded-lg object-cover"
199+
:height="post.embed.aspectRatio?.height"
200+
:width="post.embed.aspectRatio?.width"
201+
loading="lazy"
202+
/>
203+
<div
204+
class="absolute inset-0 bg-bg/50 flex items-center justify-center text-fg text-sm font-medium"
205+
>
206+
Click to watch video on Bluesky
207+
</div>
208+
</div>
209+
</template>
210+
185211
<!-- Timestamp + engagement -->
186212
<div class="flex items-center gap-4 text-sm text-fg-subtle">
187213
<DateTime :datetime="post.record.createdAt" date-style="medium" />

modules/security-headers.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@ export default defineNuxtModule({
3131
!process.env.TEST
3232

3333
// These assets are embedded directly on blog pages and should not affect image-proxy trust.
34-
const cspOnlyImgOrigins = ['https://api.star-history.com', 'https://cdn.bsky.app']
34+
const cspOnlyImgOrigins = [
35+
'https://api.star-history.com',
36+
'https://cdn.bsky.app',
37+
'https://video.bsky.app',
38+
'https://video.cdn.bsky.app',
39+
]
3540
const imgSrc = [
3641
"'self'",
3742
'data:',

0 commit comments

Comments
 (0)