Expand description
The rueder server: one program next to PostgreSQL that fetches feeds,
cleans and stores their articles, and serves the web page, the page’s API
and the Google Reader API for apps of other makers. src/main.rs is the
command line (rueder serve, rueder account add and the others); all
else is in this library, where the tests and the benchmarks reach it.
These pages come from the comments in the code, private items included
(cargo doc --no-deps --lib --document-private-items). How to build and
run the server is in server/README.md.
§Where to find what
- The server as a whole:
routerputs the routes together with the layers around them,AppStateis what every request reaches, andAppErroris how a request fails without giving away internals. - Feeds and articles:
fetchfetches what is due,feedsturns a feed into articles,cleaningmakes their HTML safe,articlesstores them,imagesis the image proxy, andhttp_clientis the only way out to the internet. - Reading:
apiis the API the page lives on, withreading,tree,subscribe,search,filtersandlabels;eventsbrings what changes to every open tab. - Accounts:
accounts,login,sessions,second_factor,passkeys(withasset_linksfor the Android app),oidc,registration,profileandtransfer. - Apps of other makers:
greaderandapp_passwords. - Safety:
hardeningfor every answer and every changing request,ratefor how much one sender and one account may ask. - Running it:
status,monitor,health,reports,retention,moderation,legalandversion. - Tools:
import(the old rueder’s data),reclean,benchandtypescript(the API’s types for the page).
Modules§
- accounts
- Accounts and their passwords.
- api
- The API a logged-in reader’s interface lives on: the tree of folders and feeds, the lists of articles, an article, what is known of it, its source and its versions, and what was read, and the search.
- app_
passwords - App passwords: how apps of other makers log in to the Google Reader API
(see
crate::greader). - articles
- The article store: three tables, so that lists never read text and old versions never touch what new articles are read from.
- asset_
links - Passkeys in Android apps: which apps may use the passkeys of rueder’s site, and the statement that says so to Android (Digital Asset Links).
- bench
- Made-up data in the size of a real installation, and timings of the queries the reader lives on. This is how the layout of the article store is checked before anything is built on it, and checked again when it changes.
- captcha
- The captcha of open registration: a proof of work after ALTCHA’s scheme.
- cleaning
- Turns the text of an article as its feed sends it into what is stored for reading. This runs once per version on the server, never in the browser.
- The address of an account (work package 5.4, A16, A17, E6).
- events
- Live updates: what changes for an account reaches all its open tabs and
devices at once, over one connection per tab (
GET /api/events, server-sent events). - feeds
- From the bytes of a feed to articles in the store.
- fetch
- Fetching feeds: one feed (
fetch_feed), everything that is due (fetch_due) and the loop the server runs (run). - filters
- A reader’s filter rules: hide articles, or mark them read, by words in the title or the text, by author or by tag.
- greader
- The Google Reader API, for apps of other makers: Reeder, NetNewsWire (as a FreshRSS account), ReadKit, Read You and others read and use an account through it, as they do with FreshRSS and Miniflux.
- hardening
- What every answer and every changing request has to pass, whatever the endpoint: the headers that tell the browser what a page of rueder may do, and the check that a change was asked for by rueder’s own pages.
- health
- Asking a running rueder whether it is well:
rueder health, the health check of the container. The image holds nothing but the program, so there is no curl to ask with. - http_
client - The one way out to the internet: feeds, web pages for the feed search and
images are all fetched through the hardened client of the crate
hardened-httpnext to the server, so the rules against fetching from inside the own network (SSRF) are in one place. RSSifier uses the same crate. - images
- The image proxy: every image a reader sees comes from rueder, never from the site that published it, so that site learns nothing about who reads what.
- import
- Brings the data of the old rueder into the new database: feeds, articles, accounts, folders and subscriptions. What an account has read and its labels are not in the old database but in the browsers; they follow at the switch.
- inactive
- Accounts nobody uses (E13). Where the operator sets it with
rueder retention set --inactive, an account goes after so many months without being used, after two mails to its confirmed address. As rueder comes, every account stays. - labels
- Labels: a reader’s own marks for articles, each with a name and a color.
- legal
- The operator’s legal texts: where the imprint, the privacy policy and the terms of use are, and which version of the terms an account agreed to.
- login
- Logging in and out over the API, and the limit on wrong passwords.
- Mail to readers (work packages 5.4 and 5.5, E6): the link that confirms an address, the notice to an address an account no longer has, the link that sets a new password and the notice that one was set.
- metrics
- Metrics for Prometheus:
GET /metrics, in its text format (0.0.4). - moderation
- Reports of feeds and articles by their readers, blocking a feed, and what else the operator does to a feed.
- monitor
- What the server notices about itself while it runs: how long requests take,
how fetching, the feed search and the image proxy fare, and the warnings and
errors it logs. All of it lives in memory, for the last hour, and is gone
with a restart; the status page of the admins shows it (
crate::status). - oidc
- Logging in through an OpenID Connect provider, for servers that set one.
- openapi
- The description of the HTTP interface (OpenAPI 3.1), written from the
code: each handler says what it takes and answers in its
#[utoipa::path], each type it sends or reads derivesToSchemanext toTS, and the routes are registered withutoipa_axum, so that the router serves exactly what the description lists (crate::description). This module holds what is the same for all of them: the overview (openapi.md), the groups, the two ways to log in, and the answers every operation that needs a login can give. - passkeys
- Passkeys: logging in without a name or a password, with a key the reader’s
device keeps and unlocks with its PIN or biometrics (WebAuthn). A passkey is
a whole login and a second factor at once: the device stands for what the
reader has, its PIN or fingerprint for what they know or are. The checking
is
webauthn-rs’s; this module keeps what goes around it. - profile
- What a reader does with their own account, and an admin with accounts: the list of the own sessions, a new password, deleting the own account, and making accounts.
- progress
- Lines in the log that say how far a long run has come: the migrations at
the start, the import of the old database and cleaning again. One every
EVERYat most, so that whoever watches the log sees what is being done without being flooded, and none for a run that is over before. - rate
- How much one sender and one account may ask of the server.
- reading
- What an account has read, and how many articles that leaves unread.
- reclean
- Cleans the text of articles again, from the versions as they were fetched.
- recovery
- “Forgot password” (work package 5.5, A17): a link mailed to the account’s confirmed address sets a new password.
- registration
- Accounts that make themselves: open registration and invitations.
- reports
- Reports of errors in the browsers of readers who agreed to send them.
- retention
- How long the server keeps what is old of the articles (
Articles, work package 5.3, A21, E4): set by the operator withrueder retention set, shown withrueder retention show, and kept in the one row of the tableretention, so that a change counts at once, without a restart. As rueder comes, everything stays for ever. Once an hoursweepclears in small portions, each in a transaction of its own, so that fetching never waits for long: - rssifier
- RSSifier, the program next to rueder that makes feeds of web pages without
one (A25,
rssifier/). The feed search asks it when a page names no feed, and the fetching asks it for the feeds of such pages (feeds.sourceispage), always with the token the operator gave rueder. - search
- The search over the articles of the feeds an account subscribes to.
- second_
factor - The second factor: codes of an authenticator app after RFC 6238 (TOTP), and
ten recovery codes for when the app is gone. Passkeys count as a second
factor too (see
crate::passkeys): an account has it on when it has the app or a passkey, and then a password alone opens nothing. - sessions
- Sessions: who a request comes from.
- settings
- The settings of
rueder servethat belong to no module of their own, read from the environment once at the start. A value that is none of its setting stops the start, rather than quietly being the default: a switch isonoroff, andAPP_API=falseis a mistake, noton. A setting that is empty counts as not set, as an empty line in.envgives. - sizes
- How large the server is set up (work package 5.33): how many connections
to the database it keeps, how many costly requests run at once and how
many mails it sends a day. As rueder comes they suit an instance of a few
thousand accounts; a large one sets them with
DATABASE_CONNECTIONS,HEAVY_AT_ONCEandMAILS_PER_DAY, which the server checks againstCONNECTIONS,HEAVYandMAILSwhen it starts. - status
- The status of the server, for its admins:
GET /api/status. - subscribe
- Subscribing: finding the feeds of an address, subscribing to one, and taking a list of subscriptions in and out as OPML.
- table
- A table in memory with room for so many keys, for the limits of
crate::rateandcrate::login. - transfer
- Moving an account from one rueder to another: what a reader made of their account goes out as one JSON file and comes in again on another server.
- tree
- Changing the tree of folders and feeds, and a reader’s settings.
- typescript
- The API’s types in TypeScript, so that the frontend and the server cannot drift apart: what the server sends and reads as JSON, written out of the Rust types themselves.
- version
- What this build is: which commit it came from and when that was made, how
it was built, and where it runs.
build.rsputs the facts into the program when it is built; what is not known is empty, as in a build from a source archive without a git directory.
Structs§
Enums§
- AppError
- What a handler can fail with. Anything unexpected becomes a logged 500.
Constants§
- API 🔒
- Where the page’s API is, in the router and in its description alike.
- GREADER 🔒
- Where the Google Reader API is.
- MAX_
BODY - The largest body a request to the API may have, in bytes.
Functions§
- api 🔒
- What goes around the page’s API.
- api_
routes 🔒 - The routes of the page’s API, without what goes around them (
api()). - description
- The description of every route the server answers (OpenAPI), from the
same routes as
routerserves; seeopenapi.server/openapi.jsonis it as a file. - health 🔒
- Whether the server and its database answer, for a health check (also
rueder healthon the command line). - image 🔒
- An image through the proxy, for logged-in readers only, unless the
operator lets a cache in front of rueder keep images (
IMAGES_PUBLIC=on). The address says which one and proves that the server itself asked for it; seeimages. - other_
routes 🔒 - The routes outside the two APIs: the image proxy, what Android asks and the metrics for Prometheus.
- router
- The whole app: the page’s API under
/api, the Google Reader API under/greader, the image proxy, and everything else is the SvelteKit SPA. - types 🔒
- The types of this module for the frontend, see
typescript.