mirror of
https://github.com/khoaliber/LetterFeed.git
synced 2026-03-02 13:18:27 +00:00
feat: LetterFeed logo for feed
This commit is contained in:
@@ -12,6 +12,7 @@ LetterFeed is a self-hosted application that transforms your email newsletters i
|
||||
- **Content Extraction:** Optionally, LetterFeed can extract the main article content from the email body.
|
||||
- **Email Management:** Can automatically move processed emails to a specified folder in your inbox to keep things organized.
|
||||
- **Easy to Use Interface:** A simple web interface to manage your newsletters and feeds.
|
||||
- **Authentication:** Optional username + password auth.
|
||||
|
||||
## How It Works
|
||||
|
||||
|
||||
@@ -16,10 +16,12 @@ def generate_feed(db: Session, newsletter_id: str):
|
||||
entries = get_entries_by_newsletter(db, newsletter_id)
|
||||
|
||||
feed_url = f"{settings.app_base_url}/feeds/{newsletter_id}"
|
||||
logo_url = f"{settings.app_base_url}/logo.png"
|
||||
|
||||
fg = FeedGenerator()
|
||||
fg.id(f"urn:letterfeed:newsletter:{newsletter.id}")
|
||||
fg.title(newsletter.name)
|
||||
fg.logo(logo_url)
|
||||
fg.link(href=feed_url, rel="self")
|
||||
sender_emails = ", ".join([s.email for s in newsletter.senders])
|
||||
fg.description(f"A feed of newsletters from {sender_emails}")
|
||||
|
||||
@@ -182,6 +182,9 @@ def test_get_newsletter_feed(client: TestClient):
|
||||
root = ET.fromstring(response.text)
|
||||
# Atom feed uses a namespace, so we need to include it in our tag searches
|
||||
ns = {"atom": "http://www.w3.org/2005/Atom"}
|
||||
logo = root.find("atom:logo", ns)
|
||||
assert logo is not None
|
||||
assert logo.text == "http://localhost:8000/logo.png"
|
||||
entry_titles = [
|
||||
entry.find("atom:title", ns).text for entry in root.findall("atom:entry", ns)
|
||||
]
|
||||
|
||||
@@ -40,6 +40,7 @@ def test_generate_feed(db_session: Session):
|
||||
# In a real scenario, you'd use an XML parser to validate structure and content more thoroughly
|
||||
assert f"<title>{newsletter.name}</title>" in feed_xml.decode()
|
||||
assert f"<id>urn:letterfeed:newsletter:{newsletter.id}</id>" in feed_xml.decode()
|
||||
assert "<logo>http://localhost:8000/logo.png</logo>" in feed_xml.decode()
|
||||
assert "<title>First Entry</title>" in feed_xml.decode()
|
||||
assert "<title>Second Entry</title>" in feed_xml.decode()
|
||||
assert (
|
||||
|
||||
Reference in New Issue
Block a user