mirror of
https://github.com/SimonBrazell/privacy-redirect
synced 2025-01-23 22:01:22 +01:00
Avoid redirecting tweetdeck.twitter.com
& list instances
This commit is contained in:
parent
398eb60423
commit
54a2c89d54
@ -1,9 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
const nitterDefault = 'https://nitter.net';
|
||||
const twitterRegex = /((www|mobile)\.)?twitter\.com/;
|
||||
const invidiousDefault = 'https://invidio.us';
|
||||
const youtubeRegex = /((www|m)\.)?youtube(-nocookie)?\.com/;
|
||||
const nitterDefault = 'https://nitter.net';
|
||||
const twitterRegex = /((www|mobile)\.)?twitter\.com/;
|
||||
const bibliogramDefault = 'https://bibliogram.art';
|
||||
const instagramRegex = /((www|about|help)\.)?instagram\.com/;
|
||||
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',
|
||||
'disableNitter',
|
||||
'disableInvidious',
|
||||
'disableBibliogram'
|
||||
'disableBibliogram',
|
||||
],
|
||||
result => {
|
||||
disableNitter = result.disableNitter;
|
||||
@ -65,7 +65,12 @@ function redirectYouTube(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) {
|
||||
@ -102,7 +107,7 @@ chrome.webRequest.onBeforeRequest.addListener(
|
||||
}
|
||||
if (redirect && redirect.redirectUrl) {
|
||||
console.log(
|
||||
'Redirecting', `"${url.toString()}"`, '=>', `"${redirect.redirectUrl}"`
|
||||
'Redirecting', `"${url.href}"`, '=>', `"${redirect.redirectUrl}"`
|
||||
);
|
||||
console.log('Details', details);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "Privacy Redirect",
|
||||
"description": "Redirects Twitter, YouTube & Instagram requests to privacy friendly alternatives - Nitter, Invidious, & Bibliogram.",
|
||||
"version": "1.1.6",
|
||||
"version": "1.1.7",
|
||||
"manifest_version": 2,
|
||||
"background": {
|
||||
"scripts": [
|
||||
|
@ -14,8 +14,8 @@
|
||||
<section class="options settings_block">
|
||||
<div class="onoffswitch switch" aria-label="Toggle Nitter redirects">
|
||||
<h1>Nitter Redirects</h1>
|
||||
<input aria-hidden="true" id="disableNitter" type="checkbox" checked>
|
||||
<label for="disableNitter" class="checkbox-label">
|
||||
<input aria-hidden="true" id="disable-nitter" type="checkbox" checked>
|
||||
<label for="disable-nitter" class="checkbox-label">
|
||||
</label>
|
||||
</div>
|
||||
</section>
|
||||
@ -23,8 +23,8 @@
|
||||
<section class="options settings_block">
|
||||
<div class="onoffswitch switch" aria-label="Toggle Invidious redirects">
|
||||
<h1>Invidious Redirects</h1>
|
||||
<input aria-hidden="true" id="disableInvidious" type="checkbox" checked>
|
||||
<label for="disableInvidious" class="checkbox-label">
|
||||
<input aria-hidden="true" id="disable-invidious" type="checkbox" checked>
|
||||
<label for="disable-invidious" class="checkbox-label">
|
||||
</label>
|
||||
</div>
|
||||
</section>
|
||||
@ -32,19 +32,41 @@
|
||||
<section class="options settings_block">
|
||||
<div class="onoffswitch switch" aria-label="Toggle Bibliogram redirects">
|
||||
<h1>Bibliogram Redirects</h1>
|
||||
<input aria-hidden="true" id="disableBibliogram" type="checkbox" checked>
|
||||
<label for="disableBibliogram" class="checkbox-label">
|
||||
<input aria-hidden="true" id="disable-bibliogram" type="checkbox" checked>
|
||||
<label for="disable-bibliogram" class="checkbox-label">
|
||||
</label>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="options settings_block">
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
|
||||
<footer>
|
||||
|
@ -1,11 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
let nitterInstance = document.querySelector('#nitterInstance');
|
||||
let invidiousInstance = document.querySelector('#invidiousInstance');
|
||||
let bibliogramInstance = document.querySelector('#bibliogramInstance');
|
||||
let disableNitter = document.querySelector('#disableNitter');
|
||||
let disableInvidious = document.querySelector('#disableInvidious');
|
||||
let disableBibliogram = document.querySelector('#disableBibliogram');
|
||||
let nitterInstance = document.querySelector('#nitter-instance');
|
||||
let invidiousInstance = document.querySelector('#invidious-instance');
|
||||
let bibliogramInstance = document.querySelector('#bibliogram-instance');
|
||||
let disableNitter = document.querySelector('#disable-nitter');
|
||||
let disableInvidious = document.querySelector('#disable-invidious');
|
||||
let disableBibliogram = document.querySelector('#disable-bibliogram');
|
||||
|
||||
chrome.storage.sync.get(
|
||||
[
|
||||
@ -14,7 +14,7 @@ chrome.storage.sync.get(
|
||||
'bibliogramInstance',
|
||||
'disableNitter',
|
||||
'disableInvidious',
|
||||
'disableBibliogram'
|
||||
'disableBibliogram',
|
||||
],
|
||||
result => {
|
||||
nitterInstance.value = result.nitterInstance || '';
|
||||
|
@ -21,8 +21,8 @@
|
||||
<section class="options settings_block">
|
||||
<div class="onoffswitch switch" aria-label="Toggle Nitter redirects">
|
||||
<h1>Nitter Redirects</h1>
|
||||
<input aria-hidden="true" id="disableNitter" type="checkbox" checked>
|
||||
<label for="disableNitter" class="checkbox-label">
|
||||
<input aria-hidden="true" id="disable-nitter" type="checkbox" checked>
|
||||
<label for="disable-nitter" class="checkbox-label">
|
||||
</label>
|
||||
</div>
|
||||
</section>
|
||||
@ -30,8 +30,8 @@
|
||||
<section class="options settings_block">
|
||||
<div class="onoffswitch switch" aria-label="Toggle Invidious redirects">
|
||||
<h1>Invidious Redirects</h1>
|
||||
<input aria-hidden="true" id="disableInvidious" type="checkbox" checked>
|
||||
<label for="disableInvidious" class="checkbox-label">
|
||||
<input aria-hidden="true" id="disable-invidious" type="checkbox" checked>
|
||||
<label for="disable-invidious" class="checkbox-label">
|
||||
</label>
|
||||
</div>
|
||||
</section>
|
||||
@ -39,19 +39,41 @@
|
||||
<section class="options settings_block">
|
||||
<div class="onoffswitch switch" aria-label="Toggle Bibliogram redirects">
|
||||
<h1>Bibliogram Redirects</h1>
|
||||
<input aria-hidden="true" id="disableBibliogram" type="checkbox" checked>
|
||||
<label for="disableBibliogram" class="checkbox-label">
|
||||
<input aria-hidden="true" id="disable-bibliogram" type="checkbox" checked>
|
||||
<label for="disable-bibliogram" class="checkbox-label">
|
||||
</label>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="options settings_block">
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
|
||||
<script src="./popup.js"></script>
|
||||
|
@ -1,11 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
let nitterInstance = document.querySelector('#nitterInstance');
|
||||
let invidiousInstance = document.querySelector('#invidiousInstance');
|
||||
let bibliogramInstance = document.querySelector('#bibliogramInstance');
|
||||
let disableNitter = document.querySelector('#disableNitter');
|
||||
let disableInvidious = document.querySelector('#disableInvidious');
|
||||
let disableBibliogram = document.querySelector('#disableBibliogram');
|
||||
let nitterInstance = document.querySelector('#nitter-instance');
|
||||
let invidiousInstance = document.querySelector('#invidious-instance');
|
||||
let bibliogramInstance = document.querySelector('#bibliogram-instance');
|
||||
let disableNitter = document.querySelector('#disable-nitter');
|
||||
let disableInvidious = document.querySelector('#disable-invidious');
|
||||
let disableBibliogram = document.querySelector('#disable-bibliogram');
|
||||
let version = document.querySelector('#version');
|
||||
|
||||
chrome.storage.sync.get(
|
||||
|
@ -47,7 +47,11 @@ header small {
|
||||
|
||||
h1 {
|
||||
font-size: 14px;
|
||||
margin: var(--space) auto
|
||||
margin: var(--space) auto;
|
||||
}
|
||||
|
||||
i {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
@ -161,3 +165,7 @@ input[type="url"]:invalid {
|
||||
background-color: var(--danger-light);
|
||||
}
|
||||
|
||||
.margin-bottom {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user