commit 565d1203429c6291fe35992811303b6b3254e8cf Author: Simon Brazell Date: Fri Sep 20 20:45:58 2019 +1000 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..500aabb --- /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 0000000..c668b2d --- /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 0000000..20fb7e6 --- /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 0000000..2fb698f --- /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 0000000..7363026 Binary files /dev/null and b/img/Screen Shot.png differ diff --git a/img/icon128.png b/img/icon128.png new file mode 100644 index 0000000..ccd689c Binary files /dev/null and b/img/icon128.png differ diff --git a/img/icon48.png b/img/icon48.png new file mode 100644 index 0000000..4ddd22e Binary files /dev/null and b/img/icon48.png differ diff --git a/img/small-tile.png b/img/small-tile.png new file mode 100644 index 0000000..a3ed077 Binary files /dev/null and b/img/small-tile.png differ diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..8023713 --- /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