diff --git a/src/App.vue b/src/App.vue
index 2df0097..7280e0a 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -197,11 +197,13 @@ const privacyLink = computed(() => {
- Loading first posts ...
+ Initialiting ...
+ Loading first posts ...
Nothing there yet ...
+ :post="post" :config="config">
+
+
diff --git a/src/components/Card.vue b/src/components/Card.vue
index bbfc372..a4c9f8e 100644
--- a/src/components/Card.vue
+++ b/src/components/Card.vue
@@ -1,11 +1,12 @@
@@ -29,8 +40,14 @@ useIntervalFn(() => {
@@ -56,11 +73,17 @@ useIntervalFn(() => {
height: 2em;
}
-.wall-item .wall-media {
+.wall-media {
+}
+
+.wall-media img, .wall-media video {
width: 100%;
+ max-height: 1wh;
+ object-fit: cover;
border-radius: 5px;
}
+
.wall-item .invisible {
font-size: 0 !important;
line-height: 0 !important;
diff --git a/src/sources.ts b/src/sources.ts
index eee959a..200429a 100644
--- a/src/sources.ts
+++ b/src/sources.ts
@@ -1,4 +1,4 @@
-import type { Config, MastodonAccount, MastodonStatus, Post } from "@/types";
+import type { Config, MastodonAccount, MastodonStatus, Post, PostMedia } from "@/types";
import { regexEscape } from "@/utils";
@@ -211,10 +211,18 @@ const statusToWallPost = (status: MastodonStatus): Post => {
if (status.reblog)
status = status.reblog
- let media;
- const image = status.media_attachments?.find((m: any) => m.type == "image")
- if (image)
- media = image.url
+ const media = status.media_attachments?.map((m) : PostMedia|undefined => {
+ switch (m.type) {
+ case "image":
+ return { type: "image", url: m.url, preview: m.preview_url, alt: m.description ?? undefined }
+ case "video":
+ case "gifv":
+ return { type: "video", url: m.url, preview: m.preview_url, alt: m.description ?? undefined }
+ case "audio":
+ case "unknown":
+ return
+ }
+ }).filter((m): m is PostMedia => m !== undefined)
return {
id: status.uri,
diff --git a/src/types.ts b/src/types.ts
index c84e8a1..4380641 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -38,10 +38,18 @@ export type Post = {
url?: string;
};
- media?: string;
+ media: Array;
+
pinned?: boolean;
};
+export type PostMedia = {
+ type: "image" | "video"
+ url: string,
+ preview: string
+ alt?: string
+}
+
/**
* Mastodon types. We only model what is important for us
@@ -98,7 +106,7 @@ export type MastodonTag = {
export type MastodonMediaAttachment = {
id: string;
- type: 'audio' | 'video' | 'gifv' | 'unknown';
+ type: 'image' | 'audio' | 'video' | 'gifv' | 'unknown';
blurhash?: string | null;
description?: string | null;
preview_url: string;