Documentation
¶
Overview ¶
Package feed handles RSS/Atom and ActivityPub feed processing and aggregation.
This package provides functionality for subscribing to, fetching, and processing content from various feed types:
- RSS 2.0 feeds
- Atom feeds
- ActivityPub (Mastodon, Pleroma, etc.)
Feed items are fetched periodically via UpdateLoop and stored in the database. Each user can subscribe to multiple feeds, and feed items are marked as read/unread per user. The package handles:
- Feed discovery from URLs (including HTML link rel="alternate")
- Content sanitization to prevent XSS attacks
- Resource downloading and local storage
- ActivityPub federation (following actors, receiving posts)
- URL resolution and normalization
- Duplicate detection
HTML content from feeds is sanitized using a whitelist-based policy that allows safe tags and attributes while removing scripts and event handlers. Embedded images and resources are downloaded and stored locally.
Example usage:
// Subscribe to a feed err := feed.AddFeed(cfg, "Hacker News", "https://news.ycombinator.com/rss", userID) // Update all feeds err := feed.Update() // Run periodic updates go feed.UpdateLoop()
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddActivityPubFeedItem ¶ added in v0.8.0
func AddActivityPubFeedItem(cfg *config.Config, f *model.Feed, u *model.User, d *ap.InboxRequest) error
AddActivityPubFeedItem adds an ActivityPub post as a feed item.
func DeleteFeed ¶ added in v0.8.0
DeleteFeed removes a user's feed subscription.
Types ¶
This section is empty.