mirror of
https://github.com/SimonBrazell/privacy-redirect
synced 2025-01-27 07:46:09 +01:00
Avoid redirecting tweetdeck.twitter.com
& list instances
This commit is contained in:
parent
398eb60423
commit
54a2c89d54
@ -1,9 +1,9 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const nitterDefault = 'https://nitter.net';
|
|
||||||
const twitterRegex = /((www|mobile)\.)?twitter\.com/;
|
|
||||||
const invidiousDefault = 'https://invidio.us';
|
const invidiousDefault = 'https://invidio.us';
|
||||||
const youtubeRegex = /((www|m)\.)?youtube(-nocookie)?\.com/;
|
const youtubeRegex = /((www|m)\.)?youtube(-nocookie)?\.com/;
|
||||||
|
const nitterDefault = 'https://nitter.net';
|
||||||
|
const twitterRegex = /((www|mobile)\.)?twitter\.com/;
|
||||||
const bibliogramDefault = 'https://bibliogram.art';
|
const bibliogramDefault = 'https://bibliogram.art';
|
||||||
const instagramRegex = /((www|about|help)\.)?instagram\.com/;
|
const instagramRegex = /((www|about|help)\.)?instagram\.com/;
|
||||||
const instagramPathsRegex = /(\/a|\/admin|\/api|\/favicon.ico|\/static|\/imageproxy|\/p|\/u|\/developer|\/about|\/legal|\/explore|\/director)/;
|
const instagramPathsRegex = /(\/a|\/admin|\/api|\/favicon.ico|\/static|\/imageproxy|\/p|\/u|\/developer|\/about|\/legal|\/explore|\/director)/;
|
||||||
@ -22,7 +22,7 @@ chrome.storage.sync.get(
|
|||||||
'bibliogramInstance',
|
'bibliogramInstance',
|
||||||
'disableNitter',
|
'disableNitter',
|
||||||
'disableInvidious',
|
'disableInvidious',
|
||||||
'disableBibliogram'
|
'disableBibliogram',
|
||||||
],
|
],
|
||||||
result => {
|
result => {
|
||||||
disableNitter = result.disableNitter;
|
disableNitter = result.disableNitter;
|
||||||
@ -65,7 +65,12 @@ function redirectYouTube(url) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function redirectTwitter(url) {
|
function redirectTwitter(url) {
|
||||||
return `${nitterInstance}${url.pathname}${url.search}`
|
if (url.host.split('.')[0] === 'tweetdeck') {
|
||||||
|
// Avoid redirecting `tweetdeck.twitter.com`
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return `${nitterInstance}${url.pathname}${url.search}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function redirectInstagram(url) {
|
function redirectInstagram(url) {
|
||||||
@ -102,7 +107,7 @@ chrome.webRequest.onBeforeRequest.addListener(
|
|||||||
}
|
}
|
||||||
if (redirect && redirect.redirectUrl) {
|
if (redirect && redirect.redirectUrl) {
|
||||||
console.log(
|
console.log(
|
||||||
'Redirecting', `"${url.toString()}"`, '=>', `"${redirect.redirectUrl}"`
|
'Redirecting', `"${url.href}"`, '=>', `"${redirect.redirectUrl}"`
|
||||||
);
|
);
|
||||||
console.log('Details', details);
|
console.log('Details', details);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Privacy Redirect",
|
"name": "Privacy Redirect",
|
||||||
"description": "Redirects Twitter, YouTube & Instagram requests to privacy friendly alternatives - Nitter, Invidious, & Bibliogram.",
|
"description": "Redirects Twitter, YouTube & Instagram requests to privacy friendly alternatives - Nitter, Invidious, & Bibliogram.",
|
||||||
"version": "1.1.6",
|
"version": "1.1.7",
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"background": {
|
"background": {
|
||||||
"scripts": [
|
"scripts": [
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
<section class="options settings_block">
|
<section class="options settings_block">
|
||||||
<div class="onoffswitch switch" aria-label="Toggle Nitter redirects">
|
<div class="onoffswitch switch" aria-label="Toggle Nitter redirects">
|
||||||
<h1>Nitter Redirects</h1>
|
<h1>Nitter Redirects</h1>
|
||||||
<input aria-hidden="true" id="disableNitter" type="checkbox" checked>
|
<input aria-hidden="true" id="disable-nitter" type="checkbox" checked>
|
||||||
<label for="disableNitter" class="checkbox-label">
|
<label for="disable-nitter" class="checkbox-label">
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@ -23,8 +23,8 @@
|
|||||||
<section class="options settings_block">
|
<section class="options settings_block">
|
||||||
<div class="onoffswitch switch" aria-label="Toggle Invidious redirects">
|
<div class="onoffswitch switch" aria-label="Toggle Invidious redirects">
|
||||||
<h1>Invidious Redirects</h1>
|
<h1>Invidious Redirects</h1>
|
||||||
<input aria-hidden="true" id="disableInvidious" type="checkbox" checked>
|
<input aria-hidden="true" id="disable-invidious" type="checkbox" checked>
|
||||||
<label for="disableInvidious" class="checkbox-label">
|
<label for="disable-invidious" class="checkbox-label">
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@ -32,19 +32,41 @@
|
|||||||
<section class="options settings_block">
|
<section class="options settings_block">
|
||||||
<div class="onoffswitch switch" aria-label="Toggle Bibliogram redirects">
|
<div class="onoffswitch switch" aria-label="Toggle Bibliogram redirects">
|
||||||
<h1>Bibliogram Redirects</h1>
|
<h1>Bibliogram Redirects</h1>
|
||||||
<input aria-hidden="true" id="disableBibliogram" type="checkbox" checked>
|
<input aria-hidden="true" id="disable-bibliogram" type="checkbox" checked>
|
||||||
<label for="disableBibliogram" class="checkbox-label">
|
<label for="disable-bibliogram" class="checkbox-label">
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="options settings_block">
|
<section class="options settings_block">
|
||||||
<h1>Nitter Instance</h1>
|
<h1>Nitter Instance</h1>
|
||||||
<input id="nitterInstance" type="url" placeholder="https://nitter.net">
|
<input id="nitter-instance" list="nitter-instance-list" type="url" placeholder="https://nitter.net">
|
||||||
|
<datalist id="nitter-instance-list">
|
||||||
|
<option value="https://nitter.net">
|
||||||
|
<option value="https://nitter.snopyta.org">
|
||||||
|
<option value="https://nitter.42l.fr">
|
||||||
|
<option value="https://nitter.nixnet.xyz">
|
||||||
|
<option value="https://nitter.13ad.de">
|
||||||
|
<option value="https://tw.openalgeria.org">
|
||||||
|
</datalist>
|
||||||
<h1>Invidious Instance</h1>
|
<h1>Invidious Instance</h1>
|
||||||
<input id="invidiousInstance" type="url" placeholder="https://invidio.us">
|
<input id="invidious-instance" list="invidious-instances-list" type="url" placeholder="https://invidio.us">
|
||||||
|
<datalist id="invidious-instances-list">
|
||||||
|
<option value="https://invidio.us">
|
||||||
|
<option value="https://invidious.snopyta.org">
|
||||||
|
<option value="https://invidiou.sh">
|
||||||
|
<option value="https://yewtu.be">
|
||||||
|
<option value="https://invidious.zapashcanon.fr">
|
||||||
|
<option value="https://invidious.toot.koeln">
|
||||||
|
<option value="https://invidious.ggc-project.de">
|
||||||
|
</datalist>
|
||||||
<h1>Bibliogram Instance</h1>
|
<h1>Bibliogram Instance</h1>
|
||||||
<input id="bibliogramInstance" type="url" placeholder="https://bibliogram.art">
|
<input id="bibliogram-instance" list="bibliogram-instance-list" type="url" placeholder="https://bibliogram.art">
|
||||||
|
<datalist id="bibliogram-instance-list">
|
||||||
|
<option value="https://bibliogram.art">
|
||||||
|
<option value="https://bibliogram.snopyta.org">
|
||||||
|
<option value="https://bibliogram.dsrev.ru">
|
||||||
|
</datalist>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
let nitterInstance = document.querySelector('#nitterInstance');
|
let nitterInstance = document.querySelector('#nitter-instance');
|
||||||
let invidiousInstance = document.querySelector('#invidiousInstance');
|
let invidiousInstance = document.querySelector('#invidious-instance');
|
||||||
let bibliogramInstance = document.querySelector('#bibliogramInstance');
|
let bibliogramInstance = document.querySelector('#bibliogram-instance');
|
||||||
let disableNitter = document.querySelector('#disableNitter');
|
let disableNitter = document.querySelector('#disable-nitter');
|
||||||
let disableInvidious = document.querySelector('#disableInvidious');
|
let disableInvidious = document.querySelector('#disable-invidious');
|
||||||
let disableBibliogram = document.querySelector('#disableBibliogram');
|
let disableBibliogram = document.querySelector('#disable-bibliogram');
|
||||||
|
|
||||||
chrome.storage.sync.get(
|
chrome.storage.sync.get(
|
||||||
[
|
[
|
||||||
@ -14,7 +14,7 @@ chrome.storage.sync.get(
|
|||||||
'bibliogramInstance',
|
'bibliogramInstance',
|
||||||
'disableNitter',
|
'disableNitter',
|
||||||
'disableInvidious',
|
'disableInvidious',
|
||||||
'disableBibliogram'
|
'disableBibliogram',
|
||||||
],
|
],
|
||||||
result => {
|
result => {
|
||||||
nitterInstance.value = result.nitterInstance || '';
|
nitterInstance.value = result.nitterInstance || '';
|
||||||
|
@ -21,8 +21,8 @@
|
|||||||
<section class="options settings_block">
|
<section class="options settings_block">
|
||||||
<div class="onoffswitch switch" aria-label="Toggle Nitter redirects">
|
<div class="onoffswitch switch" aria-label="Toggle Nitter redirects">
|
||||||
<h1>Nitter Redirects</h1>
|
<h1>Nitter Redirects</h1>
|
||||||
<input aria-hidden="true" id="disableNitter" type="checkbox" checked>
|
<input aria-hidden="true" id="disable-nitter" type="checkbox" checked>
|
||||||
<label for="disableNitter" class="checkbox-label">
|
<label for="disable-nitter" class="checkbox-label">
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@ -30,8 +30,8 @@
|
|||||||
<section class="options settings_block">
|
<section class="options settings_block">
|
||||||
<div class="onoffswitch switch" aria-label="Toggle Invidious redirects">
|
<div class="onoffswitch switch" aria-label="Toggle Invidious redirects">
|
||||||
<h1>Invidious Redirects</h1>
|
<h1>Invidious Redirects</h1>
|
||||||
<input aria-hidden="true" id="disableInvidious" type="checkbox" checked>
|
<input aria-hidden="true" id="disable-invidious" type="checkbox" checked>
|
||||||
<label for="disableInvidious" class="checkbox-label">
|
<label for="disable-invidious" class="checkbox-label">
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@ -39,19 +39,41 @@
|
|||||||
<section class="options settings_block">
|
<section class="options settings_block">
|
||||||
<div class="onoffswitch switch" aria-label="Toggle Bibliogram redirects">
|
<div class="onoffswitch switch" aria-label="Toggle Bibliogram redirects">
|
||||||
<h1>Bibliogram Redirects</h1>
|
<h1>Bibliogram Redirects</h1>
|
||||||
<input aria-hidden="true" id="disableBibliogram" type="checkbox" checked>
|
<input aria-hidden="true" id="disable-bibliogram" type="checkbox" checked>
|
||||||
<label for="disableBibliogram" class="checkbox-label">
|
<label for="disable-bibliogram" class="checkbox-label">
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="options settings_block">
|
<section class="options settings_block">
|
||||||
<h1>Nitter Instance</h1>
|
<h1>Nitter Instance</h1>
|
||||||
<input id="nitterInstance" type="url" placeholder="https://nitter.net">
|
<input id="nitter-instance" list="nitter-instance-list" type="url" placeholder="https://nitter.net">
|
||||||
|
<datalist id="nitter-instance-list">
|
||||||
|
<option value="https://nitter.net">
|
||||||
|
<option value="https://nitter.snopyta.org">
|
||||||
|
<option value="https://nitter.42l.fr">
|
||||||
|
<option value="https://nitter.nixnet.xyz">
|
||||||
|
<option value="https://nitter.13ad.de">
|
||||||
|
<option value="https://tw.openalgeria.org">
|
||||||
|
</datalist>
|
||||||
<h1>Invidious Instance</h1>
|
<h1>Invidious Instance</h1>
|
||||||
<input id="invidiousInstance" type="url" placeholder="https://invidio.us">
|
<input id="invidious-instance" list="invidious-instances-list" type="url" placeholder="https://invidio.us">
|
||||||
|
<datalist id="invidious-instances-list">
|
||||||
|
<option value="https://invidio.us">
|
||||||
|
<option value="https://invidious.snopyta.org">
|
||||||
|
<option value="https://invidiou.sh">
|
||||||
|
<option value="https://yewtu.be">
|
||||||
|
<option value="https://invidious.zapashcanon.fr">
|
||||||
|
<option value="https://invidious.toot.koeln">
|
||||||
|
<option value="https://invidious.ggc-project.de">
|
||||||
|
</datalist>
|
||||||
<h1>Bibliogram Instance</h1>
|
<h1>Bibliogram Instance</h1>
|
||||||
<input id="bibliogramInstance" type="url" placeholder="https://bibliogram.art">
|
<input id="bibliogram-instance" list="bibliogram-instance-list" type="url" placeholder="https://bibliogram.art">
|
||||||
|
<datalist id="bibliogram-instance-list">
|
||||||
|
<option value="https://bibliogram.art">
|
||||||
|
<option value="https://bibliogram.snopyta.org">
|
||||||
|
<option value="https://bibliogram.dsrev.ru">
|
||||||
|
</datalist>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<script src="./popup.js"></script>
|
<script src="./popup.js"></script>
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
let nitterInstance = document.querySelector('#nitterInstance');
|
let nitterInstance = document.querySelector('#nitter-instance');
|
||||||
let invidiousInstance = document.querySelector('#invidiousInstance');
|
let invidiousInstance = document.querySelector('#invidious-instance');
|
||||||
let bibliogramInstance = document.querySelector('#bibliogramInstance');
|
let bibliogramInstance = document.querySelector('#bibliogram-instance');
|
||||||
let disableNitter = document.querySelector('#disableNitter');
|
let disableNitter = document.querySelector('#disable-nitter');
|
||||||
let disableInvidious = document.querySelector('#disableInvidious');
|
let disableInvidious = document.querySelector('#disable-invidious');
|
||||||
let disableBibliogram = document.querySelector('#disableBibliogram');
|
let disableBibliogram = document.querySelector('#disable-bibliogram');
|
||||||
let version = document.querySelector('#version');
|
let version = document.querySelector('#version');
|
||||||
|
|
||||||
chrome.storage.sync.get(
|
chrome.storage.sync.get(
|
||||||
|
@ -47,7 +47,11 @@ header small {
|
|||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
margin: var(--space) auto
|
margin: var(--space) auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
i {
|
||||||
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
@ -161,3 +165,7 @@ input[type="url"]:invalid {
|
|||||||
background-color: var(--danger-light);
|
background-color: var(--danger-light);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.margin-bottom {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user