about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorSimon Brazell <simon.brazell@gmail.com>2019-09-20 20:45:58 +1000
committerSimon Brazell <simon.brazell@gmail.com>2019-09-20 20:45:58 +1000
commit565d1203429c6291fe35992811303b6b3254e8cf (patch)
treee196653cf79c68be8804d096b94f9f7394a25dc3
downloadlibredirect-565d1203429c6291fe35992811303b6b3254e8cf.zip
Initial commit
-rw-r--r--.gitignore1
-rw-r--r--LICENSE21
-rw-r--r--README.md16
-rw-r--r--background.js42
-rw-r--r--img/Screen Shot.pngbin0 -> 415406 bytes
-rw-r--r--img/icon128.pngbin0 -> 3197 bytes
-rw-r--r--img/icon48.pngbin0 -> 1063 bytes
-rw-r--r--img/small-tile.pngbin0 -> 35583 bytes
-rw-r--r--manifest.json27
9 files changed, 107 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..500aabbf
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+web-ext-artifacts/
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 00000000..c668b2df
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2019 Simon Brazell
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 00000000..20fb7e66
--- /dev/null
+++ b/README.md
@@ -0,0 +1,16 @@
+# Privacy Redirect
+
+-  [Chrome Extension](https://chrome.google.com/webstore/detail/privacy-redirect/pmcmeagblkinmogikoikkdjiligflglb)
+-  [Firefox Add-on](https://addons.mozilla.org/en-US/firefox/addon/privacy-redirect/)
+
+A simple browser extension to redirect Twitter & Youtube requests to [Nitter](https://nitter.net/about) & [Invideus](https://www.invidio.us/), works when navigating to the site, or opening links.
+
+## Build
+
+1.  `npm install --global web-ext`
+2.  `web-ext build`
+3.  See `web-ext-artifacts/` for outputs.
+
+## License
+
+Code released under [the MIT license](LICENSE.txt).
diff --git a/background.js b/background.js
new file mode 100644
index 00000000..2fb698f1
--- /dev/null
+++ b/background.js
@@ -0,0 +1,42 @@
+const nitter = "https://nitter.net";
+const invidious = "https://invidio.us";
+const youtubeRegex = /((www|m)\.)?youtube(-nocookie)?\.com/
+
+chrome.webRequest.onBeforeRequest.addListener(
+  function (details) {
+    if (details.url.match(youtubeRegex)) {
+      return {
+        redirectUrl:
+          invidious + details.url.match(/^https?:\/\/[^\/]+([\S\s]*)/)[1]
+      };
+    } else {
+      return {
+        redirectUrl:
+          nitter + details.url.match(/^https?:\/\/[^\/]+([\S\s]*)/)[1]
+      };
+    }
+  },
+  {
+    urls: [
+      "*://twitter.com/*",
+      "*://www.twitter.com/*",
+      "*://mobile.twitter.com/*",
+      "*://youtube.com/*",
+      "*://www.youtube.com/*",
+      "*://youtube-nocookie.com/*",
+      "*://www.youtube-nocookie.com/*",
+      "*://m.youtube.com/"
+    ],
+    types: [
+      "main_frame",
+      "sub_frame",
+      "stylesheet",
+      "script",
+      "image",
+      "object",
+      "xmlhttprequest",
+      "other"
+    ]
+  },
+  ["blocking"]
+);
diff --git a/img/Screen Shot.png b/img/Screen Shot.png
new file mode 100644
index 00000000..7363026a
--- /dev/null
+++ b/img/Screen Shot.png
Binary files differdiff --git a/img/icon128.png b/img/icon128.png
new file mode 100644
index 00000000..ccd689cc
--- /dev/null
+++ b/img/icon128.png
Binary files differdiff --git a/img/icon48.png b/img/icon48.png
new file mode 100644
index 00000000..4ddd22eb
--- /dev/null
+++ b/img/icon48.png
Binary files differdiff --git a/img/small-tile.png b/img/small-tile.png
new file mode 100644
index 00000000..a3ed077b
--- /dev/null
+++ b/img/small-tile.png
Binary files differdiff --git a/manifest.json b/manifest.json
new file mode 100644
index 00000000..80237135
--- /dev/null
+++ b/manifest.json
@@ -0,0 +1,27 @@
+{
+  "name": "Privacy Redirect",
+  "description": "Redirects Twitter & Youtube requests to privacy friendly alternatives (Nitter & Invideus).",
+  "version": "1.0.0",
+  "manifest_version": 2,
+  "background": {
+    "scripts": [
+      "background.js"
+    ]
+  },
+  "icons": {
+    "48": "img/icon48.png",
+    "128": "img/icon128.png"
+  },
+  "permissions": [
+    "webRequest",
+    "webRequestBlocking",
+    "*://twitter.com/*",
+    "*://www.twitter.com/*",
+    "*://mobile.twitter.com/*",
+    "*://youtube.com/*",
+    "*://www.youtube.com/*",
+    "*://youtube-nocookie.com/*",
+    "*://www.youtube-nocookie.com/*",
+    "*://m.youtube.com/"
+  ]
+}
\ No newline at end of file