fix(mangareader): resolve lazy-loaded covers - #727
Conversation
kkantan
left a comment
There was a problem hiding this comment.
the version numbers for mangareader sources should also be incremented so that this change shows as an update for users.
| fn preferred_image_attr(mut attr: impl FnMut(&str) -> Option<String>) -> Option<String> { | ||
| [ | ||
| "abs:data-lazy-src", | ||
| "abs:data-src", | ||
| "abs:data-url", | ||
| "abs:src", | ||
| "data-url", | ||
| ] | ||
| .into_iter() | ||
| .find_map(&mut attr) | ||
| } |
There was a problem hiding this comment.
I don't think this new implementation is necessary, since it appears to be the same logic but somewhat more abstracted, in a way that doesn't really make sense.
| use aidoku_test::aidoku_test; | ||
|
|
||
| #[aidoku_test] | ||
| fn manga_list_prefers_lazy_loaded_cover() { |
There was a problem hiding this comment.
I think maintaining tests like these can be annoying since selectors are prone to changing, and it's not clear what input the parse_manga_list function requires while testing. anyways, the change is small enough that I don't think it really warrants tests.
|
Addressed the requested version bump in a951608: Manga Mura is the only source currently depending on the mangareader template, and its source version is now 3. I also removed the abstraction and selector tests called out in the inline review. Ready for another look. |
Summary
data-lazy-src,data-src, anddata-urlbefore placeholdersrcvaluesMangaMura currently emits a one-pixel GIF in
srcand the actual CDN cover indata-src. Directsrcreads therefore produce transparent listing thumbnails even though details and reader images work. Reusing one helper across every MangaReader cover path fixes the template without adding per-entry detail requests.Verification
cargo fmt --checkintemplates/mangareadercargo test --target aarch64-apple-darwin(1 passed)cargo test --no-run(Wasm fixture compiles)cargo clippy -- -D warningsintemplates/mangareadercargo test --no-run,cargo clippy -- -D warnings, andcargo build --releaseinsources/ja.mangamurasrcplus realdata-srccovers