diff options
Diffstat (limited to 'src/loaders/pleroma.ts')
| -rw-r--r-- | src/loaders/pleroma.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/loaders/pleroma.ts b/src/loaders/pleroma.ts index a0b169f..feb11c8 100644 --- a/src/loaders/pleroma.ts +++ b/src/loaders/pleroma.ts @@ -314,6 +314,15 @@ export function pleromaLoader(config: PleromaFeedConfig): Loader { // Extract source URL from the entry const sourceUrl = entry.link?.find(link => link["@_rel"] === "alternate")?.["@_href"] || entry.id; + // Extract image attachments + const attachments = entry.link?.filter(link => + link["@_rel"] === "enclosure" && + link["@_type"]?.startsWith("image/") + ).map(link => ({ + url: link["@_href"], + type: link["@_type"] + })) || []; + // Create note entry store.set({ id: `pleroma-${postId}`, @@ -323,6 +332,7 @@ export function pleromaLoader(config: PleromaFeedConfig): Loader { cleanedContent.substring(0, 160) + (cleanedContent.length > 160 ? "..." : ""), publishDate: new Date(entry.published), sourceUrl, + attachments, }, body: cleanedContent, rendered: { @@ -363,6 +373,9 @@ export function pleromaLoader(config: PleromaFeedConfig): Loader { // Use the link as source URL const sourceUrl = typeof item.link === "string" ? item.link : item.guid || ""; + // For RSS, attachments would be empty since we're actually getting Atom feeds + const attachments: { url: string; type: string }[] = []; + // Create note entry store.set({ id: `pleroma-${postId}`, @@ -372,6 +385,7 @@ export function pleromaLoader(config: PleromaFeedConfig): Loader { cleanedContent.substring(0, 160) + (cleanedContent.length > 160 ? "..." : ""), publishDate: new Date(item.pubDate), sourceUrl, + attachments, }, body: cleanedContent, rendered: { |
