mirror of
https://github.com/juherr/kill-the-news.git
synced 2026-06-20 22:03:48 +00:00
chore: apply Prettier formatting to entire codebase
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
+16
-14
@@ -1,38 +1,40 @@
|
||||
import { Feed } from 'feed';
|
||||
import { FeedConfig, EmailData } from '../types';
|
||||
import { Feed } from "feed";
|
||||
import { FeedConfig, EmailData } from "../types";
|
||||
|
||||
/**
|
||||
* Generate an RSS feed from a list of emails
|
||||
*/
|
||||
export function generateRssFeed(
|
||||
feedConfig: FeedConfig,
|
||||
feedConfig: FeedConfig,
|
||||
emails: EmailData[],
|
||||
baseUrl: string
|
||||
baseUrl: string,
|
||||
): string {
|
||||
// Create a new feed
|
||||
const feed = new Feed({
|
||||
title: feedConfig.title,
|
||||
description: feedConfig.description || '',
|
||||
description: feedConfig.description || "",
|
||||
id: feedConfig.feed_url,
|
||||
link: feedConfig.site_url,
|
||||
language: feedConfig.language,
|
||||
updated: new Date(),
|
||||
generator: 'Email-to-RSS',
|
||||
generator: "Email-to-RSS",
|
||||
copyright: `Copyright © ${new Date().getFullYear()} ${feedConfig.title}`,
|
||||
feedLinks: {
|
||||
rss: feedConfig.feed_url
|
||||
rss: feedConfig.feed_url,
|
||||
},
|
||||
author: feedConfig.author ? {
|
||||
name: feedConfig.author,
|
||||
email: `noreply@${new URL(feedConfig.site_url).hostname}`
|
||||
} : undefined
|
||||
author: feedConfig.author
|
||||
? {
|
||||
name: feedConfig.author,
|
||||
email: `noreply@${new URL(feedConfig.site_url).hostname}`,
|
||||
}
|
||||
: undefined,
|
||||
});
|
||||
|
||||
// Add each email as a feed item
|
||||
for (const email of emails) {
|
||||
const date = new Date(email.receivedAt);
|
||||
const uniqueId = `${email.receivedAt}-${Buffer.from(email.subject).toString('base64').substring(0, 10)}`;
|
||||
|
||||
const uniqueId = `${email.receivedAt}-${Buffer.from(email.subject).toString("base64").substring(0, 10)}`;
|
||||
|
||||
feed.addItem({
|
||||
title: email.subject,
|
||||
id: uniqueId,
|
||||
@@ -50,4 +52,4 @@ export function generateRssFeed(
|
||||
|
||||
// Return the RSS feed as XML
|
||||
return feed.rss2();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user