Properly redirect images in Libreddit

This commit is contained in:
Austin Huang 2022-10-15 04:28:04 +00:00 committed by Hygna
parent 11b42fb9dc
commit 7d5a6561ab
1 changed files with 5 additions and 0 deletions

View File

@ -397,6 +397,11 @@ function redirect(url, type, initiator, forceRedirection) {
case "rimgo": case "rimgo":
if (url.href.search(/^https?:\/{2}(?:[im]\.)?stack\./) > -1) return `${randomInstance}/stack${url.pathname}${url.search}` if (url.href.search(/^https?:\/{2}(?:[im]\.)?stack\./) > -1) return `${randomInstance}/stack${url.pathname}${url.search}`
else return `${randomInstance}${url.pathname}${url.search}` else return `${randomInstance}${url.pathname}${url.search}`
case "libreddit":
if (url.hostname.match(/^(i|preview)\.redd\.it/)) {
return `${randomInstance}/img${url.pathname}`
}
return `${randomInstance}${url.pathname}${url.search}`
default: default:
return `${randomInstance}${url.pathname}${url.search}` return `${randomInstance}${url.pathname}${url.search}`
} }