Initial commit

This commit is contained in:
SimonBrazell 2019-09-20 20:45:58 +10:00
commit b2e5f0c099
9 changed files with 107 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
web-ext-artifacts/

21
LICENSE Normal file
View File

@ -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.

16
README.md Normal file
View File

@ -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).

42
background.js Normal file
View File

@ -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"]
);

BIN
img/Screen Shot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 KiB

BIN
img/icon128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
img/icon48.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
img/small-tile.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

27
manifest.json Normal file
View File

@ -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/"
]
}