diff options
| author | Dawid Rycerz <dawid@rycerz.xyz> | 2025-07-03 14:31:38 +0300 |
|---|---|---|
| committer | Dawid Rycerz <dawid@rycerz.xyz> | 2025-07-03 14:31:38 +0300 |
| commit | 0b6a5881b99027be9a175e7d1f2b112daef1ab51 (patch) | |
| tree | 5c00a2893e07e562aee15b87382bf7322494e484 /src/loaders/pleroma.ts | |
| parent | e28e2c961659f48177cf8ce39eeb39480b221535 (diff) | |
Add images support
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: { |
