Skip to content

Commit

Permalink
Fix reddit gallery host rule
Browse files Browse the repository at this point in the history
  • Loading branch information
qsniyg committed Feb 1, 2025
1 parent 8e1d1bb commit 19c1290
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 24 deletions.
30 changes: 17 additions & 13 deletions src/userscript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60120,17 +60120,6 @@ var $$IMU_EXPORT$$;
return src.replace(/:\/\/preview\.redd\.it\/(award_images\/+t[0-9]*_[0-9a-z]+\/+)?(?:[-0-9a-z]+-)?([^/.]*\.[^/.?]*)\?.*$/, "://i.redd.it/$1$2");
}

if (domain === "i.redd.it" && src.match(/^[a-z]+:\/\/[^/]*\/[0-9a-z]+\.[^-/._?#]*$/)) {
return {
url: src,
headers: {
Accept: '*/*',
Referer: null
},
is_original: true
};
}

if (domain === "i.reddituploads.com") {
// https://i.reddituploads.com/59933254fd6e44228dc5f0fef3d850af?fit=max&h=1536&w=1536&s=6db141a8ef89df0720e6666f3e7e26bf
// https://i.reddituploads.com/59933254fd6e44228dc5f0fef3d850af
Expand Down Expand Up @@ -60223,8 +60212,12 @@ var $$IMU_EXPORT$$;

var urls = [];

var obj = {
extra: {}
var obj:BigImageInfoSObject = {
extra: {},
headers: {
Accept: "*/*"
Referer: "https://www.reddit.com/"
}
};

if (item.permalink) {
Expand Down Expand Up @@ -60369,6 +60362,17 @@ var $$IMU_EXPORT$$;
} while (current = current.parentElement);
}

if (domain === "i.redd.it" && src.match(/^[a-z]+:\/\/[^/]*\/[0-9a-z]+\.[^-/._?#]*$/)) {
return {
url: src,
headers: {
Accept: '*/*',
Referer: null
},
is_original: true
};
}

if ((domain_nosub === "gstatic.com" ||
domain === "") &&
host_domain_nosub.match(/^google\./) && options.element) {
Expand Down
26 changes: 15 additions & 11 deletions userscript.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -54740,16 +54740,6 @@ var $$IMU_EXPORT$$;
// https://i.redd.it/87udn5gszb6a1.jpg
return src.replace(/:\/\/preview\.redd\.it\/(award_images\/+t[0-9]*_[0-9a-z]+\/+)?(?:[-0-9a-z]+-)?([^/.]*\.[^/.?]*)\?.*$/, "://i.redd.it/$1$2");
}
if (domain === "i.redd.it" && src.match(/^[a-z]+:\/\/[^/]*\/[0-9a-z]+\.[^-/._?#]*$/)) {
return {
url: src,
headers: {
Accept: '*/*',
Referer: null
},
is_original: true
};
}
if (domain === "i.reddituploads.com") {
// https://i.reddituploads.com/59933254fd6e44228dc5f0fef3d850af?fit=max&h=1536&w=1536&s=6db141a8ef89df0720e6666f3e7e26bf
// https://i.reddituploads.com/59933254fd6e44228dc5f0fef3d850af
Expand Down Expand Up @@ -54833,7 +54823,11 @@ var $$IMU_EXPORT$$;
}
var urls = [];
var obj = {
extra: {}
extra: {},
headers: {
Accept: "*/*",
Referer: "https://www.reddit.com/"
}
};
if (item.permalink) {
obj.extra.page = urljoin("https://www.reddit.com/", item.permalink, true);
Expand Down Expand Up @@ -54956,6 +54950,16 @@ var $$IMU_EXPORT$$;
}
} while (current = current.parentElement);
}
if (domain === "i.redd.it" && src.match(/^[a-z]+:\/\/[^/]*\/[0-9a-z]+\.[^-/._?#]*$/)) {
return {
url: src,
headers: {
Accept: '*/*',
Referer: null
},
is_original: true
};
}
if ((domain_nosub === "gstatic.com" ||
domain === "") &&
host_domain_nosub.match(/^google\./) && options.element) {
Expand Down

0 comments on commit 19c1290

Please sign in to comment.