Skip to content

Sync with FreshRSS - #65

Merged
pch merged 7 commits into
mainfrom
t3/freshrss-sync
Nov 25, 2026
Merged

pch merged 7 commits into
mainfrom
t3/freshrss-sync

Conversation

@pch

@pch pch commented Nov 25, 2026

Copy link
Copy Markdown
Owner

omafeed can now mirror a FreshRSS account as well as a Miniflux one, from the window (Sync account…, with a service choice) or omafeed account connect --service freshrss --username NAME URL. Miniflux stays the default and behaves as before.

Why it looks the way it does

FreshRSS's Google Reader API (/api/greader.php) differs from Miniflux in ways that shape the design:

  • No "changed since" for read/star state. ot selects entries added or whose content changed, not those read or starred. So a FreshRSS sync reads the complete unread and starred ID sets, the IDs new since the cursor (stream/items/ids?ot=), and fetches content only for IDs the library lacks. The sets are complete, so no count repair is needed. A quiet sync fetches no entries.
  • Categories have no IDs, only names. Category IDs become text everywhere (Category::id: String, folders.remote_id TEXT; Miniflux numbers are stored as text). Migration 7 (schema 7→8) replaces the column in place with ADD/DROP/RENAME COLUMN — not a table rebuild, which with foreign keys on would clear feeds.folder and folders.parent. A new frozen fixture (data-v7.sql, connected account, nested folders, a category) checks this.
  • Quirks worked around: renames onto a taken name and removing the default category answer OK and do nothing; the same endpoints act on entry labels — the client checks tag/list before and after. Feeds shown "in their own feed only" are left out of the reading list, so their IDs are asked for per feed. quickadd refuses with HTTP 200 and an error. A feed's address cannot change (the edit form locks it). Enclosures already linked in the content are not appended again.
  • Credentials: the API password is kept in the keyring (per service and server), sign-in happens once per client, the write token is fetched once, and no redirect is followed.

Changes

  • sync/backend.rs: service(), can_change_feed_url(), state_sync() (Changes | IdSets), and ID-set methods; rename_category returns the new ID.
  • sync/freshrss.rs: the client, with unit tests against a mock.
  • sync/mod.rs: the ID-set sync path; removing a category whose feeds the server keeps syncs at once.
  • Store: account.service, article identities freshrss:ID (re-linked after disconnect like miniflux:ID), Feed::remote.
  • App/CLI: service choice and user name; OMAFEED_SYNC_TOKEN (old OMAFEED_MINIFLUX_TOKEN still read); messages name the connected service; connecting while connected is refused before the keyring is touched.
  • Output snapshots re-blessed for the intended wording/help changes.
  • README, ARCHITECTURE, unreleased notes.

Testing

  • make check (fmt, clippy, all tests, docs); the desktop smoke test under Xvfb.
  • tests/freshrss_sync.rs against a mock reproducing the quirks above; an ignored test ran green against a real FreshRSS 1.31 (OMAFEED_FRESHRSS_URL/USER/PASSWORD).
  • Manual CLI connect/sync/disconnect against FreshRSS 1.31.
  • Reviewed by a Claude Sonnet subagent (Codex was over its usage limit); its findings on the keyring overwrite and enclosure matching are fixed, and archived FreshRSS feeds disappearing (the API does not list them) is documented.

🤖 Generated with Claude Code

pch and others added 7 commits November 25, 2026 13:22
Category IDs become text, since FreshRSS knows a category only by its name;
Miniflux keeps its numbers, written as text. Migration 7 adds the account's
service and turns folders.remote_id into a TEXT column in place (ADD, DROP
and RENAME COLUMN): rebuilding the table with foreign keys on would clear
every feeds.folder and folders.parent. A frozen v7 fixture with a connected
account, nested folders and a category checks that all of it survives.

The Backend trait gains what FreshRSS needs: its service, whether a feed's
address can change, how read and star changes are learned (listed changes,
or complete unread and starred ID sets), and the ID-set methods. Renaming a
category returns its new ID. Synced articles are identified by their
service ("miniflux:ID" or "freshrss:ID"), and a refresh after disconnecting
re-links either. Enclosures already linked in an entry's content are not
appended again. Miniflux behaves as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sync::freshrss::Client implements Backend on /api/greader.php: it signs in
once with ClientLogin (user name and API password), fetches the write token
once and sends it first in every write, and follows no redirects. Unread and
starred entries come as complete ID sets, new ones by `ot`, and contents by
ID in batches that split when a reply is too large; feeds shown only on
their own, which the reading list leaves out, are asked for one by one.

Categories are known by name. Renaming or removing one first checks that it
is a category and not an entry label, refuses a taken name, and checks the
result afterwards, since FreshRSS answers OK either way; the default
category cannot be removed. A feed's address cannot change, and quickadd's
refusal reason comes through. Addresses may name the server, its folder, or
the API itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A service that cannot list what changed since a time (StateSync::IdSets)
is synced from the IDs of the entries new since the cursor (or the last 30
days, the first time), of every unread and of every starred entry; only
entries the library lacks are fetched, with their state from the sets, and
the complete sets need no count repair. Removing a category whose feeds the
service keeps syncs at once, so they show where they went.

tests/freshrss_sync.rs mirrors an account against a mock that behaves like
FreshRSS: categories by name, a default category that stays, renames onto a
taken name and removals of the default answering OK, entry labels sharing
the categories' stream IDs, feeds left out of the reading list, quickadd
refusing with HTTP 200, and an old unread entry outside the new IDs. An
ignored test runs against a real FreshRSS given OMAFEED_FRESHRSS_URL,
OMAFEED_FRESHRSS_USER and OMAFEED_FRESHRSS_PASSWORD.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The account module picks the client by the account's service and keeps
the secret (Miniflux's API key, or FreshRSS's API password) in the
keyring per service and server; OMAFEED_SYNC_TOKEN replaces
OMAFEED_MINIFLUX_TOKEN, which still works. `omafeed account connect
--service freshrss --username NAME URL` connects to FreshRSS (Miniflux
stays the default), and the window's connect form gains a service
choice and, for FreshRSS, a user name field.

Messages name the connected service instead of Miniflux, the menu entry
is "Sync account…", and the feed form locks the address of a FreshRSS
feed, which FreshRSS cannot change; Feed::remote tells the server's
feeds from those it refused. Help and messages changed on purpose, so
the output snapshots were blessed again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The README's sync section covers both services, with what FreshRSS does
differently: ID-set syncs, the default category, categories made when a
feed goes in, locked feed addresses, no feed errors or server-side full
articles, altered title punctuation. ARCHITECTURE describes the second
backend, the state-sync kinds, migration 8 and the new tests, and the
unreleased notes announce FreshRSS, OMAFEED_SYNC_TOKEN and the schema
change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Connecting while an account is connected is refused before the keyring
is touched, so a second `account connect` can no longer replace the
connected account's secret with one that fails every sync. An enclosure
is left out only when the content names it as a whole attribute value,
not when it is a prefix of another link. The docs say that archiving a
feed in FreshRSS removes it here, since the API no longer lists it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
url 2.5.9 fixes RUSTSEC-2026-0592, a stack overflow in Url::origin() on
nested blob: URLs. RUSTSEC-2026-0543 marks chrono unmaintained with no
fixed version; it is ignored in deny.toml with its reason until chrono is
replaced, which is a change of its own. Both advisories were published
after main last passed and fail every branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pch
pch merged commit fc09c3d into main Nov 25, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant