diff options
| author | Jason Kim <git@jasonk.me> | 2021-04-08 23:37:43 -0700 |
|---|---|---|
| committer | Jason Kim <git@jasonk.me> | 2021-04-08 23:37:43 -0700 |
| commit | 123cca4e5cda2e0dfb42b3b41bf7e1412279514e (patch) | |
| tree | dea9a285f38fb0ed557be3eb0119d8d27eb94687 | |
| parent | 397fd8cffbb2f39e8f31304d4238f9087f0c19a5 (diff) | |
| download | privacy-redirect-123cca4e5cda2e0dfb42b3b41bf7e1412279514e.tar.gz privacy-redirect-123cca4e5cda2e0dfb42b3b41bf7e1412279514e.tar.bz2 privacy-redirect-123cca4e5cda2e0dfb42b3b41bf7e1412279514e.zip | |
fix: redirect teddit differently
Teddit image urls are different from libreddit. Handle each separately.
Test manually:
- libredd.it: pass
- libreddit.spike.codes: pass
- libreddit.kavin.rocks: pass
- libreddit.insanity.wtf: fail (site doesn't work in general)
- libreddit.dothq.co: pass
- teddit.net: mostly fail
- teddit.ggc-project.de: mostly fail
- teddit.kavin.rocks: mostly fail
- old.reddit.com: fail
- i.reddit.com: fail
- snew.notabug.io: fail (site doesn't work in general)
Teddit image urls have two issues. First, the links almost never work
(404) if the image url is visited directly before visiting the main
page. Once the main page is visited, however, the image url starts
working. I'm guessing this is an issue with teddit instances not
fetching images unless the main page is accessed. Second, some image
links are different/incompatible for some reason. For example,
<https://i.redd.it/htg3owj12ok21.png> turns into
<https://teddit.net/pics/w:null_TpEyuHnjif6578pV0lBuM-kNW1bXqxbvqbOHjhRZVr0.png>.
Libreddit seems to not have this issue.
| -rw-r--r-- | src/pages/background/background.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/pages/background/background.js b/src/pages/background/background.js index e93e120..bd2d04c 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -449,7 +449,12 @@ function redirectReddit(url, initiator, type) { return null; } if (url.host === "i.redd.it") { - return `${redditInstance}/img${url.pathname}${url.search}`; + if (redditInstance.includes("libredd")) { + return `${redditInstance}/img${url.pathname}${url.search}`; + } else if (redditInstance.includes("teddit")) { + let pathWithoutSlash = url.pathname.slice(1); + return `${redditInstance}/pics/w:null_${pathWithoutSlash}${url.search}` + } } return `${redditInstance}${url.pathname}${url.search}`; } |
