Skip to content

Use Reader images as KOReader article covers - #44

Merged
Endle merged 3 commits into
Endle:mainfrom
Kageetai:feat/readwise-covers
Oct 12, 2026
Merged

Endle merged 3 commits into
Endle:mainfrom
Kageetai:feat/readwise-covers

Conversation

@Kageetai

@Kageetai Kageetai commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Downloaded HTML articles currently ignore Reader's image_url, so their Reader cover is missing in KOReader. This change downloads that image as a KOReader custom cover for new articles and fills in missing covers for existing downloads without rewriting their HTML.

Cover downloads follow the existing image-download toggle and size limit. Existing custom covers are preserved. Unavailable, corrupt, or oversized images do not fail article sync; partial copies are removed so a later sync can retry. Successful downloads invalidate KOReader's metadata cache.

Validation:

  • 14 cover regression tests and 15 existing highlight tests pass.
  • All seven Lua files pass LuaJIT syntax checks and Luacheck with the repository configuration.
  • Cover display tested on a BOOX Palma 2 with KOReader v2026.07.1.

The image-heavy article freeze is tracked separately in #43. Article HTML/image processing is unchanged here, and the freeze also reproduces using a fresh HTML copy without a custom cover.

@Endle

Endle commented Oct 12, 2026

Copy link
Copy Markdown
Owner

Hi @Kageetai ,

Thank you so much for your interest. I'm sorry that I was too busy last week.

I'll take care of this PR and I'll merge it after testing on my Kindle

@Kageetai

Copy link
Copy Markdown
Contributor Author

Thanks for looking into it. I could only test it on my Android device

Endle and others added 2 commits October 12, 2026 18:44
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VTrfmhAJ2zK6Z875JKAhpm
- Covers are off by default: "Download article covers" in
  Settings/Image Download, independent of article image downloads.
- New articles get their cover at download. Articles already on the
  device wait in covers_pending and get theirs within 30 seconds per
  sync; an article open in the reader is skipped until a later sync.
- One attempt per article. Only temporary failures (no response, 408,
  429, 5xx, local write failure) are kept, in covers_failed, for
  "Retry failed covers". Successes and permanent failures store
  nothing, so a cover the user removed stays removed. Both lists are
  pruned to the articles on the device.
- After three network errors in a row, a sync stops fetching covers.
- Covers over 1 MB are logged and over 2 MB stopped while
  downloading. Images under 200 px on a side or over 4 million pixels
  are refused from their header, before decoding.
- Requests accept only formats KOReader renders, use KOReader's
  timeout sink so the 15 s total applies, and every failure is logged
  with its reason.
- One directory scan per sync instead of two per existing article,
  and only InvalidateMetadataCache is broadcast per cover.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VTrfmhAJ2zK6Z875JKAhpm
@Endle
Endle merged commit 4f21556 into Endle:main Oct 12, 2026
1 check passed
@Endle

Endle commented Oct 12, 2026

Copy link
Copy Markdown
Owner

I tested on my Kindle Paperwhite and it works great!

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.

2 participants