mirror of
https://github.com/thegeneralist01/archivr
synced 2026-07-21 18:55:36 +02:00
fix(core): prevent lazy-resolver double-processing on Freedium reader images
_archivrResolveLazyImgs is called twice: before Readability (_pre) and after the post-body stamp pass (_post). The stamp pass sets data-archivr-src but previously left data-src/data-zoom-src/etc intact, so _post's 'lazySrc && _isPlaceholder' condition fired on the same images and rewrote src to the CDN URL — which SingleFile then tried and failed to fetch from the Freedium proxy context, redundantly. Fix: strip all lazy attrs (data-src, data-lazy-src, data-zoom-src, data-original, data-lazy) when stamping data-archivr-src. _post then finds no lazySrc on those images and skips them cleanly. Rust owns them via data-archivr-src. _post continues to handle any remaining placeholder images not covered by the stamp pass (non-Freedium reader captures).
This commit is contained in:
parent
3d95df8d5a
commit
571da72649
1 changed files with 8 additions and 0 deletions
|
|
@ -95,6 +95,14 @@ const READER_MODE_SCRIPT: &str = concat!(
|
||||||
try { lazySrc = new URL(lazySrc, _base).href; } catch(e) {}
|
try { lazySrc = new URL(lazySrc, _base).href; } catch(e) {}
|
||||||
img.setAttribute('data-archivr-src', lazySrc);
|
img.setAttribute('data-archivr-src', lazySrc);
|
||||||
img.removeAttribute('loading');
|
img.removeAttribute('loading');
|
||||||
|
// Remove lazy attrs so _archivrResolveLazyImgs (called below) cannot
|
||||||
|
// rewrite src to a CDN URL that SingleFile cannot fetch from the proxy
|
||||||
|
// context — Rust owns these images via data-archivr-src instead.
|
||||||
|
img.removeAttribute('data-src');
|
||||||
|
img.removeAttribute('data-lazy-src');
|
||||||
|
img.removeAttribute('data-zoom-src');
|
||||||
|
img.removeAttribute('data-original');
|
||||||
|
img.removeAttribute('data-lazy');
|
||||||
});
|
});
|
||||||
var _post = _archivrResolveLazyImgs(_base);
|
var _post = _archivrResolveLazyImgs(_base);
|
||||||
if (article.title) document.title = article.title;
|
if (article.title) document.title = article.title;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue