Bugfix: do not convert base64 and non-http(s)://

This commit is contained in:
DarkCat09 2023-09-22 13:37:17 +04:00
parent d0d3dfd7b9
commit 3a8198ea14
No known key found for this signature in database
GPG Key ID: 0A26CD5B3345D6E3

View File

@ -10,16 +10,18 @@ export default function replaceHref(
) {
const doc = dom.window.document;
const parserUrl = (href: string) => generateParserUrl(
const parserUrl = (href: string) =>
href.startsWith("http") ? generateParserUrl(
requestUrl,
href,
engine,
redirectPath,
);
const proxyUrl = (href: string) => generateProxyUrl(
) : href;
const proxyUrl = (href: string) =>
href.startsWith("http") ? generateProxyUrl(
requestUrl,
href,
);
) : href;
modifyLinks(
doc.getElementsByTagName("a"),
@ -58,6 +60,7 @@ export default function replaceHref(
const parts = src.trim().split(" ");
try {
// first part is URL
// (srcset="http 200w 1x,...")
parts[0] = proxyUrl(parts[0]);
} catch (_err) { }
// join by space after splitting