Support for displaying GIFs

This commit is contained in:
Astra 2025-05-11 00:16:49 +09:00
parent 79d5694dd1
commit a26f0383a8
Signed by: astra
SSH key fingerprint: SHA256:jQDNS75/33T59Ey4yAzrUPP/5YQaXEetsW8hwUae+ag
2 changed files with 12 additions and 0 deletions

View file

@ -141,6 +141,13 @@
controls controls
></video> ></video>
{/if} {/if}
{#if post.gifLink}
<img
id="embedVideo"
src="{post.gifLink}"
alt="Post GIF"
/>
{/if}
</div> </div>
</div> </div>

View file

@ -46,6 +46,7 @@ class Post {
replyingUri: atUriObject | null; replyingUri: atUriObject | null;
imagesCid: string[] | null; imagesCid: string[] | null;
videosLinkCid: string | null; videosLinkCid: string | null;
gifLink: string | null;
constructor( constructor(
record: ComAtprotoRepoListRecords.Record, record: ComAtprotoRepoListRecords.Record,
@ -69,6 +70,7 @@ class Post {
this.quotingUri = null; this.quotingUri = null;
this.imagesCid = null; this.imagesCid = null;
this.videosLinkCid = null; this.videosLinkCid = null;
this.gifLink = null;
switch (post.embed?.$type) { switch (post.embed?.$type) {
case "app.bsky.embed.images": case "app.bsky.embed.images":
this.imagesCid = post.embed.images.map( this.imagesCid = post.embed.images.map(
@ -96,6 +98,9 @@ class Post {
break; break;
} }
break; break;
case "app.bsky.embed.external": // assuming that external embeds are gifs for now
this.gifLink = post.embed.external.uri;
break;
} }
} }
} }