Repository navigation
Feed check: take a feed's website and find its icon there - #69
Merged
ronibhakta1 merged 2 commits intoNov 11, 2026
Merged
Conversation
POST /admin/feed-checks accepts an optional `website`. For an OPDS feed it becomes the `alternate` text/html link (unless the feed already has it) and is checked like any other link; it is ignored for a web page. A refused website blocks with url-invalid/url-unsafe, rel "alternate". When a feed has no icon of its own, the icon is looked for on its website (the one given, else its first alternate text/html link); a web page is its own website. Candidates, best first: Apple touch icons, then icons by largest `sizes`, then /apple-touch-icon.png and /favicon.ico; at most 4 tried, the first answering with an image is kept with its served type. A page with no working icon suggests none and says nothing. `rel` is read as tokens, so "icon shortcut" and apple-touch-icon-precomposed count, and tags after </head> are no longer read. Link probes and the icon search share one limit per check and per host, inside the links stage's existing deadline.
…ut a slash is one link A library CMS that renders each missing icon slowly could keep the icon search running to the check's limit and end it with check-timed-out. The search now has its own 6 s limit and stops quietly: no icon, no finding. "https://x.org" given as the website no longer adds a second alternate link when the feed already links "https://x.org/".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #68
Feedback on the Add catalog flow asked for a website step for OPDS feeds and for Apple touch icons and well-known icon locations. This does both in the feed check. Nothing is stored and there is no schema change.
What changes
POST /admin/feed-checksaccepts an optionalwebsite(same limits asurl). For an OPDS feed,feed.linksgains{rel: "alternate", href: website, type: "text/html"}unless the feed already has it, and it is checked like any other link. A web page ignores it. A refused website blocks withurl-invalid/url-unsafeandrel: "alternate".websitegiven, else the feed's firstalternatelink of typetext/html. A web page is its own website.apple-touch-icon/apple-touch-icon-precomposed, theniconby largestsizes(anycounts as largest), then/apple-touch-icon.png, then/favicon.ico. At most 4 are tried. The first that answers with animage/*type is kept, with the type the server served. If none answers, no icon is suggested and nothing is reported.relis read as tokens, soicon shortcutcounts andmask-icondoes not. Tags after</head>are no longer read.Tests
tests/unit/test_feed_check.py: candidate ranking, well-known fallbacks without repeats,sizes="any", nothing read after the head.tests/unit/test_feed_check_service.py: the website's best working icon, a well-known fallback after a soft 404, a feed's own icon never reads the website, a given website becomes the alternate (not repeated), a dead website only warns, a refused website blocks before any request, a web page ignoreswebsite, a slow icon search gives up without a finding, a website differing only by a trailing slash is not repeated.tests/e2e/test_admin_feed_checks.py:websitethrough the app gives the alternate and the icon; an emptywebsiteis 422.ruff check,ruff format --check,mypyclean.https://test.opds.io/2.0/home.jsonwithwebsite=https://opds.io/gives the alternate link andhttps://opds.io/apple-touch-icon.png(image/png) in 1.2 s.Website
edrlab/catalog-registry-website#65 (issue edrlab/catalog-registry-website#64) sends
website. Merge and deploy this first: today the endpoint refuses unknown fields with a 422.