From 2431c35267a2ac320a922b392cb588538efe7831 Mon Sep 17 00:00:00 2001 From: Arkm20 Date: Mon, 30 Mar 2026 23:23:57 -0500 Subject: [PATCH] quick proxy sanity --- templates/reader.html | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/templates/reader.html b/templates/reader.html index 24de4d4..acde287 100644 --- a/templates/reader.html +++ b/templates/reader.html @@ -372,6 +372,8 @@ const READER_MODE_KEY = "reader_view_mode"; const HISTORY_KEY = "reading_history"; + + // --- Initialization --- function init() { const pathParts = window.location.pathname.split("/"); @@ -587,6 +589,12 @@ } } + // Add this helper right above preloadInitialImages() +function proxyUrl(src) { + if (!src || src.startsWith("/")) return src; // already relative/proxied + return `${serverUrl}/proxy-image?url=${encodeURIComponent(src)}`; +} + async function preloadInitialImages() { // Create all IMG elements first (lazy loading structure) imageLinks.forEach((src) => { @@ -603,7 +611,7 @@ // Detect Aspect Ratio on first image for Auto-Webtoon Mode if (toPreload[0]) { const tempImg = new Image(); - tempImg.src = imageLinks[0]; + tempImg.src = proxyUrl(imageLinks[0]); await new Promise(r => { tempImg.onload = () => { // If height is significantly larger than width (2x), assume Webtoon @@ -624,7 +632,7 @@ return new Promise((resolve) => { img.onload = resolve; img.onerror = resolve; - img.src = imageLinks[index]; + img.src = proxyUrl(imageLinks[index]); }); }); @@ -642,7 +650,7 @@ function loadRemainingImages() { const images = container.getElementsByTagName("img"); Array.from(images).slice(4).forEach((img, index) => { - img.src = imageLinks[index + 4]; + img.src = proxyUrl(imageLinks[index + 4]); }); }