feed

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2025 License: AGPL-3.0 Imports: 20 Imported by: 0

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 AddFeed

func AddFeed(cfg *config.Config, name, u string, uid uint) error

AddFeed adds a new feed subscription for a user.

func DeleteFeed added in v0.8.0

func DeleteFeed(cfg *config.Config, uf *model.UserFeed) error

DeleteFeed removes a user's feed subscription.

func Update

func Update() error

Update fetches and updates all feeds.

func UpdateLoop

func UpdateLoop()

UpdateLoop runs a periodic feed update loop.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL