about summary refs log tree commit diff stats
path: root/src/pages/background
diff options
context:
space:
mode:
authorSimonBrazell <simon@brazell.com.au>2021-06-16 23:32:24 +1000
committerSimonBrazell <simon@brazell.com.au>2021-06-16 23:32:24 +1000
commit1e1fb223020a12dfc137ff369102a7819666d5c3 (patch)
tree92957c57a8dcdc64b5a836b5fa250216db11717e /src/pages/background
parentFixes #238 (diff)
parentMerge pull request #250 from GaurangTandon/fix-license-link (diff)
downloadlibredirect-1e1fb223020a12dfc137ff369102a7819666d5c3.zip
Merge branch 'master' of github.com:SimonBrazell/privacy-redirect
Diffstat (limited to 'src/pages/background')
-rw-r--r--src/pages/background/background.js19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/pages/background/background.js b/src/pages/background/background.js
index 8dee546f..88b6f759 100644
--- a/src/pages/background/background.js
+++ b/src/pages/background/background.js
@@ -279,7 +279,9 @@ function redirectYouTube(url, initiator, type) {
   if (invidiousSubtitles) {
     url.searchParams.append("subtitles", invidiousSubtitles);
   }
-  url.searchParams.append("autoplay", invidiousAutoplay ? 1 : 0);
+  if (invidiousAutoplay) {
+    url.searchParams.append("autoplay", 1);
+  }
 
   return `${
     invidiousInstance || commonHelper.getRandomInstance(invidiousRandomPool)
@@ -478,6 +480,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}`;
 }