This document provides a mental model of how html2rss-web processes requests.
flowchart TD
user["User / RSS Reader"] --> routes["Roda App (app/web/routes)"]
security["Auth / Security (app/web/security)"] --> routes
routes --> feeds["Feeds Service (app/web/feeds)"]
cache["Cache (app/web/feeds/cache.rb)"] --> feeds
feeds --> gem["html2rss Gem"]
strategies["Request Strategies (Faraday / Browserless)"] --> gem
gem --> target["Target Website"]
Requests enter via app.rb and are dispatched to app/web/routes/.
- Static feed pages (
/<feed_name>): Routed byapp/web/routes/feed_pages.rband resolved astarget_kind: :static.- Source: static config in
config/feeds.yml(viaLocalConfig.find). - Auth boundary: no feed token required on this route.
- Failure mode: unknown feed names fail at static config lookup.
- Source: static config in
- Token-backed feed reads (
/api/v1/feeds/:token): Routed byapp/web/routes/api_v1/feed_routes.rband resolved astarget_kind: :token.- Token scope:
FeedAccess.authorize_feed_token!validates signature/expiry and re-checks account URL access. - Constraint: disabled when AutoSource is off (
ForbiddenErrorfromSourceResolver.ensure_auto_source_enabled!).
- Token scope:
- Feed creation (
POST /api/v1/feeds): Authenticated via bearer token inapp/web/security/auth.rb; this endpoint mints feed tokens for subsequent token-backed reads.
The Html2rss::Web::Feeds::SourceResolver determines where feed configuration comes from based on route target:
- Static (
target_kind: :static): Pre-defined inconfig/feeds.yml. - Token (
target_kind: :token): Generated from validated feed token payload + AutoSource globals.
The Html2rss::Web::Feeds::Service orchestrates the extraction:
- Checks the
Html2rss::Web::Feeds::Cache. - If stale/missing, calls the
html2rssgem with the resolved strategy. - Renders the output using
RssRenderer(XML) orJsonRenderer.
Strategies are defined by the html2rss gem but can be configured here.
- Faraday: Default HTTP client for static HTML.
- Browserless: Used for JavaScript-heavy websites.
To add or configure strategies, see app/web/feeds/source_resolver.rb and the html2rss gem documentation.