about summary refs log tree commit diff stats
path: root/src/pages
diff options
context:
space:
mode:
authorManeraKai <manerakai@protonmail.com>2022-02-05 15:49:12 +0300
committerManeraKai <manerakai@protonmail.com>2022-02-05 15:49:12 +0300
commit23be155b204ae2806e5ff276a3c27b67f50748bc (patch)
tree9e15c175ed837fb4a7a3b178b5102e8995ec5b3b /src/pages
parentredirect invidious to piped if selected and vise versa #14 (diff)
downloadlibredirect-23be155b204ae2806e5ff276a3c27b67f50748bc.zip
Added hard cancel requests, will be more improved
Diffstat (limited to 'src/pages')
-rw-r--r--src/pages/background/background.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/pages/background/background.js b/src/pages/background/background.js
index 30d7ae32..ca1f1f19 100644
--- a/src/pages/background/background.js
+++ b/src/pages/background/background.js
@@ -58,8 +58,14 @@ browser.webRequest.onBeforeRequest.addListener(
     else if (wikipediaHelper.isWikipedia(url)) newUrl = wikipediaHelper.redirect(url, initiator);
 
     if (newUrl) {
-      console.info("Redirecting", url.href, "=>", newUrl);
-      return { redirectUrl: newUrl };
+      if (newUrl == 'CANCEL') {
+        console.log(`Canceled ${url}`);
+        return { cancel: true };
+      }
+      else {
+        console.info("Redirecting", url.href, "=>", newUrl);
+        return { redirectUrl: newUrl };
+      }
     }
     return null;
   },