From 7d5a6561ab4f2dad1fce1530b40b241bd35d87d0 Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Sat, 15 Oct 2022 04:28:04 +0000 Subject: [PATCH] Properly redirect images in Libreddit --- src/assets/javascripts/services.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 6aeeff7..a2e1213 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -397,6 +397,11 @@ function redirect(url, type, initiator, forceRedirection) { case "rimgo": if (url.href.search(/^https?:\/{2}(?:[im]\.)?stack\./) > -1) return `${randomInstance}/stack${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: return `${randomInstance}${url.pathname}${url.search}` }