diff options
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | src/assets/javascripts/helpers/reddit.js | 1 | ||||
-rw-r--r-- | src/pages/background/background.js | 15 |
3 files changed, 17 insertions, 1 deletions
diff --git a/README.md b/README.md index 2f677178..344c6170 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ It's possible to toggle all redirects on and off. The extension will default to Privacy Redirect allows setting custom instances, instances can be found here: - [Nitter instances](https://github.com/zedeus/nitter/wiki/Instances) -- [Invidious instances](https://github.com/iv-org/invidious/wiki/Invidious-Instances) +- [Invidious instances](https://docs.invidious.io/Invidious-Instances.md) - [Bibliogram instances](https://git.sr.ht/~cadence/bibliogram-docs/tree/master/docs/Instances.md) - [SimplyTranslate instances](https://git.sr.ht/~metalune/simplytranslate_web#list-of-instances) - [OpenStreetMap tile servers](https://wiki.openstreetmap.org/wiki/Tile_servers) diff --git a/src/assets/javascripts/helpers/reddit.js b/src/assets/javascripts/helpers/reddit.js index a21b3288..53b309a7 100644 --- a/src/assets/javascripts/helpers/reddit.js +++ b/src/assets/javascripts/helpers/reddit.js @@ -4,6 +4,7 @@ const targets = [ "new.reddit.com", "amp.reddit.com", "i.redd.it", + "redd.it", ]; const redirects = [ // libreddit: privacy w/ modern UI diff --git a/src/pages/background/background.js b/src/pages/background/background.js index 87bc8dda..4fa36933 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -482,6 +482,21 @@ function redirectReddit(url, initiator, type) { } else { return null; } + } else if (url.host === "redd.it") { + if ( + redditInstance.includes("teddit") && + !url.pathname.match(/^\/+[^\/]+\/+[^\/]/) + ) { + // As of 2021-04-22, redirects for teddit redd.it/foo links don't work. + // It appears that adding "/comments" as a prefix works, so manually add + // that prefix if it is missing. Even though redd.it/comments/foo links + // don't seem to work or exist, guard against affecting those kinds of + // paths. + // + // Note the difference between redd.it/comments/foo (doesn't work) and + // teddit.net/comments/foo (works). + return `${redditInstance}/comments${url.pathname}${url.search}`; + } } return `${redditInstance}${url.pathname}${url.search}`; } |