Skip to content

Commit

Permalink
Merge pull request #64 from AdollaApp/dev-proxy-stuff
Browse files Browse the repository at this point in the history
Dev proxy stuff
  • Loading branch information
JipFr authored Jul 9, 2024
2 parents d838eb1 + 1c9ae58 commit 8bb98a1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
24 changes: 13 additions & 11 deletions public/js/pages/reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,23 +421,25 @@ function doImages(bypassCache = false) {
img.setAttribute("data-i", clone.length - i);
img.style.minHeight = "30vh";

const referer = location.href.includes("mangasee")
? "mangasee"
: location.href.includes("manganelo")
? "manganelo"
: location.href.includes("mangahere")
? "mangahere"
: "null";

// Set source
const proxySrc = `/proxy-image?url=${encodeURIComponent(url)}&referer=${
location.href.includes("mangasee")
? "mangasee"
: location.href.includes("manganelo")
? "manganelo"
: location.href.includes("mangahere")
? "mangahere"
: "null"
}${bypassCache ? `&c=${+Date.now()}` : ""}`;
const proxySrc = `/proxy-image?url=${encodeURIComponent(
url
)}&referer=${referer}${bypassCache ? `&c=${+Date.now()}` : ""}`;

const isBookMode = getSettings()["double-pages"] === "yes";

if (isBookMode) {
img.setAttribute("src", url.includes("mangadex") ? proxySrc : url);
img.setAttribute("src", url);
} else {
img.setAttribute("data-src", url.includes("mangadex") ? proxySrc : url);
img.setAttribute("data-src", url);
img.src =
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";
}
Expand Down
7 changes: 4 additions & 3 deletions public/js_compiled/pages/reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,14 +463,15 @@ function doImages() {
img.setAttribute("alt", "Page ".concat(Number(clone.length - i)));
img.setAttribute("data-i", clone.length - i);
img.style.minHeight = "30vh";
var referer = location.href.includes("mangasee") ? "mangasee" : location.href.includes("manganelo") ? "manganelo" : location.href.includes("mangahere") ? "mangahere" : "null";

// Set source
var proxySrc = "/proxy-image?url=".concat(encodeURIComponent(url), "&referer=").concat(location.href.includes("mangasee") ? "mangasee" : location.href.includes("manganelo") ? "manganelo" : location.href.includes("mangahere") ? "mangahere" : "null").concat(bypassCache ? "&c=".concat(+Date.now()) : "");
var proxySrc = "/proxy-image?url=".concat(encodeURIComponent(url), "&referer=").concat(referer).concat(bypassCache ? "&c=".concat(+Date.now()) : "");
var isBookMode = getSettings()["double-pages"] === "yes";
if (isBookMode) {
img.setAttribute("src", url.includes("mangadex") ? proxySrc : url);
img.setAttribute("src", url);
} else {
img.setAttribute("data-src", url.includes("mangadex") ? proxySrc : url);
img.setAttribute("data-src", url);
img.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";
}
img.addEventListener("error", function () {
Expand Down
3 changes: 2 additions & 1 deletion src/routers/manga-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,8 @@ router.get("/proxy-image", (req, res) => {
} else if (req.query.referer === "mangahere") {
headers.referer = "https://www.mangahere.cc/";
}
headers["user-agent"] = "Adolla";
headers["user-agent"] =
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36";

fetch(url, {
headers,
Expand Down

0 comments on commit 8bb98a1

Please sign in to comment.