Merge branch 'BobIsMyManager-librex'

This commit is contained in:
ManeraKai 2022-07-24 11:34:39 +03:00
commit ccfcccd53e
70 changed files with 3934 additions and 1565 deletions

View File

@ -29,7 +29,7 @@ jobs:
run: | run: |
git config --local user.email "action@github.com" git config --local user.email "action@github.com"
git config --local user.name "GitHub Action" git config --local user.name "GitHub Action"
git commit -Am "update instances" || : git commit -am "update instances" || :
- name: push changes - name: push changes
uses: ad-m/github-push-action@v0.6.0 uses: ad-m/github-push-action@v0.6.0
with: with:

2
.gitignore vendored
View File

@ -3,5 +3,3 @@ web-ext-artifacts/
nod nod
node_modules node_modules
package-lock.json package-lock.json
src/instances/blacklist.json
src/instances/data.json

View File

@ -32,7 +32,7 @@ Quora => [Quetre](https://github.com/zyachel/quetre)\
IMDb => [Libremdb](https://github.com/zyachel/libremdb)\ IMDb => [Libremdb](https://github.com/zyachel/libremdb)\
PeerTube => [SimpleerTube](https://git.sr.ht/~metalune/simpleweb_peertube)\ PeerTube => [SimpleerTube](https://git.sr.ht/~metalune/simpleweb_peertube)\
LBRY/Odysee => [Librarian](https://codeberg.org/librarian/librarian)\ LBRY/Odysee => [Librarian](https://codeberg.org/librarian/librarian)\
Search => [SearXNG](https://github.com/searxng/searxng), [SearX](https://searx.github.io/searx/), [Whoogle](https://benbusby.com/projects/whoogle-search/)\ Search => [SearXNG](https://github.com/searxng/searxng), [SearX](https://searx.github.io/searx/), [Whoogle](https://benbusby.com/projects/whoogle-search/), [Librex](https://github.com/hnhx/librex/)\
Translate => [SimplyTranslate](https://git.sr.ht/~metalune/simplytranslate_web), [LingvaTranslate](https://github.com/TheDavidDelta/lingva-translate)\ Translate => [SimplyTranslate](https://git.sr.ht/~metalune/simplytranslate_web), [LingvaTranslate](https://github.com/TheDavidDelta/lingva-translate)\
Maps => [OpenStreetMap](https://www.openstreetmap.org/), [FacilMap](https://github.com/FacilMap/facilmap)\ Maps => [OpenStreetMap](https://www.openstreetmap.org/), [FacilMap](https://github.com/FacilMap/facilmap)\
Send Files => [Send](https://gitlab.com/timvisee/send) Send Files => [Send](https://gitlab.com/timvisee/send)

View File

@ -75,10 +75,6 @@
"message": "Medium", "message": "Medium",
"description": "used in the settings page" "description": "used in the settings page"
}, },
"tor": {
"message": "Tor",
"description": "used in the settings page"
},
"theme": { "theme": {
"message": "Theme", "message": "Theme",
"description": "used in the settings page" "description": "used in the settings page"
@ -206,13 +202,10 @@
"lbry": { "lbry": {
"message": "LBRY" "message": "LBRY"
}, },
"i2p": {
"message": "I2P"
},
"loki": {
"message": "Lokinet"
},
"testInstancesLatency": { "testInstancesLatency": {
"message": "Test Instances Latency" "message": "Test Instances Latency"
},
"protocolFallback": {
"message": "Fallback to normal if no instances are available for the current protocol"
} }
} }

View File

@ -44,6 +44,8 @@ async function initDefaults() {
], ],
autoRedirect: false, autoRedirect: false,
firstPartyIsolate: false, firstPartyIsolate: false,
protocol: "normal",
protocolFallback: true
}, () => resolve()) }, () => resolve())
) )
} }

View File

@ -3,15 +3,21 @@ window.browser = window.browser || window.chrome;
import utils from './utils.js' import utils from './utils.js'
const targets = [ const targets = [
/^https?:\/{2}(www\.|)imdb\.com.*/ /^https?:\/{2}(?:www\.|)imdb\.com.*/
]; ];
let redirects = { const frontends = new Array("libremdb")
"libremdb": { const protocols = new Array("normal", "tor", "i2p", "loki")
"normal": [],
"tor": [] let redirects = {}
for (let i = 0; i < frontends.length; i++) {
redirects[frontends[i]] = {}
for (let x = 0; x < protocols.length; x++) {
redirects[frontends[i]][protocols[x]] = []
} }
} }
function setRedirects(val) { function setRedirects(val) {
browser.storage.local.get('cloudflareBlackList', r => { browser.storage.local.get('cloudflareBlackList', r => {
redirects.libremdb = val; redirects.libremdb = val;
@ -29,33 +35,42 @@ function setRedirects(val) {
let let
disableImdb, disableImdb,
imdbProtocol, protocol,
protocolFallback,
imdbRedirects, imdbRedirects,
libremdbNormalRedirectsChecks, libremdbNormalRedirectsChecks,
libremdbNormalCustomRedirects, libremdbNormalCustomRedirects,
libremdbTorRedirectsChecks, libremdbTorRedirectsChecks,
libremdbTorCustomRedirects; libremdbTorCustomRedirects,
libremdbI2pCustomRedirects,
libremdbLokiCustomRedirects;
function init() { function init() {
return new Promise(async resolve => { return new Promise(async resolve => {
browser.storage.local.get( browser.storage.local.get(
[ [
"disableImdb", "disableImdb",
"imdbProtocol", "protocol",
"protocolFallback",
"imdbRedirects", "imdbRedirects",
"libremdbNormalRedirectsChecks", "libremdbNormalRedirectsChecks",
"libremdbNormalCustomRedirects", "libremdbNormalCustomRedirects",
"libremdbTorRedirectsChecks", "libremdbTorRedirectsChecks",
"libremdbTorCustomRedirects", "libremdbTorCustomRedirects",
"libremdbI2pCustomRedirects",
"libremdbLokiCustomRedirects"
], ],
r => { r => {
disableImdb = r.disableImdb; disableImdb = r.disableImdb;
imdbProtocol = r.imdbProtocol; protocol = r.protocol;
protocolFallback = r.protocolFallback;
imdbRedirects = r.imdbRedirects; imdbRedirects = r.imdbRedirects;
libremdbNormalRedirectsChecks = r.libremdbNormalRedirectsChecks; libremdbNormalRedirectsChecks = r.libremdbNormalRedirectsChecks;
libremdbNormalCustomRedirects = r.libremdbNormalCustomRedirects; libremdbNormalCustomRedirects = r.libremdbNormalCustomRedirects;
libremdbTorRedirectsChecks = r.libremdbTorRedirectsChecks; libremdbTorRedirectsChecks = r.libremdbTorRedirectsChecks;
libremdbTorCustomRedirects = r.libremdbTorCustomRedirects; libremdbTorCustomRedirects = r.libremdbTorCustomRedirects;
libremdbI2pCustomRedirects = r.libremdbI2pCustomRedirects;
libremdbLokiCustomRedirects = r.libremdbLokiCustomRedirects;
resolve(); resolve();
} }
) )
@ -76,10 +91,14 @@ function redirect(url, type, initiator, disableOverride) {
if (initiator && (all.includes(initiator.origin) || targets.includes(initiator.host))) return; if (initiator && (all.includes(initiator.origin) || targets.includes(initiator.host))) return;
if (!targets.some(rx => rx.test(url.href))) return; if (!targets.some(rx => rx.test(url.href))) return;
let instancesList; let instancesList = [];
if (imdbProtocol == 'normal') instancesList = [...libremdbNormalRedirectsChecks, ...libremdbNormalCustomRedirects]; if (protocol == 'loki') instancesList = [...libremdbLokiCustomRedirects];
if (imdbProtocol == 'tor') instancesList = [...libremdbTorRedirectsChecks, ...libremdbTorCustomRedirects]; else if (protocol == 'i2p') instancesList = [...libremdbI2pCustomRedirects];
if (instancesList.length === 0) return; else if (protocol == 'tor') instancesList = [...libremdbTorRedirectsChecks, ...libremdbTorCustomRedirects];
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...libremdbNormalRedirectsChecks, ...libremdbNormalCustomRedirects];
}
if (instancesList.length === 0) { return; }
const randomInstance = utils.getRandomInstance(instancesList); const randomInstance = utils.getRandomInstance(instancesList);
return `${randomInstance}${url.pathname}`; return `${randomInstance}${url.pathname}`;
@ -93,7 +112,9 @@ function reverse(url) {
...imdbRedirects.libremdb.normal, ...imdbRedirects.libremdb.normal,
...imdbRedirects.libremdb.tor, ...imdbRedirects.libremdb.tor,
...libremdbNormalCustomRedirects, ...libremdbNormalCustomRedirects,
...libremdbTorCustomRedirects ...libremdbTorCustomRedirects,
...libremdbI2pCustomRedirects,
...libremdbLokiCustomRedirects
]; ];
if (!all.includes(protocolHost)) { resolve(); return; } if (!all.includes(protocolHost)) { resolve(); return; }
@ -112,12 +133,18 @@ function switchInstance(url, disableOverride) {
...libremdbNormalCustomRedirects, ...libremdbNormalCustomRedirects,
...libremdbTorCustomRedirects, ...libremdbTorCustomRedirects,
...libremdbI2pCustomRedirects,
...libremdbLokiCustomRedirects
]; ];
if (!all.includes(protocolHost)) { resolve(); return; } if (!all.includes(protocolHost)) { resolve(); return; }
let instancesList; let instancesList = [];
if (imdbProtocol == 'normal') instancesList = [...libremdbNormalCustomRedirects, ...libremdbNormalRedirectsChecks]; if (protocol == 'loki') instancesList = [...libremdbLokiCustomRedirects];
else if (imdbProtocol == 'tor') instancesList = [...libremdbTorCustomRedirects, ...libremdbTorRedirectsChecks]; else if (protocol == 'i2p') instancesList = [...libremdbI2pCustomRedirects];
else if (protocol == 'tor') instancesList = [...libremdbTorRedirectsChecks, ...libremdbTorCustomRedirects];
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...libremdbNormalRedirectsChecks, ...libremdbNormalCustomRedirects];
}
const i = instancesList.indexOf(protocolHost); const i = instancesList.indexOf(protocolHost);
if (i > -1) instancesList.splice(i, 1); if (i > -1) instancesList.splice(i, 1);
@ -132,11 +159,11 @@ function initDefaults() {
return new Promise(async resolve => { return new Promise(async resolve => {
fetch('/instances/data.json').then(response => response.text()).then(async data => { fetch('/instances/data.json').then(response => response.text()).then(async data => {
let dataJson = JSON.parse(data); let dataJson = JSON.parse(data);
redirects.libremdb = dataJson.libremdb; for (let i = 0; i < frontends.length; i++) {
redirects[frontends[i]] = dataJson[frontends[i]]
}
browser.storage.local.set({ browser.storage.local.set({
disableImdb: true, disableImdb: true,
imdbProtocol: "normal",
imdbRedirects: redirects, imdbRedirects: redirects,
libremdbNormalRedirectsChecks: [...redirects.libremdb.normal], libremdbNormalRedirectsChecks: [...redirects.libremdb.normal],
@ -144,6 +171,12 @@ function initDefaults() {
libremdbTorRedirectsChecks: [...redirects.libremdb.tor], libremdbTorRedirectsChecks: [...redirects.libremdb.tor],
libremdbTorCustomRedirects: [], libremdbTorCustomRedirects: [],
libremdbI2pRedirectsChecks: [],
libremdbI2pCustomRedirects: [],
libremdbLokiRedirectsChecks: [],
libremdbLokiCustomRedirects: []
}, () => resolve()); }, () => resolve());
}); });
}) })

View File

@ -4,13 +4,18 @@ import utils from './utils.js'
const targets = /^https?:\/{2}([im]\.)?imgur\.(com|io)(\/|$)/ const targets = /^https?:\/{2}([im]\.)?imgur\.(com|io)(\/|$)/
let redirects = { const frontends = new Array("rimgo")
"rimgo": { const protocols = new Array("normal", "tor", "i2p", "loki")
"normal": [],
"tor": [], let redirects = {}
"i2p": []
for (let i = 0; i < frontends.length; i++) {
redirects[frontends[i]] = {}
for (let x = 0; x < protocols.length; x++) {
redirects[frontends[i]][protocols[x]] = []
} }
} }
function setRedirects() { function setRedirects() {
return new Promise(resolve => { return new Promise(resolve => {
fetch('/instances/data.json').then(response => response.text()).then(async data => { fetch('/instances/data.json').then(response => response.text()).then(async data => {
@ -45,13 +50,15 @@ function setRedirects() {
let let
disableImgur, disableImgur,
imgurRedirects, imgurRedirects,
imgurProtocol, protocol,
protocolFallback,
rimgoNormalRedirectsChecks, rimgoNormalRedirectsChecks,
rimgoNormalCustomRedirects, rimgoNormalCustomRedirects,
rimgoTorRedirectsChecks, rimgoTorRedirectsChecks,
rimgoTorCustomRedirects, rimgoTorCustomRedirects,
rimgoI2pRedirectsChecks, rimgoI2pRedirectsChecks,
rimgoI2pCustomRedirects; rimgoI2pCustomRedirects,
rimgoLokiCustomRedirects;
function init() { function init() {
return new Promise(async resolve => { return new Promise(async resolve => {
@ -59,24 +66,28 @@ function init() {
[ [
"disableImgur", "disableImgur",
"imgurRedirects", "imgurRedirects",
"imgurProtocol", "protocol",
"protocolFallback",
"rimgoNormalRedirectsChecks", "rimgoNormalRedirectsChecks",
"rimgoNormalCustomRedirects", "rimgoNormalCustomRedirects",
"rimgoTorRedirectsChecks", "rimgoTorRedirectsChecks",
"rimgoTorCustomRedirects", "rimgoTorCustomRedirects",
"rimgoI2pRedirectsChecks", "rimgoI2pRedirectsChecks",
"rimgoI2pCustomRedirects", "rimgoI2pCustomRedirects",
"rimgoLokiCustomRedirects"
], ],
r => { r => {
disableImgur = r.disableImgur; disableImgur = r.disableImgur;
imgurRedirects = r.imgurRedirects; imgurRedirects = r.imgurRedirects;
imgurProtocol = r.imgurProtocol; protocol = r.protocol;
protocolFallback = r.protocolFallback;
rimgoNormalRedirectsChecks = r.rimgoNormalRedirectsChecks; rimgoNormalRedirectsChecks = r.rimgoNormalRedirectsChecks;
rimgoNormalCustomRedirects = r.rimgoNormalCustomRedirects; rimgoNormalCustomRedirects = r.rimgoNormalCustomRedirects;
rimgoTorRedirectsChecks = r.rimgoTorRedirectsChecks; rimgoTorRedirectsChecks = r.rimgoTorRedirectsChecks;
rimgoTorCustomRedirects = r.rimgoTorCustomRedirects; rimgoTorCustomRedirects = r.rimgoTorCustomRedirects;
rimgoI2pRedirectsChecks = r.rimgoI2pRedirectsChecks; rimgoI2pRedirectsChecks = r.rimgoI2pRedirectsChecks;
rimgoI2pCustomRedirects = r.rimgoI2pCustomRedirects; rimgoI2pCustomRedirects = r.rimgoI2pCustomRedirects;
rimgoLokiCustomRedirects = r.rimgoLokiCustomRedirects;
resolve(); resolve();
} }
) )
@ -100,6 +111,7 @@ function all() {
...rimgoNormalCustomRedirects, ...rimgoNormalCustomRedirects,
...rimgoTorCustomRedirects, ...rimgoTorCustomRedirects,
...rimgoI2pCustomRedirects, ...rimgoI2pCustomRedirects,
...rimgoLokiCustomRedirects
]; ];
} }
@ -111,11 +123,14 @@ function redirect(url, type, initiator, disableOverride) {
if (!targets.test(url.href)) return; if (!targets.test(url.href)) return;
if (url.pathname.includes("delete/")) return; if (url.pathname.includes("delete/")) return;
let instancesList; let instancesList = [];
if (imgurProtocol == 'normal') instancesList = [...rimgoNormalRedirectsChecks, ...rimgoNormalCustomRedirects]; if (protocol == 'loki') instancesList = [...rimgoLokiCustomRedirects];
if (imgurProtocol == 'tor') instancesList = [...rimgoTorRedirectsChecks, ...rimgoTorCustomRedirects]; else if (protocol == 'i2p') instancesList = [...rimgoI2pCustomRedirects, ...rimgoI2pRedirectsChecks];
if (imgurProtocol == 'i2p') instancesList = [...rimgoI2pRedirectsChecks, ...rimgoI2pCustomRedirects]; else if (protocol == 'tor') instancesList = [...rimgoTorRedirectsChecks, ...rimgoTorCustomRedirects];
if (instancesList.length === 0) return; if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...rimgoNormalRedirectsChecks, ...rimgoNormalCustomRedirects];
}
if (instancesList.length === 0) { return; }
const randomInstance = utils.getRandomInstance(instancesList); const randomInstance = utils.getRandomInstance(instancesList);
return `${randomInstance}${url.pathname}${url.search}`; return `${randomInstance}${url.pathname}${url.search}`;
@ -136,10 +151,13 @@ function switchInstance(url, disableOverride) {
if (disableImgur && !disableOverride) { resolve(); return; } if (disableImgur && !disableOverride) { resolve(); return; }
let protocolHost = utils.protocolHost(url); let protocolHost = utils.protocolHost(url);
if (!all().includes(protocolHost)) { resolve(); return; } if (!all().includes(protocolHost)) { resolve(); return; }
let instancesList; let instancesList = [];
if (imgurProtocol == 'normal') instancesList = [...rimgoNormalCustomRedirects, ...rimgoNormalRedirectsChecks]; if (protocol == 'loki') instancesList = [...rimgoLokiCustomRedirects];
else if (imgurProtocol == 'tor') instancesList = [...rimgoTorCustomRedirects, ...rimgoTorRedirectsChecks]; else if (protocol == 'i2p') instancesList = [...rimgoI2pCustomRedirects, ...rimgoI2pRedirectsChecks];
else if (imgurProtocol == 'i2p') instancesList = [...rimgoI2pCustomRedirects, ...rimgoI2pRedirectsChecks]; else if (protocol == 'tor') instancesList = [...rimgoTorRedirectsChecks, ...rimgoTorCustomRedirects];
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...rimgoNormalRedirectsChecks, ...rimgoNormalCustomRedirects];
}
const i = instancesList.indexOf(protocolHost); const i = instancesList.indexOf(protocolHost);
if (i > -1) instancesList.splice(i, 1); if (i > -1) instancesList.splice(i, 1);
@ -154,7 +172,9 @@ function initDefaults() {
return new Promise(resolve => { return new Promise(resolve => {
fetch('/instances/data.json').then(response => response.text()).then(async data => { fetch('/instances/data.json').then(response => response.text()).then(async data => {
let dataJson = JSON.parse(data); let dataJson = JSON.parse(data);
redirects.rimgo = dataJson.rimgo; for (let i = 0; i < frontends.length; i++) {
redirects[frontends[i]] = dataJson[frontends[i]]
}
browser.storage.local.get('cloudflareBlackList', async r => { browser.storage.local.get('cloudflareBlackList', async r => {
rimgoNormalRedirectsChecks = [...redirects.rimgo.normal]; rimgoNormalRedirectsChecks = [...redirects.rimgo.normal];
for (const instance of r.cloudflareBlackList) { for (const instance of r.cloudflareBlackList) {
@ -163,7 +183,6 @@ function initDefaults() {
} }
browser.storage.local.set({ browser.storage.local.set({
disableImgur: false, disableImgur: false,
imgurProtocol: 'normal',
imgurRedirects: redirects, imgurRedirects: redirects,
rimgoNormalRedirectsChecks: rimgoNormalRedirectsChecks, rimgoNormalRedirectsChecks: rimgoNormalRedirectsChecks,
@ -174,6 +193,9 @@ function initDefaults() {
rimgoI2pRedirectsChecks: [...redirects.rimgo.i2p], rimgoI2pRedirectsChecks: [...redirects.rimgo.i2p],
rimgoI2pCustomRedirects: [], rimgoI2pCustomRedirects: [],
rimgoLokiRedirectsChecks: [...redirects.rimgo.loki],
rimgoLokiCustomRedirects: []
}, () => resolve()); }, () => resolve());
}); });
}); });

View File

@ -5,12 +5,19 @@ const targets = [
"instagram.com", "instagram.com",
"www.instagram.com", "www.instagram.com",
]; ];
let redirects = {
"bibliogram": { const frontends = new Array("bibliogram")
"normal": [], const protocols = new Array("normal", "tor", "i2p", "loki")
"tor": []
} let redirects = {};
};
for (let i = 0; i < frontends.length; i++) {
redirects[frontends[i]] = {}
for (let x = 0; x < protocols.length; x++) {
redirects[frontends[i]][protocols[x]] = []
}
}
function setRedirects(val) { function setRedirects(val) {
browser.storage.local.get('cloudflareBlackList', async r => { browser.storage.local.get('cloudflareBlackList', async r => {
redirects.bibliogram = val; redirects.bibliogram = val;
@ -28,33 +35,42 @@ function setRedirects(val) {
let let
disableInstagram, disableInstagram,
instagramProtocol, protocol,
protocolFallback,
instagramRedirects, instagramRedirects,
bibliogramNormalRedirectsChecks, bibliogramNormalRedirectsChecks,
bibliogramTorRedirectsChecks, bibliogramTorRedirectsChecks,
bibliogramNormalCustomRedirects, bibliogramNormalCustomRedirects,
bibliogramTorCustomRedirects; bibliogramTorCustomRedirects,
bibliogramI2pCustomRedirects,
bibliogramLokiCustomRedirects;
function init() { function init() {
return new Promise(async resolve => { return new Promise(async resolve => {
browser.storage.local.get( browser.storage.local.get(
[ [
"disableInstagram", "disableInstagram",
"instagramProtocol", "protocol",
"protocolFallback",
"instagramRedirects", "instagramRedirects",
"bibliogramNormalRedirectsChecks", "bibliogramNormalRedirectsChecks",
"bibliogramTorRedirectsChecks", "bibliogramTorRedirectsChecks",
"bibliogramNormalCustomRedirects", "bibliogramNormalCustomRedirects",
"bibliogramTorCustomRedirects", "bibliogramTorCustomRedirects",
"bibliogramI2pCustomRedirects",
"bibliogramLokiCustomRedirects"
], ],
r => { r => {
disableInstagram = r.disableInstagram; disableInstagram = r.disableInstagram;
instagramProtocol = r.instagramProtocol; protocol = r.protocol;
protocolFallback = r.protocolFallback;
instagramRedirects = r.instagramRedirects; instagramRedirects = r.instagramRedirects;
bibliogramNormalRedirectsChecks = r.bibliogramNormalRedirectsChecks; bibliogramNormalRedirectsChecks = r.bibliogramNormalRedirectsChecks;
bibliogramTorRedirectsChecks = r.bibliogramTorRedirectsChecks; bibliogramTorRedirectsChecks = r.bibliogramTorRedirectsChecks;
bibliogramNormalCustomRedirects = r.bibliogramNormalCustomRedirects; bibliogramNormalCustomRedirects = r.bibliogramNormalCustomRedirects;
bibliogramTorCustomRedirects = r.bibliogramTorCustomRedirects; bibliogramTorCustomRedirects = r.bibliogramTorCustomRedirects;
bibliogramI2pCustomRedirects = r.bibliogramI2pCustomRedirects;
bibliogramLokiCustomRedirects = r.bibliogramLokiCustomRedirects
resolve(); resolve();
} }
) )
@ -70,6 +86,8 @@ function all() {
...instagramRedirects.bibliogram.tor, ...instagramRedirects.bibliogram.tor,
...bibliogramNormalCustomRedirects, ...bibliogramNormalCustomRedirects,
...bibliogramTorCustomRedirects, ...bibliogramTorCustomRedirects,
...bibliogramI2pCustomRedirects,
...bibliogramLokiCustomRedirects
] ]
} }
@ -82,10 +100,14 @@ function redirect(url, type, initiator, disableOverride) {
const bypassPaths = [/about/, /explore/, /support/, /press/, /api/, /privacy/, /safety/, /admin/, /\/(accounts\/|embeds?.js)/]; const bypassPaths = [/about/, /explore/, /support/, /press/, /api/, /privacy/, /safety/, /admin/, /\/(accounts\/|embeds?.js)/];
if (bypassPaths.some(rx => rx.test(url.pathname))) return; if (bypassPaths.some(rx => rx.test(url.pathname))) return;
let instancesList; let instancesList = [];
if (instagramProtocol == 'normal') instancesList = [...bibliogramNormalRedirectsChecks, ...bibliogramNormalCustomRedirects]; if (protocol == 'loki') instancesList = [...bibliogramLokiCustomRedirects];
else if (instagramProtocol == 'tor') instancesList = [...bibliogramTorRedirectsChecks, ...bibliogramTorCustomRedirects]; else if (protocol == 'i2p') instancesList = [...bibliogramI2pCustomRedirects];
if (instancesList.length === 0) return; else if (protocol == 'tor') instancesList = [...bibliogramTorRedirectsChecks, ...bibliogramTorCustomRedirects];
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...bibliogramNormalRedirectsChecks, ...bibliogramNormalCustomRedirects];
}
if (instancesList.length === 0) { return; }
let randomInstance = utils.getRandomInstance(instancesList) let randomInstance = utils.getRandomInstance(instancesList)
const reservedPaths = ["u", "p", "privacy",]; const reservedPaths = ["u", "p", "privacy",];
@ -116,9 +138,13 @@ function switchInstance(url, disableOverride) {
let protocolHost = utils.protocolHost(url); let protocolHost = utils.protocolHost(url);
if (!all().includes(protocolHost)) { resolve(); return; } if (!all().includes(protocolHost)) { resolve(); return; }
let instancesList; let instancesList = [];
if (instagramProtocol == 'normal') instancesList = [...bibliogramNormalCustomRedirects, ...bibliogramNormalRedirectsChecks]; if (protocol == 'loki') instancesList = [...bibliogramLokiCustomRedirects];
else if (instagramProtocol == 'tor') instancesList = [...bibliogramTorCustomRedirects, ...bibliogramTorRedirectsChecks]; else if (protocol == 'i2p') instancesList = [...bibliogramI2pCustomRedirects];
else if (protocol == 'tor') instancesList = [...bibliogramTorRedirectsChecks, ...bibliogramTorCustomRedirects];
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...bibliogramNormalRedirectsChecks, ...bibliogramNormalCustomRedirects];
}
const i = instancesList.indexOf(protocolHost); const i = instancesList.indexOf(protocolHost);
if (i > -1) instancesList.splice(i, 1); if (i > -1) instancesList.splice(i, 1);
@ -133,7 +159,9 @@ function initDefaults() {
return new Promise(resolve => { return new Promise(resolve => {
fetch('/instances/data.json').then(response => response.text()).then(data => { fetch('/instances/data.json').then(response => response.text()).then(data => {
let dataJson = JSON.parse(data); let dataJson = JSON.parse(data);
redirects.bibliogram = dataJson.bibliogram; for (let i = 0; i < frontends.length; i++) {
redirects[frontends[i]] = dataJson[frontends[i]]
}
browser.storage.local.get('cloudflareBlackList', r => { browser.storage.local.get('cloudflareBlackList', r => {
bibliogramNormalRedirectsChecks = [...redirects.bibliogram.normal]; bibliogramNormalRedirectsChecks = [...redirects.bibliogram.normal];
for (const instance of r.cloudflareBlackList) { for (const instance of r.cloudflareBlackList) {
@ -145,11 +173,16 @@ function initDefaults() {
instagramRedirects: redirects, instagramRedirects: redirects,
bibliogramNormalRedirectsChecks: bibliogramNormalRedirectsChecks, bibliogramNormalRedirectsChecks: bibliogramNormalRedirectsChecks,
bibliogramTorRedirectsChecks: [], bibliogramNormalCustomRedirects: [],
bibliogramNormalCustomRedirects: [...redirects.bibliogram.tor], bibliogramTorRedirectsChecks: [...redirects.bibliogram.tor],
bibliogramTorCustomRedirects: [], bibliogramTorCustomRedirects: [],
instagramProtocol: "normal",
bibliogramI2pRedirectsChecks: [...redirects.bibliogram.i2p],
bibliogramI2pCustomRedirects: [],
bibliogramLokiRedirectsChecks: [...redirects.bibliogram.loki],
bibliogramLokiCustomRedirects: []
}) })
resolve(); resolve();
} }

View File

@ -4,70 +4,74 @@ import utils from './utils.js'
let targets = ["odysee.com"]; let targets = ["odysee.com"];
let redirects = { const frontends = new Array("librarian")
"librarian": { const protocols = new Array("normal", "tor", "i2p", "loki")
"normal": [
"https://lbry.bcow.xyz", let redirects = {}
"https://odysee.076.ne.jp",
"https://lbry.ix.tc", for (let i = 0; i < frontends.length; i++) {
"https://librarian.pussthecat.org", redirects[frontends[i]] = {}
"https://lbry.mutahar.rocks", for (let x = 0; x < protocols.length; x++) {
"https://librarian.esmailelbob.xyz", redirects[frontends[i]][protocols[x]] = []
],
"tor": [
"http://ecc5mi5ncdw6mxhjz6re6g2uevtpbzxjvxgrxia2gyvrlnil3srbnhyd.onion",
"http://vrmbc4brkgkaysmi3fenbzkayobxjh24slmhtocambn3ewe62iuqt3yd.onion",
]
} }
} }
function setRedirects(val) { function setRedirects(val) {
redirects.librarian = val; browser.storage.local.get('cloudflareBlackList', r => {
browser.storage.local.set({ lbryTargetsRedirects: redirects }) redirects.librarian = val;
for (const item of librarianNormalRedirectsChecks) librarianNormalRedirectsChecks = [...redirects.librarian.normal];
if (!redirects.librarian.normal.includes(item)) { for (const instance of r.cloudflareBlackList) {
var index = librarianNormalRedirectsChecks.indexOf(item); const a = librarianNormalRedirectsChecks.indexOf(instance);
if (index !== -1) librarianNormalRedirectsChecks.splice(index, 1); if (a > -1) librarianNormalRedirectsChecks.splice(a, 1);
} }
browser.storage.local.set(librarianNormalRedirectsChecks); browser.storage.local.set({
lbryTargetsRedirects: redirects,
for (const item of librarianTorRedirectsChecks) librarianNormalRedirectsChecks
if (!redirects.librarian.normal.includes(item)) { })
var index = librarianTorRedirectsChecks.indexOf(item); })
if (index !== -1) librarianTorRedirectsChecks.splice(index, 1);
}
browser.storage.local.set(librarianTorRedirectsChecks)
} }
let let
disableLbryTargets, disableLbryTargets,
lbryTargetsProtocol, protocol,
protocolFallback,
lbryTargetsRedirects, lbryTargetsRedirects,
librarianNormalRedirectsChecks, librarianNormalRedirectsChecks,
librarianNormalCustomRedirects, librarianNormalCustomRedirects,
librarianTorRedirectsChecks, librarianTorRedirectsChecks,
librarianTorCustomRedirects; librarianTorCustomRedirects,
librarianI2pRedirectsChecks,
librarianI2pCustomRedirects,
librarianLokiCustomRedirects;
function init() { function init() {
return new Promise(resolve => { return new Promise(resolve => {
browser.storage.local.get( browser.storage.local.get(
[ [
"disableLbryTargets", "disableLbryTargets",
"lbryTargetsProtocol", "protocol",
"protocolFallback",
"lbryTargetsRedirects", "lbryTargetsRedirects",
"librarianNormalRedirectsChecks", "librarianNormalRedirectsChecks",
"librarianNormalCustomRedirects", "librarianNormalCustomRedirects",
"librarianTorRedirectsChecks", "librarianTorRedirectsChecks",
"librarianTorCustomRedirects", "librarianTorCustomRedirects",
"librarianI2pRedirectsChecks",
"librarianI2pCustomRedirects",
"librarianLokiCustomRedirects"
], ],
r => { r => {
disableLbryTargets = r.disableLbryTargets; disableLbryTargets = r.disableLbryTargets;
lbryTargetsProtocol = r.lbryTargetsProtocol; protocol = r.protocol;
protocolFallback = r.protocolFallback;
lbryTargetsRedirects = r.lbryTargetsRedirects; lbryTargetsRedirects = r.lbryTargetsRedirects;
librarianNormalRedirectsChecks = r.librarianNormalRedirectsChecks; librarianNormalRedirectsChecks = r.librarianNormalRedirectsChecks;
librarianNormalCustomRedirects = r.librarianNormalCustomRedirects; librarianNormalCustomRedirects = r.librarianNormalCustomRedirects;
librarianTorRedirectsChecks = r.librarianTorRedirectsChecks; librarianTorRedirectsChecks = r.librarianTorRedirectsChecks;
librarianTorCustomRedirects = r.librarianTorCustomRedirects; librarianTorCustomRedirects = r.librarianTorCustomRedirects;
librarianI2pRedirectsChecks = r.librarianI2pRedirectsChecks;
librarianI2pCustomRedirects = r.librarianI2pCustomRedirects;
librarianLokiCustomRedirects = r.librarianLokiCustomRedirects;
resolve(); resolve();
} }
) )
@ -82,6 +86,8 @@ function all() {
...redirects.librarian.tor, ...redirects.librarian.tor,
...librarianNormalCustomRedirects, ...librarianNormalCustomRedirects,
...librarianTorCustomRedirects, ...librarianTorCustomRedirects,
...librarianI2pCustomRedirects,
...librarianLokiCustomRedirects
]; ];
} }
@ -92,9 +98,13 @@ function switchInstance(url, disableOverride) {
const protocolHost = utils.protocolHost(url); const protocolHost = utils.protocolHost(url);
if (!all().includes(protocolHost)) { resolve(); return; } if (!all().includes(protocolHost)) { resolve(); return; }
let instancesList; let instancesList = [];
if (lbryTargetsProtocol == 'normal') instancesList = [...librarianNormalRedirectsChecks, ...librarianNormalCustomRedirects]; if (protocol == 'loki') instancesList = [...librarianLokiCustomRedirects];
else if (lbryTargetsProtocol == 'tor') instancesList = [...librarianTorRedirectsChecks, ...librarianTorCustomRedirects]; else if (protocol == 'i2p') instancesList = [...librarianI2pCustomRedirects];
else if (protocol == 'tor') instancesList = [...librarianTorRedirectsChecks, ...librarianTorCustomRedirects];
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...librarianNormalRedirectsChecks, ...librarianNormalCustomRedirects];
}
const i = instancesList.indexOf(protocolHost); const i = instancesList.indexOf(protocolHost);
if (i > -1) instancesList.splice(i, 1); if (i > -1) instancesList.splice(i, 1);
@ -111,9 +121,13 @@ function redirect(url, type, initiator, disableOverride) {
if (!targets.includes(url.host)) return; if (!targets.includes(url.host)) return;
if (type != "main_frame") return; if (type != "main_frame") return;
let instancesList; let instancesList = [];
if (lbryTargetsProtocol == 'normal') instancesList = [...librarianNormalRedirectsChecks, ...librarianNormalCustomRedirects]; if (protocol == 'loki') instancesList = [...librarianLokiCustomRedirects];
if (lbryTargetsProtocol == 'tor') instancesList = [...librarianTorRedirectsChecks, ...librarianTorCustomRedirects]; else if (protocol == 'i2p') instancesList = [...librarianI2pCustomRedirects];
else if (protocol == 'tor') instancesList = [...librarianTorRedirectsChecks, ...librarianTorCustomRedirects];
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...librarianNormalRedirectsChecks, ...librarianNormalCustomRedirects];
}
if (instancesList.length === 0) return; if (instancesList.length === 0) return;
const randomInstance = utils.getRandomInstance(instancesList); const randomInstance = utils.getRandomInstance(instancesList);
@ -121,31 +135,29 @@ function redirect(url, type, initiator, disableOverride) {
} }
function initDefaults() { function initDefaults() {
return new Promise(resolve => { return new Promise(async resolve => {
browser.storage.local.get('cloudflareBlackList', async r => { fetch('/instances/data.json').then(response => response.text()).then(async data => {
librarianNormalRedirectsChecks = [...redirects.librarian.normal]; let dataJson = JSON.parse(data);
for (const instance of r.cloudflareBlackList) { for (let i = 0; i < frontends.length; i++) {
let i; redirects[frontends[i]] = dataJson[frontends[i]]
i = librarianNormalRedirectsChecks.indexOf(instance);
if (i > -1) librarianNormalRedirectsChecks.splice(i, 1);
} }
browser.storage.local.set({ browser.storage.local.set({
disableLbryTargets: true, disableLbryTargets: true,
lbryTargetsRedirects: { lbryTargetsRedirects: redirects,
'librarian': redirects.librarian
},
librarianNormalRedirectsChecks: librarianNormalRedirectsChecks, librarianNormalRedirectsChecks: [...redirects.librarian.normal],
librarianNormalCustomRedirects: [], librarianNormalCustomRedirects: [],
librarianTorRedirectsChecks: [...redirects.librarian.tor], librarianTorRedirectsChecks: [...redirects.librarian.tor],
librarianTorCustomRedirects: [], librarianTorCustomRedirects: [],
lbryTargetsProtocol: "normal", librarianI2pRedirectsChecks: [...redirects.librarian.i2p],
}, () => resolve()) librarianI2pCustomRedirects: [],
}) librarianLokiRedirectsChecks: [...redirects.librarian.loki],
librarianLokiCustomRedirects: []
}, () => resolve());
});
}) })
} }

View File

@ -14,7 +14,10 @@ let redirects = {
'facil': { 'facil': {
"normal": [ "normal": [
"https://facilmap.org" "https://facilmap.org"
] ],
"tor": [],
"i2p": [],
"loki": []
} }
}; };
@ -22,22 +25,37 @@ let redirects = {
let let
disableMaps, disableMaps,
mapsFrontend, mapsFrontend,
protocol,
protocolFallback,
facilNormalRedirectsChecks, facilNormalRedirectsChecks,
facilNormalCustomRedirects; facilNormalCustomRedirects,
facilTorCustomRedirects,
facilI2pCustomRedirects,
facilLokiCustomRedirects;
function init() { function init() {
browser.storage.local.get( browser.storage.local.get(
[ [
"disableMaps", "disableMaps",
"mapsFrontend", "mapsFrontend",
"protocol",
"protocolFallback",
"facilNormalRedirectsChecks", "facilNormalRedirectsChecks",
"facilNormalCustomRedirects", "facilNormalCustomRedirects",
"facilTorCustomRedirects",
"facilI2pCustomRedirects",
"facilLokiCustomRedirects"
], ],
r => { r => {
disableMaps = r.disableMaps; disableMaps = r.disableMaps;
mapsFrontend = r.mapsFrontend; mapsFrontend = r.mapsFrontend;
protocol = r.protocol;
protocolFallback = r.protocolFallback;
facilNormalRedirectsChecks = r.facilNormalRedirectsChecks; facilNormalRedirectsChecks = r.facilNormalRedirectsChecks;
facilNormalCustomRedirects = r.facilNormalCustomRedirects; facilNormalCustomRedirects = r.facilNormalCustomRedirects;
facilTorCustomRedirects = r.facilTorCustomRedirects;
facilI2pCustomRedirects = r.facilI2pCustomRedirects;
facilLokiCustomRedirects = r.facilLokiCustomRedirects;
} }
) )
} }
@ -89,7 +107,15 @@ function redirect(url, initiator) {
let randomInstance; let randomInstance;
if (mapsFrontend == 'osm') randomInstance = utils.getRandomInstance(redirects.osm.normal); if (mapsFrontend == 'osm') randomInstance = utils.getRandomInstance(redirects.osm.normal);
if (mapsFrontend == 'facil') randomInstance = utils.getRandomInstance([...facilNormalRedirectsChecks, ...facilNormalCustomRedirects]);
if (mapsFrontend == 'facil') {
if (protocol == 'loki') randomInstance = utils.getRandomInstance(...facilLokiCustomRedirects);
else if (protocol == 'i2p') randomInstance = utils.getRandomInstance(...facilI2pCustomRedirects);
else if (protocol == 'tor') randomInstance = utils.getRandomInstance(...facilTorCustomRedirects);
if ((randomInstance == "" && protocolFallback) || protocol == 'normal') {
randomInstance = utils.getRandomInstance([...facilNormalRedirectsChecks, ...facilNormalCustomRedirects]);
}
}
let mapCentre = "#"; let mapCentre = "#";
let prefs = {}; let prefs = {};
@ -201,6 +227,15 @@ async function initDefaults() {
mapsRedirects: redirects, mapsRedirects: redirects,
facilNormalRedirectsChecks: [...redirects.facil.normal], facilNormalRedirectsChecks: [...redirects.facil.normal],
facilNormalCustomRedirects: [], facilNormalCustomRedirects: [],
facilTorRedirectsChecks: [...redirects.facil.tor],
facilTorCustomRedirects: [],
facilI2pRedirectsChecks: [...redirects.facil.i2p],
facilI2pCustomRedirects: [],
facilLokiRedirectsChecks: [...redirects.facil.loki],
facilLokiCustomRedirects: []
}, () => resolve()) }, () => resolve())
) )

View File

@ -1,7 +1,6 @@
window.browser = window.browser || window.chrome; window.browser = window.browser || window.chrome;
import utils from './utils.js' import utils from './utils.js'
const targets = [ const targets = [
// /(?:.*\.)*(?<!(link\.|cdn\-images\-\d+\.))medium\.com(\/.*)?$/, // /(?:.*\.)*(?<!(link\.|cdn\-images\-\d+\.))medium\.com(\/.*)?$/,
/^medium\.com/, /^medium\.com/,
@ -28,12 +27,18 @@ const targets = [
/^ writingcooperative\.com /, /^ writingcooperative\.com /,
]; ];
let redirects = { const frontends = new Array("scribe")
"scribe": { const protocols = new Array("normal", "tor", "i2p", "loki")
"normal": [],
"tor": [] let redirects = {};
}
}; for (let i = 0; i < frontends.length; i++) {
redirects[frontends[i]] = {}
for (let x = 0; x < protocols.length; x++) {
redirects[frontends[i]][protocols[x]] = []
}
}
function setRedirects(val) { function setRedirects(val) {
browser.storage.local.get('cloudflareBlackList', r => { browser.storage.local.get('cloudflareBlackList', r => {
redirects.scribe = val; redirects.scribe = val;
@ -56,7 +61,10 @@ let
scribeNormalCustomRedirects, scribeNormalCustomRedirects,
scribeTorRedirectsChecks, scribeTorRedirectsChecks,
scribeTorCustomRedirects, scribeTorCustomRedirects,
mediumProtocol; scribeI2pCustomRedirects,
scribeLokiCustomRedirects,
protocol,
protocolFallback;
function init() { function init() {
return new Promise(resolve => { return new Promise(resolve => {
@ -68,7 +76,10 @@ function init() {
"scribeNormalCustomRedirects", "scribeNormalCustomRedirects",
"scribeTorRedirectsChecks", "scribeTorRedirectsChecks",
"scribeTorCustomRedirects", "scribeTorCustomRedirects",
"mediumProtocol" "scribeI2pCustomRedirects",
"scribeLokiCustomRedirects",
"protocol",
"protocolFallback"
], ],
r => { r => {
disableMedium = r.disableMedium; disableMedium = r.disableMedium;
@ -77,7 +88,10 @@ function init() {
scribeNormalCustomRedirects = r.scribeNormalCustomRedirects; scribeNormalCustomRedirects = r.scribeNormalCustomRedirects;
scribeTorRedirectsChecks = r.scribeTorRedirectsChecks; scribeTorRedirectsChecks = r.scribeTorRedirectsChecks;
scribeTorCustomRedirects = r.scribeTorCustomRedirects; scribeTorCustomRedirects = r.scribeTorCustomRedirects;
mediumProtocol = r.mediumProtocol; scribeI2pCustomRedirects = r.scribeI2pCustomRedirects;
scribeLokiCustomRedirects = r.scribeLokiCustomRedirects;
protocol = r.protocol;
protocolFallback = r.protocolFallback;
resolve(); resolve();
} }
) )
@ -97,15 +111,21 @@ function redirect(url, type, initiator, disableOverride) {
...mediumRedirects.scribe.tor, ...mediumRedirects.scribe.tor,
...scribeNormalCustomRedirects, ...scribeNormalCustomRedirects,
...scribeTorCustomRedirects, ...scribeTorCustomRedirects,
...scribeI2pCustomRedirects,
...scribeLokiCustomRedirects
].includes(initiator.origin))) return; ].includes(initiator.origin))) return;
if (!targets.some(rx => rx.test(url.host))) return; if (!targets.some(rx => rx.test(url.host))) return;
if (/^\/(@[a-zA-Z.]{0,}(\/|)$)/.test(url.pathname)) return; if (/^\/(@[a-zA-Z.]{0,}(\/|)$)/.test(url.pathname)) return;
let instancesList; let instancesList = [];
if (mediumProtocol == 'normal') instancesList = [...scribeNormalRedirectsChecks, ...scribeNormalCustomRedirects]; if (protocol == 'loki') instancesList = [...scribeLokiCustomRedirects];
else if (mediumProtocol == 'tor') instancesList = [...scribeTorRedirectsChecks, ...scribeTorCustomRedirects]; else if (protocol == 'i2p') instancesList = [...scribeI2pCustomRedirects];
if (instancesList.length === 0) return; else if (protocol == 'tor') instancesList = [...scribeTorRedirectsChecks, ...scribeTorCustomRedirects];
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...scribeNormalRedirectsChecks, ...scribeNormalCustomRedirects];
}
if (instancesList.length === 0) { return; }
const randomInstance = utils.getRandomInstance(instancesList) const randomInstance = utils.getRandomInstance(instancesList)
return `${randomInstance}${url.pathname}${url.search}`; return `${randomInstance}${url.pathname}${url.search}`;
@ -122,12 +142,18 @@ function switchInstance(url, disableOverride) {
...scribeNormalCustomRedirects, ...scribeNormalCustomRedirects,
...scribeTorCustomRedirects, ...scribeTorCustomRedirects,
...scribeI2pCustomRedirects,
...scribeLokiCustomRedirects
]; ];
if (!all.includes(protocolHost)) { resolve(); return; } if (!all.includes(protocolHost)) { resolve(); return; }
let instancesList; let instancesList = [];
if (mediumProtocol == 'normal') instancesList = [...scribeNormalCustomRedirects, ...scribeNormalRedirectsChecks]; if (protocol == 'loki') instancesList = [...scribeLokiCustomRedirects];
else if (mediumProtocol == 'tor') instancesList = [...scribeTorCustomRedirects, ...scribeTorRedirectsChecks]; else if (protocol == 'i2p') instancesList = [...scribeI2pCustomRedirects];
else if (protocol == 'tor') instancesList = [...scribeTorRedirectsChecks, ...scribeTorCustomRedirects];
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...scribeNormalRedirectsChecks, ...scribeNormalCustomRedirects];
}
const i = instancesList.indexOf(protocolHost); const i = instancesList.indexOf(protocolHost);
if (i > -1) instancesList.splice(i, 1); if (i > -1) instancesList.splice(i, 1);
@ -142,7 +168,9 @@ function initDefaults() {
return new Promise(resolve => { return new Promise(resolve => {
fetch('/instances/data.json').then(response => response.text()).then(data => { fetch('/instances/data.json').then(response => response.text()).then(data => {
let dataJson = JSON.parse(data); let dataJson = JSON.parse(data);
redirects.scribe = dataJson.scribe; for (let i = 0; i < frontends.length; i++) {
redirects[frontends[i]] = dataJson[frontends[i]]
}
browser.storage.local.get('cloudflareBlackList', browser.storage.local.get('cloudflareBlackList',
async r => { async r => {
scribeNormalRedirectsChecks = [...redirects.scribe.normal]; scribeNormalRedirectsChecks = [...redirects.scribe.normal];
@ -160,7 +188,11 @@ function initDefaults() {
scribeTorRedirectsChecks: [...redirects.scribe.tor], scribeTorRedirectsChecks: [...redirects.scribe.tor],
scribeTorCustomRedirects: [], scribeTorCustomRedirects: [],
mediumProtocol: "normal", scribeI2pRedirectsChecks: [...redirects.scribe.i2p],
scribeI2pCustomRedirects: [],
scribeLokiRedirectsChecks: [...redirects.scribe.loki],
scribeLokiCustomRedirects: []
}, () => resolve()) }, () => resolve())
}) })
}) })

View File

@ -11,7 +11,9 @@ let redirects = {
"https://st.phreedom.club", "https://st.phreedom.club",
"https://simpleertube.esmailelbob.xyz", "https://simpleertube.esmailelbob.xyz",
], ],
"tor": [] "tor": [],
"i2p": [],
"loki": []
} }
} }
function setRedirects(val) { function setRedirects(val) {
@ -39,8 +41,11 @@ let
simpleertubeNormalCustomRedirects, simpleertubeNormalCustomRedirects,
simpleertubeTorRedirectsChecks, simpleertubeTorRedirectsChecks,
simpleertubeTorCustomRedirects, simpleertubeTorCustomRedirects,
simpleertubeI2pCustomRedirects,
simpleertubeLokiCustomRedirects,
peerTubeTargets, peerTubeTargets,
peertubeTargetsProtocol; protocol,
protocolFallback;
function init() { function init() {
return new Promise(resolve => { return new Promise(resolve => {
@ -52,8 +57,11 @@ function init() {
"simpleertubeNormalCustomRedirects", "simpleertubeNormalCustomRedirects",
"simpleertubeTorRedirectsChecks", "simpleertubeTorRedirectsChecks",
"simpleertubeTorCustomRedirects", "simpleertubeTorCustomRedirects",
"simpleertubeI2pCustomRedirects",
"simpleertubeLokiCustomRedirects",
"peerTubeTargets", "peerTubeTargets",
"peertubeTargetsProtocol" "protocol",
"protocolFallback"
], ],
r => { r => {
disablePeertubeTargets = r.disablePeertubeTargets; disablePeertubeTargets = r.disablePeertubeTargets;
@ -62,8 +70,11 @@ function init() {
simpleertubeNormalCustomRedirects = r.simpleertubeNormalCustomRedirects; simpleertubeNormalCustomRedirects = r.simpleertubeNormalCustomRedirects;
simpleertubeTorRedirectsChecks = r.simpleertubeTorRedirectsChecks; simpleertubeTorRedirectsChecks = r.simpleertubeTorRedirectsChecks;
simpleertubeTorCustomRedirects = r.simpleertubeTorCustomRedirects; simpleertubeTorCustomRedirects = r.simpleertubeTorCustomRedirects;
simpleertubeI2pCustomRedirects = r.simpleertubeI2pCustomRedirects;
simpleertubeLokiCustomRedirects = r.simpleertubeLokiCustomRedirects;
peerTubeTargets = r.peerTubeTargets; peerTubeTargets = r.peerTubeTargets;
peertubeTargetsProtocol = r.peertubeTargetsProtocol; protocol = r.protocol;
protocolFallback = r.protocolFallback;
resolve(); resolve();
} }
) )
@ -79,6 +90,8 @@ function all() {
...redirects.simpleertube.tor, ...redirects.simpleertube.tor,
...simpleertubeNormalCustomRedirects, ...simpleertubeNormalCustomRedirects,
...simpleertubeTorCustomRedirects, ...simpleertubeTorCustomRedirects,
...simpleertubeI2pCustomRedirects,
...simpleertubeLokiCustomRedirects
]; ];
} }
@ -89,10 +102,14 @@ function redirect(url, type, initiator, disableOverride) {
if (!peerTubeTargets.includes(protocolHost)) return; if (!peerTubeTargets.includes(protocolHost)) return;
if (type != "main_frame") return; if (type != "main_frame") return;
let instancesList; let instancesList = [];
if (peertubeTargetsProtocol == 'normal') instancesList = [...simpleertubeNormalRedirectsChecks, ...simpleertubeNormalCustomRedirects]; if (protocol == 'loki') instancesList = [...simpleertubeLokiCustomRedirects];
if (peertubeTargetsProtocol == 'tor') instancesList = [...simpleertubeTorRedirectsChecks, ...simpleertubeTorCustomRedirects]; else if (protocol == 'i2p') instancesList = [...simpleertubeI2pCustomRedirects];
if (instancesList.length === 0) return; else if (protocol == 'tor') instancesList = [...simpleertubeTorRedirectsChecks, ...simpleertubeTorCustomRedirects];
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...simpleertubeNormalRedirectsChecks, ...simpleertubeNormalCustomRedirects];
}
if (instancesList.length === 0) { return; }
const randomInstance = utils.getRandomInstance(instancesList); const randomInstance = utils.getRandomInstance(instancesList);
if (url.host == 'search.joinpeertube.org' || url.host == 'sepiasearch.org') return randomInstance; if (url.host == 'search.joinpeertube.org' || url.host == 'sepiasearch.org') return randomInstance;
@ -106,9 +123,13 @@ function switchInstance(url, disableOverride) {
const protocolHost = utils.protocolHost(url); const protocolHost = utils.protocolHost(url);
if (!all().includes(protocolHost)) { resolve(); return; } if (!all().includes(protocolHost)) { resolve(); return; }
let instancesList; let instancesList = [];
if (peertubeTargetsProtocol == 'normal') instancesList = [...simpleertubeNormalRedirectsChecks, ...simpleertubeNormalCustomRedirects]; if (protocol == 'loki') instancesList = [...simpleertubeLokiCustomRedirects];
else if (peertubeTargetsProtocol == 'tor') instancesList = [...simpleertubeTorRedirectsChecks, ...simpleertubeTorCustomRedirects]; else if (protocol == 'i2p') instancesList = [...simpleertubeI2pCustomRedirects];
else if (protocol == 'tor') instancesList = [...simpleertubeTorRedirectsChecks, ...simpleertubeTorCustomRedirects];
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...simpleertubeNormalRedirectsChecks, ...simpleertubeNormalCustomRedirects];
}
const i = instancesList.indexOf(protocolHost); const i = instancesList.indexOf(protocolHost);
if (i > -1) instancesList.splice(i, 1); if (i > -1) instancesList.splice(i, 1);
@ -140,7 +161,11 @@ function initDefaults() {
simpleertubeTorRedirectsChecks: [...redirects.simpleertube.tor], simpleertubeTorRedirectsChecks: [...redirects.simpleertube.tor],
simpleertubeTorCustomRedirects: [], simpleertubeTorCustomRedirects: [],
peertubeTargetsProtocol: "normal", simpleertubeI2pRedirectsChecks: [...redirects.simpleertube.i2p],
simpleertubeI2pCustomRedirects: [],
simpleertubeLokiRedirectsChecks: [...redirects.simpleertube.loki],
simpleertubeLokiCustomRedirects: []
}, () => resolve()); }, () => resolve());
}) })
}) })

View File

@ -6,12 +6,18 @@ const targets = [
/^https?:\/{2}(www\.|)quora\.com.*/ /^https?:\/{2}(www\.|)quora\.com.*/
]; ];
let redirects = { let redirects = {}
"quetre": {
"normal": [], const frontends = new Array("quetre")
"tor": [] const protocols = new Array("normal", "tor", "i2p", "loki")
for (let i = 0; i < frontends.length; i++) {
redirects[frontends[i]] = {}
for (let x = 0; x < protocols.length; x++) {
redirects[frontends[i]][protocols[x]] = []
} }
} }
function setRedirects(val) { function setRedirects(val) {
browser.storage.local.get('cloudflareBlackList', r => { browser.storage.local.get('cloudflareBlackList', r => {
redirects.quetre = val; redirects.quetre = val;
@ -29,33 +35,42 @@ function setRedirects(val) {
let let
disableQuora, disableQuora,
quoraProtocol, protocol,
protocolFallback,
quoraRedirects, quoraRedirects,
quetreNormalRedirectsChecks, quetreNormalRedirectsChecks,
quetreNormalCustomRedirects, quetreNormalCustomRedirects,
quetreTorRedirectsChecks, quetreTorRedirectsChecks,
quetreTorCustomRedirects; quetreTorCustomRedirects,
quetreI2pCustomRedirects,
quetreLokiCustomRedirects;
function init() { function init() {
return new Promise(async resolve => { return new Promise(async resolve => {
browser.storage.local.get( browser.storage.local.get(
[ [
"disableQuora", "disableQuora",
"quoraProtocol", "protocol",
"protocolFallback",
"quoraRedirects", "quoraRedirects",
"quetreNormalRedirectsChecks", "quetreNormalRedirectsChecks",
"quetreNormalCustomRedirects", "quetreNormalCustomRedirects",
"quetreTorRedirectsChecks", "quetreTorRedirectsChecks",
"quetreTorCustomRedirects", "quetreTorCustomRedirects",
"quetreI2pCustomRedirects",
"quetreLokiCustomRedirects"
], ],
r => { r => {
disableQuora = r.disableQuora; disableQuora = r.disableQuora;
quoraProtocol = r.quoraProtocol; protocol = r.protocol;
protocolFallback = r.protocolFallback;
quoraRedirects = r.quoraRedirects; quoraRedirects = r.quoraRedirects;
quetreNormalRedirectsChecks = r.quetreNormalRedirectsChecks; quetreNormalRedirectsChecks = r.quetreNormalRedirectsChecks;
quetreNormalCustomRedirects = r.quetreNormalCustomRedirects; quetreNormalCustomRedirects = r.quetreNormalCustomRedirects;
quetreTorRedirectsChecks = r.quetreTorRedirectsChecks; quetreTorRedirectsChecks = r.quetreTorRedirectsChecks;
quetreTorCustomRedirects = r.quetreTorCustomRedirects; quetreTorCustomRedirects = r.quetreTorCustomRedirects;
quetreI2pCustomRedirects = r.quetreI2pCustomRedirects;
quetreLokiCustomRedirects = r.quetreLokiCustomRedirects;
resolve(); resolve();
} }
) )
@ -76,10 +91,14 @@ function redirect(url, type, initiator, disableOverride) {
if (initiator && (all.includes(initiator.origin) || targets.includes(initiator.host))) return; if (initiator && (all.includes(initiator.origin) || targets.includes(initiator.host))) return;
if (!targets.some(rx => rx.test(url.href))) return; if (!targets.some(rx => rx.test(url.href))) return;
let instancesList; let instancesList = [];
if (quoraProtocol == 'normal') instancesList = [...quetreNormalRedirectsChecks, ...quetreNormalCustomRedirects]; if (protocol == 'loki') instancesList = [...quetreLokiCustomRedirects];
if (quoraProtocol == 'tor') instancesList = [...quetreTorRedirectsChecks, ...quetreTorCustomRedirects]; else if (protocol == 'i2p') instancesList = [...quetreI2pCustomRedirects];
if (instancesList.length === 0) return; else if (protocol == 'tor') instancesList = [...quetreTorRedirectsChecks, ...quetreTorCustomRedirects];
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...quetreNormalRedirectsChecks, ...quetreNormalCustomRedirects];
}
if (instancesList.length === 0) { return; }
const randomInstance = utils.getRandomInstance(instancesList); const randomInstance = utils.getRandomInstance(instancesList);
return `${randomInstance}${url.pathname}`; return `${randomInstance}${url.pathname}`;
@ -93,7 +112,9 @@ function reverse(url) {
...quoraRedirects.quetre.normal, ...quoraRedirects.quetre.normal,
...quoraRedirects.quetre.tor, ...quoraRedirects.quetre.tor,
...quetreNormalCustomRedirects, ...quetreNormalCustomRedirects,
...quetreTorCustomRedirects ...quetreTorCustomRedirects,
...quetreI2pCustomRedirects,
...quetreLokiCustomRedirects
]; ];
if (!all.includes(protocolHost)) { resolve(); return; } if (!all.includes(protocolHost)) { resolve(); return; }
@ -112,12 +133,18 @@ function switchInstance(url, disableOverride) {
...quetreNormalCustomRedirects, ...quetreNormalCustomRedirects,
...quetreTorCustomRedirects, ...quetreTorCustomRedirects,
...quetreI2pCustomRedirects,
...quetreLokiCustomRedirects
]; ];
if (!all.includes(protocolHost)) { resolve(); return; } if (!all.includes(protocolHost)) { resolve(); return; }
let instancesList; let instancesList = [];
if (quoraProtocol == 'normal') instancesList = [...quetreNormalCustomRedirects, ...quetreNormalRedirectsChecks]; if (protocol == 'loki') instancesList = [...quetreLokiCustomRedirects];
else if (quoraProtocol == 'tor') instancesList = [...quetreTorCustomRedirects, ...quetreTorRedirectsChecks]; else if (protocol == 'i2p') instancesList = [...quetreI2pCustomRedirects];
else if (protocol == 'tor') instancesList = [...quetreTorRedirectsChecks, ...quetreTorCustomRedirects];
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...quetreNormalRedirectsChecks, ...quetreNormalCustomRedirects];
}
const i = instancesList.indexOf(protocolHost); const i = instancesList.indexOf(protocolHost);
if (i > -1) instancesList.splice(i, 1); if (i > -1) instancesList.splice(i, 1);
@ -132,10 +159,11 @@ function initDefaults() {
return new Promise(async resolve => { return new Promise(async resolve => {
fetch('/instances/data.json').then(response => response.text()).then(async data => { fetch('/instances/data.json').then(response => response.text()).then(async data => {
let dataJson = JSON.parse(data); let dataJson = JSON.parse(data);
redirects.quetre = dataJson.quetre; for (let i = 0; i < frontends.length; i++) {
redirects[frontends[i]] = dataJson[frontends[i]]
}
browser.storage.local.set({ browser.storage.local.set({
disableQuora: false, disableQuora: false,
quoraProtocol: "normal",
quoraRedirects: redirects, quoraRedirects: redirects,
@ -144,6 +172,12 @@ function initDefaults() {
quetreTorRedirectsChecks: [...redirects.quetre.tor], quetreTorRedirectsChecks: [...redirects.quetre.tor],
quetreTorCustomRedirects: [], quetreTorCustomRedirects: [],
quetreI2pRedirectsChecks: [...redirects.quetre.i2p],
quetreI2pCustomRedirects: [],
quetreLokiRedirectsChecks: [...redirects.quetre.loki],
quetreLokiCustomRedirects: []
}, () => resolve()); }, () => resolve());
}); });
}) })

View File

@ -6,16 +6,18 @@ const targets = [
/^https?:\/{2}(www\.|old\.|np\.|new\.|amp\.|)reddit\.com/, /^https?:\/{2}(www\.|old\.|np\.|new\.|amp\.|)reddit\.com/,
/^https?:\/{2}(i\.|preview\.)redd\.it/, /^https?:\/{2}(i\.|preview\.)redd\.it/,
]; ];
let redirects = { let redirects = {};
"libreddit": {
"normal": [], const frontends = new Array("libreddit", "teddit")
"tor": [] const protocols = new Array("normal", "tor", "i2p", "loki")
},
"teddit": { for (let i = 0; i < frontends.length; i++) {
"normal": [], redirects[frontends[i]] = {}
"tor": [] for (let x = 0; x < protocols.length; x++) {
}, redirects[frontends[i]][protocols[x]] = []
}; }
}
function setRedirects(val) { function setRedirects(val) {
browser.storage.local.get('cloudflareBlackList', r => { browser.storage.local.get('cloudflareBlackList', r => {
redirects = val; redirects = val;
@ -40,15 +42,27 @@ let
disableReddit, disableReddit,
redditFrontend, redditFrontend,
redditRedirects, redditRedirects,
redditProtocol, protocol,
protocolFallback,
libredditNormalRedirectsChecks, libredditNormalRedirectsChecks,
libredditNormalCustomRedirects, libredditNormalCustomRedirects,
libredditTorRedirectsChecks, libredditTorRedirectsChecks,
libredditTorCustomRedirects, libredditTorCustomRedirects,
libredditI2pCustomRedirects,
libredditLokiCustomRedirects,
tedditNormalRedirectsChecks, tedditNormalRedirectsChecks,
tedditNormalCustomRedirects, tedditNormalCustomRedirects,
tedditTorRedirectsChecks, tedditTorRedirectsChecks,
tedditTorCustomRedirects; tedditTorCustomRedirects,
tedditI2pCustomRedirects,
tedditLokiCustomRedirects;
function init() { function init() {
return new Promise(resolve => { return new Promise(resolve => {
@ -57,29 +71,39 @@ function init() {
"disableReddit", "disableReddit",
"redditFrontend", "redditFrontend",
"redditRedirects", "redditRedirects",
"redditProtocol", "protocol",
"protocolFallback",
"libredditNormalRedirectsChecks", "libredditNormalRedirectsChecks",
"libredditNormalCustomRedirects", "libredditNormalCustomRedirects",
"libredditTorRedirectsChecks", "libredditTorRedirectsChecks",
"libredditTorCustomRedirects", "libredditTorCustomRedirects",
"libredditI2pCustomRedirects",
"libredditLokiCustomRedirects",
"tedditNormalRedirectsChecks", "tedditNormalRedirectsChecks",
"tedditNormalCustomRedirects", "tedditNormalCustomRedirects",
"tedditTorRedirectsChecks", "tedditTorRedirectsChecks",
"tedditTorCustomRedirects", "tedditTorCustomRedirects",
"tedditI2pCustomRedirects",
"tedditLokiCustomRedirects"
], ],
r => { r => {
disableReddit = r.disableReddit; disableReddit = r.disableReddit;
redditFrontend = r.redditFrontend; redditFrontend = r.redditFrontend;
redditRedirects = r.redditRedirects; redditRedirects = r.redditRedirects;
redditProtocol = r.redditProtocol; protocol = r.protocol;
protocolFallback = r.protocolFallback;
libredditNormalRedirectsChecks = r.libredditNormalRedirectsChecks; libredditNormalRedirectsChecks = r.libredditNormalRedirectsChecks;
libredditNormalCustomRedirects = r.libredditNormalCustomRedirects; libredditNormalCustomRedirects = r.libredditNormalCustomRedirects;
libredditTorRedirectsChecks = r.libredditTorRedirectsChecks; libredditTorRedirectsChecks = r.libredditTorRedirectsChecks;
libredditTorCustomRedirects = r.libredditTorCustomRedirects; libredditTorCustomRedirects = r.libredditTorCustomRedirects;
libredditI2pCustomRedirects = r.libredditI2pCustomRedirects;
libredditLokiCustomRedirects = r.libredditLokiCustomRedirects;
tedditNormalRedirectsChecks = r.tedditNormalRedirectsChecks; tedditNormalRedirectsChecks = r.tedditNormalRedirectsChecks;
tedditNormalCustomRedirects = r.tedditNormalCustomRedirects; tedditNormalCustomRedirects = r.tedditNormalCustomRedirects;
tedditTorRedirectsChecks = r.tedditTorRedirectsChecks; tedditTorRedirectsChecks = r.tedditTorRedirectsChecks;
tedditTorCustomRedirects = r.tedditTorCustomRedirects; tedditTorCustomRedirects = r.tedditTorCustomRedirects;
tedditI2pCustomRedirects = r.tedditI2pCustomRedirects;
tedditLokiCustomRedirects = r.tedditLokiCustomRedirects;
resolve(); resolve();
} }
) )
@ -98,12 +122,18 @@ function initLibredditCookies(test, from) {
...libredditTorRedirectsChecks, ...libredditTorRedirectsChecks,
...libredditNormalCustomRedirects, ...libredditNormalCustomRedirects,
...libredditTorCustomRedirects, ...libredditTorCustomRedirects,
...libredditI2pCustomRedirects,
...libredditLokiCustomRedirects
].includes(protocolHost)) { resolve(); return; } ].includes(protocolHost)) { resolve(); return; }
if (!test) { if (!test) {
let checkedInstances; let checkedInstances = [];
if (redditProtocol == 'normal') checkedInstances = [...libredditNormalRedirectsChecks, ...libredditNormalCustomRedirects]; if (protocol == 'loki') checkedInstances = [...libredditLokiCustomRedirects];
else if (redditProtocol == 'tor') checkedInstances = [...libredditTorRedirectsChecks, ...libredditTorCustomRedirects]; else if (protocol == 'i2p') checkedInstances = [...libredditI2pCustomRedirects];
else if (protocol == 'tor') checkedInstances = [...libredditTorRedirectsChecks, ...libredditTorCustomRedirects];
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
checkedInstances = [...libredditNormalRedirectsChecks, ...libredditNormalCustomRedirects];
}
await utils.copyCookie('libreddit', from, checkedInstances, "theme"); await utils.copyCookie('libreddit', from, checkedInstances, "theme");
await utils.copyCookie('libreddit', from, checkedInstances, "front_page"); await utils.copyCookie('libreddit', from, checkedInstances, "front_page");
await utils.copyCookie('libreddit', from, checkedInstances, "layout"); await utils.copyCookie('libreddit', from, checkedInstances, "layout");
@ -124,10 +154,14 @@ function initLibredditCookies(test, from) {
function pasteLibredditCookies() { function pasteLibredditCookies() {
return new Promise(async resolve => { return new Promise(async resolve => {
await init(); await init();
if (disableReddit || redditFrontend != 'libreddit' || redditProtocol === undefined) { resolve(); return; } if (disableReddit || redditFrontend != 'libreddit' || protocol === undefined) { resolve(); return; }
let checkedInstances; let checkedInstances = [];
if (redditProtocol == 'normal') checkedInstances = [...libredditNormalRedirectsChecks, ...libredditNormalCustomRedirects] if (protocol == 'loki') checkedInstances = [...libredditLokiCustomRedirects];
else if (redditProtocol == 'tor') checkedInstances = [...libredditTorRedirectsChecks, ...libredditTorCustomRedirects] else if (protocol == 'i2p') checkedInstances = [...libredditI2pCustomRedirects];
else if (protocol == 'tor') checkedInstances = [...libredditTorRedirectsChecks, ...libredditTorCustomRedirects];
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
checkedInstances = [...libredditNormalRedirectsChecks, ...libredditNormalCustomRedirects];
}
utils.getCookiesFromStorage('libreddit', checkedInstances, "theme"); utils.getCookiesFromStorage('libreddit', checkedInstances, "theme");
utils.getCookiesFromStorage('libreddit', checkedInstances, "front_page"); utils.getCookiesFromStorage('libreddit', checkedInstances, "front_page");
utils.getCookiesFromStorage('libreddit', checkedInstances, "layout"); utils.getCookiesFromStorage('libreddit', checkedInstances, "layout");
@ -153,12 +187,19 @@ function initTedditCookies(test, from) {
...tedditTorRedirectsChecks, ...tedditTorRedirectsChecks,
...tedditNormalCustomRedirects, ...tedditNormalCustomRedirects,
...tedditTorCustomRedirects, ...tedditTorCustomRedirects,
...tedditI2pCustomRedirects,
...tedditI2pCustomRedirects
].includes(protocolHost)) resolve(); ].includes(protocolHost)) resolve();
if (!test) { if (!test) {
let checkedInstances; let checkedInstances = [];
if (redditProtocol == 'normal') checkedInstances = [...tedditNormalRedirectsChecks, ...tedditNormalCustomRedirects] if (protocol == 'loki') checkedInstances = [...tedditLokiCustomRedirects];
else if (redditProtocol == 'tor') checkedInstances = [...tedditTorRedirectsChecks, ...tedditTorCustomRedirects] else if (protocol == 'i2p') checkedInstances = [...tedditI2pCustomRedirects];
else if (protocol == 'tor') checkedInstances = [...tedditTorRedirectsChecks, ...tedditTorCustomRedirects];
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
checkedInstances = [...tedditNormalRedirectsChecks, ...tedditNormalCustomRedirects];
}
await utils.copyCookie('teddit', from, checkedInstances, 'collapse_child_comments') await utils.copyCookie('teddit', from, checkedInstances, 'collapse_child_comments')
await utils.copyCookie('teddit', from, checkedInstances, 'domain_instagram') await utils.copyCookie('teddit', from, checkedInstances, 'domain_instagram')
await utils.copyCookie('teddit', from, checkedInstances, 'domain_twitter') await utils.copyCookie('teddit', from, checkedInstances, 'domain_twitter')
@ -179,10 +220,14 @@ function initTedditCookies(test, from) {
function pasteTedditCookies() { function pasteTedditCookies() {
return new Promise(async resolve => { return new Promise(async resolve => {
await init(); await init();
if (disableReddit || redditFrontend != 'teddit' || redditProtocol === undefined) { resolve(); return; } if (disableReddit || redditFrontend != 'teddit' || protocol === undefined) { resolve(); return; }
let checkedInstances; let checkedInstances = [];
if (redditProtocol == 'normal') checkedInstances = [...tedditNormalRedirectsChecks, ...tedditNormalCustomRedirects] if (protocol == 'loki') checkedInstances = [...tedditLokiCustomRedirects];
else if (redditProtocol == 'tor') checkedInstances = [...tedditTorRedirectsChecks, ...tedditTorCustomRedirects] else if (protocol == 'i2p') checkedInstances = [...tedditI2pCustomRedirects];
else if (protocol == 'tor') checkedInstances = [...tedditTorRedirectsChecks, ...tedditTorCustomRedirects];
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
checkedInstances = [...tedditNormalRedirectsChecks, ...tedditNormalCustomRedirects];
}
utils.getCookiesFromStorage('teddit', checkedInstances, 'collapse_child_comments') utils.getCookiesFromStorage('teddit', checkedInstances, 'collapse_child_comments')
utils.getCookiesFromStorage('teddit', checkedInstances, 'domain_instagram') utils.getCookiesFromStorage('teddit', checkedInstances, 'domain_instagram')
utils.getCookiesFromStorage('teddit', checkedInstances, 'domain_twitter') utils.getCookiesFromStorage('teddit', checkedInstances, 'domain_twitter')
@ -207,8 +252,12 @@ function all() {
...redditRedirects.teddit.tor, ...redditRedirects.teddit.tor,
...libredditNormalCustomRedirects, ...libredditNormalCustomRedirects,
...libredditTorCustomRedirects, ...libredditTorCustomRedirects,
...libredditI2pCustomRedirects,
...libredditLokiCustomRedirects,
...tedditNormalCustomRedirects, ...tedditNormalCustomRedirects,
...tedditTorCustomRedirects, ...tedditTorCustomRedirects,
...tedditI2pCustomRedirects,
...tedditLokiCustomRedirects
]; ];
} }
@ -230,15 +279,25 @@ function redirect(url, type, initiator, disableOverride) {
const bypassPaths = /\/(gallery\/poll\/rpan\/settings\/topics)/; const bypassPaths = /\/(gallery\/poll\/rpan\/settings\/topics)/;
if (url.pathname.match(bypassPaths)) return; if (url.pathname.match(bypassPaths)) return;
let libredditInstancesList; let libredditInstancesList = [];
let tedditInstancesList; let tedditInstancesList = [];
if (redditProtocol == 'normal') {
libredditInstancesList = [...libredditNormalRedirectsChecks, ...libredditNormalCustomRedirects]; if (protocol == 'loki') {
tedditInstancesList = [...tedditNormalRedirectsChecks, ...tedditNormalCustomRedirects]; libredditInstancesList = [...libredditLokiCustomRedirects];
} else if (redditProtocol == 'tor') { tedditInstancesList = [...tedditLokiCustomRedirects];
}
else if (protocol == 'i2p') {
libredditInstancesList = [...libredditI2pCustomRedirects];
tedditInstancesList = [...tedditI2pCustomRedirects];
}
else if (protocol == 'tor') {
libredditInstancesList = [...libredditTorRedirectsChecks, ...libredditTorCustomRedirects]; libredditInstancesList = [...libredditTorRedirectsChecks, ...libredditTorCustomRedirects];
tedditInstancesList = [...tedditTorRedirectsChecks, ...tedditTorCustomRedirects]; tedditInstancesList = [...tedditTorRedirectsChecks, ...tedditTorCustomRedirects];
} }
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
libredditInstancesList = [...libredditNormalRedirectsChecks, ...libredditNormalCustomRedirects];
tedditInstancesList = [...tedditNormalRedirectsChecks, ...tedditNormalCustomRedirects];
}
if (url.host === "i.redd.it") { if (url.host === "i.redd.it") {
if (redditFrontend == 'teddit') { if (redditFrontend == 'teddit') {
@ -293,18 +352,26 @@ function switchInstance(url, disableOverride) {
if (disableReddit && !disableOverride) { resolve(); return; } if (disableReddit && !disableOverride) { resolve(); return; }
const protocolHost = utils.protocolHost(url); const protocolHost = utils.protocolHost(url);
if (!all().includes(protocolHost)) { resolve(); return; } if (!all().includes(protocolHost)) { resolve(); return; }
let instancesList; let instancesList = [];
if (redditFrontend == 'libreddit') { if (redditFrontend == 'libreddit') {
if (redditProtocol == 'normal') instancesList = [...libredditNormalRedirectsChecks, ...libredditNormalCustomRedirects]; if (protocol == 'loki') instancesList = [...libredditLokiCustomRedirects];
else if (redditProtocol == 'tor') instancesList = [...libredditTorRedirectsChecks, ...libredditTorCustomRedirects]; else if (protocol == 'i2p') instancesList = [...libredditI2pCustomRedirects];
else if (protocol == 'tor') instancesList = [...libredditTorRedirectsChecks, ...libredditTorCustomRedirects];
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...libredditNormalRedirectsChecks, ...libredditNormalCustomRedirects];
}
if ([ if ([
...redditRedirects.teddit.normal, ...redditRedirects.teddit.normal,
...redditRedirects.teddit.tor ...redditRedirects.teddit.tor
].includes(protocolHost)) url.pathname = url.pathname.replace("/pics/w:null_", "/img/"); ].includes(protocolHost)) url.pathname = url.pathname.replace("/pics/w:null_", "/img/");
} }
else if (redditFrontend == 'teddit') { else if (redditFrontend == 'teddit') {
if (redditProtocol == 'normal') instancesList = [...tedditNormalRedirectsChecks, ...tedditNormalCustomRedirects]; if (protocol == 'loki') instancesList = [...tedditLokiCustomRedirects];
else if (redditProtocol == 'tor') instancesList = [...tedditTorRedirectsChecks, ...tedditTorCustomRedirects]; else if (protocol == 'i2p') instancesList = [...tedditI2pCustomRedirects];
else if (protocol == 'tor') instancesList = [...tedditTorRedirectsChecks, ...tedditTorCustomRedirects];
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...tedditNormalRedirectsChecks, ...tedditNormalCustomRedirects];
}
if ([ if ([
...redditRedirects.libreddit.normal, ...redditRedirects.libreddit.normal,
...redditRedirects.libreddit.tor ...redditRedirects.libreddit.tor
@ -325,8 +392,9 @@ function initDefaults() {
return new Promise(resolve => { return new Promise(resolve => {
fetch('/instances/data.json').then(response => response.text()).then(async data => { fetch('/instances/data.json').then(response => response.text()).then(async data => {
let dataJson = JSON.parse(data); let dataJson = JSON.parse(data);
redirects.teddit = dataJson.teddit; for (let i = 0; i < frontends.length; i++) {
redirects.libreddit = dataJson.libreddit; redirects[frontends[i]] = dataJson[frontends[i]]
}
browser.storage.local.get('cloudflareBlackList', async r => { browser.storage.local.get('cloudflareBlackList', async r => {
libredditNormalRedirectsChecks = [...redirects.libreddit.normal]; libredditNormalRedirectsChecks = [...redirects.libreddit.normal];
tedditNormalRedirectsChecks = [...redirects.teddit.normal] tedditNormalRedirectsChecks = [...redirects.teddit.normal]
@ -341,7 +409,6 @@ function initDefaults() {
} }
browser.storage.local.set({ browser.storage.local.set({
disableReddit: false, disableReddit: false,
redditProtocol: 'normal',
redditFrontend: 'libreddit', redditFrontend: 'libreddit',
redditRedirects: redirects, redditRedirects: redirects,
@ -351,11 +418,23 @@ function initDefaults() {
libredditTorRedirectsChecks: [...redirects.libreddit.tor], libredditTorRedirectsChecks: [...redirects.libreddit.tor],
libredditTorCustomRedirects: [], libredditTorCustomRedirects: [],
libredditI2pRedirectsChecks: [...redirects.libreddit.i2p],
libredditI2pCustomRedirects: [],
libredditLokiRedirectsChecks: [...redirects.libreddit.loki],
libredditLokiCustomRedirects: [],
tedditNormalRedirectsChecks: tedditNormalRedirectsChecks, tedditNormalRedirectsChecks: tedditNormalRedirectsChecks,
tedditNormalCustomRedirects: [], tedditNormalCustomRedirects: [],
tedditTorRedirectsChecks: [...redirects.teddit.tor], tedditTorRedirectsChecks: [...redirects.teddit.tor],
tedditTorCustomRedirects: [], tedditTorCustomRedirects: [],
tedditI2pRedirectsChecks: [...redirects.teddit.i2p],
tedditI2pCustomRedirects: [],
tedditLokiRedirectsChecks: [...redirects.teddit.loki],
tedditLokiCustomRedirects: []
}, () => resolve()); }, () => resolve());
}); });
}); });

View File

@ -9,41 +9,77 @@ const targets = [
let redirects = { let redirects = {
"neuters": { "neuters": {
"normal": [ "normal": [
'https://neuters.de', "https://neuters.de"
], ],
"tor": [] "tor": [],
"i2p": [],
"loki": []
} }
} }
// const frontends = new Array("neuters")
// const protocols = new Array("normal", "tor", "i2p", "loki")
// for (let i = 0; i < frontends.length; i++) {
// redirects[frontends[i]] = {}
// for (let x = 0; x < protocols.length; x++) {
// redirects[frontends[i]][protocols[x]] = []
// }
// }
function setRedirects(val) {
browser.storage.local.get('cloudflareBlackList', r => {
redirects.neuters = val;
neutersNormalRedirectsChecks = [...redirects.neuters.normal];
for (const instance of r.cloudflareBlackList) {
const a = neutersNormalRedirectsChecks.indexOf(instance);
if (a > -1) neutersNormalRedirectsChecks.splice(a, 1);
}
browser.storage.local.set({
neutersRedirects: redirects,
neutersNormalRedirectsChecks
})
})
}
let let
disableReuters, disableReuters,
reutersProtocol, protocol,
protocolFallback,
reutersRedirects, reutersRedirects,
neutersNormalRedirectsChecks, neutersNormalRedirectsChecks,
neutersNormalCustomRedirects, neutersNormalCustomRedirects,
neutersTorRedirectsChecks, neutersTorRedirectsChecks,
neutersTorCustomRedirects; neutersTorCustomRedirects,
neutersI2pCustomRedirects,
neutersLokiCustomRedirects;
function init() { function init() {
return new Promise(async resolve => { return new Promise(async resolve => {
browser.storage.local.get( browser.storage.local.get(
[ [
"disableReuters", "disableReuters",
"reutersProtocol", "protocol",
"protocolFallback",
"reutersRedirects", "reutersRedirects",
"neutersNormalRedirectsChecks", "neutersNormalRedirectsChecks",
"neutersNormalCustomRedirects", "neutersNormalCustomRedirects",
"neutersTorRedirectsChecks", "neutersTorRedirectsChecks",
"neutersTorCustomRedirects", "neutersTorCustomRedirects",
"neutersI2pCustomRedirects",
"neutersLokiCustomRedirects"
], ],
r => { r => {
disableReuters = r.disableReuters; disableReuters = r.disableReuters;
reutersProtocol = r.reutersProtocol; protocol = r.protocol;
protocolFallback = r.protocolFallback;
reutersRedirects = r.reutersRedirects; reutersRedirects = r.reutersRedirects;
neutersNormalRedirectsChecks = r.neutersNormalRedirectsChecks; neutersNormalRedirectsChecks = r.neutersNormalRedirectsChecks;
neutersNormalCustomRedirects = r.neutersNormalCustomRedirects; neutersNormalCustomRedirects = r.neutersNormalCustomRedirects;
neutersTorRedirectsChecks = r.neutersTorRedirectsChecks; neutersTorRedirectsChecks = r.neutersTorRedirectsChecks;
neutersTorCustomRedirects = r.neutersTorCustomRedirects; neutersTorCustomRedirects = r.neutersTorCustomRedirects;
neutersI2pCustomRedirects = r.neutersI2pCustomRedirects;
neutersLokiCustomRedirects = r.neutersLokiCustomRedirects;
resolve(); resolve();
} }
) )
@ -63,9 +99,13 @@ function redirect(url, type, initiator, disableOverride) {
if (initiator && (all.includes(initiator.origin) || targets.includes(initiator.host))) return; if (initiator && (all.includes(initiator.origin) || targets.includes(initiator.host))) return;
if (!targets.some(rx => rx.test(url.href))) return; if (!targets.some(rx => rx.test(url.href))) return;
let instancesList; let instancesList = [];
if (reutersProtocol == 'normal') instancesList = [...neutersNormalRedirectsChecks, ...neutersNormalCustomRedirects]; if (protocol == 'loki') instancesList = [...neutersLokiCustomRedirects];
if (reutersProtocol == 'tor') instancesList = [...neutersTorRedirectsChecks, ...neutersTorCustomRedirects]; else if (protocol == 'i2p') instancesList = [...neutersI2pCustomRedirects];
else if (protocol == 'tor') instancesList = [...neutersTorRedirectsChecks, ...neutersTorCustomRedirects];
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...neutersNormalRedirectsChecks, ...neutersNormalCustomRedirects];
}
if (instancesList.length === 0) return; if (instancesList.length === 0) return;
const randomInstance = utils.getRandomInstance(instancesList); const randomInstance = utils.getRandomInstance(instancesList);
@ -87,7 +127,6 @@ function initDefaults() {
return new Promise(resolve => { return new Promise(resolve => {
browser.storage.local.set({ browser.storage.local.set({
disableReuters: true, disableReuters: true,
reutersProtocol: "normal",
reutersRedirects: redirects, reutersRedirects: redirects,
@ -96,11 +135,18 @@ function initDefaults() {
neutersTorRedirectsChecks: [...redirects.neuters.tor], neutersTorRedirectsChecks: [...redirects.neuters.tor],
neutersTorCustomRedirects: [], neutersTorCustomRedirects: [],
neutersI2pRedirectsChecks: [...redirects.neuters.i2p],
neutersI2pCustomRedirects: [],
neutersLokiRedirectsChecks: [...redirects.neuters.loki],
neutersLokiCustomRedirects: []
}, () => resolve()); }, () => resolve());
}); });
} }
export default { export default {
setRedirects,
redirect, redirect,
initDefaults initDefaults
}; };

View File

@ -5,8 +5,12 @@ import utils from './utils.js'
const targets = [ const targets = [
/^https?:\/{2}search\.libredirect\.invalid/, /^https?:\/{2}search\.libredirect\.invalid/,
]; ];
// Ill optimise all of assets/javascripts at a later date. For now, I'll just add librex and optimse options javascript
const frontends = new Array("searx", "searxng", "whoogle", "librex")
const protocols = new Array("normal", "tor", "i2p", "loki")
let redirects = { const redirects = {}
/*
"searx": { "searx": {
"normal": [], "normal": [],
"tor": [], "tor": [],
@ -22,7 +26,27 @@ let redirects = {
"tor": [], "tor": [],
"i2p": [] "i2p": []
} }
}; */
//};
//let tmp = "{"
for (let i = 0; i < frontends.length; i++) {
//redirects.frontends[i] = {}
//redirects.push(frontends[i])
//tmp = frontends[i]
//tmp = tmp + '\n"' + frontends[i] + '": {'
redirects[frontends[i]] = {}
for (let x = 0; x < protocols.length; x++) {
//redirects.frontends[i].protocols = []
//tmp = tmp + '\n"' + protocols[x] + '": [],'
redirects[frontends[i]][protocols[x]] = []
}
//tmp = tmp + "\n},"
}
//tmp = tmp + "\n}"
//const redirects = JSON.parse(tmp)
function setRedirects(val) { function setRedirects(val) {
browser.storage.local.get('cloudflareBlackList', r => { browser.storage.local.get('cloudflareBlackList', r => {
@ -30,6 +54,7 @@ function setRedirects(val) {
searxNormalRedirectsChecks = [...redirects.searx.normal]; searxNormalRedirectsChecks = [...redirects.searx.normal];
searxngNormalRedirectsChecks = [...redirects.searxng.normal]; searxngNormalRedirectsChecks = [...redirects.searxng.normal];
whoogleNormalRedirectsChecks = [...redirects.whoogle.normal]; whoogleNormalRedirectsChecks = [...redirects.whoogle.normal];
librexNormalRedirectsChecks = [...redirects.librex.normal];
for (const instance of r.cloudflareBlackList) { for (const instance of r.cloudflareBlackList) {
const a = searxNormalRedirectsChecks.indexOf(instance); const a = searxNormalRedirectsChecks.indexOf(instance);
if (a > -1) searxNormalRedirectsChecks.splice(a, 1); if (a > -1) searxNormalRedirectsChecks.splice(a, 1);
@ -39,12 +64,16 @@ function setRedirects(val) {
const c = whoogleNormalRedirectsChecks.indexOf(instance); const c = whoogleNormalRedirectsChecks.indexOf(instance);
if (c > -1) whoogleNormalRedirectsChecks.splice(c, 1); if (c > -1) whoogleNormalRedirectsChecks.splice(c, 1);
const d = librexNormalRedirectsChecks.indexOf(instance);
if (d > -1) librexNormalRedirectsChecks.splice(d, 1);
} }
browser.storage.local.set({ browser.storage.local.set({
searchRedirects: redirects, searchRedirects: redirects,
searxNormalRedirectsChecks, searxNormalRedirectsChecks,
searxngNormalRedirectsChecks, searxngNormalRedirectsChecks,
whoogleNormalRedirectsChecks, whoogleNormalRedirectsChecks,
librexNormalRedirectsChecks,
}); });
}) })
} }
@ -53,25 +82,36 @@ let
disableSearch, disableSearch,
searchFrontend, searchFrontend,
searchRedirects, searchRedirects,
searchProtocol, protocol,
protocolFallback,
whoogleNormalRedirectsChecks, whoogleNormalRedirectsChecks,
whoogleNormalCustomRedirects, whoogleNormalCustomRedirects,
whoogleTorRedirectsChecks, whoogleTorRedirectsChecks,
whoogleTorCustomRedirects, whoogleTorCustomRedirects,
whoogleI2pRedirectsChecks, whoogleI2pRedirectsChecks,
whoogleI2pCustomRedirects, whoogleI2pCustomRedirects,
whoogleLokiCustomRedirects,
searxNormalRedirectsChecks, searxNormalRedirectsChecks,
searxNormalCustomRedirects, searxNormalCustomRedirects,
searxTorRedirectsChecks, searxTorRedirectsChecks,
searxTorCustomRedirects, searxTorCustomRedirects,
searxI2pRedirectsChecks, searxI2pRedirectsChecks,
searxI2pCustomRedirects, searxI2pCustomRedirects,
searxLokiCustomRedirects,
searxngNormalRedirectsChecks, searxngNormalRedirectsChecks,
searxngNormalCustomRedirects, searxngNormalCustomRedirects,
searxngTorRedirectsChecks, searxngTorRedirectsChecks,
searxngTorCustomRedirects, searxngTorCustomRedirects,
searxngI2pRedirectsChecks, searxngI2pRedirectsChecks,
searxngI2pCustomRedirects; searxngI2pCustomRedirects,
searxngLokiCustomRedirects,
librexNormalRedirectsChecks,
librexNormalCustomRedirects,
librexTorRedirectsChecks,
librexTorCustomRedirects,
librexI2pRedirectsChecks,
librexI2pCustomRedirects,
librexLokiCustomRedirects;
function init() { function init() {
return new Promise(async resolve => { return new Promise(async resolve => {
@ -80,49 +120,71 @@ function init() {
"disableSearch", "disableSearch",
"searchFrontend", "searchFrontend",
"searchRedirects", "searchRedirects",
"searchProtocol", "protocol",
"protocolFallback",
"whoogleNormalRedirectsChecks", "whoogleNormalRedirectsChecks",
"whoogleNormalCustomRedirects", "whoogleNormalCustomRedirects",
"whoogleTorRedirectsChecks", "whoogleTorRedirectsChecks",
"whoogleTorCustomRedirects", "whoogleTorCustomRedirects",
"whoogleI2pRedirectsChecks", "whoogleI2pRedirectsChecks",
"whoogleI2pCustomRedirects", "whoogleI2pCustomRedirects",
"whoogleLokiCustomRedirects",
"searxNormalRedirectsChecks", "searxNormalRedirectsChecks",
"searxNormalCustomRedirects", "searxNormalCustomRedirects",
"searxTorRedirectsChecks", "searxTorRedirectsChecks",
"searxTorCustomRedirects", "searxTorCustomRedirects",
"searxI2pRedirectsChecks", "searxI2pRedirectsChecks",
"searxI2pCustomRedirects", "searxI2pCustomRedirects",
"searxLokiCustomRedirects",
"searxngNormalRedirectsChecks", "searxngNormalRedirectsChecks",
"searxngNormalCustomRedirects", "searxngNormalCustomRedirects",
"searxngTorRedirectsChecks", "searxngTorRedirectsChecks",
"searxngTorCustomRedirects", "searxngTorCustomRedirects",
"searxngI2pRedirectsChecks", "searxngI2pRedirectsChecks",
"searxngI2pCustomRedirects", "searxngI2pCustomRedirects",
"searxngLokiCustomRedirects",
"librexNormalRedirectsChecks",
"librexNormalCustomRedirects",
"librexTorRedirectsChecks",
"librexTorCustomRedirects",
"librexI2pRedirectsChecks",
"librexI2pCustomRedirects",
"librexLokiCustomRedirects"
], ],
r => { r => {
disableSearch = r.disableSearch; disableSearch = r.disableSearch;
searchFrontend = r.searchFrontend; searchFrontend = r.searchFrontend;
searchRedirects = r.searchRedirects; searchRedirects = r.searchRedirects;
searchProtocol = r.searchProtocol; protocol = r.protocol;
protocolFallback = r.protocolFallback;
whoogleNormalRedirectsChecks = r.whoogleNormalRedirectsChecks; whoogleNormalRedirectsChecks = r.whoogleNormalRedirectsChecks;
whoogleNormalCustomRedirects = r.whoogleNormalCustomRedirects; whoogleNormalCustomRedirects = r.whoogleNormalCustomRedirects;
whoogleTorRedirectsChecks = r.whoogleTorRedirectsChecks; whoogleTorRedirectsChecks = r.whoogleTorRedirectsChecks;
whoogleTorCustomRedirects = r.whoogleTorCustomRedirects; whoogleTorCustomRedirects = r.whoogleTorCustomRedirects;
whoogleI2pRedirectsChecks = r.whoogleI2pRedirectsChecks; whoogleI2pRedirectsChecks = r.whoogleI2pRedirectsChecks;
whoogleI2pCustomRedirects = r.whoogleI2pCustomRedirects; whoogleI2pCustomRedirects = r.whoogleI2pCustomRedirects;
whoogleLokiCustomRedirects = r.whoogleLokiCustomRedirects;
searxNormalRedirectsChecks = r.searxNormalRedirectsChecks; searxNormalRedirectsChecks = r.searxNormalRedirectsChecks;
searxNormalCustomRedirects = r.searxNormalCustomRedirects; searxNormalCustomRedirects = r.searxNormalCustomRedirects;
searxTorRedirectsChecks = r.searxTorRedirectsChecks; searxTorRedirectsChecks = r.searxTorRedirectsChecks;
searxTorCustomRedirects = r.searxTorCustomRedirects; searxTorCustomRedirects = r.searxTorCustomRedirects;
searxI2pRedirectsChecks = r.searxI2pRedirectsChecks; searxI2pRedirectsChecks = r.searxI2pRedirectsChecks;
searxI2pCustomRedirects = r.searxI2pCustomRedirects; searxI2pCustomRedirects = r.searxI2pCustomRedirects;
searxLokiCustomRedirects = r.searxLokiCustomRedirects;
searxngNormalRedirectsChecks = r.searxngNormalRedirectsChecks; searxngNormalRedirectsChecks = r.searxngNormalRedirectsChecks;
searxngNormalCustomRedirects = r.searxngNormalCustomRedirects; searxngNormalCustomRedirects = r.searxngNormalCustomRedirects;
searxngTorRedirectsChecks = r.searxngTorRedirectsChecks; searxngTorRedirectsChecks = r.searxngTorRedirectsChecks;
searxngTorCustomRedirects = r.searxngTorCustomRedirects; searxngTorCustomRedirects = r.searxngTorCustomRedirects;
searxngI2pRedirectsChecks = r.searxngI2pRedirectsChecks; searxngI2pRedirectsChecks = r.searxngI2pRedirectsChecks;
searxngI2pCustomRedirects = r.searxngI2pCustomRedirects; searxngI2pCustomRedirects = r.searxngI2pCustomRedirects;
searxngLokiCustomRedirects = r.searxngLokiCustomRedirects;
librexNormalRedirectsChecks = r.librexNormalRedirectsChecks;
librexNormalCustomRedirects = r.librexNormalCustomRedirects;
librexTorRedirectsChecks = r.librexTorRedirectsChecks;
librexTorCustomRedirects = r.librexTorCustomRedirects;
librexI2pRedirectsChecks = r.librexI2pRedirectsChecks;
librexI2pCustomRedirects = r.librexI2pCustomRedirects;
librexLokiCustomRedirects = r.librexLokiCustomRedirects;
resolve(); resolve();
} }
) )
@ -143,13 +205,17 @@ function initSearxCookies(test, from) {
...searxTorCustomRedirects, ...searxTorCustomRedirects,
...searxI2pRedirectsChecks, ...searxI2pRedirectsChecks,
...searxI2pCustomRedirects, ...searxI2pCustomRedirects,
...searxLokiCustomRedirects
].includes(protocolHost)) { resolve(); return; } ].includes(protocolHost)) { resolve(); return; }
if (!test) { if (!test) {
let checkedInstances; let checkedInstances = [];
if (searchProtocol == 'normal') checkedInstances = [...searxNormalRedirectsChecks, ...searxNormalCustomRedirects]; if (protocol == 'loki') checkedInstances = [...searxLokiCustomRedirects];
else if (searchProtocol == 'tor') checkedInstances = [...searxTorRedirectsChecks, ...searxTorCustomRedirects]; else if (protocol == 'i2p') checkedInstances = [...searxI2pCustomRedirects, ...searxI2pRedirectsChecks];
else if (searchProtocol == 'i2p') checkedInstances = [...searxI2pRedirectsChecks, ...searxI2pCustomRedirects]; else if (protocol == 'tor') checkedInstances = [...searxTorRedirectsChecks, ...searxTorCustomRedirects];
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
checkedInstances = [...searxNormalRedirectsChecks, ...searxNormalCustomRedirects];
}
await utils.copyCookie('searx', from, checkedInstances, 'advanced_search'); await utils.copyCookie('searx', from, checkedInstances, 'advanced_search');
await utils.copyCookie('searx', from, checkedInstances, 'autocomplete'); await utils.copyCookie('searx', from, checkedInstances, 'autocomplete');
await utils.copyCookie('searx', from, checkedInstances, 'categories'); await utils.copyCookie('searx', from, checkedInstances, 'categories');
@ -176,9 +242,13 @@ function pasteSearxCookies() {
return new Promise(async resolve => { return new Promise(async resolve => {
await init(); await init();
if (disableSearch || searchFrontend != 'searx') { resolve(); return; } if (disableSearch || searchFrontend != 'searx') { resolve(); return; }
let checkedInstances; let checkedInstances = [];
if (searchProtocol == 'normal') checkedInstances = [...searxNormalRedirectsChecks, ...searxNormalCustomRedirects] if (protocol == 'loki') checkedInstances = [...searxLokiCustomRedirects];
else if (searchProtocol == 'tor') checkedInstances = [...searxTorRedirectsChecks, ...searxTorCustomRedirects] else if (protocol == 'i2p') checkedInstances = [...searxI2pCustomRedirects, ...searxI2pRedirectsChecks];
else if (protocol == 'tor') checkedInstances = [...searxTorRedirectsChecks, ...searxTorCustomRedirects];
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
checkedInstances = [...searxNormalRedirectsChecks, ...searxNormalCustomRedirects];
}
utils.getCookiesFromStorage('searx', checkedInstances, 'advanced_search'); utils.getCookiesFromStorage('searx', checkedInstances, 'advanced_search');
utils.getCookiesFromStorage('searx', checkedInstances, 'autocomplete'); utils.getCookiesFromStorage('searx', checkedInstances, 'autocomplete');
utils.getCookiesFromStorage('searx', checkedInstances, 'categories'); utils.getCookiesFromStorage('searx', checkedInstances, 'categories');
@ -211,13 +281,17 @@ function initSearxngCookies(test, from) {
...searxngTorCustomRedirects, ...searxngTorCustomRedirects,
...searxngI2pRedirectsChecks, ...searxngI2pRedirectsChecks,
...searxngI2pCustomRedirects, ...searxngI2pCustomRedirects,
...searxngLokiCustomRedirects,
].includes(protocolHost)) { resolve(); return; } ].includes(protocolHost)) { resolve(); return; }
if (!test) { if (!test) {
let checkedInstances; let checkedInstances = [];
if (searchProtocol == 'normal') checkedInstances = [...searxngNormalRedirectsChecks, ...searxngNormalCustomRedirects]; if (protocol == 'loki') checkedInstances = [...searxngLokiCustomRedirects];
else if (searchProtocol == 'tor') checkedInstances = [...searxngTorRedirectsChecks, ...searxngTorCustomRedirects]; else if (protocol == 'i2p') checkedInstances = [...searxngI2pCustomRedirects, ...searxngI2pRedirectsChecks];
else if (searchProtocol == 'i2p') checkedInstances = [...searxngI2pRedirectsChecks, ...searxngI2pCustomRedirects]; else if (protocol == 'tor') checkedInstances = [...searxngTorRedirectsChecks, ...searxngTorCustomRedirects];
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
checkedInstances = [...searxngNormalRedirectsChecks, ...searxngNormalCustomRedirects];
}
await utils.copyCookie('searxng', from, checkedInstances, 'autocomplete'); await utils.copyCookie('searxng', from, checkedInstances, 'autocomplete');
await utils.copyCookie('searxng', from, checkedInstances, 'categories'); await utils.copyCookie('searxng', from, checkedInstances, 'categories');
await utils.copyCookie('searxng', from, checkedInstances, 'disabled_engines'); await utils.copyCookie('searxng', from, checkedInstances, 'disabled_engines');
@ -245,10 +319,14 @@ function initSearxngCookies(test, from) {
function pasteSearxngCookies() { function pasteSearxngCookies() {
return new Promise(async resolve => { return new Promise(async resolve => {
await init(); await init();
if (disableSearch || searchFrontend != 'searxng', searchProtocol === undefined) { resolve(); return; } if (disableSearch || searchFrontend != 'searxng', protocol === undefined) { resolve(); return; }
let checkedInstances; let checkedInstances = [];
if (searchProtocol == 'normal') checkedInstances = [...searxngNormalRedirectsChecks, ...searxngNormalCustomRedirects] if (protocol == 'loki') checkedInstances = [...searxngLokiCustomRedirects];
else if (searchProtocol == 'tor') checkedInstances = [...searxngTorRedirectsChecks, ...searxngTorCustomRedirects] else if (protocol == 'i2p') checkedInstances = [...searxngI2pCustomRedirects, ...searxngI2pRedirectsChecks];
else if (protocol == 'tor') checkedInstances = [...searxngTorRedirectsChecks, ...searxngTorCustomRedirects];
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
checkedInstances = [...searxngNormalRedirectsChecks, ...searxngNormalCustomRedirects];
}
utils.getCookiesFromStorage('searxng', checkedInstances, 'autocomplete'); utils.getCookiesFromStorage('searxng', checkedInstances, 'autocomplete');
utils.getCookiesFromStorage('searxng', checkedInstances, 'categories'); utils.getCookiesFromStorage('searxng', checkedInstances, 'categories');
utils.getCookiesFromStorage('searxng', checkedInstances, 'disabled_engines'); utils.getCookiesFromStorage('searxng', checkedInstances, 'disabled_engines');
@ -272,6 +350,63 @@ function pasteSearxngCookies() {
}) })
} }
function initLibrexCookies(test, from) {
return new Promise(async resolve => {
await init();
let protocolHost = utils.protocolHost(from);
if (![
...librexNormalRedirectsChecks,
...librexNormalCustomRedirects,
...librexTorRedirectsChecks,
...librexTorCustomRedirects,
...librexI2pRedirectsChecks,
...librexI2pCustomRedirects,
...librexLokiCustomRedirects
].includes(protocolHost)) { resolve(); return; }
if(!test) {
let checkedInstances = [];
if (protocol == 'loki') checkedInstances = [...librexLokiCustomRedirects];
else if (protocol == 'i2p') checkedInstances = [...librexI2pCustomRedirects, ...librexI2pRedirectsChecks];
else if (protocol == 'tor') checkedInstances = [...librexTorRedirectsChecks, ...librexTorCustomRedirects];
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
checkedInstances = [...librexNormalRedirectsChecks, ...librexNormalCustomRedirects];
}
await utils.copyCookie('librex', from, checkedInstances, 'bibliogram');
await utils.copyCookie('librex', from, checkedInstances, 'disable_special');
await utils.copyCookie('librex', from, checkedInstances, 'invidious');
await utils.copyCookie('librex', from, checkedInstances, 'libreddit');
await utils.copyCookie('librex', from, checkedInstances, 'nitter');
await utils.copyCookie('librex', from, checkedInstances, 'proxitok');
await utils.copyCookie('librex', from, checkedInstances, 'theme');
await utils.copyCookie('librex', from, checkedInstances, 'wikiless');
}
resolve(true);
})
}
function pasteLibrexCookies() {
return new Promise(async resolve => {
await init();
if (disableSearch || searchFrontend != 'librex', protocol === undefined) { resolve(); return; }
let checkedInstances = [];
if (protocol == 'loki') checkedInstances = [...librexLokiCustomRedirects];
else if (protocol == 'i2p') checkedInstances = [...librexI2pCustomRedirects, ...librexI2pRedirectsChecks];
else if (protocol == 'tor') checkedInstances = [...librexTorRedirectsChecks, ...librexTorCustomRedirects];
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
checkedInstances = [...librexNormalRedirectsChecks, ...librexNormalCustomRedirects];
}
utils.getCookiesFromStorage('librex', checkedInstances, 'bibliogram');
utils.getCookiesFromStorage('librex', checkedInstances, 'disable_special');
utils.getCookiesFromStorage('librex', checkedInstances, 'invidious');
utils.getCookiesFromStorage('librex', checkedInstances, 'libreddit');
utils.getCookiesFromStorage('librex', checkedInstances, 'nitter');
utils.getCookiesFromStorage('librex', checkedInstances, 'proxitok');
utils.getCookiesFromStorage('librex', checkedInstances, 'theme');
utils.getCookiesFromStorage('librex', checkedInstances, 'wikiless');
resolve();
})
}
function redirect(url, disableOverride) { function redirect(url, disableOverride) {
if (disableSearch && !disableOverride) return; if (disableSearch && !disableOverride) return;
@ -281,32 +416,57 @@ function redirect(url, disableOverride) {
let randomInstance; let randomInstance;
let path; let path;
if (searchFrontend == 'searx') { if (searchFrontend == 'searx') {
let instancesList; let instancesList = [];
if (searchProtocol == 'normal') instancesList = [...searxNormalRedirectsChecks, ...searxNormalCustomRedirects]; if (protocol == 'loki') instancesList = [...searxLokiCustomRedirects];
else if (searchProtocol == 'tor') instancesList = [...searxTorRedirectsChecks, ...searxTorCustomRedirects]; else if (protocol == 'i2p') instancesList = [...searxI2pCustomRedirects, ...searxI2pRedirectsChecks];
else if (searchProtocol == 'i2p') instancesList = [...searxI2pRedirectsChecks, ...searxI2pCustomRedirects]; else if (protocol == 'tor') instancesList = [...searxTorRedirectsChecks, ...searxTorCustomRedirects];
if (instancesList.length === 0) return; if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...searxNormalRedirectsChecks, ...searxNormalCustomRedirects];
}
if (instancesList.length === 0) { return; }
randomInstance = utils.getRandomInstance(instancesList) randomInstance = utils.getRandomInstance(instancesList)
path = "/"; path = "/";
} }
else if (searchFrontend == 'searxng') { else if (searchFrontend == 'searxng') {
let instancesList; let instancesList = [];
if (searchProtocol == 'normal') instancesList = [...searxngNormalRedirectsChecks, ...searxngNormalCustomRedirects]; if (protocol == 'loki') instancesList = [...searxngLokiCustomRedirects];
else if (searchProtocol == 'tor') instancesList = [...searxngTorRedirectsChecks, ...searxngTorCustomRedirects]; else if (protocol == 'i2p') instancesList = [...searxngI2pCustomRedirects, ...searxngI2pRedirectsChecks];
else if (searchProtocol == 'i2p') instancesList = [...searxngI2pRedirectsChecks, ...searxngI2pCustomRedirects]; else if (protocol == 'tor') instancesList = [...searxngTorRedirectsChecks, ...searxngTorCustomRedirects];
if (instancesList.length === 0) return; if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...searxngNormalRedirectsChecks, ...searxngNormalCustomRedirects];
}
if (instancesList.length === 0) { return; }
randomInstance = utils.getRandomInstance(instancesList) randomInstance = utils.getRandomInstance(instancesList)
path = "/"; path = "/";
} }
else if (searchFrontend == 'whoogle') { else if (searchFrontend == 'whoogle') {
let instancesList; let instancesList = [];
if (searchProtocol == 'normal') instancesList = [...whoogleNormalRedirectsChecks, ...whoogleNormalCustomRedirects]; if (protocol == 'loki') instancesList = [...whoogleLokiCustomRedirects];
if (searchProtocol == 'tor') instancesList = [...whoogleTorRedirectsChecks, ...whoogleTorCustomRedirects]; else if (protocol == 'i2p') instancesList = [...whoogleI2pCustomRedirects, ...whoogleI2pRedirectsChecks];
if (searchProtocol == 'i2p') instancesList = [...whoogleI2pRedirectsChecks, ...whoogleI2pCustomRedirects]; else if (protocol == 'tor') instancesList = [...whoogleTorRedirectsChecks, ...whoogleTorCustomRedirects];
if (instancesList.length === 0) return; if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...whoogleNormalRedirectsChecks, ...whoogleNormalCustomRedirects];
}
if (instancesList.length === 0) { return; }
randomInstance = utils.getRandomInstance(instancesList) randomInstance = utils.getRandomInstance(instancesList)
path = "/search"; path = "/search";
} }
else if (searchFrontend == 'librex') {
let instancesList = [];
if (protocol == 'loki') instancesList = [...librexLokiCustomRedirects];
else if (protocol == 'i2p') instancesList = [...librexI2pCustomRedirects, ...librexI2pRedirectsChecks];
else if (protocol == 'tor') instancesList = [...librexTorRedirectsChecks, ...librexTorCustomRedirects];
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...librexNormalRedirectsChecks, ...librexNormalCustomRedirects];
}
if (instancesList.length === 0) { return; }
randomInstance = utils.getRandomInstance(instancesList)
path = "/search.php";
}
if ( if (
((url.hostname.includes('google') || url.hostname.includes('bing')) && !url.searchParams.has('q')) || ((url.hostname.includes('google') || url.hostname.includes('bing')) && !url.searchParams.has('q')) ||
@ -345,36 +505,57 @@ function switchInstance(url, disableOverride) {
...searchRedirects.whoogle.tor, ...searchRedirects.whoogle.tor,
...searchRedirects.whoogle.i2p, ...searchRedirects.whoogle.i2p,
...searchRedirects.librex.normal,
...searchRedirects.librex.tor,
...searchRedirects.librex.i2p,
...searxNormalCustomRedirects, ...searxNormalCustomRedirects,
...searxTorCustomRedirects, ...searxTorCustomRedirects,
...searxI2pCustomRedirects, ...searxI2pCustomRedirects,
...searxLokiCustomRedirects,
...searxngNormalCustomRedirects, ...searxngNormalCustomRedirects,
...searxngTorCustomRedirects, ...searxngTorCustomRedirects,
...searxngI2pCustomRedirects, ...searxngI2pCustomRedirects,
...searxngLokiCustomRedirects,
...whoogleNormalCustomRedirects, ...whoogleNormalCustomRedirects,
...whoogleTorCustomRedirects, ...whoogleTorCustomRedirects,
...whoogleI2pCustomRedirects, ...whoogleI2pCustomRedirects,
...whoogleLokiCustomRedirects,
...librexNormalCustomRedirects,
...librexTorCustomRedirects,
...librexI2pCustomRedirects,
...librexLokiCustomRedirects
].includes(protocolHost)) { resolve(); return; } ].includes(protocolHost)) { resolve(); return; }
let instancesList; let instancesList;
if (searchProtocol == 'normal') {
if (searchFrontend == 'searx') instancesList = [...searxNormalRedirectsChecks, ...searxNormalCustomRedirects]; if (protocol == 'loki') {
else if (searchFrontend == 'searxng') instancesList = [...searxngNormalRedirectsChecks, ...searxngNormalCustomRedirects]; if (searchFrontend == 'searx') instancesList = [...searxLokiCustomRedirects];
else if (searchFrontend == 'whoogle') instancesList = [...whoogleNormalRedirectsChecks, ...whoogleNormalCustomRedirects]; else if (searchFrontend == 'searxng') instancesList = [...searxngLokiCustomRedirects];
else if (searchFrontend == 'whoogle') instancesList = [...whoogleLokiCustomRedirects];
else if (searchFrontend == 'librex') instancesList = [...librexLokiCustomRedirects];
} }
else if (searchProtocol == 'tor') { else if (protocol == 'tor') {
if (searchFrontend == 'searx') instancesList = [...searxTorRedirectsChecks, ...searxTorCustomRedirects]; if (searchFrontend == 'searx') instancesList = [...searxTorRedirectsChecks, ...searxTorCustomRedirects];
else if (searchFrontend == 'searxng') instancesList = [...searxngTorRedirectsChecks, ...searxngTorCustomRedirects]; else if (searchFrontend == 'searxng') instancesList = [...searxngTorRedirectsChecks, ...searxngTorCustomRedirects];
else if (searchFrontend == 'whoogle') instancesList = [...whoogleTorRedirectsChecks, ...whoogleTorCustomRedirects]; else if (searchFrontend == 'whoogle') instancesList = [...whoogleTorRedirectsChecks, ...whoogleTorCustomRedirects];
else if (searchFrontend == 'librex') instancesList = [...librexTorRedirectsChecks, ...librexTorCustomRedirects];
} }
else if (searchProtocol == 'i2p') { else if (protocol == 'i2p') {
if (searchFrontend == 'searx') instancesList = [...searxI2pRedirectsChecks, ...searxI2pCustomRedirects]; if (searchFrontend == 'searx') instancesList = [...searxI2pRedirectsChecks, ...searxI2pCustomRedirects];
else if (searchFrontend == 'searxng') instancesList = [...searxngI2pRedirectsChecks, ...searxngI2pCustomRedirects]; else if (searchFrontend == 'searxng') instancesList = [...searxngI2pRedirectsChecks, ...searxngI2pCustomRedirects];
else if (searchFrontend == 'whoogle') instancesList = [...whoogleI2pRedirectsChecks, ...whoogleI2pCustomRedirects]; else if (searchFrontend == 'whoogle') instancesList = [...whoogleI2pRedirectsChecks, ...whoogleI2pCustomRedirects];
else if (searchFrontend == 'librex') instancesList = [...librexI2pRedirectsChecks, ...librexI2pCustomRedirects];
}
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
if (searchFrontend == 'searx') instancesList = [...searxNormalRedirectsChecks, ...searxNormalCustomRedirects];
else if (searchFrontend == 'searxng') instancesList = [...searxngNormalRedirectsChecks, ...searxngNormalCustomRedirects];
else if (searchFrontend == 'whoogle') instancesList = [...whoogleNormalRedirectsChecks, ...whoogleNormalCustomRedirects];
else if (searchFrontend == 'librex') instancesList = [...librexNormalRedirectsChecks, ...librexNormalCustomRedirects];
} }
const i = instancesList.indexOf(protocolHost); const i = instancesList.indexOf(protocolHost);
if (i > -1) instancesList.splice(i, 1); if (i > -1) instancesList.splice(i, 1);
if (instancesList.length === 0) { resolve(); return; } if (instancesList.length === 0) { resolve(); return; }
@ -388,14 +569,20 @@ function initDefaults() {
return new Promise(async resolve => { return new Promise(async resolve => {
fetch('/instances/data.json').then(response => response.text()).then(async data => { fetch('/instances/data.json').then(response => response.text()).then(async data => {
let dataJson = JSON.parse(data); let dataJson = JSON.parse(data);
/*
redirects.searx = dataJson.searx; redirects.searx = dataJson.searx;
redirects.searxng = dataJson.searxng; redirects.searxng = dataJson.searxng;
redirects.whoogle = dataJson.whoogle; redirects.whoogle = dataJson.whoogle;
*/
for (let i = 0; i < frontends.length; i++) {
redirects[frontends[i]] = dataJson[frontends[i]]
}
browser.storage.local.get('cloudflareBlackList', async r => { browser.storage.local.get('cloudflareBlackList', async r => {
whoogleNormalRedirectsChecks = [...redirects.whoogle.normal]; whoogleNormalRedirectsChecks = [...redirects.whoogle.normal];
searxNormalRedirectsChecks = [...redirects.searx.normal]; searxNormalRedirectsChecks = [...redirects.searx.normal];
searxngNormalRedirectsChecks = [...redirects.searxng.normal]; searxngNormalRedirectsChecks = [...redirects.searxng.normal];
librexNormalRedirectsChecks = [...redirects.librex.normal];
for (const instance of r.cloudflareBlackList) { for (const instance of r.cloudflareBlackList) {
let i; let i;
@ -407,13 +594,15 @@ function initDefaults() {
i = searxngNormalRedirectsChecks.indexOf(instance); i = searxngNormalRedirectsChecks.indexOf(instance);
if (i > -1) searxngNormalRedirectsChecks.splice(i, 1); if (i > -1) searxngNormalRedirectsChecks.splice(i, 1);
i = librexNormalRedirectsChecks.indexOf(instance);
if (i > -1) librexNormalRedirectsChecks.splice(i, 1)
} }
browser.storage.local.set({ browser.storage.local.set({
disableSearch: false, disableSearch: false,
searchFrontend: 'searxng', searchFrontend: 'searxng',
searchRedirects: redirects, searchRedirects: redirects,
searxngCustomSettings: false, searxngCustomSettings: false,
searchProtocol: 'normal',
whoogleNormalRedirectsChecks: whoogleNormalRedirectsChecks, whoogleNormalRedirectsChecks: whoogleNormalRedirectsChecks,
whoogleNormalCustomRedirects: [], whoogleNormalCustomRedirects: [],
@ -424,6 +613,9 @@ function initDefaults() {
whoogleI2pRedirectsChecks: [...redirects.whoogle.i2p], whoogleI2pRedirectsChecks: [...redirects.whoogle.i2p],
whoogleI2pCustomRedirects: [], whoogleI2pCustomRedirects: [],
whoogleLokiRedirectsChecks: [...redirects.whoogle.loki],
whoogleLokiCustomRedirects: [],
searxNormalRedirectsChecks: searxNormalRedirectsChecks, searxNormalRedirectsChecks: searxNormalRedirectsChecks,
searxNormalCustomRedirects: [], searxNormalCustomRedirects: [],
@ -433,6 +625,9 @@ function initDefaults() {
searxI2pRedirectsChecks: [...redirects.searx.i2p], searxI2pRedirectsChecks: [...redirects.searx.i2p],
searxI2pCustomRedirects: [], searxI2pCustomRedirects: [],
searxLokiRedirectsChecks: [...redirects.searx.loki],
searxLokiCustomRedirects: [],
searxngNormalRedirectsChecks: searxngNormalRedirectsChecks, searxngNormalRedirectsChecks: searxngNormalRedirectsChecks,
searxngNormalCustomRedirects: [], searxngNormalCustomRedirects: [],
@ -441,6 +636,21 @@ function initDefaults() {
searxngI2pRedirectsChecks: [...redirects.searxng.i2p], searxngI2pRedirectsChecks: [...redirects.searxng.i2p],
searxngI2pCustomRedirects: [], searxngI2pCustomRedirects: [],
searxngLokiRedirectsChecks: [...redirects.searxng.loki],
searxngLokiCustomRedirects: [],
librexNormalRedirectsChecks: librexNormalRedirectsChecks,
librexNormalCustomRedirects: [],
librexTorRedirectsChecks: [...redirects.librex.tor],
librexTorCustomRedirects: [],
librexI2pRedirectsChecks: [...redirects.librex.i2p],
librexI2pCustomRedirects: [],
librexLokiRedirectsChecks: [...redirects.librex.loki],
librexLokiCustomRedirects: []
}, () => resolve()) }, () => resolve())
}) })
}) })
@ -453,6 +663,8 @@ export default {
pasteSearxCookies, pasteSearxCookies,
initSearxngCookies, initSearxngCookies,
pasteSearxngCookies, pasteSearxngCookies,
initLibrexCookies,
pasteLibrexCookies,
redirect, redirect,
initDefaults, initDefaults,
switchInstance, switchInstance,

View File

@ -8,12 +8,18 @@ const targets = [
/^https?:\/{2}sendfiles\.online\/$/ /^https?:\/{2}sendfiles\.online\/$/
]; ];
let redirects = { const frontends = new Array("send")
"send": { const protocols = new Array("normal", "tor", "i2p", "loki")
"normal": [],
"tor": [] let redirects = {}
for (let i = 0; i < frontends.length; i++) {
redirects[frontends[i]] = {}
for (let x = 0; x < protocols.length; x++) {
redirects[frontends[i]][protocols[x]] = []
} }
} }
function setRedirects(val) { function setRedirects(val) {
browser.storage.local.get('cloudflareBlackList', r => { browser.storage.local.get('cloudflareBlackList', r => {
redirects.send = val; redirects.send = val;
@ -36,7 +42,10 @@ let
sendNormalCustomRedirects, sendNormalCustomRedirects,
sendTorRedirectsChecks, sendTorRedirectsChecks,
sendTorCustomRedirects, sendTorCustomRedirects,
sendTargetsProtocol; sendI2pCustomRedirects,
sendLokiCustomRedirects,
protocol,
protocolFallback;
function init() { function init() {
return new Promise(resolve => { return new Promise(resolve => {
@ -44,11 +53,14 @@ function init() {
[ [
"disableSendTarget", "disableSendTarget",
"sendTargetsRedirects", "sendTargetsRedirects",
"sendTargetsProtocol", "protocol",
"protocolFallback",
"sendNormalRedirectsChecks", "sendNormalRedirectsChecks",
"sendNormalCustomRedirects", "sendNormalCustomRedirects",
"sendTorRedirectsChecks", "sendTorRedirectsChecks",
"sendTorCustomRedirects", "sendTorCustomRedirects",
"sendI2pCustomRedirects",
"sendLokiCustomRedirects"
], ],
r => { r => {
disableSendTarget = r.disableSendTarget; disableSendTarget = r.disableSendTarget;
@ -57,7 +69,10 @@ function init() {
sendNormalCustomRedirects = r.sendNormalCustomRedirects; sendNormalCustomRedirects = r.sendNormalCustomRedirects;
sendTorRedirectsChecks = r.sendTorRedirectsChecks; sendTorRedirectsChecks = r.sendTorRedirectsChecks;
sendTorCustomRedirects = r.sendTorCustomRedirects; sendTorCustomRedirects = r.sendTorCustomRedirects;
sendTargetsProtocol = r.sendTargetsProtocol; sendI2pCustomRedirects = r.sendI2pCustomRedirects;
sendLokiCustomRedirects = r.sendLokiCustomRedirects;
protocol = r.protocol;
protocolFallback = r.protocolFallback;
resolve(); resolve();
} }
) )
@ -74,6 +89,8 @@ function all() {
...sendNormalCustomRedirects, ...sendNormalCustomRedirects,
...sendTorRedirectsChecks, ...sendTorRedirectsChecks,
...sendTorCustomRedirects, ...sendTorCustomRedirects,
...sendI2pCustomRedirects,
...sendLokiCustomRedirects
]; ];
} }
@ -85,9 +102,13 @@ function switchInstance(url, disableOverride) {
if (!all().includes(protocolHost)) { resolve(); return; } if (!all().includes(protocolHost)) { resolve(); return; }
if (url.pathname != '/') { resolve(); return; } if (url.pathname != '/') { resolve(); return; }
let instancesList; let instancesList = [];
if (sendTargetsProtocol == 'normal') instancesList = [...sendNormalRedirectsChecks, ...sendNormalCustomRedirects]; if (protocol == 'loki') instancesList = [...sendLokiCustomRedirects];
else if (sendTargetsProtocol == 'tor') instancesList = [...sendTorRedirectsChecks, ...sendTorCustomRedirects]; else if (protocol == 'i2p') instancesList = [...sendI2pCustomRedirects];
else if (protocol == 'tor') instancesList = [...sendTorRedirectsChecks, ...sendTorCustomRedirects];
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...sendNormalRedirectsChecks, ...sendNormalCustomRedirects];
}
const i = instancesList.indexOf(protocolHost); const i = instancesList.indexOf(protocolHost);
if (i > -1) instancesList.splice(i, 1); if (i > -1) instancesList.splice(i, 1);
@ -104,9 +125,13 @@ function redirect(url, type, initiator, disableOverride) {
if (initiator && (all().includes(initiator.origin) || targets.includes(initiator.host))) return; if (initiator && (all().includes(initiator.origin) || targets.includes(initiator.host))) return;
if (!targets.some(rx => rx.test(url.href))) return; if (!targets.some(rx => rx.test(url.href))) return;
let instancesList; let instancesList = [];
if (sendTargetsProtocol == 'normal') instancesList = [...sendNormalRedirectsChecks, ...sendNormalCustomRedirects]; if (protocol == 'loki') instancesList = [...sendLokiCustomRedirects];
if (sendTargetsProtocol == 'tor') instancesList = [...sendTorRedirectsChecks, ...sendTorCustomRedirects]; else if (protocol == 'i2p') instancesList = [...sendI2pCustomRedirects];
else if (protocol == 'tor') instancesList = [...sendTorRedirectsChecks, ...sendTorCustomRedirects];
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...sendNormalRedirectsChecks, ...sendNormalCustomRedirects];
}
if (instancesList.length === 0) return; if (instancesList.length === 0) return;
const randomInstance = utils.getRandomInstance(instancesList); const randomInstance = utils.getRandomInstance(instancesList);
@ -117,7 +142,9 @@ function initDefaults() {
return new Promise(resolve => { return new Promise(resolve => {
fetch('/instances/data.json').then(response => response.text()).then(async data => { fetch('/instances/data.json').then(response => response.text()).then(async data => {
let dataJson = JSON.parse(data); let dataJson = JSON.parse(data);
redirects.send = dataJson.send; for (let i = 0; i < frontends.length; i++) {
redirects[frontends[i]] = dataJson[frontends[i]]
}
browser.storage.local.get('cloudflareBlackList', async r => { browser.storage.local.get('cloudflareBlackList', async r => {
sendNormalRedirectsChecks = [...redirects.send.normal]; sendNormalRedirectsChecks = [...redirects.send.normal];
for (const instance of r.cloudflareBlackList) { for (const instance of r.cloudflareBlackList) {
@ -134,7 +161,11 @@ function initDefaults() {
sendTorRedirectsChecks: [...redirects.send.tor], sendTorRedirectsChecks: [...redirects.send.tor],
sendTorCustomRedirects: [], sendTorCustomRedirects: [],
sendTargetsProtocol: "normal", sendI2pRedirectsChecks: [...redirects.send.i2p],
sendI2pCustomRedirects: [],
sendLokiRedirectsChecks: [...redirects.send.loki],
sendLokiCustomRedirects: []
}, () => resolve()) }, () => resolve())
}) })
}) })

View File

@ -6,12 +6,18 @@ const targets = [
/^https?:\/{2}(www\.|)tiktok\.com.*/ /^https?:\/{2}(www\.|)tiktok\.com.*/
]; ];
let redirects = { const frontends = new Array("proxiTok")
"proxiTok": { const protocols = new Array("normal", "tor", "i2p", "loki")
"normal": [],
"tor": [] let redirects = {}
for (let i = 0; i < frontends.length; i++) {
redirects[frontends[i]] = {}
for (let x = 0; x < protocols.length; x++) {
redirects[frontends[i]][protocols[x]] = []
} }
} }
function setRedirects(val) { function setRedirects(val) {
browser.storage.local.get('cloudflareBlackList', r => { browser.storage.local.get('cloudflareBlackList', r => {
redirects.proxiTok = val; redirects.proxiTok = val;
@ -36,12 +42,18 @@ function initProxiTokCookies(test, from) {
...proxiTokNormalCustomRedirects, ...proxiTokNormalCustomRedirects,
...proxiTokTorRedirectsChecks, ...proxiTokTorRedirectsChecks,
...proxiTokTorCustomRedirects, ...proxiTokTorCustomRedirects,
...proxiTokI2pCustomRedirects,
...proxiTokLokiCustomRedirects,
].includes(protocolHost)) resolve(); ].includes(protocolHost)) resolve();
if (!test) { if (!test) {
let checkedInstances; let checkedInstances = [];
if (tiktokProtocol == 'normal') checkedInstances = [...proxiTokNormalRedirectsChecks, ...proxiTokNormalCustomRedirects] if (protocol == 'loki') checkedInstances = [...proxiTokI2pCustomRedirects];
else if (tiktokProtocol == 'tor') checkedInstances = [...proxiTokTorRedirectsChecks, ...proxiTokTorCustomRedirects] else if (protocol == 'i2p') checkedInstances = [...proxiTokLokiCustomRedirects];
else if (protocol == 'tor') checkedInstances = [...proxiTokTorRedirectsChecks, ...proxiTokTorCustomRedirects];
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
checkedInstances = [...proxiTokNormalRedirectsChecks, ...proxiTokNormalCustomRedirects];
}
await utils.copyCookie('proxitok', from, checkedInstances, 'theme'); await utils.copyCookie('proxitok', from, checkedInstances, 'theme');
await utils.copyCookie('proxitok', from, checkedInstances, 'api-legacy'); await utils.copyCookie('proxitok', from, checkedInstances, 'api-legacy');
} }
@ -52,10 +64,14 @@ function initProxiTokCookies(test, from) {
function pasteProxiTokCookies() { function pasteProxiTokCookies() {
return new Promise(async resolve => { return new Promise(async resolve => {
await init(); await init();
if (disableTiktok || tiktokProtocol === undefined) { resolve(); return; } if (disableTiktok || protocol === undefined) { resolve(); return; }
let checkedInstances; let checkedInstances = [];
if (tiktokProtocol == 'normal') checkedInstances = [...proxiTokNormalRedirectsChecks, ...proxiTokNormalCustomRedirects] if (protocol == 'loki') checkedInstances = [...proxiTokI2pCustomRedirects];
else if (tiktokProtocol == 'tor') checkedInstances = [...proxiTokTorRedirectsChecks, ...proxiTokTorCustomRedirects] else if (protocol == 'i2p') checkedInstances = [...proxiTokLokiCustomRedirects];
else if (protocol == 'tor') checkedInstances = [...proxiTokTorRedirectsChecks, ...proxiTokTorCustomRedirects];
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
checkedInstances = [...proxiTokNormalRedirectsChecks, ...proxiTokNormalCustomRedirects];
}
utils.getCookiesFromStorage('proxitok', checkedInstances, 'theme'); utils.getCookiesFromStorage('proxitok', checkedInstances, 'theme');
utils.getCookiesFromStorage('proxitok', checkedInstances, 'api-legacy'); utils.getCookiesFromStorage('proxitok', checkedInstances, 'api-legacy');
resolve(); resolve();
@ -64,33 +80,42 @@ function pasteProxiTokCookies() {
let let
disableTiktok, disableTiktok,
tiktokProtocol, protocol,
protocolFallback,
tiktokRedirects, tiktokRedirects,
proxiTokNormalRedirectsChecks, proxiTokNormalRedirectsChecks,
proxiTokNormalCustomRedirects, proxiTokNormalCustomRedirects,
proxiTokTorRedirectsChecks, proxiTokTorRedirectsChecks,
proxiTokTorCustomRedirects; proxiTokTorCustomRedirects,
proxiTokI2pCustomRedirects,
proxiTokLokiCustomRedirects;
function init() { function init() {
return new Promise(async resolve => { return new Promise(async resolve => {
browser.storage.local.get( browser.storage.local.get(
[ [
"disableTiktok", "disableTiktok",
"tiktokProtocol", "protocol",
"protocolFallback",
"tiktokRedirects", "tiktokRedirects",
"proxiTokNormalRedirectsChecks", "proxiTokNormalRedirectsChecks",
"proxiTokNormalCustomRedirects", "proxiTokNormalCustomRedirects",
"proxiTokTorRedirectsChecks", "proxiTokTorRedirectsChecks",
"proxiTokTorCustomRedirects", "proxiTokTorCustomRedirects",
"proxiTokI2pCustomRedirects",
"proxiTokLokiCustomRedirects"
], ],
r => { r => {
disableTiktok = r.disableTiktok; disableTiktok = r.disableTiktok;
tiktokProtocol = r.tiktokProtocol; protocol = r.protocol;
protocolFallback = r.protocolFallback;
tiktokRedirects = r.tiktokRedirects; tiktokRedirects = r.tiktokRedirects;
proxiTokNormalRedirectsChecks = r.proxiTokNormalRedirectsChecks; proxiTokNormalRedirectsChecks = r.proxiTokNormalRedirectsChecks;
proxiTokNormalCustomRedirects = r.proxiTokNormalCustomRedirects; proxiTokNormalCustomRedirects = r.proxiTokNormalCustomRedirects;
proxiTokTorRedirectsChecks = r.proxiTokTorRedirectsChecks; proxiTokTorRedirectsChecks = r.proxiTokTorRedirectsChecks;
proxiTokTorCustomRedirects = r.proxiTokTorCustomRedirects; proxiTokTorCustomRedirects = r.proxiTokTorCustomRedirects;
proxiTokI2pCustomRedirects = r.proxiTokI2pCustomRedirects;
proxiTokLokiCustomRedirects = r.proxiTokLokiCustomRedirects;
resolve(); resolve();
} }
) )
@ -112,9 +137,13 @@ function redirect(url, type, initiator, disableOverride) {
if (initiator && (all.includes(initiator.origin) || targets.includes(initiator.host))) return; if (initiator && (all.includes(initiator.origin) || targets.includes(initiator.host))) return;
if (!targets.some(rx => rx.test(url.href))) return; if (!targets.some(rx => rx.test(url.href))) return;
let instancesList; let instancesList = [];
if (tiktokProtocol == 'normal') instancesList = [...proxiTokNormalRedirectsChecks, ...proxiTokNormalCustomRedirects]; if (protocol == 'loki') instancesList = [...proxiTokI2pCustomRedirects];
if (tiktokProtocol == 'tor') instancesList = [...proxiTokTorRedirectsChecks, ...proxiTokTorCustomRedirects]; else if (protocol == 'i2p') instancesList = [...proxiTokLokiCustomRedirects];
else if (protocol == 'tor') instancesList = [...proxiTokTorRedirectsChecks, ...proxiTokTorCustomRedirects];
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...proxiTokNormalRedirectsChecks, ...proxiTokNormalCustomRedirects];
}
if (instancesList.length === 0) return; if (instancesList.length === 0) return;
const randomInstance = utils.getRandomInstance(instancesList); const randomInstance = utils.getRandomInstance(instancesList);
@ -129,7 +158,9 @@ function reverse(url) {
...tiktokRedirects.proxiTok.normal, ...tiktokRedirects.proxiTok.normal,
...tiktokRedirects.proxiTok.tor, ...tiktokRedirects.proxiTok.tor,
...proxiTokNormalCustomRedirects, ...proxiTokNormalCustomRedirects,
...proxiTokTorCustomRedirects ...proxiTokTorCustomRedirects,
...proxiTokI2pCustomRedirects,
...proxiTokLokiCustomRedirects
]; ];
if (!all.includes(protocolHost)) { resolve(); return; } if (!all.includes(protocolHost)) { resolve(); return; }
@ -148,12 +179,18 @@ function switchInstance(url, disableOverride) {
...proxiTokNormalCustomRedirects, ...proxiTokNormalCustomRedirects,
...proxiTokTorCustomRedirects, ...proxiTokTorCustomRedirects,
...proxiTokI2pCustomRedirects,
...proxiTokLokiCustomRedirects
]; ];
if (!all.includes(protocolHost)) { resolve(); return; } if (!all.includes(protocolHost)) { resolve(); return; }
let instancesList; let instancesList = [];
if (tiktokProtocol == 'normal') instancesList = [...proxiTokNormalCustomRedirects, ...proxiTokNormalRedirectsChecks]; if (protocol == 'loki') instancesList = [...proxiTokI2pCustomRedirects];
else if (tiktokProtocol == 'tor') instancesList = [...proxiTokTorCustomRedirects, ...proxiTokTorRedirectsChecks]; else if (protocol == 'i2p') instancesList = [...proxiTokLokiCustomRedirects];
else if (protocol == 'tor') instancesList = [...proxiTokTorRedirectsChecks, ...proxiTokTorCustomRedirects];
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...proxiTokNormalRedirectsChecks, ...proxiTokNormalCustomRedirects];
}
const i = instancesList.indexOf(protocolHost); const i = instancesList.indexOf(protocolHost);
if (i > -1) instancesList.splice(i, 1); if (i > -1) instancesList.splice(i, 1);
@ -168,10 +205,11 @@ function initDefaults() {
return new Promise(async resolve => { return new Promise(async resolve => {
fetch('/instances/data.json').then(response => response.text()).then(async data => { fetch('/instances/data.json').then(response => response.text()).then(async data => {
let dataJson = JSON.parse(data); let dataJson = JSON.parse(data);
redirects.proxiTok = dataJson.proxiTok; for (let i = 0; i < frontends.length; i++) {
redirects[frontends[i]] = dataJson[frontends[i]]
}
browser.storage.local.set({ browser.storage.local.set({
disableTiktok: false, disableTiktok: false,
tiktokProtocol: "normal",
tiktokRedirects: redirects, tiktokRedirects: redirects,
@ -180,6 +218,12 @@ function initDefaults() {
proxiTokTorRedirectsChecks: [...redirects.proxiTok.tor], proxiTokTorRedirectsChecks: [...redirects.proxiTok.tor],
proxiTokTorCustomRedirects: [], proxiTokTorCustomRedirects: [],
proxiTokI2pRedirectsChecks: [...redirects.proxiTok.i2p],
proxiTokI2pCustomRedirects: [],
proxiTokLokiRedirectsChecks: [...redirects.proxiTok.loki],
proxiTokLokiCustomRedirects: []
}, () => resolve()); }, () => resolve());
}); });
}) })

View File

@ -6,36 +6,38 @@ const targets = [
/^https?:\/{2}translate\.google(\.[a-z]{2,3}){1,2}\//, /^https?:\/{2}translate\.google(\.[a-z]{2,3}){1,2}\//,
]; ];
let redirects = { const frontends = new Array("simplyTranslate", "lingva")
"simplyTranslate": { const protocols = new Array("normal", "tor", "i2p", "loki")
"normal": [],
"tor": [], let redirects = {};
"i2p": [],
"loki": [] for (let i = 0; i < frontends.length; i++) {
}, redirects[frontends[i]] = {}
"lingva": { for (let x = 0; x < protocols.length; x++) {
"normal": [], redirects[frontends[i]][protocols[x]] = []
"tor": [] }
} }
};
let let
translateDisable, translateDisable,
translateFrontend, translateFrontend,
translateProtocol, protocol,
protocolFallback,
translateRedirects, translateRedirects,
simplyTranslateNormalRedirectsChecks, simplyTranslateNormalRedirectsChecks,
simplyTranslateNormalCustomRedirects, simplyTranslateNormalCustomRedirects,
simplyTranslateTorRedirectsChecks, simplyTranslateTorRedirectsChecks,
simplyTranslateTorCustomRedirects, simplyTranslateTorCustomRedirects,
simplyTranslateI2PRedirectsChecks, simplyTranslateI2pRedirectsChecks,
simplyTranslateI2PCustomRedirects, simplyTranslateI2pCustomRedirects,
simplyTranslateLokiRedirectsChecks, simplyTranslateLokiRedirectsChecks,
simplyTranslateLokiCustomReidrects, simplyTranslateLokiCustomRedirects,
lingvaNormalRedirectsChecks, lingvaNormalRedirectsChecks,
lingvaNormalCustomRedirects, lingvaNormalCustomRedirects,
lingvaTorRedirectsChecks, lingvaTorRedirectsChecks,
lingvaTorCustomRedirects; lingvaTorCustomRedirects,
lingvaI2pCustomRedirects,
lingvaLokiCustomRedirects
function init() { function init() {
return new Promise(resolve => { return new Promise(resolve => {
@ -43,40 +45,45 @@ function init() {
[ [
"translateDisable", "translateDisable",
"translateFrontend", "translateFrontend",
"translateProtocol", "protocol",
"protocolFallback",
"translateRedirects", "translateRedirects",
"simplyTranslateNormalRedirectsChecks", "simplyTranslateNormalRedirectsChecks",
"simplyTranslateNormalCustomRedirects", "simplyTranslateNormalCustomRedirects",
"simplyTranslateTorRedirectsChecks", "simplyTranslateTorRedirectsChecks",
"simplyTranslateTorCustomRedirects", "simplyTranslateTorCustomRedirects",
"simplyTranslateI2PRedirectsChecks", "simplyTranslateI2pRedirectsChecks",
"simplyTranslateI2PCustomRedirects", "simplyTranslateI2pCustomRedirects",
"simplyTranslateLokiRedirectsChecks", "simplyTranslateLokiRedirectsChecks",
"simplyTranslateLokiCustomReidrects", "simplyTranslateLokiCustomRedirects",
"lingvaNormalRedirectsChecks", "lingvaNormalRedirectsChecks",
"lingvaNormalCustomRedirects", "lingvaNormalCustomRedirects",
"lingvaTorRedirectsChecks", "lingvaTorRedirectsChecks",
"lingvaTorCustomRedirects", "lingvaTorCustomRedirects",
"lingvaI2pCustomRedirects",
"lingvaLokiCustomRedirects"
], ],
r => { r => {
translateDisable = r.translateDisable; translateDisable = r.translateDisable;
translateFrontend = r.translateFrontend; translateFrontend = r.translateFrontend;
translateProtocol = r.translateProtocol; protocol = r.protocol;
protocolFallback = r.protocolFallback
translateRedirects = r.translateRedirects; translateRedirects = r.translateRedirects;
simplyTranslateNormalRedirectsChecks = r.simplyTranslateNormalRedirectsChecks; simplyTranslateNormalRedirectsChecks = r.simplyTranslateNormalRedirectsChecks;
simplyTranslateNormalCustomRedirects = r.simplyTranslateNormalCustomRedirects; simplyTranslateNormalCustomRedirects = r.simplyTranslateNormalCustomRedirects;
simplyTranslateTorRedirectsChecks = r.simplyTranslateTorRedirectsChecks; simplyTranslateTorRedirectsChecks = r.simplyTranslateTorRedirectsChecks;
simplyTranslateTorCustomRedirects = r.simplyTranslateTorCustomRedirects; simplyTranslateTorCustomRedirects = r.simplyTranslateTorCustomRedirects;
simplyTranslateI2PRedirectsChecks = r.simplyTranslateI2PRedirectsChecks; simplyTranslateI2pRedirectsChecks = r.simplyTranslateI2pRedirectsChecks;
simplyTranslateI2PCustomRedirects = r.simplyTranslateI2PCustomRedirects; simplyTranslateI2pCustomRedirects = r.simplyTranslateI2pCustomRedirects;
simplyTranslateLokiRedirectsChecks = r.simplyTranslateLokiRedirectsChecks; simplyTranslateLokiRedirectsChecks = r.simplyTranslateLokiRedirectsChecks;
simplyTranslateLokiCustomReidrects = r.simplyTranslateLokiCustomReidrects; simplyTranslateLokiCustomRedirects = r.simplyTranslateLokiCustomRedirects;
lingvaNormalRedirectsChecks = r.lingvaNormalRedirectsChecks; lingvaNormalRedirectsChecks = r.lingvaNormalRedirectsChecks;
lingvaNormalCustomRedirects = r.lingvaNormalCustomRedirects; lingvaNormalCustomRedirects = r.lingvaNormalCustomRedirects;
lingvaTorRedirectsChecks = r.lingvaTorRedirectsChecks; lingvaTorRedirectsChecks = r.lingvaTorRedirectsChecks;
lingvaTorCustomRedirects = r.lingvaTorCustomRedirects; lingvaTorCustomRedirects = r.lingvaTorCustomRedirects;
lingvaI2pCustomRedirects = r.lingvaI2pCustomRedirects;
lingvaLokiCustomRedirects = r.lingvaLokiCustomRedirects;
resolve(); resolve();
} }
) )
@ -98,7 +105,7 @@ function setRedirects(val) {
translateRedirects: redirects, translateRedirects: redirects,
simplyTranslateNormalRedirectsChecks: redirects.simplyTranslate.normal, simplyTranslateNormalRedirectsChecks: redirects.simplyTranslate.normal,
simplyTranslateTorRedirectsChecks: redirects.simplyTranslate.tor, simplyTranslateTorRedirectsChecks: redirects.simplyTranslate.tor,
simplyTranslateI2PRedirectsChecks: redirects.simplyTranslate.i2p, simplyTranslateI2pRedirectsChecks: redirects.simplyTranslate.i2p,
simplyTranslateLokiRedirectsChecks: redirects.simplyTranslate.loki, simplyTranslateLokiRedirectsChecks: redirects.simplyTranslate.loki,
lingvaNormalRedirectsChecks, lingvaNormalRedirectsChecks,
lingvaTorRedirectsChecks: redirects.lingva.tor, lingvaTorRedirectsChecks: redirects.lingva.tor,
@ -116,6 +123,8 @@ function copyPasteLingvaLocalStorage(test, url, tabId) {
...lingvaNormalCustomRedirects, ...lingvaNormalCustomRedirects,
...lingvaTorRedirectsChecks, ...lingvaTorRedirectsChecks,
...lingvaTorCustomRedirects, ...lingvaTorCustomRedirects,
...lingvaI2pCustomRedirects,
...lingvaLokiCustomRedirects
].includes(protocolHost)) { resolve(); return; } ].includes(protocolHost)) { resolve(); return; }
if (!test) { if (!test) {
@ -124,9 +133,13 @@ function copyPasteLingvaLocalStorage(test, url, tabId) {
{ file: "/assets/javascripts/translate/get_lingva_preferences.js", runAt: "document_start" } { file: "/assets/javascripts/translate/get_lingva_preferences.js", runAt: "document_start" }
); );
let checkedInstances; let checkedInstances = [];
if (translateProtocol == 'normal') checkedInstances = [...lingvaNormalRedirectsChecks, ...lingvaNormalCustomRedirects]; if (protocol == 'loki') checkedInstances = [...lingvaLokiCustomRedirects]; //...lingvaLokiRedirectsChecks,
if (translateProtocol == 'tor') checkedInstances = [...lingvaTorRedirectsChecks, ...lingvaTorCustomRedirects]; else if (protocol == 'i2p') checkedInstances = [...lingvaI2pCustomRedirects]; //...lingvaI2pRedirectsChecks,
else if (protocol == 'tor') checkedInstances = [...lingvaTorRedirectsChecks, ...lingvaTorCustomRedirects];
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
checkedInstances = [...lingvaNormalRedirectsChecks, ...lingvaNormalCustomRedirects];
}
const i = checkedInstances.indexOf(protocolHost); const i = checkedInstances.indexOf(protocolHost);
if (i !== -1) checkedInstances.splice(i, 1); if (i !== -1) checkedInstances.splice(i, 1);
if (checkedInstances.length === 0) { resolve(); return; } if (checkedInstances.length === 0) { resolve(); return; }
@ -145,9 +158,13 @@ function pasteLingvaLocalStorage() {
return new Promise(async resolve => { return new Promise(async resolve => {
await init(); await init();
if (translateDisable || translateFrontend != 'lingva') { resolve(); return; } if (translateDisable || translateFrontend != 'lingva') { resolve(); return; }
let checkedInstances; let checkedInstances = [];
if (translateProtocol == 'normal') checkedInstances = [...lingvaNormalRedirectsChecks, ...lingvaNormalCustomRedirects]; if (protocol == 'loki') checkedInstances = [...lingvaLokiCustomRedirects]; //...lingvaLokiRedirectsChecks,
if (translateProtocol == 'tor') checkedInstances = [...lingvaTorRedirectsChecks, ...lingvaTorCustomRedirects]; else if (protocol == 'i2p') checkedInstances = [...lingvaI2pCustomRedirects]; //...lingvaI2pRedirectsChecks,
else if (protocol == 'tor') checkedInstances = [...lingvaTorRedirectsChecks, ...lingvaTorCustomRedirects];
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
checkedInstances = [...lingvaNormalRedirectsChecks, ...lingvaNormalCustomRedirects];
}
for (const to of checkedInstances) for (const to of checkedInstances)
browser.tabs.create({ url: to }, browser.tabs.create({ url: to },
tab => browser.tabs.executeScript(tab.id, { file: "/assets/javascripts/translate/set_lingva_preferences.js", runAt: "document_start" })) tab => browser.tabs.executeScript(tab.id, { file: "/assets/javascripts/translate/set_lingva_preferences.js", runAt: "document_start" }))
@ -164,17 +181,19 @@ function copyPasteSimplyTranslateCookies(test, from) {
...simplyTranslateNormalCustomRedirects, ...simplyTranslateNormalCustomRedirects,
...simplyTranslateTorRedirectsChecks, ...simplyTranslateTorRedirectsChecks,
...simplyTranslateTorCustomRedirects, ...simplyTranslateTorCustomRedirects,
...simplyTranslateI2PRedirectsChecks, ...simplyTranslateI2pRedirectsChecks,
...simplyTranslateI2PCustomRedirects, ...simplyTranslateI2pCustomRedirects,
...simplyTranslateLokiRedirectsChecks, ...simplyTranslateLokiRedirectsChecks,
...simplyTranslateLokiCustomReidrects, ...simplyTranslateLokiCustomRedirects,
].includes(protocolHost)) { resolve(); return; } ].includes(protocolHost)) { resolve(); return; }
if (!test) { if (!test) {
let checkedInstances; let checkedInstances = [];
if (translateProtocol == 'normal') checkedInstances = [...simplyTranslateNormalRedirectsChecks, ...simplyTranslateNormalCustomRedirects] if (protocol == 'loki') checkedInstances = [...simplyTranslateLokiRedirectsChecks, ...simplyTranslateLokiCustomRedirects]
else if (translateProtocol == 'tor') checkedInstances = [...simplyTranslateTorRedirectsChecks, ...simplyTranslateTorCustomRedirects] else if (protocol == 'i2p') checkedInstances = [...simplyTranslateI2pCustomRedirects, ...simplyTranslateI2pRedirectsChecks];
else if (translateProtocol == 'i2p') checkedInstances = [...simplyTranslateI2PRedirectsChecks, ...simplyTranslateI2PCustomRedirects] else if (protocol == 'tor') checkedInstances = [...simplyTranslateTorRedirectsChecks, ...simplyTranslateTorCustomRedirects];
else if (translateProtocol == 'loki') checkedInstances = [...simplyTranslateLokiRedirectsChecks, ...simplyTranslateLokiCustomReidrects] if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
checkedInstances = [...simplyTranslateNormalRedirectsChecks, ...simplyTranslateNormalCustomRedirects];
}
await utils.copyCookie('simplyTranslate', from, checkedInstances, 'from_lang'); await utils.copyCookie('simplyTranslate', from, checkedInstances, 'from_lang');
await utils.copyCookie('simplyTranslate', from, checkedInstances, 'to_lang'); await utils.copyCookie('simplyTranslate', from, checkedInstances, 'to_lang');
await utils.copyCookie('simplyTranslate', from, checkedInstances, 'tts_enabled'); await utils.copyCookie('simplyTranslate', from, checkedInstances, 'tts_enabled');
@ -189,11 +208,13 @@ function pasteSimplyTranslateCookies() {
return new Promise(async resolve => { return new Promise(async resolve => {
await init(); await init();
if (translateDisable || translateFrontend != 'simplyTranslate') { resolve(); return; } if (translateDisable || translateFrontend != 'simplyTranslate') { resolve(); return; }
let checkedInstances; let checkedInstances = [];
if (translateProtocol == 'normal') checkedInstances = [...simplyTranslateNormalRedirectsChecks, ...simplyTranslateNormalCustomRedirects] if (protocol == 'loki') checkedInstances = [...simplyTranslateLokiRedirectsChecks, ...simplyTranslateLokiCustomRedirects]
else if (translateProtocol == 'tor') checkedInstances = [...simplyTranslateTorRedirectsChecks, ...simplyTranslateTorCustomRedirects] else if (protocol == 'i2p') checkedInstances = [...simplyTranslateI2pCustomRedirects, ...simplyTranslateI2pRedirectsChecks];
else if (translateProtocol == 'i2p') checkedInstances = [...simplyTranslateI2PRedirectsChecks, ...simplyTranslateI2PCustomRedirects] else if (protocol == 'tor') checkedInstances = [...simplyTranslateTorRedirectsChecks, ...simplyTranslateTorCustomRedirects];
else if (translateProtocol == 'loki') checkedInstances = [...simplyTranslateLokiRedirectsChecks, ...simplyTranslateLokiCustomReidrects] if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
checkedInstances = [...simplyTranslateNormalRedirectsChecks, ...simplyTranslateNormalCustomRedirects];
}
utils.getCookiesFromStorage('simplyTranslate', checkedInstances, 'from_lang'); utils.getCookiesFromStorage('simplyTranslate', checkedInstances, 'from_lang');
utils.getCookiesFromStorage('simplyTranslate', checkedInstances, 'to_lang'); utils.getCookiesFromStorage('simplyTranslate', checkedInstances, 'to_lang');
utils.getCookiesFromStorage('simplyTranslate', checkedInstances, 'tts_enabled'); utils.getCookiesFromStorage('simplyTranslate', checkedInstances, 'tts_enabled');
@ -208,11 +229,13 @@ function redirect(url, disableOverride) {
if (!targets.some(rx => rx.test(url.href))) return; if (!targets.some(rx => rx.test(url.href))) return;
if (translateFrontend == 'simplyTranslate') { if (translateFrontend == 'simplyTranslate') {
let instancesList; let instancesList = [];
if (translateProtocol == 'normal') instancesList = [...simplyTranslateNormalRedirectsChecks, ...simplyTranslateNormalCustomRedirects]; if (protocol == 'loki') instancesList = [...simplyTranslateLokiRedirectsChecks, ...simplyTranslateLokiCustomRedirects];
if (translateProtocol == 'tor') instancesList = [...simplyTranslateTorRedirectsChecks, ...simplyTranslateTorCustomRedirects]; else if (protocol == 'i2p') instancesList = [...simplyTranslateI2pRedirectsChecks, ...simplyTranslateI2pCustomRedirects];
if (translateProtocol == 'i2p') instancesList = [...simplyTranslateI2PRedirectsChecks, ...simplyTranslateI2PCustomRedirects]; else if (protocol == 'tor') instancesList = [...simplyTranslateTorRedirectsChecks, ...simplyTranslateTorCustomRedirects];
if (translateProtocol == 'loki') instancesList = [...simplyTranslateLokiRedirectsChecks, ...simplyTranslateLokiCustomReidrects]; if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...simplyTranslateNormalRedirectsChecks, ...simplyTranslateNormalCustomRedirects];
}
if (instancesList.length === 0) return; if (instancesList.length === 0) return;
const randomInstance = utils.getRandomInstance(instancesList) const randomInstance = utils.getRandomInstance(instancesList)
@ -226,9 +249,13 @@ function redirect(url, disableOverride) {
let pair = params_arr[i].split('='); let pair = params_arr[i].split('=');
params[pair[0]] = pair[1]; params[pair[0]] = pair[1];
} }
let instancesList; let instancesList = [];
if (translateProtocol == 'normal') instancesList = [...lingvaNormalRedirectsChecks, ...lingvaNormalCustomRedirects]; if (protocol == 'loki') instancesList = [...lingvaLokiCustomRedirects]; //...lingvaLokiRedirectsChecks,
if (translateProtocol == 'tor') instancesList = [...lingvaTorRedirectsChecks, ...lingvaTorCustomRedirects]; else if (protocol == 'i2p') instancesList = [...lingvaI2pCustomRedirects]; //...lingvaI2pRedirectsChecks,
if (protocol == 'tor') instancesList = [...lingvaTorRedirectsChecks, ...lingvaTorCustomRedirects];
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...lingvaNormalRedirectsChecks, ...lingvaNormalCustomRedirects];
}
if (instancesList.length === 0) return; if (instancesList.length === 0) return;
const randomInstance = utils.getRandomInstance(instancesList) const randomInstance = utils.getRandomInstance(instancesList)
@ -252,32 +279,35 @@ function switchInstance(url, disableOverride) {
...simplyTranslateNormalCustomRedirects, ...simplyTranslateNormalCustomRedirects,
...simplyTranslateTorCustomRedirects, ...simplyTranslateTorCustomRedirects,
...simplyTranslateI2PCustomRedirects, ...simplyTranslateI2pCustomRedirects,
...simplyTranslateLokiCustomReidrects, ...simplyTranslateLokiCustomRedirects,
...translateRedirects.lingva.normal, ...translateRedirects.lingva.normal,
...translateRedirects.lingva.tor, ...translateRedirects.lingva.tor,
...lingvaNormalCustomRedirects, ...lingvaNormalCustomRedirects,
...lingvaTorCustomRedirects, ...lingvaTorCustomRedirects,
...lingvaI2pCustomRedirects,
...lingvaLokiCustomRedirects
].includes(protocolHost)) { resolve(); return; } ].includes(protocolHost)) { resolve(); return; }
let instancesList; let instancesList;
if (translateProtocol == 'normal') {
if (translateFrontend == 'simplyTranslate') instancesList = [...simplyTranslateNormalRedirectsChecks, ...simplyTranslateNormalCustomRedirects]; if (protocol == 'loki') {
else if (translateFrontend == 'lingva') instancesList = [...lingvaNormalRedirectsChecks, ...lingvaNormalCustomRedirects]; if (translateFrontend == 'simplyTranslate') instancesList = [...simplyTranslateLokiRedirectsChecks, ...simplyTranslateLokiCustomRedirects];
else if (translateFrontend == 'lingva') instancesList = [...lingvaLokiCustomRedirects]; //...lingvaLokiRedirectsChecks,
} }
else if (translateProtocol == 'tor') { else if (protocol == 'i2p') {
if (translateFrontend == 'simplyTranslate') instancesList = [...simplyTranslateI2pRedirectsChecks, ...simplyTranslateI2pCustomRedirects];
else if (translateFrontend == 'lingva') instancesList = [...lingvaI2pCustomRedirects]; //...lingvaI2pRedirectsChecks,
}
else if (protocol == 'tor') {
if (translateFrontend == 'simplyTranslate') instancesList = [...simplyTranslateTorRedirectsChecks, ...simplyTranslateTorCustomRedirects]; if (translateFrontend == 'simplyTranslate') instancesList = [...simplyTranslateTorRedirectsChecks, ...simplyTranslateTorCustomRedirects];
else if (translateFrontend == 'lingva') instancesList = [...lingvaTorRedirectsChecks, ...lingvaTorCustomRedirects]; else if (translateFrontend == 'lingva') instancesList = [...lingvaTorRedirectsChecks, ...lingvaTorCustomRedirects];
} }
else if (translateProtocol == 'i2p') { if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
if (translateFrontend == 'simplyTranslate') instancesList = [...simplyTranslateI2PRedirectsChecks, ...simplyTranslateI2PCustomRedirects]; if (translateFrontend == 'simplyTranslate') instancesList = [...simplyTranslateNormalRedirectsChecks, ...simplyTranslateNormalCustomRedirects];
//else if (translateFrontend == 'lingva') instancesList = [...lingvaI2PRedirectsChecks, ...lingvaI2PCustomRedirects]; else if (translateFrontend == 'lingva') instancesList = [...lingvaNormalRedirectsChecks, ...lingvaNormalCustomRedirects];
}
else if (translateProtocol == 'loki') {
if (translateFrontend == 'simplyTranslate') instancesList = [...simplyTranslateLokiRedirectsChecks, ...simplyTranslateLokiCustomReidrects];
//else if (translateFrontend == 'lingva') instancesList = [...lingvaLokiRedirectsChecks, ...lingvaLokiCustomRedirects];
} }
const i = instancesList.indexOf(protocolHost); const i = instancesList.indexOf(protocolHost);
@ -293,8 +323,9 @@ function initDefaults() {
return new Promise(async resolve => { return new Promise(async resolve => {
fetch('/instances/data.json').then(response => response.text()).then(data => { fetch('/instances/data.json').then(response => response.text()).then(data => {
let dataJson = JSON.parse(data); let dataJson = JSON.parse(data);
redirects.simplyTranslate = dataJson.simplyTranslate; for (let i = 0; i < frontends.length; i++) {
redirects.lingva = dataJson.lingva; redirects[frontends[i]] = dataJson[frontends[i]]
}
browser.storage.local.get('cloudflareBlackList', browser.storage.local.get('cloudflareBlackList',
async r => { async r => {
lingvaNormalRedirectsChecks = [...redirects.lingva.normal] lingvaNormalRedirectsChecks = [...redirects.lingva.normal]
@ -305,22 +336,31 @@ function initDefaults() {
browser.storage.local.set({ browser.storage.local.set({
translateDisable: false, translateDisable: false,
translateFrontend: "simplyTranslate", translateFrontend: "simplyTranslate",
translateProtocol: 'normal',
translateRedirects: redirects, translateRedirects: redirects,
simplyTranslateNormalRedirectsChecks: [...redirects.simplyTranslate.normal], simplyTranslateNormalRedirectsChecks: [...redirects.simplyTranslate.normal],
simplyTranslateNormalCustomRedirects: [], simplyTranslateNormalCustomRedirects: [],
simplyTranslateTorRedirectsChecks: [...redirects.simplyTranslate.tor], simplyTranslateTorRedirectsChecks: [...redirects.simplyTranslate.tor],
simplyTranslateTorCustomRedirects: [], simplyTranslateTorCustomRedirects: [],
simplyTranslateI2PRedirectsChecks: [...redirects.simplyTranslate.i2p],
simplyTranslateI2PCustomRedirects: [], simplyTranslateI2pRedirectsChecks: [...redirects.simplyTranslate.i2p],
simplyTranslateI2pCustomRedirects: [],
simplyTranslateLokiRedirectsChecks: [...redirects.simplyTranslate.loki], simplyTranslateLokiRedirectsChecks: [...redirects.simplyTranslate.loki],
simplyTranslateLokiCustomReidrects: [], simplyTranslateLokiCustomRedirects: [],
lingvaNormalRedirectsChecks: lingvaNormalRedirectsChecks, lingvaNormalRedirectsChecks: lingvaNormalRedirectsChecks,
lingvaNormalCustomRedirects: [], lingvaNormalCustomRedirects: [],
lingvaTorRedirectsChecks: [...redirects.lingva.tor], lingvaTorRedirectsChecks: [...redirects.lingva.tor],
lingvaTorCustomRedirects: [], lingvaTorCustomRedirects: [],
lingvaI2pRedirectsChecks: [...redirects.lingva.i2p],
lingvaI2pCustomRedirects: [],
lingvaLokiRedirectsChecks: [...redirects.lingva.loki],
lingvaLokiCustomRedirects: []
}, () => resolve()) }, () => resolve())
}) })
}) })

View File

@ -9,12 +9,17 @@ const targets = [
/^https?:\/{2}t\.co/ /^https?:\/{2}t\.co/
]; ];
let redirects = { const frontends = new Array("nitter")
"nitter": { const protocols = new Array("normal", "tor", "i2p", "loki")
"normal": [],
"tor": [] let redirects = {}
},
}; for (let i = 0; i < frontends.length; i++) {
redirects[frontends[i]] = {}
for (let x = 0; x < protocols.length; x++) {
redirects[frontends[i]][protocols[x]] = []
}
}
function setRedirects(val) { function setRedirects(val) {
browser.storage.local.get(['cloudflareBlackList', 'authenticateBlackList'], r => { browser.storage.local.get(['cloudflareBlackList', 'authenticateBlackList'], r => {
@ -34,36 +39,45 @@ function setRedirects(val) {
let let
disableTwitter, disableTwitter,
twitterProtocol, protocol,
protocolFallback,
twitterRedirects, twitterRedirects,
twitterRedirectType, twitterRedirectType,
nitterNormalRedirectsChecks, nitterNormalRedirectsChecks,
nitterNormalCustomRedirects, nitterNormalCustomRedirects,
nitterTorRedirectsChecks, nitterTorRedirectsChecks,
nitterTorCustomRedirects; nitterTorCustomRedirects,
nitterI2pCustomRedirects,
nitterLokiCustomRedirects;
function init() { function init() {
return new Promise(async resolve => { return new Promise(async resolve => {
browser.storage.local.get( browser.storage.local.get(
[ [
"disableTwitter", "disableTwitter",
"twitterProtocol", "protocol",
"protocolFallback",
"twitterRedirects", "twitterRedirects",
"twitterRedirectType", "twitterRedirectType",
"nitterNormalRedirectsChecks", "nitterNormalRedirectsChecks",
"nitterNormalCustomRedirects", "nitterNormalCustomRedirects",
"nitterTorRedirectsChecks", "nitterTorRedirectsChecks",
"nitterTorCustomRedirects", "nitterTorCustomRedirects",
"nitterI2pCustomRedirects",
"nitterLokiCustomRedirects"
], ],
r => { r => {
disableTwitter = r.disableTwitter; disableTwitter = r.disableTwitter;
twitterProtocol = r.twitterProtocol; protocol = r.protocol;
protocolFallback = r.protocolFallback;
twitterRedirects = r.twitterRedirects; twitterRedirects = r.twitterRedirects;
twitterRedirectType = r.twitterRedirectType; twitterRedirectType = r.twitterRedirectType;
nitterNormalRedirectsChecks = r.nitterNormalRedirectsChecks; nitterNormalRedirectsChecks = r.nitterNormalRedirectsChecks;
nitterNormalCustomRedirects = r.nitterNormalCustomRedirects; nitterNormalCustomRedirects = r.nitterNormalCustomRedirects;
nitterTorRedirectsChecks = r.nitterTorRedirectsChecks; nitterTorRedirectsChecks = r.nitterTorRedirectsChecks;
nitterTorCustomRedirects = r.nitterTorCustomRedirects; nitterTorCustomRedirects = r.nitterTorCustomRedirects;
nitterI2pCustomRedirects = r.nitterI2pCustomRedirects;
nitterLokiCustomRedirects = r.nitterLokiCustomRedirects;
resolve(); resolve();
} }
) )
@ -79,6 +93,8 @@ function all() {
...nitterTorRedirectsChecks, ...nitterTorRedirectsChecks,
...nitterNormalCustomRedirects, ...nitterNormalCustomRedirects,
...nitterTorCustomRedirects, ...nitterTorCustomRedirects,
...nitterI2pCustomRedirects,
...nitterLokiCustomRedirects
]; ];
} }
@ -90,9 +106,13 @@ function redirect(url, type, initiator, disableOverride) {
if (twitterRedirectType == 'sub_frame' && type == "main_frame") return; if (twitterRedirectType == 'sub_frame' && type == "main_frame") return;
if (twitterRedirectType == 'main_frame' && type != "main_frame") return; if (twitterRedirectType == 'main_frame' && type != "main_frame") return;
let instancesList; let instancesList = [];
if (twitterProtocol == 'normal') instancesList = [...nitterNormalRedirectsChecks, ...nitterNormalCustomRedirects]; if (protocol == 'loki') instancesList = [...nitterI2pCustomRedirects];
else if (twitterProtocol == 'tor') instancesList = [...nitterTorRedirectsChecks, ...nitterTorCustomRedirects]; else if (protocol == 'i2p') instancesList = [...nitterLokiCustomRedirects];
else if (protocol == 'tor') instancesList = [...nitterTorRedirectsChecks, ...nitterTorCustomRedirects];
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...nitterNormalRedirectsChecks, ...nitterNormalCustomRedirects];
}
if (instancesList.length === 0) return; if (instancesList.length === 0) return;
const randomInstance = utils.getRandomInstance(instancesList); const randomInstance = utils.getRandomInstance(instancesList);
@ -125,9 +145,13 @@ function switchInstance(url, disableOverride) {
if (disableTwitter && !disableOverride) { resolve(); return; } if (disableTwitter && !disableOverride) { resolve(); return; }
const protocolHost = utils.protocolHost(url); const protocolHost = utils.protocolHost(url);
if (!all().includes(protocolHost)) { resolve(); return; } if (!all().includes(protocolHost)) { resolve(); return; }
let instancesList; let instancesList = [];
if (twitterProtocol == 'normal') instancesList = [...nitterNormalRedirectsChecks, ...nitterNormalCustomRedirects]; if (protocol == 'loki') instancesList = [...nitterI2pCustomRedirects];
else if (twitterProtocol == 'tor') instancesList = [...nitterTorRedirectsChecks, ...nitterTorCustomRedirects]; else if (protocol == 'i2p') instancesList = [...nitterLokiCustomRedirects];
else if (protocol == 'tor') instancesList = [...nitterTorRedirectsChecks, ...nitterTorCustomRedirects];
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...nitterNormalRedirectsChecks, ...nitterNormalCustomRedirects];
}
let index = instancesList.indexOf(protocolHost); let index = instancesList.indexOf(protocolHost);
if (index > -1) instancesList.splice(index, 1); if (index > -1) instancesList.splice(index, 1);
@ -164,9 +188,13 @@ function initNitterCookies(test, from) {
if (!all().includes(protocolHost) if (!all().includes(protocolHost)
) { resolve(); return; } ) { resolve(); return; }
if (!test) { if (!test) {
let checkedInstances; let checkedInstances = [];
if (twitterProtocol == 'normal') checkedInstances = [...nitterNormalRedirectsChecks, ...nitterNormalCustomRedirects] if (protocol == 'loki') checkedInstances = [...nitterI2pCustomRedirects];
else if (twitterProtocol == 'tor') checkedInstances = [...nitterTorRedirectsChecks, ...nitterTorCustomRedirects] else if (protocol == 'i2p') checkedInstances = [...nitterLokiCustomRedirects];
else if (protocol == 'tor') checkedInstances = [...nitterTorRedirectsChecks, ...nitterTorCustomRedirects];
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
checkedInstances = [...nitterNormalRedirectsChecks, ...nitterNormalCustomRedirects];
}
await utils.copyCookie('nitter', from, checkedInstances, 'theme'); await utils.copyCookie('nitter', from, checkedInstances, 'theme');
await utils.copyCookie('nitter', from, checkedInstances, 'infiniteScroll'); await utils.copyCookie('nitter', from, checkedInstances, 'infiniteScroll');
await utils.copyCookie('nitter', from, checkedInstances, 'stickyProfile'); await utils.copyCookie('nitter', from, checkedInstances, 'stickyProfile');
@ -194,10 +222,14 @@ function initNitterCookies(test, from) {
function pasteNitterCookies() { function pasteNitterCookies() {
return new Promise(async resolve => { return new Promise(async resolve => {
await init(); await init();
if (disableTwitter || twitterProtocol === undefined) { resolve(); return; } if (disableTwitter || protocol === undefined) { resolve(); return; }
let checkedInstances; let checkedInstances = [];
if (twitterProtocol == 'normal') checkedInstances = [...nitterNormalRedirectsChecks, ...nitterNormalCustomRedirects] if (protocol == 'loki') checkedInstances = [...nitterI2pCustomRedirects];
else if (twitterProtocol == 'tor') checkedInstances = [...nitterTorRedirectsChecks, ...nitterTorCustomRedirects] else if (protocol == 'i2p') checkedInstances = [...nitterLokiCustomRedirects];
else if (protocol == 'tor') checkedInstances = [...nitterTorRedirectsChecks, ...nitterTorCustomRedirects];
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
checkedInstances = [...nitterNormalRedirectsChecks, ...nitterNormalCustomRedirects];
}
utils.getCookiesFromStorage('nitter', checkedInstances, 'theme'); utils.getCookiesFromStorage('nitter', checkedInstances, 'theme');
utils.getCookiesFromStorage('nitter', checkedInstances, 'infiniteScroll'); utils.getCookiesFromStorage('nitter', checkedInstances, 'infiniteScroll');
utils.getCookiesFromStorage('nitter', checkedInstances, 'stickyProfile'); utils.getCookiesFromStorage('nitter', checkedInstances, 'stickyProfile');
@ -226,7 +258,9 @@ function initDefaults() {
return new Promise(resolve => { return new Promise(resolve => {
fetch('/instances/data.json').then(response => response.text()).then(data => { fetch('/instances/data.json').then(response => response.text()).then(data => {
let dataJson = JSON.parse(data); let dataJson = JSON.parse(data);
redirects.nitter = dataJson.nitter; for (let i = 0; i < frontends.length; i++) {
redirects[frontends[i]] = dataJson[frontends[i]]
}
browser.storage.local.get(['cloudflareBlackList', 'authenticateBlackList'], async r => { browser.storage.local.get(['cloudflareBlackList', 'authenticateBlackList'], async r => {
nitterNormalRedirectsChecks = [...redirects.nitter.normal]; nitterNormalRedirectsChecks = [...redirects.nitter.normal];
for (const instance of [...r.cloudflareBlackList, ...r.authenticateBlackList]) { for (const instance of [...r.cloudflareBlackList, ...r.authenticateBlackList]) {
@ -236,7 +270,6 @@ function initDefaults() {
browser.storage.local.set({ browser.storage.local.set({
disableTwitter: false, disableTwitter: false,
twitterRedirects: redirects, twitterRedirects: redirects,
twitterProtocol: "normal",
twitterRedirectType: "both", twitterRedirectType: "both",
nitterNormalRedirectsChecks: nitterNormalRedirectsChecks, nitterNormalRedirectsChecks: nitterNormalRedirectsChecks,
@ -244,6 +277,12 @@ function initDefaults() {
nitterTorRedirectsChecks: [...redirects.nitter.tor], nitterTorRedirectsChecks: [...redirects.nitter.tor],
nitterTorCustomRedirects: [], nitterTorCustomRedirects: [],
nitterI2pRedirectsChecks: [...redirects.nitter.i2p],
nitterI2pCustomRedirects: [],
nitterLokiRedirectsChecks: [...redirects.nitter.loki],
nitterLokiCustomRedirects: []
}, () => resolve()); }, () => resolve());
}) })
}) })

View File

@ -14,6 +14,7 @@ import tiktokHelper from "./tiktok.js";
import quoraHelper from "./quora.js" import quoraHelper from "./quora.js"
import libremdbHelper from "./imdb.js"; import libremdbHelper from "./imdb.js";
import imgurHelper from "./imgur.js"; import imgurHelper from "./imgur.js";
import reutersHelper from './reuters.js';
import localise from './localise.js' import localise from './localise.js'
function getRandomInstance(instances) { function getRandomInstance(instances) {
@ -41,18 +42,20 @@ function updateInstances() {
await initcloudflareBlackList(); await initcloudflareBlackList();
const instances = JSON.parse(http.responseText); const instances = JSON.parse(http.responseText);
youtubeHelper.setRedirects({ 'invidious': instances.invidious, 'piped': instances.piped, }) youtubeHelper.setRedirects({ 'invidious': instances.invidious, 'piped': instances.piped, 'pipedMaterial': instances.pipedMaterial })
twitterHelper.setRedirects(instances.nitter); twitterHelper.setRedirects(instances.nitter);
instagramHelper.setRedirects(instances.bibliogram); instagramHelper.setRedirects(instances.bibliogram);
redditHelper.setRedirects({ 'libreddit': instances.libreddit, 'teddit': instances.teddit }); redditHelper.setRedirects({ 'libreddit': instances.libreddit, 'teddit': instances.teddit });
translateHelper.setRedirects({ "simplyTranslate": instances.simplyTranslate, "lingva": instances.lingva }); translateHelper.setRedirects({ "simplyTranslate": instances.simplyTranslate, "lingva": instances.lingva });
searchHelper.setRedirects({ 'searx': instances.searx, 'searxng': instances.searxng, 'whoogle': instances.whoogle }); searchHelper.setRedirects({ 'searx': instances.searx, 'searxng': instances.searxng, 'whoogle': instances.whoogle, 'librex': instances.librex });
wikipediaHelper.setRedirects(instances.wikiless); wikipediaHelper.setRedirects(instances.wikiless);
mediumHelper.setRedirects(instances.scribe); mediumHelper.setRedirects(instances.scribe);
quoraHelper.setRedirects(instances.quetre); quoraHelper.setRedirects(instances.quetre);
libremdbHelper.setRedirects(instances.libremdb); libremdbHelper.setRedirects(instances.libremdb);
sendTargetsHelper.setRedirects(instances.send); sendTargetsHelper.setRedirects(instances.send);
tiktokHelper.setRedirects(instances.proxiTok); tiktokHelper.setRedirects(instances.proxiTok);
lbryHelper.setRedirects(instances.librarian);
reutersHelper.setRedirects(instances.neuters);
console.info("Successfully updated Instances"); console.info("Successfully updated Instances");
resolve(true); return; resolve(true); return;
@ -89,7 +92,7 @@ async function processDefaultCustomInstances(target, name, protocol, document) {
let redirects; let redirects;
async function getFromStorage() { async function getFromStorage() {
return new Promise(async resolve => { return new Promise(async resolve =>
browser.storage.local.get( browser.storage.local.get(
[ [
redirectsChecks, redirectsChecks,
@ -105,27 +108,31 @@ async function processDefaultCustomInstances(target, name, protocol, document) {
resolve(); resolve();
} }
) )
}) )
} }
await getFromStorage(); await getFromStorage();
if (nameCustomInstances === undefined) console.log(customRedirects);
function calcNameCheckBoxes() { function calcNameCheckBoxes() {
let isTrue = true; let isTrue = true;
for (const item of redirects[name][protocol]) for (const item of redirects[name][protocol]) {
if (!nameDefaultRedirects.includes(item)) { if (!nameDefaultRedirects.includes(item)) {
isTrue = false; isTrue = false;
break; break;
} }
for (const element of nameCheckListElement.getElementsByTagName('input')) }
for (const element of nameCheckListElement.getElementsByTagName('input')) {
element.checked = nameDefaultRedirects.includes(element.className) element.checked = nameDefaultRedirects.includes(element.className)
}
if (nameDefaultRedirects.length == 0) isTrue = false; if (nameDefaultRedirects.length == 0) isTrue = false;
nameProtocolElement.getElementsByClassName('toogle-all')[0].checked = isTrue; nameProtocolElement.getElementsByClassName('toggle-all')[0].checked = isTrue;
} }
nameCheckListElement.innerHTML = nameCheckListElement.innerHTML =
[ [
`<div> `<div>
<x data-localise="__MSG_toggleAll__">Toggle All</x> <x data-localise="__MSG_toggleAll__">Toggle All</x>
<input type="checkbox" class="toogle-all"/> <input type="checkbox" class="toggle-all"/>
</div>`, </div>`,
...redirects[name][protocol].map( ...redirects[name][protocol].map(
x => { x => {
@ -153,7 +160,7 @@ async function processDefaultCustomInstances(target, name, protocol, document) {
localise.localisePage(); localise.localisePage();
calcNameCheckBoxes(); calcNameCheckBoxes();
nameProtocolElement.getElementsByClassName('toogle-all')[0].addEventListener("change", async event => { nameProtocolElement.getElementsByClassName('toggle-all')[0].addEventListener("change", async event => {
if (event.target.checked) if (event.target.checked)
nameDefaultRedirects = [...redirects[name][protocol]]; nameDefaultRedirects = [...redirects[name][protocol]];
else else
@ -164,7 +171,7 @@ async function processDefaultCustomInstances(target, name, protocol, document) {
}); });
for (let element of nameCheckListElement.getElementsByTagName('input')) { for (let element of nameCheckListElement.getElementsByTagName('input')) {
if (element.className != 'toogle-all') if (element.className != 'toggle-all')
nameProtocolElement.getElementsByClassName(element.className)[0].addEventListener("change", async event => { nameProtocolElement.getElementsByClassName(element.className)[0].addEventListener("change", async event => {
if (event.target.checked) if (event.target.checked)
nameDefaultRedirects.push(element.className) nameDefaultRedirects.push(element.className)
@ -384,6 +391,7 @@ function unify(test) {
if (!result) result = await searchHelper.initSearxCookies(test, url); if (!result) result = await searchHelper.initSearxCookies(test, url);
if (!result) result = await searchHelper.initSearxngCookies(test, url); if (!result) result = await searchHelper.initSearxngCookies(test, url);
if (!result) result = await searchHelper.initLibrexCookies(test, url);
if (!result) result = await tiktokHelper.initProxiTokCookies(test, url); if (!result) result = await tiktokHelper.initProxiTokCookies(test, url);

View File

@ -4,13 +4,18 @@ import utils from './utils.js'
const targets = /^https?:\/{2}(([a-z]{1,}\.){0,})wikipedia\.org/ const targets = /^https?:\/{2}(([a-z]{1,}\.){0,})wikipedia\.org/
let redirects = { const frontends = new Array("wikiless")
"wikiless": { const protocols = new Array("normal", "tor", "i2p", "loki")
"normal": [],
"tor": [], let redirects = {};
"i2p": []
} for (let i = 0; i < frontends.length; i++) {
}; redirects[frontends[i]] = {}
for (let x = 0; x < protocols.length; x++) {
redirects[frontends[i]][protocols[x]] = []
}
}
function setRedirects(val) { function setRedirects(val) {
browser.storage.local.get('cloudflareBlackList', r => { browser.storage.local.get('cloudflareBlackList', r => {
redirects.wikiless = val; redirects.wikiless = val;
@ -29,13 +34,15 @@ function setRedirects(val) {
let let
disableWikipedia, disableWikipedia,
wikipediaRedirects, wikipediaRedirects,
wikipediaProtocol, protocol,
protocolFallback,
wikilessNormalRedirectsChecks, wikilessNormalRedirectsChecks,
wikilessTorRedirectsChecks, wikilessTorRedirectsChecks,
wikilessI2pRedirectsChecks, wikilessI2pRedirectsChecks,
wikilessNormalCustomRedirects, wikilessNormalCustomRedirects,
wikilessTorCustomRedirects, wikilessTorCustomRedirects,
wikilessI2pCustomRedirects; wikilessI2pCustomRedirects,
wikilessLokiCustomRedirects;
function init() { function init() {
return new Promise(async resolve => { return new Promise(async resolve => {
@ -43,25 +50,28 @@ function init() {
[ [
"disableWikipedia", "disableWikipedia",
"wikipediaRedirects", "wikipediaRedirects",
"wikipediaProtocol", "protocol",
"protocolFallback",
"wikilessNormalRedirectsChecks", "wikilessNormalRedirectsChecks",
"wikilessTorRedirectsChecks", "wikilessTorRedirectsChecks",
"wikilessI2pRedirectsChecks", "wikilessI2pRedirectsChecks",
"wikilessNormalCustomRedirects", "wikilessNormalCustomRedirects",
"wikilessTorCustomRedirects", "wikilessTorCustomRedirects",
"wikilessI2pCustomRedirects", "wikilessI2pCustomRedirects",
"wikilessLokiCustomRedirects"
], ],
r => { r => {
disableWikipedia = r.disableWikipedia; disableWikipedia = r.disableWikipedia;
wikipediaRedirects = r.wikipediaRedirects; wikipediaRedirects = r.wikipediaRedirects;
wikipediaProtocol = r.wikipediaProtocol; protocol = r.protocol;
protocolFallback = r.protocolFallback;
wikilessNormalRedirectsChecks = r.wikilessNormalRedirectsChecks; wikilessNormalRedirectsChecks = r.wikilessNormalRedirectsChecks;
wikilessTorRedirectsChecks = r.wikilessTorRedirectsChecks; wikilessTorRedirectsChecks = r.wikilessTorRedirectsChecks;
wikilessI2pRedirectsChecks = r.wikilessI2pRedirectsChecks; wikilessI2pRedirectsChecks = r.wikilessI2pRedirectsChecks;
wikilessNormalCustomRedirects = r.wikilessNormalCustomRedirects; wikilessNormalCustomRedirects = r.wikilessNormalCustomRedirects;
wikilessTorCustomRedirects = r.wikilessTorCustomRedirects; wikilessTorCustomRedirects = r.wikilessTorCustomRedirects;
wikilessI2pCustomRedirects = r.wikilessI2pCustomRedirects; wikilessI2pCustomRedirects = r.wikilessI2pCustomRedirects;
wikilessLokiCustomRedirects = r.wikilessLokiCustomRedirects;
resolve(); resolve();
} }
) )
@ -82,14 +92,18 @@ function initWikilessCookies(test, from) {
...wikilessTorCustomRedirects, ...wikilessTorCustomRedirects,
...wikilessI2pRedirectsChecks, ...wikilessI2pRedirectsChecks,
...wikilessI2pCustomRedirects, ...wikilessI2pCustomRedirects,
...wikilessLokiCustomRedirects
]; ];
if (!all.includes(protocolHost)) { resolve(); return; } if (!all.includes(protocolHost)) { resolve(); return; }
if (!test) { if (!test) {
let checkedInstances; let checkedInstances = [];
if (wikipediaProtocol == 'normal') checkedInstances = [...wikilessNormalRedirectsChecks, ...wikilessNormalCustomRedirects] if (protocol == 'loki') checkedInstances = [...wikilessLokiCustomRedirects];
else if (wikipediaProtocol == 'tor') checkedInstances = [...wikilessTorRedirectsChecks, ...wikilessTorCustomRedirects] else if (protocol == 'i2p') checkedInstances = [...wikilessI2pCustomRedirects, ...wikilessI2pRedirectsChecks];
else if (wikipediaProtocol == 'i2p') checkedInstances = [...wikilessI2pRedirectsChecks, ...wikilessI2pCustomRedirects] else if (protocol == 'tor') checkedInstances = [...wikilessTorRedirectsChecks, ...wikilessTorCustomRedirects];
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
checkedInstances = [...wikilessNormalRedirectsChecks, ...wikilessNormalCustomRedirects];
}
await utils.copyCookie('wikiless', from, checkedInstances, 'theme'); await utils.copyCookie('wikiless', from, checkedInstances, 'theme');
await utils.copyCookie('wikiless', from, checkedInstances, 'default_lang'); await utils.copyCookie('wikiless', from, checkedInstances, 'default_lang');
} }
@ -100,10 +114,14 @@ function initWikilessCookies(test, from) {
function pasteWikilessCookies() { function pasteWikilessCookies() {
return new Promise(async resolve => { return new Promise(async resolve => {
await init(); await init();
if (disableWikipedia || wikipediaProtocol === undefined) { resolve(); return; } if (disableWikipedia || protocol === undefined) { resolve(); return; }
let checkedInstances; let checkedInstances = [];
if (wikipediaProtocol == 'normal') checkedInstances = [...wikilessNormalRedirectsChecks, ...wikilessNormalCustomRedirects] if (protocol == 'loki') checkedInstances = [...wikilessLokiCustomRedirects];
else if (wikipediaProtocol == 'tor') checkedInstances = [...wikilessTorRedirectsChecks, ...wikilessTorCustomRedirects] else if (protocol == 'i2p') checkedInstances = [...wikilessI2pCustomRedirects, ...wikilessI2pRedirectsChecks];
else if (protocol == 'tor') checkedInstances = [...wikilessTorRedirectsChecks, ...wikilessTorCustomRedirects];
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
checkedInstances = [...wikilessNormalRedirectsChecks, ...wikilessNormalCustomRedirects];
}
utils.getCookiesFromStorage('wikiless', checkedInstances, 'theme'); utils.getCookiesFromStorage('wikiless', checkedInstances, 'theme');
utils.getCookiesFromStorage('wikiless', checkedInstances, 'default_lang'); utils.getCookiesFromStorage('wikiless', checkedInstances, 'default_lang');
resolve(); resolve();
@ -123,10 +141,13 @@ function redirect(url, disableOverride) {
GETArguments.push([args[0], args[1]]); GETArguments.push([args[0], args[1]]);
} }
} }
let instancesList; let instancesList = [];
if (wikipediaProtocol == 'normal') instancesList = [...wikilessNormalRedirectsChecks, ...wikilessNormalCustomRedirects]; if (protocol == 'loki') instancesList = [...wikilessLokiCustomRedirects];
else if (wikipediaProtocol == 'tor') instancesList = [...wikilessTorRedirectsChecks, ...wikilessTorCustomRedirects]; else if (protocol == 'i2p') instancesList = [...wikilessI2pCustomRedirects, ...wikilessI2pRedirectsChecks];
else if (wikipediaProtocol == 'i2p') instancesList = [...wikilessI2pRedirectsChecks, ...wikilessI2pCustomRedirects]; else if (protocol == 'tor') instancesList = [...wikilessTorRedirectsChecks, ...wikilessTorCustomRedirects];
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...wikilessNormalRedirectsChecks, ...wikilessNormalCustomRedirects];
}
if (instancesList.length === 0) return; if (instancesList.length === 0) return;
const randomInstance = utils.getRandomInstance(instancesList) const randomInstance = utils.getRandomInstance(instancesList)
@ -158,14 +179,18 @@ function switchInstance(url, disableOverride) {
...wikilessNormalCustomRedirects, ...wikilessNormalCustomRedirects,
...wikilessTorCustomRedirects, ...wikilessTorCustomRedirects,
...wikilessI2pCustomRedirects ...wikilessI2pCustomRedirects,
...wikilessLokiCustomRedirects
]; ];
if (!wikipediaList.includes(protocolHost)) { resolve(); return; } if (!wikipediaList.includes(protocolHost)) { resolve(); return; }
let instancesList; let instancesList = [];
if (wikipediaProtocol == 'normal') instancesList = [...wikilessNormalCustomRedirects, ...wikilessNormalRedirectsChecks]; if (protocol == 'loki') instancesList = [...wikilessLokiCustomRedirects];
else if (wikipediaProtocol == 'tor') instancesList = [...wikilessTorCustomRedirects, ...wikilessTorRedirectsChecks]; else if (protocol == 'i2p') instancesList = [...wikilessI2pCustomRedirects, ...wikilessI2pRedirectsChecks];
else if (wikipediaProtocol == 'i2p') instancesList = [...wikilessI2pCustomRedirects, ...wikilessI2pRedirectsChecks]; else if (protocol == 'tor') instancesList = [...wikilessTorRedirectsChecks, ...wikilessTorCustomRedirects];
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...wikilessNormalRedirectsChecks, ...wikilessNormalCustomRedirects];
}
let index = instancesList.indexOf(protocolHost); let index = instancesList.indexOf(protocolHost);
if (index > -1) instancesList.splice(index, 1); if (index > -1) instancesList.splice(index, 1);
@ -180,7 +205,9 @@ function initDefaults() {
return new Promise(resolve => { return new Promise(resolve => {
fetch('/instances/data.json').then(response => response.text()).then(async data => { fetch('/instances/data.json').then(response => response.text()).then(async data => {
let dataJson = JSON.parse(data); let dataJson = JSON.parse(data);
redirects.wikiless = dataJson.wikiless; for (let i = 0; i < frontends.length; i++) {
redirects[frontends[i]] = dataJson[frontends[i]]
}
browser.storage.local.get('cloudflareBlackList', async r => { browser.storage.local.get('cloudflareBlackList', async r => {
wikilessNormalRedirectsChecks = [...redirects.wikiless.normal]; wikilessNormalRedirectsChecks = [...redirects.wikiless.normal];
for (const instance of r.cloudflareBlackList) { for (const instance of r.cloudflareBlackList) {
@ -190,13 +217,19 @@ function initDefaults() {
browser.storage.local.set({ browser.storage.local.set({
disableWikipedia: true, disableWikipedia: true,
wikipediaRedirects: redirects, wikipediaRedirects: redirects,
wikipediaProtocol: "normal",
wikilessNormalRedirectsChecks: wikilessNormalRedirectsChecks, wikilessNormalRedirectsChecks: wikilessNormalRedirectsChecks,
wikilessTorRedirectsChecks: [...redirects.wikiless.tor],
wikilessI2pRedirectsChecks: [...redirects.wikiless.i2p],
wikilessNormalCustomRedirects: [], wikilessNormalCustomRedirects: [],
wikilessTorRedirectsChecks: [...redirects.wikiless.tor],
wikilessTorCustomRedirects: [], wikilessTorCustomRedirects: [],
wikilessI2pRedirectsChecks: [...redirects.wikiless.i2p],
wikilessI2pCustomRedirects: [], wikilessI2pCustomRedirects: [],
wikilessLokiRedirectsChecks: [...redirects.wikiless.loki],
wikilessLokiCustomRedirects: []
}, () => resolve()); }, () => resolve());
}) })
}) })

View File

@ -16,35 +16,36 @@ const targets = [
/^https?:\/{2}(www\.|)(youtube|youtube-nocookie)\.com\/embed\/..*/, /^https?:\/{2}(www\.|)(youtube|youtube-nocookie)\.com\/embed\/..*/,
]; ];
let redirects = {
"invidious": { const frontends = new Array("invidious", "piped", "pipedMaterial")
"normal": [], const protocols = new Array("normal", "tor", "i2p", "loki")
"tor": []
}, let redirects = {};
"piped": {
"normal": [], for (let i = 0; i < frontends.length; i++) {
"tor": [] redirects[frontends[i]] = {}
}, for (let x = 0; x < protocols.length; x++) {
"pipedMaterial": { redirects[frontends[i]][protocols[x]] = []
"normal": [
"https://piped-material.xn--17b.net",
"https://piped-material.ftp.sh",
],
"tor": []
} }
}; }
function setRedirects(val) { function setRedirects(val) {
browser.storage.local.get('cloudflareBlackList', r => { browser.storage.local.get('cloudflareBlackList', r => {
redirects.invidious = val.invidious; redirects.invidious = val.invidious;
redirects.piped = val.piped; redirects.piped = val.piped;
redirects.pipedMaterial = val.pipedMaterial
invidiousNormalRedirectsChecks = [...redirects.invidious.normal]; invidiousNormalRedirectsChecks = [...redirects.invidious.normal];
pipedNormalRedirectsChecks = [...redirects.piped.normal]; pipedNormalRedirectsChecks = [...redirects.piped.normal];
pipedMaterialNormalRedirectsChecks = [...redirects.pipedMaterial.normal]
for (const instance of r.cloudflareBlackList) { for (const instance of r.cloudflareBlackList) {
const a = invidiousNormalRedirectsChecks.indexOf(instance); const a = invidiousNormalRedirectsChecks.indexOf(instance);
if (a > -1) invidiousNormalRedirectsChecks.splice(a, 1); if (a > -1) invidiousNormalRedirectsChecks.splice(a, 1);
const b = pipedNormalRedirectsChecks.indexOf(instance); const b = pipedNormalRedirectsChecks.indexOf(instance);
if (b > -1) pipedNormalRedirectsChecks.splice(b, 1); if (b > -1) pipedNormalRedirectsChecks.splice(b, 1);
const c = pipedMaterialNormalRedirectsChecks.indexOf(instance);
if (c > -1) pipedMaterialNormalRedirectsChecks.splice(c, 1);
} }
browser.storage.local.set({ browser.storage.local.set({
youtubeRedirects: redirects, youtubeRedirects: redirects,
@ -52,6 +53,8 @@ function setRedirects(val) {
invidiousTorRedirectsChecks: redirects.invidious.tor, invidiousTorRedirectsChecks: redirects.invidious.tor,
pipedNormalRedirectsChecks, pipedNormalRedirectsChecks,
pipedTorRedirectsChecks: redirects.piped.tor, pipedTorRedirectsChecks: redirects.piped.tor,
pipedMaterialNormalRedirectsChecks,
// pipedMaterialTorRedirectsChecks: redirects.pipedMaterial.tor
}) })
}) })
} }
@ -60,21 +63,28 @@ let
disableYoutube, disableYoutube,
onlyEmbeddedVideo, onlyEmbeddedVideo,
youtubeFrontend, youtubeFrontend,
youtubeProtocol, protocol,
protocolFallback,
youtubeEmbedFrontend, youtubeEmbedFrontend,
youtubeRedirects, youtubeRedirects,
invidiousNormalRedirectsChecks, invidiousNormalRedirectsChecks,
invidiousNormalCustomRedirects, invidiousNormalCustomRedirects,
invidiousTorRedirectsChecks, invidiousTorRedirectsChecks,
invidiousTorCustomRedirects, invidiousTorCustomRedirects,
invidiousI2pCustomRedirects,
invidiousLokiCustomRedirects,
pipedNormalRedirectsChecks, pipedNormalRedirectsChecks,
pipedNormalCustomRedirects, pipedNormalCustomRedirects,
pipedTorRedirectsChecks, pipedTorRedirectsChecks,
pipedTorCustomRedirects, pipedTorCustomRedirects,
pipedI2pCustomRedirects,
pipedLokiCustomRedirects,
pipedMaterialNormalRedirectsChecks, pipedMaterialNormalRedirectsChecks,
pipedMaterialNormalCustomRedirects, pipedMaterialNormalCustomRedirects,
pipedMaterialTorRedirectsChecks, pipedMaterialTorRedirectsChecks,
pipedMaterialTorCustomRedirects; pipedMaterialTorCustomRedirects,
pipedMaterialI2pCustomRedirects,
pipedMaterialLokiCustomRedirects;
function init() { function init() {
return new Promise(resolve => { return new Promise(resolve => {
@ -83,41 +93,55 @@ function init() {
"disableYoutube", "disableYoutube",
"onlyEmbeddedVideo", "onlyEmbeddedVideo",
"youtubeFrontend", "youtubeFrontend",
"youtubeProtocol", "protocol",
"protocolFallback",
"youtubeEmbedFrontend", "youtubeEmbedFrontend",
"youtubeRedirects", "youtubeRedirects",
"invidiousNormalRedirectsChecks", "invidiousNormalRedirectsChecks",
"invidiousNormalCustomRedirects", "invidiousNormalCustomRedirects",
"invidiousTorRedirectsChecks", "invidiousTorRedirectsChecks",
"invidiousTorCustomRedirects", "invidiousTorCustomRedirects",
"invidiousI2pCustomRedirects",
"invidiousLokiCustomRedirects",
"pipedNormalRedirectsChecks", "pipedNormalRedirectsChecks",
"pipedNormalCustomRedirects", "pipedNormalCustomRedirects",
"pipedTorRedirectsChecks", "pipedTorRedirectsChecks",
"pipedTorCustomRedirects", "pipedTorCustomRedirects",
"pipedI2pCustomRedirects",
"pipedLokiCustomRedirects",
"pipedMaterialNormalRedirectsChecks", "pipedMaterialNormalRedirectsChecks",
"pipedMaterialNormalCustomRedirects", "pipedMaterialNormalCustomRedirects",
"pipedMaterialTorRedirectsChecks", "pipedMaterialTorRedirectsChecks",
"pipedMaterialTorCustomRedirects", "pipedMaterialTorCustomRedirects",
"pipedMaterialI2pCustomRedirects",
"pipedMaterialLokiCustomRedirects"
], ],
r => { r => {
disableYoutube = r.disableYoutube; disableYoutube = r.disableYoutube;
onlyEmbeddedVideo = r.onlyEmbeddedVideo; onlyEmbeddedVideo = r.onlyEmbeddedVideo;
youtubeFrontend = r.youtubeFrontend; youtubeFrontend = r.youtubeFrontend;
youtubeProtocol = r.youtubeProtocol; protocol = r.protocol;
protocolFallback = r.protocolFallback;
youtubeEmbedFrontend = r.youtubeEmbedFrontend; youtubeEmbedFrontend = r.youtubeEmbedFrontend;
youtubeRedirects = r.youtubeRedirects; youtubeRedirects = r.youtubeRedirects;
invidiousNormalRedirectsChecks = r.invidiousNormalRedirectsChecks; invidiousNormalRedirectsChecks = r.invidiousNormalRedirectsChecks;
invidiousNormalCustomRedirects = r.invidiousNormalCustomRedirects; invidiousNormalCustomRedirects = r.invidiousNormalCustomRedirects;
invidiousTorRedirectsChecks = r.invidiousTorRedirectsChecks; invidiousTorRedirectsChecks = r.invidiousTorRedirectsChecks;
invidiousTorCustomRedirects = r.invidiousTorCustomRedirects; invidiousTorCustomRedirects = r.invidiousTorCustomRedirects;
invidiousI2pCustomRedirects = r.invidiousI2pCustomRedirects;
invidiousLokiCustomRedirects = r.invidiousLokiCustomRedirects;
pipedNormalRedirectsChecks = r.pipedNormalRedirectsChecks; pipedNormalRedirectsChecks = r.pipedNormalRedirectsChecks;
pipedNormalCustomRedirects = r.pipedNormalCustomRedirects; pipedNormalCustomRedirects = r.pipedNormalCustomRedirects;
pipedTorRedirectsChecks = r.pipedTorRedirectsChecks; pipedTorRedirectsChecks = r.pipedTorRedirectsChecks;
pipedTorCustomRedirects = r.pipedTorCustomRedirects; pipedTorCustomRedirects = r.pipedTorCustomRedirects;
pipedI2pCustomRedirects = r.pipedI2pCustomRedirects;
pipedLokiCustomRedirects = r.pipedLokiCustomRedirects;
pipedMaterialNormalRedirectsChecks = r.pipedMaterialNormalRedirectsChecks; pipedMaterialNormalRedirectsChecks = r.pipedMaterialNormalRedirectsChecks;
pipedMaterialNormalCustomRedirects = r.pipedMaterialNormalCustomRedirects; pipedMaterialNormalCustomRedirects = r.pipedMaterialNormalCustomRedirects;
pipedMaterialTorRedirectsChecks = r.pipedMaterialTorRedirectsChecks; pipedMaterialTorRedirectsChecks = r.pipedMaterialTorRedirectsChecks;
pipedMaterialTorCustomRedirects = r.pipedMaterialTorCustomRedirects; pipedMaterialTorCustomRedirects = r.pipedMaterialTorCustomRedirects;
pipedMaterialI2pCustomRedirects - r.pipedMaterialI2pCustomRedirects;
pipedMaterialLokiCustomRedirects = r.pipedMaterialLokiCustomRedirects;
resolve(); resolve();
} }
) )
@ -140,12 +164,18 @@ function all() {
...invidiousNormalCustomRedirects, ...invidiousNormalCustomRedirects,
...invidiousTorCustomRedirects, ...invidiousTorCustomRedirects,
...invidiousI2pCustomRedirects,
...invidiousLokiCustomRedirects,
...pipedNormalCustomRedirects, ...pipedNormalCustomRedirects,
...pipedTorCustomRedirects, ...pipedTorCustomRedirects,
...pipedI2pCustomRedirects,
...pipedLokiCustomRedirects,
...pipedMaterialNormalCustomRedirects, ...pipedMaterialNormalCustomRedirects,
...pipedMaterialTorCustomRedirects, ...pipedMaterialTorCustomRedirects,
...pipedMaterialI2pCustomRedirects,
...pipedMaterialLokiCustomRedirects
]; ];
} }
@ -160,7 +190,7 @@ function redirect(url, type, initiator, disableOverride) {
const isFreetube = youtubeFrontend == 'freetube'; const isFreetube = youtubeFrontend == 'freetube';
const isYatte = youtubeFrontend == 'yatte'; const isYatte = youtubeFrontend == 'yatte';
const isFrontendYoutube = youtubeEmbedFrontend == "youtube"; //const isFrontendYoutube = youtubeEmbedFrontend == "youtube";
const isFrontendInvidious = youtubeEmbedFrontend == 'invidious'; const isFrontendInvidious = youtubeEmbedFrontend == 'invidious';
const isFrontendPiped = youtubeEmbedFrontend == 'piped'; const isFrontendPiped = youtubeEmbedFrontend == 'piped';
const isFrontendPipedMaterial = youtubeEmbedFrontend == 'pipedMaterial'; const isFrontendPipedMaterial = youtubeEmbedFrontend == 'pipedMaterial';
@ -172,31 +202,43 @@ function redirect(url, type, initiator, disableOverride) {
if (onlyEmbeddedVideo == 'onlyEmbedded' && main_frame) return; if (onlyEmbeddedVideo == 'onlyEmbedded' && main_frame) return;
if (onlyEmbeddedVideo == 'onlyNotEmbedded' && !main_frame) return; if (onlyEmbeddedVideo == 'onlyNotEmbedded' && !main_frame) return;
if ((isFreetube || isYatte) && sub_frame && isFrontendYoutube) return; //if ((isFreetube || isYatte) && sub_frame && isFrontendYoutube) return;
if (isYatte && main_frame) return url.href.replace(/^https?:\/{2}/, 'yattee://'); if (isYatte && main_frame) return url.href.replace(/^https?:\/{2}/, 'yattee://');
if (isFreetube && main_frame) return `freetube://https://youtube.com${url.pathname}${url.search}`; if (isFreetube && main_frame) return `freetube://https://youtube.com${url.pathname}${url.search}`;
if (isInvidious || ((isFreetube || isYatte) && sub_frame && isFrontendInvidious)) { if (isInvidious || ((isFreetube || isYatte) && sub_frame && isFrontendInvidious)) {
let instancesList; let instancesList = [];
if (youtubeProtocol == 'normal') instancesList = [...invidiousNormalRedirectsChecks, ...invidiousNormalCustomRedirects]; if (protocol == 'loki') instancesList = [...invidiousLokiCustomRedirects];
else if (youtubeProtocol == 'tor') instancesList = [...invidiousTorRedirectsChecks, ...invidiousTorCustomRedirects]; else if (protocol == 'i2p') instancesList = [...invidiousI2pCustomRedirects];
else if (protocol == 'tor') instancesList = [...invidiousTorRedirectsChecks, ...invidiousTorCustomRedirects];
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...invidiousNormalRedirectsChecks, ...invidiousNormalCustomRedirects];
}
if (instancesList.length === 0) return; if (instancesList.length === 0) return;
const randomInstance = utils.getRandomInstance(instancesList); const randomInstance = utils.getRandomInstance(instancesList);
return `${randomInstance}${url.pathname}${url.search}`; return `${randomInstance}${url.pathname}${url.search}`;
} }
if (isPiped || ((isFreetube || isYatte) && sub_frame && isFrontendPiped)) { if (isPiped || ((isFreetube || isYatte) && sub_frame && isFrontendPiped)) {
let instancesList; let instancesList = [];
if (youtubeProtocol == 'normal') instancesList = [...pipedNormalRedirectsChecks, ...pipedNormalCustomRedirects]; if (protocol == 'loki') instancesList = [...pipedLokiCustomRedirects];
else if (youtubeProtocol == 'tor') instancesList = [...pipedTorRedirectsChecks, ...pipedTorCustomRedirects]; else if (protocol == 'i2p') instancesList = [...pipedI2pCustomRedirects];
else if (protocol == 'tor') instancesList = [...pipedTorRedirectsChecks, ...pipedTorCustomRedirects];
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...pipedNormalRedirectsChecks, ...pipedNormalCustomRedirects];
}
if (instancesList.length === 0) return; if (instancesList.length === 0) return;
const randomInstance = utils.getRandomInstance(instancesList); const randomInstance = utils.getRandomInstance(instancesList);
return `${randomInstance}${url.pathname}${url.search}`; return `${randomInstance}${url.pathname}${url.search}`;
} }
if (isPipedMaterial || ((isFreetube || isYatte) && sub_frame && isFrontendPipedMaterial)) { if (isPipedMaterial || ((isFreetube || isYatte) && sub_frame && isFrontendPipedMaterial)) {
let instancesList; let instancesList = [];
if (youtubeProtocol == 'normal') instancesList = [...pipedMaterialNormalRedirectsChecks, ...pipedMaterialNormalCustomRedirects]; if (protocol == 'loki') instancesList = [...pipedMaterialLokiCustomRedirects];
else if (youtubeProtocol == 'tor') instancesList = [...pipedMaterialTorRedirectsChecks, ...pipedMaterialTorCustomRedirects]; else if (protocol == 'i2p') instancesList = [...pipedMaterialI2pCustomRedirects];
else if (protocol == 'tor') instancesList = [...pipedMaterialTorCustomRedirects]; //...pipedMaterialTorRedirectsChecks,
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...pipedMaterialNormalRedirectsChecks, ...pipedMaterialNormalCustomRedirects];
}
const randomInstance = utils.getRandomInstance(instancesList); const randomInstance = utils.getRandomInstance(instancesList);
return `${randomInstance}${url.pathname}${url.search}`; return `${randomInstance}${url.pathname}${url.search}`;
} }
@ -219,17 +261,27 @@ function switchInstance(url, disableOverride) {
const protocolHost = utils.protocolHost(url); const protocolHost = utils.protocolHost(url);
if (!all().includes(protocolHost)) { resolve(); return; } if (!all().includes(protocolHost)) { resolve(); return; }
let instancesList; let instancesList = [];
if (youtubeProtocol == 'normal') { if (protocol == 'loki') {
if (youtubeFrontend == 'invidious') instancesList = [...invidiousLokiCustomRedirects]; //...invidiousLokiRedirectsChecks,
else if (youtubeFrontend == 'piped') instancesList = [...pipedLokiCustomRedirects]; //...pipedLokiRedirectsChecks,
else if (youtubeFrontend == 'pipedMaterial') instancesList = [...pipedMaterialLokiCustomRedirects]; //...pipedMaterialLokiRedirectsChecks,
}
else if (protocol == 'i2p') {
if (youtubeFrontend == 'invidious') instancesList = [...invidiousI2pCustomRedirects]; //...invidiousI2pRedirectsChecks,
else if (youtubeFrontend == 'piped') instancesList = [...pipedI2pCustomRedirects]; //...pipedI2pRedirectsChecks,
else if (youtubeFrontend == 'pipedMaterial') instancesList = [...pipedMaterialI2pCustomRedirects]; //...pipedMaterialI2pRedirectsChecks,
}
else if (protocol == 'tor') {
if (youtubeFrontend == 'invidious') instancesList = [...invidiousTorRedirectsChecks, ...invidiousTorCustomRedirects];
else if (youtubeFrontend == 'piped') instancesList = [...pipedTorRedirectsChecks, ...pipedTorCustomRedirects];
else if (youtubeFrontend == 'pipedMaterial') instancesList = [...pipedMaterialTorCustomRedirects]; //...pipedMaterialTorRedirectsChecks,
}
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
if (youtubeFrontend == 'invidious') instancesList = [...invidiousNormalRedirectsChecks, ...invidiousNormalCustomRedirects]; if (youtubeFrontend == 'invidious') instancesList = [...invidiousNormalRedirectsChecks, ...invidiousNormalCustomRedirects];
else if (youtubeFrontend == 'piped') instancesList = [...pipedNormalRedirectsChecks, ...pipedNormalCustomRedirects]; else if (youtubeFrontend == 'piped') instancesList = [...pipedNormalRedirectsChecks, ...pipedNormalCustomRedirects];
else if (youtubeFrontend == 'pipedMaterial') instancesList = [...pipedMaterialNormalRedirectsChecks, ...pipedMaterialNormalCustomRedirects]; else if (youtubeFrontend == 'pipedMaterial') instancesList = [...pipedMaterialNormalRedirectsChecks, ...pipedMaterialNormalCustomRedirects];
} }
else if (youtubeProtocol == 'tor') {
if (youtubeFrontend == 'invidious') instancesList = [...invidiousTorRedirectsChecks, ...invidiousTorCustomRedirects];
else if (youtubeFrontend == 'piped') instancesList = [...pipedTorRedirectsChecks, ...pipedTorCustomRedirects];
else if (youtubeFrontend == 'pipedMaterial') instancesList = [...pipedMaterialTorRedirectsChecks, ...pipedMaterialTorCustomRedirects];
}
const i = instancesList.indexOf(protocolHost); const i = instancesList.indexOf(protocolHost);
if (i > -1) instancesList.splice(i, 1); if (i > -1) instancesList.splice(i, 1);
@ -244,8 +296,9 @@ function initDefaults() {
return new Promise(async resolve => { return new Promise(async resolve => {
fetch('/instances/data.json').then(response => response.text()).then(async data => { fetch('/instances/data.json').then(response => response.text()).then(async data => {
let dataJson = JSON.parse(data); let dataJson = JSON.parse(data);
redirects.invidious = dataJson.invidious; for (let i = 0; i < frontends.length; i++) {
redirects.piped = dataJson.piped; redirects[frontends[i]] = dataJson[frontends[i]]
}
browser.storage.local.get('cloudflareBlackList', async r => { browser.storage.local.get('cloudflareBlackList', async r => {
invidiousNormalRedirectsChecks = [...redirects.invidious.normal]; invidiousNormalRedirectsChecks = [...redirects.invidious.normal];
@ -267,9 +320,7 @@ function initDefaults() {
disableYoutube: false, disableYoutube: false,
enableYoutubeCustomSettings: false, enableYoutubeCustomSettings: false,
onlyEmbeddedVideo: 'both', onlyEmbeddedVideo: 'both',
youtubeRedirects: redirects, youtubeRedirects: redirects,
youtubeFrontend: 'invidious', youtubeFrontend: 'invidious',
invidiousNormalRedirectsChecks: invidiousNormalRedirectsChecks, invidiousNormalRedirectsChecks: invidiousNormalRedirectsChecks,
@ -278,20 +329,37 @@ function initDefaults() {
invidiousTorRedirectsChecks: [...redirects.invidious.tor], invidiousTorRedirectsChecks: [...redirects.invidious.tor],
invidiousTorCustomRedirects: [], invidiousTorCustomRedirects: [],
invidiousI2pRedirectsChecks: [...redirects.invidious.i2p],
invidiousI2pCustomRedirects: [],
invidiousLokiRedirectsChecks: [...redirects.invidious.loki],
invidiousLokiCustomRedirects: [],
pipedNormalRedirectsChecks: pipedNormalRedirectsChecks, pipedNormalRedirectsChecks: pipedNormalRedirectsChecks,
pipedNormalCustomRedirects: [], pipedNormalCustomRedirects: [],
pipedTorRedirectsChecks: [...redirects.piped.tor], pipedTorRedirectsChecks: [...redirects.piped.tor],
pipedTorCustomRedirects: [], pipedTorCustomRedirects: [],
pipedI2pRedirectsChecks: [...redirects.piped.i2p],
pipedI2pCustomRedirects: [],
pipedLokiRedirectsChecks: [...redirects.piped.loki],
pipedLokiCustomRedirects: [],
pipedMaterialNormalRedirectsChecks: pipedMaterialNormalRedirectsChecks, pipedMaterialNormalRedirectsChecks: pipedMaterialNormalRedirectsChecks,
pipedMaterialNormalCustomRedirects: [], pipedMaterialNormalCustomRedirects: [],
pipedMaterialTorRedirectsChecks: [...redirects.pipedMaterial.tor], pipedMaterialTorRedirectsChecks: [...redirects.pipedMaterial.tor],
pipedMaterialTorCustomRedirects: [], pipedMaterialTorCustomRedirects: [],
youtubeEmbedFrontend: 'invidious', pipedMaterialI2pRedirectsChecks: [...redirects.pipedMaterial.i2p],
youtubeProtocol: 'normal', pipedMaterialI2pCustomRedirects: [],
pipedMaterialLokiRedirectsChecks: [...redirects.pipedMaterial.loki],
pipedMaterialLokiCustomRedirects: [],
youtubeEmbedFrontend: 'invidious'
}, () => resolve()) }, () => resolve())
}) })
}) })
@ -308,11 +376,18 @@ function copyPasteInvidiousCookies(test, from) {
...invidiousTorRedirectsChecks, ...invidiousTorRedirectsChecks,
...invidiousNormalCustomRedirects, ...invidiousNormalCustomRedirects,
...invidiousTorCustomRedirects, ...invidiousTorCustomRedirects,
...invidiousI2pCustomRedirects,
...invidiousLokiCustomRedirects
].includes(protocolHost)) { resolve(); return; } ].includes(protocolHost)) { resolve(); return; }
if (!test) { if (!test) {
let checkedInstances; let checkedInstances = [];
if (youtubeProtocol == 'normal') checkedInstances = [...invidiousNormalRedirectsChecks, ...invidiousNormalCustomRedirects]
else if (youtubeProtocol == 'tor') checkedInstances = [...invidiousTorRedirectsChecks, ...invidiousTorCustomRedirects] if (protocol == 'loki') checkedInstances = [...invidiousLokiCustomRedirects];
else if (protocol == 'i2p') checkedInstances = [...invidiousI2pCustomRedirects];
else if (protocol == 'tor') checkedInstances = [...invidiousTorRedirectsChecks, ...invidiousTorCustomRedirects];
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
checkedInstances = [...invidiousNormalRedirectsChecks, ...invidiousNormalCustomRedirects];
}
const i = checkedInstances.indexOf(protocolHost); const i = checkedInstances.indexOf(protocolHost);
if (i !== -1) checkedInstances.splice(i, 1); if (i !== -1) checkedInstances.splice(i, 1);
await utils.copyCookie('invidious', from, checkedInstances, 'PREFS'); await utils.copyCookie('invidious', from, checkedInstances, 'PREFS');
@ -325,9 +400,13 @@ function pasteInvidiousCookies() {
return new Promise(async resolve => { return new Promise(async resolve => {
await init(); await init();
if (disableYoutube || youtubeFrontend != 'invidious') { resolve(); return; } if (disableYoutube || youtubeFrontend != 'invidious') { resolve(); return; }
let checkedInstances; let checkedInstances = [];
if (youtubeProtocol == 'normal') checkedInstances = [...invidiousNormalRedirectsChecks, ...invidiousNormalCustomRedirects] if (protocol == 'loki') checkedInstances = [...invidiousLokiCustomRedirects];
else if (youtubeProtocol == 'tor') checkedInstances = [...invidiousTorRedirectsChecks, ...invidiousTorCustomRedirects] else if (protocol == 'i2p') checkedInstances = [...invidiousI2pCustomRedirects];
else if (protocol == 'tor') checkedInstances = [...invidiousTorRedirectsChecks, ...invidiousTorCustomRedirects]
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
checkedInstances = [...invidiousNormalRedirectsChecks, ...invidiousNormalCustomRedirects]
}
utils.getCookiesFromStorage('invidious', checkedInstances, 'PREFS'); utils.getCookiesFromStorage('invidious', checkedInstances, 'PREFS');
resolve(); resolve();
}) })
@ -343,14 +422,20 @@ function copyPastePipedLocalStorage(test, url, tabId) {
...pipedNormalRedirectsChecks, ...pipedNormalRedirectsChecks,
...pipedTorRedirectsChecks, ...pipedTorRedirectsChecks,
...pipedTorCustomRedirects, ...pipedTorCustomRedirects,
...pipedI2pCustomRedirects,
...pipedLokiCustomRedirects
].includes(protocolHost)) { resolve(); return; } ].includes(protocolHost)) { resolve(); return; }
if (!test) { if (!test) {
browser.tabs.executeScript(tabId, { file: "/assets/javascripts/youtube/get_piped_preferences.js", runAt: "document_start" }); browser.tabs.executeScript(tabId, { file: "/assets/javascripts/youtube/get_piped_preferences.js", runAt: "document_start" });
let checkedInstances; let checkedInstances = [];
if (youtubeProtocol == 'normal') checkedInstances = [...pipedNormalCustomRedirects, ...pipedNormalRedirectsChecks] if (protocol == 'loki') checkedInstances = [...pipedLokiCustomRedirects];
else if (youtubeProtocol == 'tor') checkedInstances = [...pipedTorRedirectsChecks, ...pipedTorCustomRedirects] else if (protocol == 'i2p') checkedInstances = [...pipedI2pCustomRedirects];
else if (protocol == 'tor') checkedInstances = [...pipedTorRedirectsChecks, ...pipedTorCustomRedirects]
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
checkedInstances = [...pipedNormalCustomRedirects, ...pipedNormalRedirectsChecks]
}
const i = checkedInstances.indexOf(protocolHost); const i = checkedInstances.indexOf(protocolHost);
if (i !== -1) checkedInstances.splice(i, 1); if (i !== -1) checkedInstances.splice(i, 1);
for (const to of checkedInstances) { for (const to of checkedInstances) {
@ -365,9 +450,13 @@ function pastePipedLocalStorage() {
return new Promise(async resolve => { return new Promise(async resolve => {
await init(); await init();
if (disableYoutube || youtubeFrontend != 'piped') { resolve(); return; } if (disableYoutube || youtubeFrontend != 'piped') { resolve(); return; }
let checkedInstances; let checkedInstances = [];
if (youtubeProtocol == 'normal') checkedInstances = [...pipedNormalCustomRedirects, ...pipedNormalRedirectsChecks] if (protocol == 'loki') checkedInstances = [...pipedLokiCustomRedirects];
else if (youtubeProtocol == 'tor') checkedInstances = [...pipedTorRedirectsChecks, ...pipedTorCustomRedirects] else if (protocol == 'i2p') checkedInstances = [...pipedI2pCustomRedirects];
else if (protocol == 'tor') checkedInstances = [...pipedTorRedirectsChecks, ...pipedTorCustomRedirects]
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
checkedInstances = [...pipedNormalCustomRedirects, ...pipedNormalRedirectsChecks]
}
for (const to of checkedInstances) { for (const to of checkedInstances) {
browser.tabs.create({ url: to }, browser.tabs.create({ url: to },
tab => browser.tabs.executeScript(tab.id, { file: "/assets/javascripts/youtube/set_piped_preferences.js", runAt: "document_start" })) tab => browser.tabs.executeScript(tab.id, { file: "/assets/javascripts/youtube/set_piped_preferences.js", runAt: "document_start" }))
@ -384,16 +473,22 @@ function copyPastePipedMaterialLocalStorage(test, url, tabId,) {
if (![ if (![
...pipedMaterialNormalRedirectsChecks, ...pipedMaterialNormalRedirectsChecks,
...pipedMaterialNormalCustomRedirects, ...pipedMaterialNormalCustomRedirects,
...pipedMaterialTorRedirectsChecks, //...pipedMaterialTorRedirectsChecks,
...pipedMaterialTorCustomRedirects, ...pipedMaterialTorCustomRedirects,
...pipedMaterialI2pCustomRedirects,
...pipedMaterialLokiCustomRedirects
].includes(protocolHost)) { resolve(); return; } ].includes(protocolHost)) { resolve(); return; }
if (!test) { if (!test) {
browser.tabs.executeScript(tabId, { file: "/assets/javascripts/youtube/get_pipedMaterial_preferences.js", runAt: "document_start" }); browser.tabs.executeScript(tabId, { file: "/assets/javascripts/youtube/get_pipedMaterial_preferences.js", runAt: "document_start" });
let checkedInstances; let checkedInstances = [];
if (youtubeProtocol == 'normal') checkedInstances = [...pipedMaterialNormalRedirectsChecks, ...pipedMaterialNormalCustomRedirects] if (protocol == 'loki') checkedInstances = [...pipedMaterialLokiCustomRedirects];
else if (youtubeProtocol == 'tor') checkedInstances = [...pipedMaterialTorRedirectsChecks, ...pipedMaterialTorCustomRedirects] else if (protocol == 'i2p') checkedInstances = [...pipedMaterialI2pCustomRedirects];
else if (protocol == 'tor') checkedInstances = [...pipedMaterialTorCustomRedirects]; //...pipedMaterialTorRedirectsChecks,
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
checkedInstances = [...pipedMaterialNormalRedirectsChecks, ...pipedMaterialNormalCustomRedirects]
}
const i = checkedInstances.indexOf(protocolHost); const i = checkedInstances.indexOf(protocolHost);
if (i !== -1) checkedInstances.splice(i, 1); if (i !== -1) checkedInstances.splice(i, 1);
for (const to of checkedInstances) for (const to of checkedInstances)
@ -410,9 +505,13 @@ function pastePipedMaterialLocalStorage() {
return new Promise(async resolve => { return new Promise(async resolve => {
await init(); await init();
if (disableYoutube || youtubeFrontend != 'pipedMaterial') { resolve(); return; } if (disableYoutube || youtubeFrontend != 'pipedMaterial') { resolve(); return; }
let checkedInstances; let checkedInstances = [];
if (youtubeProtocol == 'normal') checkedInstances = [...pipedMaterialNormalRedirectsChecks, ...pipedMaterialNormalCustomRedirects] if (protocol == 'loki') checkedInstances = [...pipedMaterialLokiCustomRedirects];
else if (youtubeProtocol == 'tor') checkedInstances = [...pipedMaterialTorRedirectsChecks, ...pipedMaterialTorCustomRedirects] else if (protocol == 'i2p') checkedInstances = [...pipedMaterialI2pCustomRedirects];
else if (protocol == 'tor') checkedInstances = [...pipedMaterialTorCustomRedirects]; //...pipedMaterialTorRedirectsChecks,
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
checkedInstances = [...pipedMaterialNormalRedirectsChecks, ...pipedMaterialNormalCustomRedirects]
}
for (const to of checkedInstances) { for (const to of checkedInstances) {
browser.tabs.create({ url: to }, browser.tabs.create({ url: to },
tab => browser.tabs.executeScript(tab.id, { file: "/assets/javascripts/youtube/set_pipedMaterial_preferences.js", runAt: "document_start" })) tab => browser.tabs.executeScript(tab.id, { file: "/assets/javascripts/youtube/set_pipedMaterial_preferences.js", runAt: "document_start" }))
@ -427,18 +526,26 @@ function removeXFrameOptions(e) {
if (e.type == 'main_frame') { if (e.type == 'main_frame') {
for (const i in e.responseHeaders) { for (const i in e.responseHeaders) {
if (e.responseHeaders[i].name == 'content-security-policy') { if (e.responseHeaders[i].name == 'content-security-policy') {
let instancesList; let instancesList = [];
if (youtubeFrontend == 'invidious') { if (protocol == 'loki') {
if (youtubeProtocol == 'normal') instancesList = [...invidiousNormalRedirectsChecks, ...invidiousNormalCustomRedirects]; if (youtubeFrontend == 'invidious') instancesList = [...invidiousLokiCustomRedirects]; //...invidiousLokiRedirectsChecks,
else if (youtubeProtocol == 'tor') instancesList = [...invidiousTorRedirectsChecks, ...invidiousTorCustomRedirects]; if (youtubeFrontend == 'piped') instancesList = [...pipedLokiCustomRedirects]; //...pipedLokiRedirectsChecks,
if (youtubeFrontend == 'pipedMaterial') instancesList = [...pipedMaterialLokiCustomRedirects]; //...pipedMaterialLokiRedirectsChecks,
} }
else if (youtubeFrontend == 'piped') { else if (protocol == 'i2p') {
if (youtubeProtocol == 'normal') instancesList = [...pipedNormalRedirectsChecks, ...pipedNormalCustomRedirects]; if (youtubeFrontend == 'invidious') instancesList = [...invidiousI2pCustomRedirects]; //...invidiousI2pRedirectsChecks,
else if (youtubeProtocol == 'tor') instancesList = [...pipedTorRedirectsChecks, ...pipedTorCustomRedirects]; if (youtubeFrontend == 'piped') instancesList = [...pipedI2pCustomRedirects]; //...pipedI2pRedirectsChecks,
if (youtubeFrontend == 'pipedMaterial') instancesList = [...pipedMaterialI2pCustomRedirects]; //...pipedMaterialI2pRedirectsChecks,
} }
else if (youtubeFrontend == 'pipedMaterial') { else if (protocol == 'tor') {
if (youtubeProtocol == 'normal') instancesList = [...pipedMaterialNormalRedirectsChecks, ...pipedMaterialNormalCustomRedirects]; if (youtubeFrontend == 'invidious') instancesList = [...invidiousTorRedirectsChecks, ...invidiousTorCustomRedirects];
else if (youtubeProtocol == 'tor') instancesList = [...pipedMaterialTorRedirectsChecks, ...pipedMaterialTorCustomRedirects]; if (youtubeFrontend == 'piped') instancesList = [...pipedTorRedirectsChecks, ...pipedTorCustomRedirects];
if (youtubeFrontend == 'pipedMaterial') instancesList = [...pipedMaterialTorCustomRedirects]; //...pipedMaterialTorRedirectsChecks,
}
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
if (youtubeFrontend == 'invidious') instancesList = [...invidiousNormalRedirectsChecks, ...invidiousNormalCustomRedirects];
if (youtubeFrontend == 'piped') instancesList = [...pipedNormalRedirectsChecks, ...pipedNormalCustomRedirects];
if (youtubeFrontend == 'pipedMaterial') instancesList = [...pipedMaterialNormalRedirectsChecks, ...pipedMaterialNormalCustomRedirects];
} }
let securityPolicyList = e.responseHeaders[i].value.split(';'); let securityPolicyList = e.responseHeaders[i].value.split(';');
for (const i in securityPolicyList) securityPolicyList[i] = securityPolicyList[i].trim(); for (const i in securityPolicyList) securityPolicyList[i] = securityPolicyList[i].trim();

View File

@ -12,26 +12,43 @@ let redirects = {
"normal": [ "normal": [
"https://beatbump.ml" "https://beatbump.ml"
], ],
"tor": [] "tor": [],
"i2p": [],
"loki": []
}, },
}; };
let let
disableYoutubeMusic, disableYoutubeMusic,
protocol,
protocolFallback,
beatbumpNormalRedirectsChecks, beatbumpNormalRedirectsChecks,
beatbumpNormalCustomRedirects; beatbumpNormalCustomRedirects,
beatbumpTorCustomRedirects,
beatbumpI2pCustomRedirects,
beatbumpLokiCustomRedirects;
function init() { function init() {
browser.storage.local.get( browser.storage.local.get(
[ [
"disableYoutubeMusic", "disableYoutubeMusic",
"protocol",
"protocolFallback",
"beatbumpNormalRedirectsChecks", "beatbumpNormalRedirectsChecks",
"beatbumpNormalCustomRedirects", "beatbumpNormalCustomRedirects",
"beatbumpTorCustomRedirects",
"beatbumpI2pCustomRedirects",
"beatbumpLokiCustomRedirects"
], ],
r => { r => {
disableYoutubeMusic = r.disableYoutubeMusic; disableYoutubeMusic = r.disableYoutubeMusic;
protocol = r.protocol;
protocolFallback = r.protocolFallback;
beatbumpNormalRedirectsChecks = r.beatbumpNormalRedirectsChecks; beatbumpNormalRedirectsChecks = r.beatbumpNormalRedirectsChecks;
beatbumpNormalCustomRedirects = r.beatbumpNormalCustomRedirects; beatbumpNormalCustomRedirects = r.beatbumpNormalCustomRedirects;
beatbumpTorCustomRedirects = r.beatbumpTorCustomRedirects;
beatbumpI2pCustomRedirects = r.beatbumpI2pCustomRedirects;
beatbumpLokiCustomRedirects = r.beatbumpLokiCustomRedirects;
} }
) )
} }
@ -75,7 +92,13 @@ function redirect(url, disableOverride) {
if (disableYoutubeMusic && !disableOverride) return; if (disableYoutubeMusic && !disableOverride) return;
if (!targets.some(rx => rx.test(url.href))) return; if (!targets.some(rx => rx.test(url.href))) return;
let instancesList = [...beatbumpNormalRedirectsChecks, ...beatbumpNormalCustomRedirects]; let instancesList = [];
if (protocol == 'loki') instancesList = [...beatbumpLokiCustomRedirects];
else if (protocol == 'i2p') instancesList = [...beatbumpI2pCustomRedirects];
else if (protocol == 'tor') instancesList = [...beatbumpTorCustomRedirects];
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
instancesList = [...beatbumpNormalRedirectsChecks, ...beatbumpNormalCustomRedirects];
}
if (instancesList.length === 0) return; if (instancesList.length === 0) return;
const randomInstance = utils.getRandomInstance(instancesList); const randomInstance = utils.getRandomInstance(instancesList);
return `${randomInstance}${url.pathname}${url.search}` return `${randomInstance}${url.pathname}${url.search}`
@ -93,6 +116,15 @@ async function initDefaults() {
beatbumpNormalRedirectsChecks: [...redirects.beatbump.normal], beatbumpNormalRedirectsChecks: [...redirects.beatbump.normal],
beatbumpNormalCustomRedirects: [], beatbumpNormalCustomRedirects: [],
beatbumpTorRedirectsChecks: [...redirects.beatbump.tor],
beatbumpTorCustomRedirects: [],
beatbumpI2pRedirectsChecks: [...redirects.beatbump.i2p],
beatbumpI2pCustomRedirects: [],
beatbumpLokiRedirectsChecks: [...redirects.beatbump.loki],
beatbumpLokiCustomRedirects: []
}, () => resolve()) }, () => resolve())
) )
} }

View File

@ -7,7 +7,7 @@
"https://piped.syncpundit.com", "https://piped.syncpundit.com",
"https://piped.mha.fi", "https://piped.mha.fi",
"https://piped.shimul.me", "https://piped.shimul.me",
"https://pipedus.palash.dev/", "https://pipedus.palash.dev",
"https://nitter.domain.glass", "https://nitter.domain.glass",
"https://birdsite.xanny.family", "https://birdsite.xanny.family",
"https://nitter.moomoo.me", "https://nitter.moomoo.me",
@ -16,8 +16,10 @@
"https://nitter.winscloud.net", "https://nitter.winscloud.net",
"https://twtr.bch.bar", "https://twtr.bch.bar",
"https://twitter.dr460nf1r3.org", "https://twitter.dr460nf1r3.org",
"https://nitter.garudalinux.org",
"https://nitter.wef.lol", "https://nitter.wef.lol",
"https://nitter.catalyst.sx", "https://nitter.catalyst.sx",
"https://nitter.fprivacy.com",
"https://bib.actionsack.com", "https://bib.actionsack.com",
"https://libreddit.domain.glass", "https://libreddit.domain.glass",
"https://r.nf", "https://r.nf",
@ -36,21 +38,19 @@
"https://teddit.domain.glass", "https://teddit.domain.glass",
"https://teddit.httpjames.space", "https://teddit.httpjames.space",
"https://teddit.encrypted-data.xyz", "https://teddit.encrypted-data.xyz",
"https://teddit.garudalinux.org",
"https://tedd.it",
"https://wiki.604kph.xyz", "https://wiki.604kph.xyz",
"https://wikiless.lunar.icu",
"https://lingva.lunar.icu",
"https://searx.josie.lol",
"https://searx.org", "https://searx.org",
"https://searx.run", "https://searx.run",
"https://searx.albony.xyz",
"https://searx.kujonello.cf",
"https://search.albony.xyz", "https://search.albony.xyz",
"https://search.garudalinux.org", "https://search.garudalinux.org",
"https://search.dr460nf1r3.org", "https://search.dr460nf1r3.org",
"https://search.wef.lol", "https://search.wef.lol",
"https://i.actionsack.com" "https://i.actionsack.com",
"https://rimgo.encrypted-data.xyz"
], ],
"authenticate": [ "authenticate": [
"https://nitter.nixnet.services" "https://nitter.nixnet.services"
] ]
} }

View File

@ -10,8 +10,8 @@
"https://y.com.sb", "https://y.com.sb",
"https://yt.artemislena.eu", "https://yt.artemislena.eu",
"https://invidious.flokinet.to", "https://invidious.flokinet.to",
"https://invidious.tiekoetter.com",
"https://invidious.sethforprivacy.com", "https://invidious.sethforprivacy.com",
"https://invidious.tiekoetter.com",
"https://inv.bp.projectsegfau.lt", "https://inv.bp.projectsegfau.lt",
"https://invidious.projectsegfau.lt", "https://invidious.projectsegfau.lt",
"https://inv.vern.cc", "https://inv.vern.cc",
@ -26,12 +26,15 @@
"http://c7hqkpkpemu6e7emz5b4vyz7idjgdvgaaa3dyimmeojqbgpea3xqjoid.onion", "http://c7hqkpkpemu6e7emz5b4vyz7idjgdvgaaa3dyimmeojqbgpea3xqjoid.onion",
"http://w6ijuptxiku4xpnnaetxvnkc5vqcdu7mgns2u77qefoixi63vbvnpnqd.onion", "http://w6ijuptxiku4xpnnaetxvnkc5vqcdu7mgns2u77qefoixi63vbvnpnqd.onion",
"http://kbjggqkzv65ivcqj6bumvp337z6264huv5kpkwuv6gu5yjiskvan7fad.onion", "http://kbjggqkzv65ivcqj6bumvp337z6264huv5kpkwuv6gu5yjiskvan7fad.onion",
"http://grwp24hodrefzvjjuccrkw3mjq4tzhaaq32amf33dzpmuxe7ilepcmad.onion",
"http://osbivz6guyeahrwp2lnwyjk2xos342h4ocsxyqrlaopqjuhwn2djiiyd.onion", "http://osbivz6guyeahrwp2lnwyjk2xos342h4ocsxyqrlaopqjuhwn2djiiyd.onion",
"http://u2cvlit75owumwpy4dj2hsmvkq7nvrclkpht7xgyye2pyoxhpmclkrad.onion", "http://u2cvlit75owumwpy4dj2hsmvkq7nvrclkpht7xgyye2pyoxhpmclkrad.onion",
"http://euxxcnhsynwmfidvhjf6uzptsmh4dipkmgdmcmxxuo7tunp3ad2jrwyd.onion/", "http://euxxcnhsynwmfidvhjf6uzptsmh4dipkmgdmcmxxuo7tunp3ad2jrwyd.onion",
"http://invidious.lqs5fjmajyp7rvp4qvyubwofzi6d4imua7vs237rkc4m5qogitqwrgyd.onion", "http://invidious.lqs5fjmajyp7rvp4qvyubwofzi6d4imua7vs237rkc4m5qogitqwrgyd.onion",
"http://inv.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion/" "http://inv.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion"
] ],
"i2p": [],
"loki": []
}, },
"piped": { "piped": {
"normal": [ "normal": [
@ -42,7 +45,7 @@
"https://piped.syncpundit.com", "https://piped.syncpundit.com",
"https://piped.mha.fi", "https://piped.mha.fi",
"https://piped.shimul.me", "https://piped.shimul.me",
"https://pipedus.palash.dev/", "https://pipedus.palash.dev",
"https://yt.jae.fi", "https://yt.jae.fi",
"https://piped.mint.lgbt", "https://piped.mint.lgbt",
"https://piped.privacy.com.de", "https://piped.privacy.com.de",
@ -50,15 +53,31 @@
], ],
"tor": [ "tor": [
"http://piped2bbch4xslbl2ckr6k62q56kon56ffowxaqzy42ai22a4sash3ad.onion" "http://piped2bbch4xslbl2ckr6k62q56kon56ffowxaqzy42ai22a4sash3ad.onion"
] ],
"i2p": [],
"loki": []
},
"pipedMaterial": {
"normal": [
"https://piped-material.১.net",
"https://piped-material.ftp.sh",
"https://piped-staging.ftp.sh",
"https://ui.piped.১.net"
],
"tor": [],
"i2p": [],
"loki": []
}, },
"proxiTok": { "proxiTok": {
"normal": [ "normal": [
"https://proxitok.herokuapp.com", "https://proxitok.herokuapp.com",
"https://proxitok.pussthecat.org", "https://proxitok.pussthecat.org",
"https://proxitok.privacydev.net" "https://proxitok.privacydev.net",
"https://tok.habedieeh.re"
], ],
"tor": [] "tor": [],
"i2p": [],
"loki": []
}, },
"send": { "send": {
"normal": [ "normal": [
@ -68,7 +87,7 @@
"https://send.ephemeral.land", "https://send.ephemeral.land",
"https://send.mni.li", "https://send.mni.li",
"https://send.monks.tools", "https://send.monks.tools",
"https://send.boblorange.net/", "https://send.boblorange.net",
"https://send.aurorabilisim.com", "https://send.aurorabilisim.com",
"https://nhanh.cloud", "https://nhanh.cloud",
"https://send.datahoarder.dev", "https://send.datahoarder.dev",
@ -80,7 +99,9 @@
"https://bytefile.de", "https://bytefile.de",
"https://transfer.acted.org" "https://transfer.acted.org"
], ],
"tor": [] "tor": [],
"i2p": [],
"loki": []
}, },
"nitter": { "nitter": {
"normal": [ "normal": [
@ -128,6 +149,7 @@
"https://nitter.bird.froth.zone", "https://nitter.bird.froth.zone",
"https://nitter.dcs0.hu", "https://nitter.dcs0.hu",
"https://twitter.dr460nf1r3.org", "https://twitter.dr460nf1r3.org",
"https://nitter.garudalinux.org",
"https://twitter.beparanoid.de", "https://twitter.beparanoid.de",
"https://n.ramle.be", "https://n.ramle.be",
"https://nitter.cz", "https://nitter.cz",
@ -135,15 +157,23 @@
"https://tweet.lambda.dance", "https://tweet.lambda.dance",
"https://nitter.ebnar.xyz", "https://nitter.ebnar.xyz",
"https://nitter.kylrth.com", "https://nitter.kylrth.com",
"https://nitter.oishi-ra.men",
"https://nitter.foss.wtf", "https://nitter.foss.wtf",
"https://nitter.priv.pw", "https://nitter.priv.pw",
"https://t.com.sb",
"https://nt.vern.cc", "https://nt.vern.cc",
"https://nitter.wef.lol", "https://nitter.wef.lol",
"https://nitter.tokhmi.xyz", "https://nitter.tokhmi.xyz",
"https://nitter.catalyst.sx", "https://nitter.catalyst.sx",
"https://unofficialbird.com" "https://unofficialbird.com",
"https://nitter.projectsegfau.lt",
"https://singapore.unofficialbird.com",
"https://twt.funami.tech",
"https://nitter.fprivacy.com",
"https://canada.unofficialbird.com",
"https://india.unofficialbird.com",
"https://nederland.unofficialbird.com",
"https://uk.unofficialbird.com",
"https://n.l5.ca",
"https://nitter.slipfox.xyz"
], ],
"tor": [ "tor": [
"http://3nzoldnxplag42gqjs23xvghtzf6t6yzssrtytnntc6ppc7xxuoneoad.onion", "http://3nzoldnxplag42gqjs23xvghtzf6t6yzssrtytnntc6ppc7xxuoneoad.onion",
@ -169,8 +199,11 @@
"http://fbdi323aj3t6hdx4jtkuwxrnafzskquciowu2yu3jizfssaq35aow6ad.onion", "http://fbdi323aj3t6hdx4jtkuwxrnafzskquciowu2yu3jizfssaq35aow6ad.onion",
"http://nitterqdyumlovt7tjqpdjrluitgmtpa53qq3idlpgoe4kxo7gs3xvad.onion", "http://nitterqdyumlovt7tjqpdjrluitgmtpa53qq3idlpgoe4kxo7gs3xvad.onion",
"http://nitter.privpw3tndpkw6pnp3g727zfgfdzbu3k6a7chv226s3xymv2p4eiuqyd.onion", "http://nitter.privpw3tndpkw6pnp3g727zfgfdzbu3k6a7chv226s3xymv2p4eiuqyd.onion",
"http://aaaaaxx74hbzeibageieowryhsqvimbdiitfkfe47tvgawkwkjh3coqd.onion" "http://aaaaaxx74hbzeibageieowryhsqvimbdiitfkfe47tvgawkwkjh3coqd.onion",
] "http://wiio4sgs4247brk7hj6qck2jxnvldwfdbguigc5ivpxrsegnliyfvuqd.onion"
],
"i2p": [],
"loki": []
}, },
"bibliogram": { "bibliogram": {
"normal": [ "normal": [
@ -181,12 +214,16 @@
"https://bibliogram.froth.zone", "https://bibliogram.froth.zone",
"https://insta.trom.tf", "https://insta.trom.tf",
"https://insta.tromdienste.de", "https://insta.tromdienste.de",
"https://biblio.alefvanoon.xyz", "https://ig.tokhmi.xyz",
"https://ig.beparanoid.de", "https://ig.beparanoid.de",
"https://bibliogram.privacydev.net", "https://bibliogram.privacydev.net",
"https://bibliogram.priv.pw",
"https://ig.funami.tech",
"https://bib.actionsack.com" "https://bib.actionsack.com"
], ],
"tor": [] "tor": [],
"i2p": [],
"loki": []
}, },
"libreddit": { "libreddit": {
"normal": [ "normal": [
@ -269,7 +306,9 @@
"http://inz6tbezfwzexva6dize4cqraj2tjdhygxabmcgysccesvw2pybzhbyd.onion", "http://inz6tbezfwzexva6dize4cqraj2tjdhygxabmcgysccesvw2pybzhbyd.onion",
"http://libreddit.micohauwkjbyw5meacrb4ipicwvwg4xtzl7y7viv53kig2mdcsvwkyyd.onion", "http://libreddit.micohauwkjbyw5meacrb4ipicwvwg4xtzl7y7viv53kig2mdcsvwkyyd.onion",
"http://lr.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion" "http://lr.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion"
] ],
"i2p": [],
"loki": []
}, },
"teddit": { "teddit": {
"normal": [ "normal": [
@ -290,10 +329,12 @@
"https://teddit.adminforge.de", "https://teddit.adminforge.de",
"https://teddit.bus-hit.me", "https://teddit.bus-hit.me",
"https://teddit.froth.zone", "https://teddit.froth.zone",
"https://rdt.trom.tf/", "https://rdt.trom.tf",
"https://teddit.encrypted-data.xyz", "https://teddit.encrypted-data.xyz",
"https://i.opnxng.com", "https://i.opnxng.com",
"https://teddit.tokhmi.xyz" "https://teddit.tokhmi.xyz",
"https://teddit.garudalinux.org",
"https://tedd.it"
], ],
"tor": [ "tor": [
"http://snoo.ioensistjs7wd746zluwixvojbbkxhr37lepdvwtdfeav673o64iflqd.onion", "http://snoo.ioensistjs7wd746zluwixvojbbkxhr37lepdvwtdfeav673o64iflqd.onion",
@ -301,7 +342,9 @@
"http://tedditfyn6idalzso5wam5qd3kdtxoljjhbrbbx34q2xkcisvshuytad.onion", "http://tedditfyn6idalzso5wam5qd3kdtxoljjhbrbbx34q2xkcisvshuytad.onion",
"http://dawtyi5e2cfyfmoht4izmczi42aa2zwh6wi34zwvc6rzf2acpxhrcrad.onion", "http://dawtyi5e2cfyfmoht4izmczi42aa2zwh6wi34zwvc6rzf2acpxhrcrad.onion",
"http://qtpvyiaqhmwccxwzsqubd23xhmmrt75tdyw35kp43w4hvamsgl3x27ad.onion" "http://qtpvyiaqhmwccxwzsqubd23xhmmrt75tdyw35kp43w4hvamsgl3x27ad.onion"
] ],
"i2p": [],
"loki": []
}, },
"wikiless": { "wikiless": {
"normal": [ "normal": [
@ -313,8 +356,8 @@
"https://wikiless.northboot.xyz", "https://wikiless.northboot.xyz",
"https://wikiless.tiekoetter.com", "https://wikiless.tiekoetter.com",
"https://wikiless.esmailelbob.xyz", "https://wikiless.esmailelbob.xyz",
"", "https://wiki.slipfox.xyz",
"https://wiki.slipfox.xyz" "https://wikiless.funami.tech"
], ],
"tor": [ "tor": [
"http://dj2tbh2nqfxyfmvq33cjmhuw7nb6am7thzd3zsjvizeqf374fixbrxyd.onion", "http://dj2tbh2nqfxyfmvq33cjmhuw7nb6am7thzd3zsjvizeqf374fixbrxyd.onion",
@ -325,7 +368,8 @@
"i2p": [ "i2p": [
"http://hflqp2ejxygpj6cdwo3ogfieqmxw3b56w7dblt7bor2ltwk6kcfa.b32.i2p", "http://hflqp2ejxygpj6cdwo3ogfieqmxw3b56w7dblt7bor2ltwk6kcfa.b32.i2p",
"http://x33lx4h6d7h6xs4eiqwhvaxn3ea5gn2ifmu3jobnvuvn4k4aej7a.b32.i2p" "http://x33lx4h6d7h6xs4eiqwhvaxn3ea5gn2ifmu3jobnvuvn4k4aej7a.b32.i2p"
] ],
"loki": []
}, },
"scribe": { "scribe": {
"normal": [ "normal": [
@ -335,7 +379,9 @@
"https://scribe.bus-hit.me", "https://scribe.bus-hit.me",
"https://scribe.froth.zone" "https://scribe.froth.zone"
], ],
"tor": [] "tor": [],
"i2p": [],
"loki": []
}, },
"quetre": { "quetre": {
"normal": [ "normal": [
@ -344,9 +390,12 @@
"https://quetre.pussthecat.org", "https://quetre.pussthecat.org",
"https://wuetre.herokuapp.com", "https://wuetre.herokuapp.com",
"https://quetreus.herokuapp.com", "https://quetreus.herokuapp.com",
"https://quetre.tokhmi.xyz" "https://quetre.tokhmi.xyz",
"https://quetre.projectsegfau.lt"
], ],
"tor": [] "tor": [],
"i2p": [],
"loki": []
}, },
"libremdb": { "libremdb": {
"normal": [ "normal": [
@ -355,7 +404,9 @@
"https://libremdbeu.herokuapp.com", "https://libremdbeu.herokuapp.com",
"https://lmdb.tokhmi.xyz" "https://lmdb.tokhmi.xyz"
], ],
"tor": [] "tor": [],
"i2p": [],
"loki": []
}, },
"simplyTranslate": { "simplyTranslate": {
"normal": [ "normal": [
@ -397,30 +448,16 @@
"https://lingva.lunar.icu", "https://lingva.lunar.icu",
"https://lingva.opnxng.com" "https://lingva.opnxng.com"
], ],
"tor": [] "tor": [],
"i2p": [],
"loki": []
}, },
"searx": { "searx": {
"tor": [
"http://3afisqjw2rxm6z7mmstyt5rx75qfqrgxnkzftknbp2vhipr2nrmrjdyd.onion",
"http://w5rl6wsd7mzj4bdkbuqvzidet5osdsm5jhg2f7nvfidakfq5exda5wid.onion",
"http://yra4tke2pwcnatxjkufpw6kvebu3h3ti2jca2lcdpgx3mpwol326lzid.onion",
"http://z5vawdol25vrmorm4yydmohsd4u6rdoj2sylvoi3e3nqvxkvpqul7bqd.onion",
"http://zbuc3bbzbfdqqo2x46repx2ddajbha6fpsjeeptjhhhhzji3zopxdqyd.onion",
"http://f4qfqajszpx5b7itzxt6mb7kj4ktpgbdq7lq6xaiqyqx6a7de3epptad.onion",
"http://rq2w52kyrif3xpfihkgjnhqm3a5aqhoikpv72z3drpjglfzc2wr5z4yd.onion",
"http://searx.bsbvtqi5oq2cqzn32zt4cr2f2z2rwots3dq7gmdcnlyqoxko2wx6reqd.onion"
],
"i2p": [
"http://ransack.i2p",
"http://mqamk4cfykdvhw5kjez2gnvse56gmnqxn7vkvvbuor4k4j2lbbnq.b32.i2p"
],
"normal": [ "normal": [
"https://anon.sx", "https://anon.sx",
"https://dynabyte.ca", "https://dynabyte.ca",
"https://jsearch.pw", "https://jsearch.pw",
"https://nibblehole.com",
"https://search.ethibox.fr", "https://search.ethibox.fr",
"https://search.jpope.org",
"https://search.snopyta.org", "https://search.snopyta.org",
"https://search.stinpriza.org", "https://search.stinpriza.org",
"https://search.trom.tf", "https://search.trom.tf",
@ -429,15 +466,12 @@
"https://searx.dresden.network", "https://searx.dresden.network",
"https://searx.fossencdi.org", "https://searx.fossencdi.org",
"https://searx.gnu.style", "https://searx.gnu.style",
"https://searx.josie.lol",
"https://searx.mastodontech.de", "https://searx.mastodontech.de",
"https://searx.mxchange.org", "https://searx.mxchange.org",
"https://searx.nakhan.net", "https://searx.nakhan.net",
"https://searx.netzspielplatz.de", "https://searx.netzspielplatz.de",
"https://searx.nixnet.services", "https://searx.nixnet.services",
"https://searx.openhoofd.nl",
"https://searx.org", "https://searx.org",
"https://searx.ppeb.me",
"https://searx.pwoss.org", "https://searx.pwoss.org",
"https://searx.rasp.fr", "https://searx.rasp.fr",
"https://searx.ru", "https://searx.ru",
@ -451,55 +485,63 @@
"https://searx.webheberg.info", "https://searx.webheberg.info",
"https://searx.xyz", "https://searx.xyz",
"https://searx.zapashcanon.fr", "https://searx.zapashcanon.fr",
"https://searxng.ir",
"https://spot.ecloud.global", "https://spot.ecloud.global",
"https://suche.dasnetzundich.de", "https://suche.dasnetzundich.de",
"https://suche.tromdienste.de", "https://suche.tromdienste.de",
"https://suche.uferwerk.org", "https://suche.uferwerk.org",
"https://sx.catgirl.cloud", "https://sx.catgirl.cloud",
"https://timdor.noip.me/searx", "https://timdor.noip.me/searx",
"https://www.gruble.de",
"https://searx.roflcopter.fr" "https://searx.roflcopter.fr"
] ],
"tor": [
"http://3afisqjw2rxm6z7mmstyt5rx75qfqrgxnkzftknbp2vhipr2nrmrjdyd.onion",
"http://w5rl6wsd7mzj4bdkbuqvzidet5osdsm5jhg2f7nvfidakfq5exda5wid.onion",
"http://yra4tke2pwcnatxjkufpw6kvebu3h3ti2jca2lcdpgx3mpwol326lzid.onion",
"http://z5vawdol25vrmorm4yydmohsd4u6rdoj2sylvoi3e3nqvxkvpqul7bqd.onion",
"http://zbuc3bbzbfdqqo2x46repx2ddajbha6fpsjeeptjhhhhzji3zopxdqyd.onion",
"http://f4qfqajszpx5b7itzxt6mb7kj4ktpgbdq7lq6xaiqyqx6a7de3epptad.onion"
],
"i2p": [
"http://ransack.i2p",
"http://mqamk4cfykdvhw5kjez2gnvse56gmnqxn7vkvvbuor4k4j2lbbnq.b32.i2p"
],
"loki": []
}, },
"searxng": { "searxng": {
"tor": [
"http://4n53nafyi77iplnbrpmxnp3x4exbswwxigujaxy3b37fvr7bvlopxeyd.onion",
"http://search3q76rqpektbrchlf2rjq4fnbxzeov6rljdywg3nwbunpgd7bid.onion",
"http://searchoorwalty5a2ailrboa2asqyts2u7bdoqwnjefpgjobpvtzn4qd.onion",
"http://gbat2pbpg7ys3fi3pbp64667tt5x66mg45xok35bxdw7v55brm7a27yd.onion",
"http://searxdr3pqz4nydgnqocsia2xbywptxbkympa2emn7zlgggrir4bkfad.onion",
"http://searx.micohauwkjbyw5meacrb4ipicwvwg4xtzl7y7viv53kig2mdcsvwkyyd.onion",
"http://searx.privpw3tndpkw6pnp3g727zfgfdzbu3k6a7chv226s3xymv2p4eiuqyd.onion",
"http://searx3aolosaf3urwnhpynlhuokqsgz47si4pzz5hvb7uuzyjncl2tid.onion",
"http://4tz2vlnwk2apf2rpinkqv6uxvfgo5xjx6vl5vp7lxgaiooumetjpstqd.onion"
],
"i2p": [],
"normal": [ "normal": [
"https://darmarit.org/searx", "https://darmarit.org/searx",
"https://de.xcxc.ml", "https://de.xcxc.ml",
"https://etsi.me", "https://etsi.me",
"https://icanfindit.online",
"https://jackgoss.xyz",
"https://northboot.xyz", "https://northboot.xyz",
"https://notgoogle.win",
"https://opnxng.com", "https://opnxng.com",
"https://paulgo.io", "https://paulgo.io",
"https://priv.au",
"https://private-searx.ml",
"https://privatus.live",
"https://s.frlt.one", "https://s.frlt.one",
"https://s.zhaocloud.net", "https://s.zhaocloud.net",
"https://search.affusio.com",
"https://search.ashs.club", "https://search.ashs.club",
"https://search.bingowaves.xyz", "https://search.bingowaves.xyz",
"https://search.bus-hit.me", "https://search.bus-hit.me",
"https://search.chemicals-in-the-water.eu",
"https://search.disroot.org", "https://search.disroot.org",
"https://search.gcomm.ch",
"https://search.kiwitalk.de", "https://search.kiwitalk.de",
"https://search.mdosch.de", "https://search.mdosch.de",
"https://search.neet.works", "https://search.neet.works",
"https://search.ononoki.org", "https://search.ononoki.org",
"https://search.privacyguides.net", "https://search.privacyguides.net",
"https://search.projectsegfau.lt",
"https://search.rabbit-company.com", "https://search.rabbit-company.com",
"https://search.sapti.me", "https://search.sapti.me",
"https://search.teamriverbubbles.com", "https://search.teamriverbubbles.com",
"https://search.unlocked.link", "https://search.unlocked.link",
"https://search.vojkovic.xyz", "https://search.vidhukant.xyz",
"https://search.zzls.xyz", "https://search.zzls.xyz",
"https://searx.albony.xyz",
"https://searx.be", "https://searx.be",
"https://searx.becomesovran.com", "https://searx.becomesovran.com",
"https://searx.chocoflan.net", "https://searx.chocoflan.net",
@ -509,7 +551,6 @@
"https://searx.fi", "https://searx.fi",
"https://searx.fmac.xyz", "https://searx.fmac.xyz",
"https://searx.gnous.eu", "https://searx.gnous.eu",
"https://searx.kujonello.cf",
"https://searx.loafland.xyz", "https://searx.loafland.xyz",
"https://searx.mha.fi", "https://searx.mha.fi",
"https://searx.mistli.net", "https://searx.mistli.net",
@ -517,24 +558,40 @@
"https://searx.orion-hub.fr", "https://searx.orion-hub.fr",
"https://searx.priv.pw", "https://searx.priv.pw",
"https://searx.prvcy.eu", "https://searx.prvcy.eu",
"https://searx.rimkus.it",
"https://searx.sethforprivacy.com", "https://searx.sethforprivacy.com",
"https://searx.sev.monster", "https://searx.sev.monster",
"https://searx.slipfox.xyz/searx", "https://searx.slipfox.xyz/searx",
"http://fub6vgedgeadlu3ctskrpkcqjruh76tckwtj5swfhyblgml2tzgzckqd.onion/searx",
"https://searx.tiekoetter.com", "https://searx.tiekoetter.com",
"https://searx.vimproved.me", "https://searx.vimproved.me",
"https://searx.youshitsune.me", "https://searx.youshitsune.me",
"https://searx.zcyph.cc", "https://searx.zcyph.cc",
"https://searxng.au/searx", "https://searxng.au/searx",
"https://searxng.ir",
"https://searxng.tordenskjold.de", "https://searxng.tordenskjold.de",
"https://searxng.zackptg5.com", "https://searxng.zackptg5.com",
"https://serx.ml", "https://serx.ml",
"https://srx.cosmohub.io", "https://srx.cosmohub.io",
"https://swag.pw", "https://swag.pw",
"https://www.gruble.de",
"https://www.webrats.xyz", "https://www.webrats.xyz",
"https://xcxc.ml" "https://xcxc.ml"
] ],
"tor": [
"http://4n53nafyi77iplnbrpmxnp3x4exbswwxigujaxy3b37fvr7bvlopxeyd.onion",
"http://x5gdjh6t7kb4yubpufhtc3l3df2acev3emxdasd5vyuyoon5rzf5zkyd.onion",
"http://search3q76rqpektbrchlf2rjq4fnbxzeov6rljdywg3nwbunpgd7bid.onion",
"http://searchoorwalty5a2ailrboa2asqyts2u7bdoqwnjefpgjobpvtzn4qd.onion",
"http://gbat2pbpg7ys3fi3pbp64667tt5x66mg45xok35bxdw7v55brm7a27yd.onion",
"http://searxdr3pqz4nydgnqocsia2xbywptxbkympa2emn7zlgggrir4bkfad.onion",
"http://searx.micohauwkjbyw5meacrb4ipicwvwg4xtzl7y7viv53kig2mdcsvwkyyd.onion",
"http://searx.privpw3tndpkw6pnp3g727zfgfdzbu3k6a7chv226s3xymv2p4eiuqyd.onion",
"http://rq2w52kyrif3xpfihkgjnhqm3a5aqhoikpv72z3drpjglfzc2wr5z4yd.onion",
"http://fub6vgedgeadlu3ctskrpkcqjruh76tckwtj5swfhyblgml2tzgzckqd.onion/searx",
"http://searx3aolosaf3urwnhpynlhuokqsgz47si4pzz5hvb7uuzyjncl2tid.onion",
"http://4tz2vlnwk2apf2rpinkqv6uxvfgo5xjx6vl5vp7lxgaiooumetjpstqd.onion"
],
"i2p": [],
"loki": []
}, },
"whoogle": { "whoogle": {
"normal": [ "normal": [
@ -553,7 +610,24 @@
"https://search.wef.lol" "https://search.wef.lol"
], ],
"tor": [], "tor": [],
"i2p": [] "i2p": [],
"loki": []
},
"librex": {
"normal": [
"https://librex.beparanoid.de",
"https://search.davidovski.xyz",
"https://search.funami.tech",
"https://librex.catalyst.sx"
],
"tor": [
"http://librex.prnoid54e44a4bduq5due64jkk7wcnkxcp5kv3juncm7veptjcqudgyd.onion",
"http://librex.so2mpiyfo4cje7bof5v52y3cvjyo2haxpqfvut4sr6gj2ul4mddx2jid.onion"
],
"i2p": [
"http://fboseyskrqpi6yjiifvz4ryuoiswjezkqsfxfkm2vmbuhehbpr7q.b32.i2p"
],
"loki": []
}, },
"rimgo": { "rimgo": {
"normal": [ "normal": [
@ -565,21 +639,138 @@
"https://i.actionsack.com", "https://i.actionsack.com",
"https://rimgo.privacydev.net", "https://rimgo.privacydev.net",
"https://imgur.artemislena.eu", "https://imgur.artemislena.eu",
"https://rimgo.vern.cc" "https://rimgo.vern.cc",
"https://rimgo.encrypted-data.xyz",
"https://rimgo.mha.fi"
], ],
"tor": [ "tor": [
"http://rimgo.lqs5fjmajyp7rvp4qvyubwofzi6d4imua7vs237rkc4m5qogitqwrgyd.onion", "http://rimgo.lqs5fjmajyp7rvp4qvyubwofzi6d4imua7vs237rkc4m5qogitqwrgyd.onion",
"http://rimgo.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion" "http://rimgo.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion",
"http://rimgo.micohauwkjbyw5meacrb4ipicwvwg4xtzl7y7viv53kig2mdcsvwkyyd.onion"
], ],
"i2p": [] "i2p": [],
"loki": []
},
"librarian": {
"normal": [
"https://lbry.bcow.xyz",
"https://odysee.076.ne.jp",
"https://librarian.pussthecat.org",
"https://lbry.mutahar.rocks",
"https://librarian.esmailelbob.xyz",
"https://lbry.vern.cc"
],
"tor": [
"http://librarian.lqs5fjmajyp7rvp4qvyubwofzi6d4imua7vs237rkc4m5qogitqwrgyd.onion",
"http://lbry.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion"
],
"i2p": [],
"loki": []
}, },
"peertube": [ "peertube": [
"https://pire.artisanlogiciel.net",
"https://trutube.xyz",
"https://tube-test.apps.education.fr",
"https://tube-sciences-technologies.apps.education.fr",
"https://stream.conesphere.cloud",
"https://tube-institutionnel.apps.education.fr",
"https://trutube.online",
"https://tube-cycle-3.apps.education.fr",
"https://video.manicphase.me",
"https://tube.emy.plus",
"https://v.bearvideo.win",
"https://tubulus.openlatin.org",
"https://peertube.securetown.top",
"https://tv.datamol.org",
"https://video.graine-pdl.org",
"https://tube.zee.li",
"https://tube-cycle-2.apps.education.fr",
"https://mikeclips.net",
"https://tube.s1gm4.eu",
"https://videos.keyedlimepie.org",
"https://video.cpn.so",
"https://video.davduf.net",
"https://tube.oldkid.digital",
"https://tube.fofoca.eu",
"https://tube-langues-vivantes.apps.education.fr",
"https://tube-arts-lettres-sciences-humaines.apps.education.fr",
"https://videos.scanlines.xyz",
"https://video.kicik.fr",
"https://media.theplattform.net",
"https://peertube.offerman.com",
"https://v.lastorder.xyz",
"https://video.eradicatinglove.xyz",
"https://peertube.thele.me",
"https://video.schnitzler.one",
"https://tube.cybershock.life",
"https://tube.reseau-canope.fr",
"https://frentube.myyouniverse.observer",
"https://tube-maternelle.apps.education.fr",
"https://peertube.onionstorm.net",
"https://dev.dollarvigilante.tv",
"https://video.trankil.info",
"https://video.uriopss-pdl.fr",
"https://pt.bolapara.mywire.org",
"https://ptube.ranranhome.info",
"https://vidid.pl",
"https://video.3cmr.fr",
"https://tube.die-rote-front.de",
"https://peertube.miguelcr.me",
"https://video.thinkof.name",
"https://nekofans.tv",
"https://video.comun.al",
"https://peertube.nrsk.no",
"https://video.occm.cc",
"https://peertube.viviers-fibre.net",
"https://tube-action-educative.apps.education.fr",
"https://themadlads.live",
"https://jahve.pl",
"https://videos.yesil.club",
"https://peertube.adjutor.xyz",
"https://peertube.terranout.mine.nu",
"https://tube.hunterjozwiak.com",
"https://tube-numerique-educatif.apps.education.fr",
"https://tube.itsg.host",
"https://tube.valinor.fr",
"https://lucarne.balsamine.be",
"https://peertube.suranyami.com",
"https://video.ados.accoord.fr",
"https://t.0x0.st",
"https://tube-education-physique-et-sportive.apps.education.fr",
"https://videos.lemouvementassociatif-pdl.org",
"https://videos.casually.cat",
"https://playroom.kitsunes.world",
"https://tube2.nous.media",
"https://peertube.freenet.ru",
"https://peertube.0x5e.eu",
"https://tube.darknight-coffee.org",
"https://play.mittdata.se",
"https://peertube.lhc.net.br",
"https://see.vtopia.live",
"https://peertube.letoine.fr",
"https://tube-enseignement-professionnel.apps.education.fr",
"https://socpeertube.ru",
"https://videos.laliguepaysdelaloire.org",
"https://videotube.duckdns.org",
"https://quantube.win",
"https://twctube.twc-zone.eu",
"https://vhs.absturztau.be",
"https://video.espr.moe",
"https://peertube.social.my-wan.de",
"https://phijkchu.com",
"https://video.lycee-experimental.org",
"https://galileo.news",
"https://peertube.otakufarms.com",
"https://tube.motuhake.xyz",
"https://pt.m0r016.net",
"https://hitchtube.fr",
"https://video.fox-romka.ru",
"https://peertube.ctrl-c.liu.se",
"https://peertube.live",
"https://video.slipfox.xyz", "https://video.slipfox.xyz",
"https://pt.vern.cc", "https://pt.vern.cc",
"https://3.600900.su",
"https://vnop.org", "https://vnop.org",
"https://videos.cassidypunchmachine.com", "https://videos.cassidypunchmachine.com",
"https://video.mullet.social",
"https://tv1.gomntu.space", "https://tv1.gomntu.space",
"https://dalek.zone", "https://dalek.zone",
"https://seka.pona.la", "https://seka.pona.la",
@ -588,7 +779,6 @@
"https://tube.miegl.cz", "https://tube.miegl.cz",
"https://mov.clov.fr", "https://mov.clov.fr",
"https://videomensoif.ynh.fr", "https://videomensoif.ynh.fr",
"https://peertube.hainry.fr",
"https://videos.neongarden.life", "https://videos.neongarden.life",
"https://video.vaku.org.ua", "https://video.vaku.org.ua",
"https://videos.trom.lt", "https://videos.trom.lt",
@ -626,7 +816,6 @@
"https://turkum.me", "https://turkum.me",
"https://video.colibris-outilslibres.org", "https://video.colibris-outilslibres.org",
"https://invoice.peertube.biz", "https://invoice.peertube.biz",
"https://vnhup.com",
"https://peertube.chantierlibre.org", "https://peertube.chantierlibre.org",
"https://video.9wd.eu", "https://video.9wd.eu",
"https://video.niboe.info", "https://video.niboe.info",
@ -638,10 +827,8 @@
"https://tube.nestor.coop", "https://tube.nestor.coop",
"https://live.oldskool.fi", "https://live.oldskool.fi",
"https://dytube.com", "https://dytube.com",
"https://video.toby3d.me",
"https://tube.thierrytalbert.fr", "https://tube.thierrytalbert.fr",
"https://peertube.informaction.info", "https://peertube.informaction.info",
"https://peertube.thele.me",
"https://tube.ac-amiens.fr", "https://tube.ac-amiens.fr",
"https://tube.alado.space", "https://tube.alado.space",
"https://tube.network.europa.eu", "https://tube.network.europa.eu",
@ -653,7 +840,6 @@
"https://cliptube.org", "https://cliptube.org",
"https://tube.tr4sk.me", "https://tube.tr4sk.me",
"https://videos.campdarling.com", "https://videos.campdarling.com",
"https://peertube.live",
"https://video.mikka.md", "https://video.mikka.md",
"https://www.aktion-nordost.tv", "https://www.aktion-nordost.tv",
"https://tube.rooty.fr", "https://tube.rooty.fr",
@ -683,15 +869,12 @@
"https://videopen.net", "https://videopen.net",
"https://demo.lioncast.org", "https://demo.lioncast.org",
"https://peertube.get-racing.de", "https://peertube.get-racing.de",
"https://tube-rennes.beta.education.fr",
"https://pierre.tube", "https://pierre.tube",
"https://mirametube.fr", "https://mirametube.fr",
"https://tube.sanyi.nl",
"https://vidz.dou.bet", "https://vidz.dou.bet",
"https://videos.redeyes.site", "https://videos.redeyes.site",
"https://video.hostpath.de", "https://video.hostpath.de",
"https://free-streams.com", "https://free-streams.com",
"https://video.chadwaltercummings.me",
"https://tube.pawelko.net", "https://tube.pawelko.net",
"https://video.livecchi.cloud", "https://video.livecchi.cloud",
"https://anarchy.video", "https://anarchy.video",
@ -716,7 +899,6 @@
"https://tube.linc.systems", "https://tube.linc.systems",
"https://peertube.ketchup.noho.st", "https://peertube.ketchup.noho.st",
"https://yt.x1337x.fr", "https://yt.x1337x.fr",
"https://video.wsforum.net",
"https://videos.rabbit-company.com", "https://videos.rabbit-company.com",
"https://video.paradigmthreat.net", "https://video.paradigmthreat.net",
"https://video.lincolncyber.com", "https://video.lincolncyber.com",
@ -751,8 +933,6 @@
"https://tube.globalfrens.com", "https://tube.globalfrens.com",
"https://peertube.hacknews.pmdcollab.org", "https://peertube.hacknews.pmdcollab.org",
"https://freetubes.nohost.me", "https://freetubes.nohost.me",
"https://video.simplex-software.ru",
"https://wwtube.net",
"https://video.snug.moe", "https://video.snug.moe",
"https://video.avant-le-strike.buzz", "https://video.avant-le-strike.buzz",
"https://videos.ritimo.org", "https://videos.ritimo.org",
@ -760,7 +940,6 @@
"https://video.cerclearistote.com", "https://video.cerclearistote.com",
"https://computerstuff.mooo.com", "https://computerstuff.mooo.com",
"https://video.greenmycity.eu", "https://video.greenmycity.eu",
"https://peertubemirror.satoshishop.de",
"https://przej.me", "https://przej.me",
"https://pt.mezzo.moe", "https://pt.mezzo.moe",
"https://tube.dsocialize.net", "https://tube.dsocialize.net",
@ -773,19 +952,15 @@
"https://tube.nx12.net", "https://tube.nx12.net",
"https://redundant2.peertube.support", "https://redundant2.peertube.support",
"https://peertube.ignifi.me", "https://peertube.ignifi.me",
"https://docker.videos.lecygnenoir.info",
"https://tv.based.quest", "https://tv.based.quest",
"https://peertube.beardedtek.com", "https://peertube.beardedtek.com",
"https://casnocensure.site",
"https://creemoseducacioninclusiva.uma.es", "https://creemoseducacioninclusiva.uma.es",
"https://videos.yeswiki.net", "https://videos.yeswiki.net",
"https://tube.lrk.sh", "https://tube.lrk.sh",
"https://peertube.teneriffe.nohost.me",
"https://peertube.autogestioncitoyenne.org", "https://peertube.autogestioncitoyenne.org",
"https://stream.dynacloud.ynh.fr", "https://stream.dynacloud.ynh.fr",
"https://video.r3s.nrw", "https://video.r3s.nrw",
"https://peertube.semweb.pro", "https://peertube.semweb.pro",
"https://sneedtube.com",
"https://poast.tv", "https://poast.tv",
"https://testube.distrilab.fr", "https://testube.distrilab.fr",
"https://peertube.rse43.com", "https://peertube.rse43.com",
@ -793,7 +968,6 @@
"https://vid.lelux.fi", "https://vid.lelux.fi",
"https://v.wolfskaempf.de", "https://v.wolfskaempf.de",
"https://peertube.chevro.fr", "https://peertube.chevro.fr",
"https://peertube.minecloud.ro",
"https://media.econoalchemist.com", "https://media.econoalchemist.com",
"https://video.qoto.org", "https://video.qoto.org",
"https://peertube.maxweiss.io", "https://peertube.maxweiss.io",
@ -818,7 +992,6 @@
"https://swebbtube.se", "https://swebbtube.se",
"https://video.dnfi.no", "https://video.dnfi.no",
"https://peertube.revelin.fr", "https://peertube.revelin.fr",
"https://video.wsf2021.info",
"https://armstube.com", "https://armstube.com",
"https://peertube.ti-fr.com", "https://peertube.ti-fr.com",
"https://video.turbo.chat", "https://video.turbo.chat",
@ -859,9 +1032,7 @@
"https://tube.1o1.io", "https://tube.1o1.io",
"https://peertube.aventer.biz", "https://peertube.aventer.biz",
"https://videos.rights.ninja", "https://videos.rights.ninja",
"https://pertur.be",
"https://tube.pilgerweg-21.de", "https://tube.pilgerweg-21.de",
"https://freediverse.com",
"https://pocketnetpeertube2.nohost.me", "https://pocketnetpeertube2.nohost.me",
"https://peertube.bubbletea.dev", "https://peertube.bubbletea.dev",
"https://peertube.art3mis.de", "https://peertube.art3mis.de",
@ -900,7 +1071,6 @@
"https://dud-video.inf.tu-dresden.de", "https://dud-video.inf.tu-dresden.de",
"https://media-test.interior.edu.uy", "https://media-test.interior.edu.uy",
"https://media.interior.edu.uy", "https://media.interior.edu.uy",
"https://bitcast.online",
"https://peertube.la-scic.fr", "https://peertube.la-scic.fr",
"https://phoenixproject.group", "https://phoenixproject.group",
"https://peertube.sebu77.com", "https://peertube.sebu77.com",
@ -938,7 +1108,6 @@
"https://video.liveitlive.show", "https://video.liveitlive.show",
"https://vid.plantplotting.co.uk", "https://vid.plantplotting.co.uk",
"https://video.telemillevaches.net", "https://video.telemillevaches.net",
"https://p.nogafa.org",
"https://tv.pirati.cz", "https://tv.pirati.cz",
"https://peertube.therealblue.de", "https://peertube.therealblue.de",
"https://tube.nuxnik.com", "https://tube.nuxnik.com",
@ -948,7 +1117,6 @@
"https://tube.communia.org", "https://tube.communia.org",
"https://peertube.dragonborn.app", "https://peertube.dragonborn.app",
"https://ai-tube.ch", "https://ai-tube.ch",
"https://buddhist.tv",
"https://video.citizen4.eu", "https://video.citizen4.eu",
"https://video.matomocamp.org", "https://video.matomocamp.org",
"https://media.fsfe.org", "https://media.fsfe.org",
@ -984,7 +1152,6 @@
"https://video.rubdos.be", "https://video.rubdos.be",
"https://tube.tuxfriend.fr", "https://tube.tuxfriend.fr",
"https://anarchy.tube", "https://anarchy.tube",
"https://nsfw.vger.cloud",
"https://tube.elemac.fr", "https://tube.elemac.fr",
"https://tube.nocturlab.fr", "https://tube.nocturlab.fr",
"https://videos.optoutpod.com", "https://videos.optoutpod.com",
@ -1005,7 +1172,6 @@
"https://peertube.tangentfox.com", "https://peertube.tangentfox.com",
"https://puffy.tube", "https://puffy.tube",
"https://tube.kher.nl", "https://tube.kher.nl",
"https://perceptiontravel.tv",
"https://watch.ocaml.org", "https://watch.ocaml.org",
"https://peertube.kleph.eu", "https://peertube.kleph.eu",
"https://tube.missbanal.net", "https://tube.missbanal.net",
@ -1021,7 +1187,6 @@
"https://video.ustim.ru", "https://video.ustim.ru",
"https://merci-la-police.fr", "https://merci-la-police.fr",
"https://pocketnetpeertube7.nohost.me", "https://pocketnetpeertube7.nohost.me",
"https://tube.noise.rocks",
"https://video.rhizome.org", "https://video.rhizome.org",
"https://dnk.video", "https://dnk.video",
"https://video.medienzentrum-harburg.de", "https://video.medienzentrum-harburg.de",
@ -1086,7 +1251,6 @@
"https://libra.syntazia.org", "https://libra.syntazia.org",
"https://peertube.beeldengeluid.nl", "https://peertube.beeldengeluid.nl",
"https://tv.lumbung.space", "https://tv.lumbung.space",
"https://vid.dascoyote.xyz",
"https://peertube.cuatrolibertades.org", "https://peertube.cuatrolibertades.org",
"https://videos.hush.is", "https://videos.hush.is",
"https://tube.ebin.club", "https://tube.ebin.club",
@ -1096,7 +1260,6 @@
"https://video.migennes.net", "https://video.migennes.net",
"https://irrsinn.video", "https://irrsinn.video",
"https://pocketnetpeertube4.nohost.me", "https://pocketnetpeertube4.nohost.me",
"https://video.omniatv.com",
"https://comf.tube", "https://comf.tube",
"https://pocketnetpeertube6.nohost.me", "https://pocketnetpeertube6.nohost.me",
"https://pocketnetpeertube5.nohost.me", "https://pocketnetpeertube5.nohost.me",
@ -1118,7 +1281,6 @@
"https://video.shitposter.club", "https://video.shitposter.club",
"https://tv.mattchristiansenmedia.com", "https://tv.mattchristiansenmedia.com",
"https://tube.hackerscop.org", "https://tube.hackerscop.org",
"https://videos.capas.se",
"https://peertube.kx.studio", "https://peertube.kx.studio",
"https://videos.3d-wolf.com", "https://videos.3d-wolf.com",
"https://tube.octaplex.net", "https://tube.octaplex.net",
@ -1155,7 +1317,6 @@
"https://videos.benjaminbrady.ie", "https://videos.benjaminbrady.ie",
"https://video.binarydad.com", "https://video.binarydad.com",
"https://tube.pmj.rocks", "https://tube.pmj.rocks",
"https://gary.vger.cloud",
"https://video.guerredeclasse.fr", "https://video.guerredeclasse.fr",
"https://ptmir4.inter21.net", "https://ptmir4.inter21.net",
"https://ptmir3.inter21.net", "https://ptmir3.inter21.net",
@ -1172,7 +1333,6 @@
"https://tube.kotur.org", "https://tube.kotur.org",
"https://peertube.euskarabildua.eus", "https://peertube.euskarabildua.eus",
"https://video.veloma.org", "https://video.veloma.org",
"https://vidcommons.org",
"https://regarder.sans.pub", "https://regarder.sans.pub",
"https://tube.rhythms-of-resistance.org", "https://tube.rhythms-of-resistance.org",
"https://tube-bordeaux.beta.education.fr", "https://tube-bordeaux.beta.education.fr",
@ -1218,7 +1378,6 @@
"https://evangelisch.video", "https://evangelisch.video",
"https://tube.anufrij.de", "https://tube.anufrij.de",
"https://videos.mastodont.cat", "https://videos.mastodont.cat",
"https://flim.txmn.tk",
"https://video.taboulisme.com", "https://video.taboulisme.com",
"https://media.undeadnetwork.de", "https://media.undeadnetwork.de",
"https://tube.dragonpsi.xyz", "https://tube.dragonpsi.xyz",
@ -1295,7 +1454,6 @@
"https://www4.mir.inter21.net", "https://www4.mir.inter21.net",
"https://video.csc49.fr", "https://video.csc49.fr",
"https://tube.wolfe.casa", "https://tube.wolfe.casa",
"https://tube.linkse.media",
"https://video.dresden.network", "https://video.dresden.network",
"https://peertube.zapashcanon.fr", "https://peertube.zapashcanon.fr",
"https://40two.tube", "https://40two.tube",
@ -1304,7 +1462,6 @@
"https://kino.schuerz.at", "https://kino.schuerz.at",
"https://peertube.tiennot.net", "https://peertube.tiennot.net",
"https://tututu.tube", "https://tututu.tube",
"https://peertube.interhop.org",
"https://tube.picasoft.net", "https://tube.picasoft.net",
"https://www.wiki-tube.de", "https://www.wiki-tube.de",
"https://videos.pair2jeux.tube", "https://videos.pair2jeux.tube",
@ -1334,7 +1491,6 @@
"https://xxx.noho.st", "https://xxx.noho.st",
"https://peertube.stefofficiel.me", "https://peertube.stefofficiel.me",
"https://canard.tube", "https://canard.tube",
"https://videos.jordanwarne.xyz",
"https://tube.jeena.net", "https://tube.jeena.net",
"https://tube.cloud-libre.eu", "https://tube.cloud-libre.eu",
"https://videos.coletivos.org", "https://videos.coletivos.org",
@ -1354,7 +1510,6 @@
"https://tube.others.social", "https://tube.others.social",
"https://videos.ubuntu-paris.org", "https://videos.ubuntu-paris.org",
"https://tube-poitiers.beta.education.fr", "https://tube-poitiers.beta.education.fr",
"https://streamsource.video",
"https://vid.wildeboer.net", "https://vid.wildeboer.net",
"https://battlepenguin.video", "https://battlepenguin.video",
"https://peertube.cloud.sans.pub", "https://peertube.cloud.sans.pub",
@ -1380,7 +1535,6 @@
"https://peertube.devloprog.org", "https://peertube.devloprog.org",
"https://peertube.designersethiques.org", "https://peertube.designersethiques.org",
"https://testtube.florimond.eu", "https://testtube.florimond.eu",
"https://tube.gnous.eu",
"https://tube-lille.beta.education.fr", "https://tube-lille.beta.education.fr",
"https://peertube.monlycee.net", "https://peertube.monlycee.net",
"https://tube.plomlompom.com", "https://tube.plomlompom.com",
@ -1454,7 +1608,6 @@
"https://video.oh14.de", "https://video.oh14.de",
"https://mytube.madzel.de", "https://mytube.madzel.de",
"https://monplaisirtube.ddns.net", "https://monplaisirtube.ddns.net",
"https://video.okaris.de",
"https://video.blender.org", "https://video.blender.org",
"https://peertube.020.pl", "https://peertube.020.pl",
"https://tube.azbyka.ru", "https://tube.azbyka.ru",
@ -1510,14 +1663,12 @@
"https://video.lemediatv.fr", "https://video.lemediatv.fr",
"https://peertube.artica.center", "https://peertube.artica.center",
"https://indymotion.fr", "https://indymotion.fr",
"https://video.farci.org",
"https://tube.fede.re", "https://tube.fede.re",
"https://peertube.mygaia.org", "https://peertube.mygaia.org",
"https://peertube.livingutopia.org", "https://peertube.livingutopia.org",
"https://tube.anjara.eu", "https://tube.anjara.eu",
"https://video.latavernedejohnjohn.fr", "https://video.latavernedejohnjohn.fr",
"https://peertube.pcservice46.fr", "https://peertube.pcservice46.fr",
"https://alttube.fr",
"https://video.coop.tools", "https://video.coop.tools",
"https://video.cabane-libre.org", "https://video.cabane-libre.org",
"https://peertube.openstreetmap.fr", "https://peertube.openstreetmap.fr",
@ -1550,7 +1701,6 @@
"https://www.yiny.org", "https://www.yiny.org",
"https://video.typica.us", "https://video.typica.us",
"https://videos.lescommuns.org", "https://videos.lescommuns.org",
"https://dialup.express",
"https://peertube.1312.media", "https://peertube.1312.media",
"https://skeptikon.fr", "https://skeptikon.fr",
"https://video.blueline.mg", "https://video.blueline.mg",
@ -1562,20 +1712,6 @@
"https://peertube.qtg.fr", "https://peertube.qtg.fr",
"https://tube.p2p.legal", "https://tube.p2p.legal",
"https://troll.tv", "https://troll.tv",
"https://videos.iut-orsay.fr", "https://videos.iut-orsay.fr"
"https://peertube.solidev.net",
"https://videos.cemea.org",
"https://video.passageenseine.fr",
"https://peertube.touhoppai.moe",
"https://share.tube",
"https://peertube.heraut.eu",
"https://peertube.gegeweb.eu",
"https://framatube.org",
"https://tube.conferences-gesticulees.net",
"https://peertube.datagueule.tv",
"https://video.lqdn.fr",
"https://peertube3.cpy.re",
"https://peertube2.cpy.re",
"https://peertube.cpy.re"
] ]
} }

View File

@ -87,6 +87,8 @@ def invidious():
invidiousList = {} invidiousList = {}
invidiousList['normal'] = [] invidiousList['normal'] = []
invidiousList['tor'] = [] invidiousList['tor'] = []
invidiousList['i2p'] = []
invidiousList['loki'] = []
for instance in rJson: for instance in rJson:
if instance[1]['type'] == 'https': if instance[1]['type'] == 'https':
invidiousList['normal'].append(instance[1]['uri']) invidiousList['normal'].append(instance[1]['uri'])
@ -103,6 +105,23 @@ def piped():
print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Piped') print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Piped')
def pipedMaterial():
r = requests.get(
'https://raw.githubusercontent.com/mmjee/Piped-Material/master/README.md')
tmp = re.findall(
r"\| (https?:\/{2}(?:.+\.)+[a-zA-Z0-9]*) +\|", r.text)
pipedMaterialList = {}
pipedMaterialList['normal'] = []
pipedMaterialList['tor'] = []
pipedMaterialList['i2p'] = []
pipedMaterialList['loki'] = []
for item in tmp:
pipedMaterialList['normal'].append(item)
mightyList['pipedMaterial'] = pipedMaterialList
print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'pipedMaterial')
def proxitok(): def proxitok():
r = requests.get( r = requests.get(
'https://raw.githubusercontent.com/wiki/pablouser1/ProxiTok/Public-instances.md') 'https://raw.githubusercontent.com/wiki/pablouser1/ProxiTok/Public-instances.md')
@ -112,6 +131,8 @@ def proxitok():
proxiTokList = {} proxiTokList = {}
proxiTokList['normal'] = [] proxiTokList['normal'] = []
proxiTokList['tor'] = [] proxiTokList['tor'] = []
proxiTokList['i2p'] = []
proxiTokList['loki'] = []
for item in tmp: for item in tmp:
proxiTokList['normal'].append(re.sub(r'/$', '', item)) proxiTokList['normal'].append(re.sub(r'/$', '', item))
mightyList['proxiTok'] = proxiTokList mightyList['proxiTok'] = proxiTokList
@ -126,6 +147,8 @@ def send():
sendList = {} sendList = {}
sendList['normal'] = [] sendList['normal'] = []
sendList['tor'] = [] sendList['tor'] = []
sendList['i2p'] = []
sendList['loki'] = []
for item in tmp: for item in tmp:
sendList['normal'].append(item) sendList['normal'].append(item)
mightyList['send'] = sendList mightyList['send'] = sendList
@ -142,6 +165,8 @@ def nitter():
nitterList = {} nitterList = {}
nitterList['normal'] = [] nitterList['normal'] = []
nitterList['tor'] = [] nitterList['tor'] = []
nitterList['i2p'] = []
nitterList['loki'] = []
for table in tables: for table in tables:
tbody = table.find('tbody') tbody = table.find('tbody')
trs = tbody.find_all('tr') trs = tbody.find_all('tr')
@ -160,11 +185,13 @@ def nitter():
def bibliogram(): def bibliogram():
r = requests.get('https://bibliogram.pussthecat.org/api/instances') r = requests.get('https://bibliogram.art/api/instances')
rJson = json.loads(r.text) rJson = json.loads(r.text)
bibliogramList = {} bibliogramList = {}
bibliogramList['normal'] = [] bibliogramList['normal'] = []
bibliogramList['tor'] = [] bibliogramList['tor'] = []
bibliogramList['i2p'] = []
bibliogramList['loki'] = []
for item in rJson['data']: for item in rJson['data']:
bibliogramList['normal'].append(item['address']) bibliogramList['normal'].append(item['address'])
mightyList['bibliogram'] = bibliogramList mightyList['bibliogram'] = bibliogramList
@ -177,13 +204,14 @@ def libreddit():
libredditList = {} libredditList = {}
libredditList['normal'] = [] libredditList['normal'] = []
libredditList['tor'] = [] libredditList['tor'] = []
libredditList['i2p'] = []
libredditList['loki'] = []
tmp = re.findall( tmp = re.findall(
r"\| \[.*\]\(([-a-zA-Z0-9@:%_\+.~#?&//=]{2,}\.[a-z]{2,}\b(?:\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?)\)*\|*[A-Z]{0,}.*\|.*\|", r.text) r"\| \[.*\]\(([-a-zA-Z0-9@:%_\+.~#?&//=]{2,}\.[a-z]{2,}\b(?:\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?)\)*\|*[A-Z]{0,}.*\|.*\|", r.text)
for item in tmp: for item in tmp:
if item.endswith('.onion'): if re.search("https?:\/{2}(?:[a-zA-Z0-9]+\.)+onion(?:\/[a-zA-Z0-9]+)*\/?", item):
libredditList['tor'].append(item) libredditList['tor'].append(item)
else: else:
libredditList['normal'].append(item) libredditList['normal'].append(item)
@ -198,6 +226,8 @@ def teddit():
tedditList = {} tedditList = {}
tedditList['normal'] = [] tedditList['normal'] = []
tedditList['tor'] = [] tedditList['tor'] = []
tedditList['i2p'] = []
tedditList['loki'] = []
for item in rJson: for item in rJson:
url = item['url'] url = item['url']
if url != '': if url != '':
@ -218,13 +248,17 @@ def wikiless():
wikilessList['normal'] = [] wikilessList['normal'] = []
wikilessList['tor'] = [] wikilessList['tor'] = []
wikilessList['i2p'] = [] wikilessList['i2p'] = []
wikilessList['loki'] = []
for item in rJson: for item in rJson:
if 'url' in item: if 'url' in item:
wikilessList['normal'].append(item['url']) if item['url'].strip() != "":
wikilessList['normal'].append(item['url'])
if 'onion' in item: if 'onion' in item:
wikilessList['tor'].append(item['onion']) if item['onion'].strip() != "":
wikilessList['tor'].append(item['onion'])
if 'i2p' in item: if 'i2p' in item:
wikilessList['i2p'].append(item['i2p']) if item['i2p'].strip() != "":
wikilessList['i2p'].append(item['i2p'])
mightyList['wikiless'] = wikilessList mightyList['wikiless'] = wikilessList
print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Wikiless') print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Wikiless')
@ -236,6 +270,8 @@ def scribe():
scribeList = {} scribeList = {}
scribeList['normal'] = [] scribeList['normal'] = []
scribeList['tor'] = [] scribeList['tor'] = []
scribeList['i2p'] = []
scribeList['loki'] = []
for item in rJson: for item in rJson:
scribeList['normal'].append(item) scribeList['normal'].append(item)
mightyList['scribe'] = scribeList mightyList['scribe'] = scribeList
@ -248,13 +284,15 @@ def quetre():
_list = {} _list = {}
_list['normal'] = [] _list['normal'] = []
_list['tor'] = [] _list['tor'] = []
_list['i2p'] = []
_list['loki'] = []
tmp = re.findall( tmp = re.findall(
r"\| \[.*\]\(([-a-zA-Z0-9@:%_\+.~#?&//=]{2,}\.[a-z]{2,}\b(?:\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?)\)*\|*[A-Z]{0,}.*\|.*\|", r.text) r"\| \[.*\]\(([-a-zA-Z0-9@:%_\+.~#?&//=]{2,}\.[a-z]{2,}\b(?:\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?)\)*\|*[A-Z]{0,}.*\|.*\|", r.text)
for item in tmp: for item in tmp:
if item.endswith('.onion'): if re.search("https?:\/{2}(?:[a-zA-Z0-9]+\.)+onion(?:\/[a-zA-Z0-9]+)*\/?", item):
_list['tor'].append(item) _list['tor'].append(item)
else: else:
_list['normal'].append(item) _list['normal'].append(item)
@ -268,6 +306,8 @@ def libremdb():
_list = {} _list = {}
_list['normal'] = [] _list['normal'] = []
_list['tor'] = [] _list['tor'] = []
_list['i2p'] = []
_list['loki'] = []
tmp = re.findall( tmp = re.findall(
r"\| ([-a-zA-Z0-9@:%_\+.~#?&//=]{2,}\.[a-z]{2,}\b(?:\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?)*\|*[A-Z]{0,}.*\|.*\|", r.text) r"\| ([-a-zA-Z0-9@:%_\+.~#?&//=]{2,}\.[a-z]{2,}\b(?:\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?)*\|*[A-Z]{0,}.*\|.*\|", r.text)
@ -276,7 +316,7 @@ def libremdb():
for item in tmp: for item in tmp:
if item.strip() == "": if item.strip() == "":
continue continue
if item.endswith('.onion'): if re.search("https?:\/{2}(?:[a-zA-Z0-9]+\.)+onion(?:\/[a-zA-Z0-9]+)*\/?", item):
_list['tor'].append(item) _list['tor'].append(item)
else: else:
_list['normal'].append(item) _list['normal'].append(item)
@ -318,6 +358,8 @@ def linvgatranslate():
lingvaList = {} lingvaList = {}
lingvaList['normal'] = [] lingvaList['normal'] = []
lingvaList['tor'] = [] lingvaList['tor'] = []
lingvaList['i2p'] = []
lingvaList['loki'] = []
for item in rJson: for item in rJson:
lingvaList['normal'].append(item) lingvaList['normal'].append(item)
@ -329,20 +371,22 @@ def searx_searxng():
r = requests.get('https://searx.space/data/instances.json') r = requests.get('https://searx.space/data/instances.json')
rJson = json.loads(r.text) rJson = json.loads(r.text)
searxList = {} searxList = {}
searxList['normal'] = []
searxList['tor'] = [] searxList['tor'] = []
searxList['i2p'] = [] searxList['i2p'] = []
searxList['normal'] = [] searxList['loki'] = []
searxngList = {} searxngList = {}
searxngList['normal'] = []
searxngList['tor'] = [] searxngList['tor'] = []
searxngList['i2p'] = [] searxngList['i2p'] = []
searxngList['normal'] = [] searxngList['loki'] = []
for item in rJson['instances']: for item in rJson['instances']:
if item[:-1].endswith('.onion'): if re.search("https?:\/{2}(?:[a-zA-Z0-9]+\.)+onion(?:\/[a-zA-Z0-9]+)*\/?", item[:-1]):
if (rJson['instances'][item].get('generator') == 'searxng'): if (rJson['instances'][item].get('generator') == 'searxng'):
searxngList['tor'].append(item[:-1]) searxngList['tor'].append(item[:-1])
else: else:
searxList['tor'].append(item[:-1]) searxList['tor'].append(item[:-1])
elif item[:-1].endswith('.i2p'): elif re.search("https?:\/{2}(?:[a-zA-Z0-9]+\.)+i2p(?:\/[a-zA-Z0-9]+)*\/?", item[:-1]):
if (rJson['instances'][item].get('generator') == 'searxng'): if (rJson['instances'][item].get('generator') == 'searxng'):
searxngList['i2p'].append(item[:-1]) searxngList['i2p'].append(item[:-1])
else: else:
@ -366,10 +410,11 @@ def whoogle():
whoogleList['normal'] = [] whoogleList['normal'] = []
whoogleList['tor'] = [] whoogleList['tor'] = []
whoogleList['i2p'] = [] whoogleList['i2p'] = []
whoogleList['loki'] = []
for item in tmpList: for item in tmpList:
if item.endswith('.onion'): if re.search("https?:\/{2}(?:[a-zA-Z0-9]+\.)+onion(?:\/[a-zA-Z0-9]+)*\/?", item):
whoogleList['tor'].append(item) whoogleList['tor'].append(item)
elif item.endswith('.i2p'): elif re.search("https?:\/{2}(?:[a-zA-Z0-9]+\.)+i2p(?:\/[a-zA-Z0-9]+)*\/?", item):
whoogleList['i2p'].append(item) whoogleList['i2p'].append(item)
else: else:
whoogleList['normal'].append(item) whoogleList['normal'].append(item)
@ -377,6 +422,31 @@ def whoogle():
print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Whoogle') print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Whoogle')
def librex():
r = requests.get(
'https://raw.githubusercontent.com/hnhx/librex/main/README.md')
_list = {}
_list['normal'] = []
_list['tor'] = []
_list['i2p'] = []
_list['loki'] = []
tmp = re.findall(
r"\| {1,2}\[(?:(?:[a-zA-Z0-9]+\.)+[a-zA-Z]{2,}|✅)\]\((https?:\/{2}(?:[a-zA-Z0-9]+\.)+[a-zA-Z0-9]{2,})", r.text)
for item in tmp:
if item.strip() == "":
continue
elif re.search("https?:\/{2}(?:[a-zA-Z0-9]+\.)+onion(?:\/[a-zA-Z0-9]+)*\/?", item):
_list['tor'].append(item)
elif re.search("https?:\/{2}(?:[a-zA-Z0-9]+\.)+i2p(?:\/[a-zA-Z0-9]+)*\/?", item):
_list['i2p'].append(item)
else:
_list['normal'].append(item)
mightyList['librex'] = _list
print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Librex')
def rimgo(): def rimgo():
r = requests.get( r = requests.get(
'https://codeberg.org/video-prize-ranch/rimgo/raw/branch/main/instances.json') 'https://codeberg.org/video-prize-ranch/rimgo/raw/branch/main/instances.json')
@ -385,6 +455,7 @@ def rimgo():
rimgoList['normal'] = [] rimgoList['normal'] = []
rimgoList['tor'] = [] rimgoList['tor'] = []
rimgoList['i2p'] = [] rimgoList['i2p'] = []
rimgoList['loki'] = []
for item in rJson: for item in rJson:
if 'url' in item: if 'url' in item:
rimgoList['normal'].append(item['url']) rimgoList['normal'].append(item['url'])
@ -396,6 +467,30 @@ def rimgo():
print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Rimgo') print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Rimgo')
def librarian():
r = requests.get(
'https://codeberg.org/librarian/librarian/raw/branch/main/instances.json')
rJson = json.loads(r.text)
librarianList = {}
librarianList['normal'] = []
librarianList['tor'] = []
librarianList['i2p'] = []
librarianList['loki'] = []
instances = rJson['instances']
for item in instances:
url = item['url']
if url.strip() == "":
continue
elif re.search("https?:\/{2}(?:[a-zA-Z0-9]+\.)+onion(?:\/[a-zA-Z0-9]+)*\/?", url):
librarianList['tor'].append(url)
elif re.search("https?:\/{2}(?:[a-zA-Z0-9]+\.)+i2p(?:\/[a-zA-Z0-9]+)*\/?", url):
librarianList['i2p'].append(url)
else:
librarianList['normal'].append(url)
mightyList['librarian'] = librarianList
print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Librarian')
def peertube(): def peertube():
r = requests.get( r = requests.get(
'https://instances.joinpeertube.org/api/v1/instances?start=0&count=1045&sort=-createdAt') 'https://instances.joinpeertube.org/api/v1/instances?start=0&count=1045&sort=-createdAt')
@ -419,6 +514,7 @@ def isValid(url): # This code is contributed by avanitrachhadiya2155
invidious() invidious()
piped() piped()
pipedMaterial()
proxitok() proxitok()
send() send()
nitter() nitter()
@ -433,7 +529,9 @@ simplytranslate()
linvgatranslate() linvgatranslate()
searx_searxng() searx_searxng()
whoogle() whoogle()
librex()
rimgo() rimgo()
librarian()
mightyList = filterLastSlash(mightyList) mightyList = filterLastSlash(mightyList)
cloudflare = [] cloudflare = []

View File

@ -15,5 +15,7 @@
], ],
"tor": [ "tor": [
"http://piped2bbch4xslbl2ckr6k62q56kon56ffowxaqzy42ai22a4sash3ad.onion" "http://piped2bbch4xslbl2ckr6k62q56kon56ffowxaqzy42ai22a4sash3ad.onion"
] ],
} "i2p": [],
"loki": []
}

View File

@ -81,6 +81,7 @@ twitterHelper.pasteNitterCookies();
wikipediaHelper.pasteWikilessCookies(); wikipediaHelper.pasteWikilessCookies();
searchHelper.pasteSearxCookies(); searchHelper.pasteSearxCookies();
searchHelper.pasteSearxngCookies(); searchHelper.pasteSearxngCookies();
searchHelper.pasteLibrexCookies();
redditHelper.pasteLibredditCookies(); redditHelper.pasteLibredditCookies();
redditHelper.pasteTedditCookies(); redditHelper.pasteTedditCookies();
tiktokHelper.pasteProxiTokCookies(); tiktokHelper.pasteProxiTokCookies();
@ -257,4 +258,6 @@ browser.contextMenus.onClicked.addListener(
browser.runtime.onMessage.addListener((message, sender, sendResponse) => { browser.runtime.onMessage.addListener((message, sender, sendResponse) => {
if (message.function === 'unify') utils.unify(false).then(r => sendResponse({ response: r })) if (message.function === 'unify') utils.unify(false).then(r => sendResponse({ response: r }))
return true; return true;
}); });
browser.storage.local.set({"version": browser.runtime.getManifest().version})

View File

@ -14,8 +14,9 @@ await twitterHelper.pasteNitterCookies();
await wikipediaHelper.pasteWikilessCookies(); await wikipediaHelper.pasteWikilessCookies();
await searchHelper.pasteSearxCookies(); await searchHelper.pasteSearxCookies();
await searchHelper.pasteSearxngCookies(); await searchHelper.pasteSearxngCookies();
await searchHelper.pasteLibrexCookies();
await redditHelper.pasteLibredditCookies(); await redditHelper.pasteLibredditCookies();
await redditHelper.pasteTedditCookies(); await redditHelper.pasteTedditCookies();
await tiktokHelper.pasteProxiTokCookies(); await tiktokHelper.pasteProxiTokCookies();
window.close() window.close()

File diff suppressed because it is too large Load Diff

View File

@ -42,7 +42,7 @@ function exportSettings() {
null, null,
result => { result => {
let resultString = JSON.stringify(result, null, ' '); let resultString = JSON.stringify(result, null, ' ');
exportSettingsElement.href = 'data:application/json;base64,' + btoa(resultString); exportSettingsElement.href = 'data:application/json;base64,' + btoa(encodeURI(resultString));
exportSettingsElement.download = 'libredirect-settings.json'; exportSettingsElement.download = 'libredirect-settings.json';
} }
); );
@ -83,6 +83,7 @@ importSettingsElement.addEventListener("change",
await searchHelper.pasteSearxCookies(); await searchHelper.pasteSearxCookies();
await searchHelper.pasteSearxngCookies(); await searchHelper.pasteSearxngCookies();
await searchHelper.pasteLibrexCookies();
await redditHelper.pasteLibredditCookies(); await redditHelper.pasteLibredditCookies();
await redditHelper.pasteTedditCookies(); await redditHelper.pasteTedditCookies();
@ -150,9 +151,9 @@ resetSettings.addEventListener("click",
); );
let autoRedirectElement = document.getElementById("auto-redirect") let autoRedirectElement = document.getElementById("auto-redirect")
autoRedirectElement.addEventListener("change", autoRedirectElement.addEventListener("change", event => {
event => browser.storage.local.set({ autoRedirect: event.target.checked }) browser.storage.local.set({ autoRedirect: event.target.checked })
); });
let themeElement = document.getElementById("theme"); let themeElement = document.getElementById("theme");
themeElement.addEventListener("change", event => { themeElement.addEventListener("change", event => {
@ -161,6 +162,18 @@ themeElement.addEventListener("change", event => {
location.reload(); location.reload();
}) })
let protocolElement = document.getElementById("protocol");
protocolElement.addEventListener("change", event => {
const value = event.target.options[protocol.selectedIndex].value;
browser.storage.local.set({ protocol: value });
location.reload();
})
let protocolFallbackCheckbox = document.getElementById("protocol-fallback-checkbox")
protocolFallbackCheckbox.addEventListener("change", event => {
browser.storage.local.set({ protocolFallback: event.target.checked });
})
let nameCustomInstanceInput = document.getElementById("exceptions-custom-instance"); let nameCustomInstanceInput = document.getElementById("exceptions-custom-instance");
let instanceTypeElement = document.getElementById("exceptions-custom-instance-type"); let instanceTypeElement = document.getElementById("exceptions-custom-instance-type");
let instanceType = "url" let instanceType = "url"
@ -187,13 +200,25 @@ browser.storage.local.get(
'theme', 'theme',
'autoRedirect', 'autoRedirect',
'exceptions', 'exceptions',
'protocol',
'protocolFallback'
// 'firstPartyIsolate' // 'firstPartyIsolate'
], ],
r => { r => {
autoRedirectElement.checked = r.autoRedirect; autoRedirectElement.checked = r.autoRedirect;
themeElement.value = r.theme; themeElement.value = r.theme;
protocolElement.value = r.protocol;
protocolFallbackCheckbox.checked = r.protocolFallback;
// firstPartyIsolate.checked = r.firstPartyIsolate; // firstPartyIsolate.checked = r.firstPartyIsolate;
let protocolFallbackElement = document.getElementById('protocol-fallback')
if (protocolElement.value == "normal") {
protocolFallbackElement.style.display = 'none';
} else {
protocolFallbackElement.style.display = 'block';
}
instanceTypeElement.addEventListener("change", instanceTypeElement.addEventListener("change",
event => { event => {
instanceType = event.target.options[instanceTypeElement.selectedIndex].value instanceType = event.target.options[instanceTypeElement.selectedIndex].value

View File

@ -14,6 +14,19 @@ section#general_page.option-block
h4 Tor Browser h4 Tor Browser
input#firstPartyIsolate(type="checkbox") input#firstPartyIsolate(type="checkbox")
.some-block.option-block
h4(data-localise="__MSG_protocol__")
select#protocol
option(value="normal" data-localise="__MSG_normal__") Normal
option(value="tor") Tor
option(value="i2p") I2P
option(value="loki") Lokinet
#protocol-fallback
.some-block.option-block
h4(data-localise="__MSG_protocolFallback__") Fallback to normal if no instances are available for the current protocol
input#protocol-fallback-checkbox(type="checkbox")
.some-block.option-block .some-block.option-block
h4(data-localise="__MSG_autoRedirect__") h4(data-localise="__MSG_autoRedirect__")
input#auto-redirect(type="checkbox") input#auto-redirect(type="checkbox")
@ -188,4 +201,4 @@ section#general_page.option-block
input#sendTargets(type="checkbox") input#sendTargets(type="checkbox")
script(type="module" src="./widgets/general.js") script(type="module" src="./widgets/general.js")

View File

@ -1,42 +1,61 @@
import utils from "../../../assets/javascripts/utils.js"; import utils from "../../../assets/javascripts/utils.js";
const enable = document.getElementById("imdb-enable"); // UNCOMMENT ALL COMMENTS ONCE OTHER FRONTENDS EXIST
const protocol = document.getElementById("imdb-protocol")
const imdb = document.getElementById('imdb_page');
function changeProtocolSettings() { const frontends = new Array("libremdb")
const normalDiv = imdb.getElementsByClassName("normal")[0]; const protocols = new Array("normal", "tor", "i2p", "loki")
const torDiv = imdb.getElementsByClassName("tor")[0];
if (protocol.value == 'normal') { const enable = document.getElementById("imdb-enable");
normalDiv.style.display = 'block'; const imdb = document.getElementById('imdb_page');
torDiv.style.display = 'none'; //const frontend = document.getElementById("imdb-frontend");
} let protocol
else if (protocol.value == 'tor') {
normalDiv.style.display = 'none'; /*
torDiv.style.display = 'block'; function changeFrontendsSettings() {
for (let i = 0; i < frontends.length; i++) {
const frontendDiv = document.getElementById(frontends[i])
if (frontends[i] == frontend.value) {
frontendDiv.style.display = 'block'
} else {
frontendDiv.style.display = 'none'
}
} }
} }
*/
imdb.addEventListener("change", () => { function changeProtocolSettings() {
changeProtocolSettings(); for (let i = 0; i < frontends.length; i++) {
browser.storage.local.set({ const frontendDiv = document.getElementById(frontends[i])
disableImdb: !enable.checked, for (let x = 0; x < protocols.length; x++) {
imdbProtocol: protocol.value, const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0]
}) if (protocols[x] == protocol) {
}) protocolDiv.style.display = 'block'
} else {
protocolDiv.style.display = 'none'
}
}
}
}
browser.storage.local.get( browser.storage.local.get(
[ [
"disableImdb", "disableImdb",
"imdbProtocol" "protocol"
], ],
r => { r => {
enable.checked = !r.disableImdb; enable.checked = !r.disableImdb;
protocol.value = r.imdbProtocol; protocol = r.protocol;
changeProtocolSettings(); changeProtocolSettings();
} }
) )
utils.processDefaultCustomInstances('imdb', 'libremdb', 'normal', document); imdb.addEventListener("change", () => {
utils.processDefaultCustomInstances('imdb', 'libremdb', 'tor', document); browser.storage.local.set({ disableImdb: !enable.checked })
utils.latency('imdb', 'libremdb', document, location) })
for (let i = 0; i < frontends.length; i++) {
for (let x = 0; x < protocols.length; x++){
utils.processDefaultCustomInstances('imdb', frontends[i], protocols[x], document)
}
utils.latency('imdb', frontends[i], document, location)
}

View File

@ -6,12 +6,6 @@ section#imdb_page.option-block
h4(data-localise="__MSG_enable__") Enable h4(data-localise="__MSG_enable__") Enable
input#imdb-enable(type="checkbox") input#imdb-enable(type="checkbox")
.some-block.option-block
h4(data-localise="__MSG_protocol__") Protocol
select#imdb-protocol
option(value="normal" data-localise="__MSG_normal__") Normal
option(value="tor" data-localise="__MSG_tor__") Tor
#libremdb #libremdb
hr hr
.normal .normal
@ -21,6 +15,12 @@ section#imdb_page.option-block
+latency('libremdb') +latency('libremdb')
.tor .tor
include ../../widgets/instances.pug include ../../widgets/instances.pug
+instances('https://libremdb.onion') +instances('http://libremdb.onion')
.i2p
include ../../widgets/instances.pug
+instances('http://libremdb.i2p')
.loki
include ../../widgets/instances.pug
+instances('http://libremdb.loki')
script(type="module" src="./widgets/imdb.js") script(type="module" src="./widgets/imdb.js")

View File

@ -1,53 +1,61 @@
import utils from "../../../assets/javascripts/utils.js"; import utils from "../../../assets/javascripts/utils.js";
const enable = document.getElementById("imgur-enable"); // UNCOMMENT ALL COMMENTS ONCE OTHER FRONTENDS EXIST
const protocol = document.getElementById("imgur-protocol")
const imgur = document.getElementById('imgur_page');
const normalDiv = imgur.getElementsByClassName("normal")[0]; const frontends = new Array("rimgo")
const torDiv = imgur.getElementsByClassName("tor")[0]; const protocols = new Array("normal", "tor", "i2p", "loki")
const i2pDiv = imgur.getElementsByClassName("i2p")[0];
const enable = document.getElementById("imgur-enable");
const imgur = document.getElementById('imgur_page');
//const frontend = document.getElementById("imgur-frontend");
let protocol
/*
function changeFrontendsSettings() {
for (let i = 0; i < frontends.length; i++) {
const frontendDiv = document.getElementById(frontends[i])
if (frontends[i] == frontend.value) {
frontendDiv.style.display = 'block'
} else {
frontendDiv.style.display = 'none'
}
}
}
*/
function changeProtocolSettings() { function changeProtocolSettings() {
if (protocol.value == 'normal') { for (let i = 0; i < frontends.length; i++) {
normalDiv.style.display = 'block'; const frontendDiv = document.getElementById(frontends[i])
torDiv.style.display = 'none'; for (let x = 0; x < protocols.length; x++) {
i2pDiv.style.display = 'none'; const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0]
} if (protocols[x] == protocol) {
else if (protocol.value == 'tor') { protocolDiv.style.display = 'block'
normalDiv.style.display = 'none'; } else {
torDiv.style.display = 'block'; protocolDiv.style.display = 'none'
i2pDiv.style.display = 'none'; }
} }
else if (protocol.value == 'i2p') {
normalDiv.style.display = 'none';
torDiv.style.display = 'none';
i2pDiv.style.display = 'block';
} }
} }
browser.storage.local.get( browser.storage.local.get(
[ [
"disableImgur", "disableImgur",
"imgurProtocol", "protocol"
], ],
r => { r => {
enable.checked = !r.disableImgur; enable.checked = !r.disableImgur;
protocol.value = r.imgurProtocol; protocol = r.protocol;
changeProtocolSettings(); changeProtocolSettings();
} }
); );
imgur.addEventListener("change", () => { imgur.addEventListener("change", () => {
changeProtocolSettings(); browser.storage.local.set({ disableImgur: !enable.checked });
browser.storage.local.set({
disableImgur: !enable.checked,
imgurProtocol: protocol.value,
});
}) })
utils.processDefaultCustomInstances('imgur', 'rimgo', 'normal', document); for (let i = 0; i < frontends.length; i++) {
utils.processDefaultCustomInstances('imgur', 'rimgo', 'tor', document); for (let x = 0; x < protocols.length; x++){
utils.processDefaultCustomInstances('imgur', 'rimgo', 'i2p', document); utils.processDefaultCustomInstances('imgur', frontends[i], protocols[x], document)
}
utils.latency('imgur', 'rimgo', document, location) utils.latency('imgur', frontends[i], document, location)
}

View File

@ -7,13 +7,6 @@ section#imgur_page.option-block
h4(data-localise="__MSG_enable__") Enable h4(data-localise="__MSG_enable__") Enable
input#imgur-enable(type="checkbox") input#imgur-enable(type="checkbox")
.some-block.option-block
h4(data-localise="__MSG_protocol__") Protocol
select#imgur-protocol
option(value="normal" data-localise="__MSG_normal__") Normal
option(value="tor" data-localise="__MSG_tor__") Tor
option(value="i2p" data-localise="__MSG_i2p__") I2P
#rimgo #rimgo
hr hr
.normal .normal
@ -23,10 +16,12 @@ section#imgur_page.option-block
+latency('rimgo') +latency('rimgo')
.tor .tor
include ../../widgets/instances.pug include ../../widgets/instances.pug
+instances('https://rimgo.onion') +instances('http://rimgo.onion')
.i2p .i2p
include ../../widgets/instances.pug include ../../widgets/instances.pug
+instances('https://rimgo.onion') +instances('http://rimgo.onion')
.loki
include ../../widgets/instances.pug
+instances('http://rimgo.loki')
script(type="module" src="./widgets/imgur.js") script(type="module" src="./widgets/imgur.js")

View File

@ -1,45 +1,61 @@
import utils from "../../../assets/javascripts/utils.js"; import utils from "../../../assets/javascripts/utils.js";
const enable = document.getElementById("instagram-enable"); // UNCOMMENT ALL COMMENTS ONCE OTHER FRONTENDS EXIST
const protocol = document.getElementById("instagram-protocol");
const frontends = new Array("bibliogram")
const protocols = new Array("normal", "tor", "i2p", "loki")
const enable = document.getElementById("instagram-enable");
const instagram = document.getElementById('instagram_page') const instagram = document.getElementById('instagram_page')
const normalDiv = instagram.getElementsByClassName("normal")[0]; //const frontend = document.getElementById("instagram-frontend");
const torDiv = instagram.getElementsByClassName("tor")[0]; let protocol
/*
function changeFrontendsSettings() {
for (let i = 0; i < frontends.length; i++) {
const frontendDiv = document.getElementById(frontends[i])
if (frontends[i] == frontend.value) {
frontendDiv.style.display = 'block'
} else {
frontendDiv.style.display = 'none'
}
}
}
*/
function changeProtocolSettings() { function changeProtocolSettings() {
if (protocol.value == 'normal') { for (let i = 0; i < frontends.length; i++) {
normalDiv.style.display = 'block'; const frontendDiv = document.getElementById(frontends[i])
torDiv.style.display = 'none'; for (let x = 0; x < protocols.length; x++) {
} const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0]
else if (protocol.value == 'tor') { if (protocols[x] == protocol) {
normalDiv.style.display = 'none'; protocolDiv.style.display = 'block'
torDiv.style.display = 'block'; } else {
protocolDiv.style.display = 'none'
}
}
} }
} }
browser.storage.local.get( browser.storage.local.get(
[ [
"disableInstagram", "disableInstagram",
"instagramProtocol" "protocol"
], ],
r => { r => {
enable.checked = !r.disableInstagram; enable.checked = !r.disableInstagram;
protocol.value = r.instagramProtocol; protocol = r.protocol;
changeProtocolSettings(); changeProtocolSettings();
} }
) )
instagram.addEventListener("change", () => { instagram.addEventListener("change", () => {
changeProtocolSettings(); browser.storage.local.set({ disableInstagram: !enable.checked })
browser.storage.local.set({
disableInstagram: !enable.checked,
instagramProtocol: protocol.value,
})
}) })
for (let i = 0; i < frontends.length; i++) {
utils.processDefaultCustomInstances('instagram', 'bibliogram', 'normal', document); for (let x = 0; x < protocols.length; x++){
utils.processDefaultCustomInstances('instagram', 'bibliogram', 'tor', document); utils.processDefaultCustomInstances('instagram', frontends[i], protocols[x], document)
}
utils.latency('instagram', 'bibliogram', document, location) utils.latency('instagram', frontends[i], document, location)
}

View File

@ -7,12 +7,6 @@ section#instagram_page.option-block
h4(data-localise="__MSG_enable__") Enable h4(data-localise="__MSG_enable__") Enable
input#instagram-enable(type="checkbox") input#instagram-enable(type="checkbox")
.some-block.option-block
h4(data-localise="__MSG_protocol__") Protocol
select#instagram-protocol
option(value="normal" data-localise="__MSG_normal__") Normal
option(value="tor" data-localise="__MSG_tor__") Tor
#bibliogram #bibliogram
hr hr
.normal .normal
@ -21,6 +15,13 @@ section#instagram_page.option-block
include ../../widgets/latency.pug include ../../widgets/latency.pug
+latency('bibliogram') +latency('bibliogram')
.tor .tor
include ../../widgets/instances.pug
+instances('https://bibliogram.onion') +instances('https://bibliogram.onion')
.i2p
include ../../widgets/instances.pug
+instances('http://bibliogram.onion')
.loki
include ../../widgets/instances.pug
+instances('http://bibliogram.loki')
script(type="module" src="./widgets/instagram.js") script(type="module" src="./widgets/instagram.js")

View File

@ -1,44 +1,61 @@
import utils from "../../../assets/javascripts/utils.js"; import utils from "../../../assets/javascripts/utils.js";
const enable = document.getElementById("lbry-enable"); // UNCOMMENT ALL COMMENTS ONCE OTHER FRONTENDS EXIST
const protocol = document.getElementById("lbry-protocol")
const frontends = new Array("librarian")
const protocols = new Array("normal", "tor", "i2p", "loki")
const enable = document.getElementById("lbry-enable");
const lbry = document.getElementById('lbry_page'); const lbry = document.getElementById('lbry_page');
const normalDiv = lbry.getElementsByClassName("normal")[0]; //const frontend = document.getElementById("lbry-frontend");
const torDiv = lbry.getElementsByClassName("tor")[0]; let protocol
/*
function changeFrontendsSettings() {
for (let i = 0; i < frontends.length; i++) {
const frontendDiv = document.getElementById(frontends[i])
if (frontends[i] == frontend.value) {
frontendDiv.style.display = 'block'
} else {
frontendDiv.style.display = 'none'
}
}
}
*/
function changeProtocolSettings() { function changeProtocolSettings() {
if (protocol.value == 'normal') { for (let i = 0; i < frontends.length; i++) {
normalDiv.style.display = 'block'; const frontendDiv = document.getElementById(frontends[i])
torDiv.style.display = 'none'; for (let x = 0; x < protocols.length; x++) {
} const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0]
else if (protocol.value == 'tor') { if (protocols[x] == protocol) {
normalDiv.style.display = 'none'; protocolDiv.style.display = 'block'
torDiv.style.display = 'block'; } else {
protocolDiv.style.display = 'none'
}
}
} }
} }
browser.storage.local.get( browser.storage.local.get(
[ [
"disableLbryTargets", "disableLbryTargets",
"lbryTargetsProtocol" "protocol"
], ],
r => { r => {
enable.checked = !r.disableLbryTargets; enable.checked = !r.disableLbryTargets;
protocol.value = r.lbryTargetsProtocol; protocol = r.protocol;
changeProtocolSettings(); changeProtocolSettings();
} }
) )
lbry.addEventListener("change", () => { lbry.addEventListener("change", () => {
changeProtocolSettings() browser.storage.local.set({ disableLbryTargets: !enable.checked });
browser.storage.local.set({
disableLbryTargets: !enable.checked,
lbryTargetsProtocol: protocol.value,
});
}) })
utils.processDefaultCustomInstances('lbryTargets', 'librarian', 'normal', document); for (let i = 0; i < frontends.length; i++) {
utils.processDefaultCustomInstances('lbryTargets', 'librarian', 'tor', document); for (let x = 0; x < protocols.length; x++){
utils.processDefaultCustomInstances('lbryTargets', frontends[i], protocols[x], document)
utils.latency('lbryTargets', 'librarian', document, location) }
utils.latency('lbryTargets', frontends[i], document, location)
}

View File

@ -6,12 +6,6 @@ section#lbry_page.option-block
h4(data-localise="__MSG_enable__") Enable h4(data-localise="__MSG_enable__") Enable
input#lbry-enable(type="checkbox") input#lbry-enable(type="checkbox")
.some-block.option-block
h4(data-localise="__MSG_protocol__") Protocol
select#lbry-protocol
option(value="normal" data-localise="__MSG_normal__") Normal
option(value="tor" data-localise="__MSG_tor__") Tor
#librarian #librarian
hr hr
.normal .normal
@ -22,5 +16,11 @@ section#lbry_page.option-block
.tor .tor
include ../../widgets/instances.pug include ../../widgets/instances.pug
+instances('https://librarian.onion') +instances('https://librarian.onion')
.i2p
include ../../widgets/instances.pug
+instances('http://librarian.onion')
.loki
include ../../widgets/instances.pug
+instances('http://librarian.loki')
script(type="module" src="./widgets/lbry.js") script(type="module" src="./widgets/lbry.js")

View File

@ -1,34 +1,64 @@
import utils from "../../../assets/javascripts/utils.js"; import utils from "../../../assets/javascripts/utils.js";
const enable = document.getElementById("maps-enable"); const frontends = new Array("facil")
const frontend = document.getElementById("maps-frontend"); const protocols = new Array("normal", "tor", "i2p", "loki")
const enable = document.getElementById("maps-enable");
const maps = document.getElementById('maps_page'); const maps = document.getElementById('maps_page');
const facilDiv = document.getElementById("facil") const frontend = document.getElementById("maps-frontend");
let protocol
function changeProtocolSettings() {
for (let i = 0; i < frontends.length; i++) {
const frontendDiv = document.getElementById(frontends[i])
for (let x = 0; x < protocols.length; x++) {
const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0]
if (protocols[x] == protocol) {
protocolDiv.style.display = 'block'
} else {
protocolDiv.style.display = 'none'
}
}
}
}
function changeFrontendsSettings() { function changeFrontendsSettings() {
if (frontend.value == 'facil') facilDiv.style.display = 'block'; for (let i = 0; i < frontends.length; i++) {
else if (frontend.value == 'osm') facilDiv.style.display = 'none'; const frontendDiv = document.getElementById(frontends[i])
if (frontends[i] == frontend.value) {
frontendDiv.style.display = 'block'
} else {
frontendDiv.style.display = 'none'
}
}
} }
browser.storage.local.get( browser.storage.local.get(
[ [
"disableMaps", "disableMaps",
"mapsFrontend", "protocol",
"mapsFrontend"
], ],
r => { r => {
enable.checked = !r.disableMaps; enable.checked = !r.disableMaps;
protocol = r.protocol;
frontend.value = r.mapsFrontend; frontend.value = r.mapsFrontend;
changeFrontendsSettings(); changeFrontendsSettings();
changeProtocolSettings();
} }
) )
maps.addEventListener("change", () => { maps.addEventListener("change", () => {
changeFrontendsSettings();
browser.storage.local.set({ browser.storage.local.set({
disableMaps: !enable.checked, disableMaps: !enable.checked,
mapsFrontend: frontend.value, mapsFrontend: frontend.value
}) });
changeFrontendsSettings();
}) })
utils.processDefaultCustomInstances('maps', 'facil', 'normal', document); for (let i = 0; i < frontends.length; i++) {
for (let x = 0; x < protocols.length; x++) {
utils.processDefaultCustomInstances('maps', frontends[i], protocols[x], document)
}
utils.latency('maps', frontends[i], document, location)
}

View File

@ -18,6 +18,15 @@ section#maps_page.option-block
include ../../widgets/instances.pug include ../../widgets/instances.pug
+instances('https://facilmap.com') +instances('https://facilmap.com')
include ../../widgets/latency.pug include ../../widgets/latency.pug
+latency('facilmap') +latency('facil')
.tor
+instances('http://facilmap.onion')
include ../../widgets/instances.pug
.i2p
include ../../widgets/instances.pug
+instances('http://facilmap.i2p')
.loki
include ../../widgets/instances.pug
+instances('http://facilmap.loki')
script(type="module" src="./widgets/maps.js") script(type="module" src="./widgets/maps.js")

View File

@ -1,42 +1,61 @@
import utils from "../../../assets/javascripts/utils.js"; import utils from "../../../assets/javascripts/utils.js";
const enable = document.getElementById("medium-enable"); // UNCOMMENT ALL COMMENTS ONCE OTHER FRONTENDS EXIST
const protocol = document.getElementById("medium-protocol")
const medium = document.getElementById('medium_page');
function changeProtocolSettings() { const frontends = new Array("scribe")
const normalDiv = medium.getElementsByClassName("normal")[0]; const protocols = new Array("normal", "tor", "i2p", "loki")
const torDiv = medium.getElementsByClassName("tor")[0];
if (protocol.value == 'normal') { const enable = document.getElementById("medium-enable");
normalDiv.style.display = 'block'; const medium = document.getElementById('medium_page');
torDiv.style.display = 'none'; //const frontend = document.getElementById("medium-frontend");
} let protocol
else if (protocol.value == 'tor') {
normalDiv.style.display = 'none'; /*
torDiv.style.display = 'block'; function changeFrontendsSettings() {
for (let i = 0; i < frontends.length; i++) {
const frontendDiv = document.getElementById(frontends[i])
if (frontends[i] == frontend.value) {
frontendDiv.style.display = 'block'
} else {
frontendDiv.style.display = 'none'
}
} }
} }
*/
medium.addEventListener("change", () => { function changeProtocolSettings() {
changeProtocolSettings(); for (let i = 0; i < frontends.length; i++) {
browser.storage.local.set({ const frontendDiv = document.getElementById(frontends[i])
disableMedium: !enable.checked, for (let x = 0; x < protocols.length; x++) {
mediumProtocol: protocol.value, const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0]
}) if (protocols[x] == protocol) {
}) protocolDiv.style.display = 'block'
} else {
protocolDiv.style.display = 'none'
}
}
}
}
browser.storage.local.get( browser.storage.local.get(
[ [
"disableMedium", "disableMedium",
"mediumProtocol" "protocol"
], ],
r => { r => {
enable.checked = !r.disableMedium; enable.checked = !r.disableMedium;
protocol.value = r.mediumProtocol; protocol = r.protocol;
changeProtocolSettings(); changeProtocolSettings();
} }
) )
utils.processDefaultCustomInstances('medium', 'scribe', 'normal', document); medium.addEventListener("change", () => {
utils.processDefaultCustomInstances('medium', 'scribe', 'tor', document); browser.storage.local.set({ disableMedium: !enable.checked })
utils.latency('medium', 'scribe', document, location) })
for (let i = 0; i < frontends.length; i++) {
for (let x = 0; x < protocols.length; x++){
utils.processDefaultCustomInstances('medium', frontends[i], protocols[x], document)
}
utils.latency('medium', frontends[i], document, location)
}

View File

@ -6,12 +6,6 @@ section#medium_page.option-block
h4(data-localise="__MSG_enable__") Enable h4(data-localise="__MSG_enable__") Enable
input#medium-enable(type="checkbox") input#medium-enable(type="checkbox")
.some-block.option-block
h4(data-localise="__MSG_protocol__") Protocol
select#medium-protocol
option(value="normal" data-localise="__MSG_normal__") Normal
option(value="tor" data-localise="__MSG_tor__") Tor
#scribe #scribe
hr hr
.normal .normal
@ -21,6 +15,12 @@ section#medium_page.option-block
+latency('scribe') +latency('scribe')
.tor .tor
include ../../widgets/instances.pug include ../../widgets/instances.pug
+instances('https://scribe.onion') +instances('http://scribe.onion')
.i2p
include ../../widgets/instances.pug
+instances('http://scribe.i2p')
.loki
include ../../widgets/instances.pug
+instances('http://scribe.loki')
script(type="module" src="./widgets/medium.js") script(type="module" src="./widgets/medium.js")

View File

@ -1,42 +1,61 @@
import utils from "../../../assets/javascripts/utils.js"; import utils from "../../../assets/javascripts/utils.js";
// UNCOMMENT ALL COMMENTS ONCE OTHER FRONTENDS EXIST
const frontends = new Array("simpleertube")
const protocols = new Array("normal", "tor", "i2p", "loki")
const enable = document.getElementById("peertube-enable"); const enable = document.getElementById("peertube-enable");
const protocol = document.getElementById("peertube-protocol");
const peertube = document.getElementById('peertube_page'); const peertube = document.getElementById('peertube_page');
//const frontend = document.getElementById("peertube-frontend");
let protocol
/*
function changeFrontendsSettings() {
for (let i = 0; i < frontends.length; i++) {
const frontendDiv = document.getElementById(frontends[i])
if (frontends[i] == frontend.value) {
frontendDiv.style.display = 'block'
} else {
frontendDiv.style.display = 'none'
}
}
}
*/
function changeProtocolSettings() { function changeProtocolSettings() {
const normalDiv = peertube.getElementsByClassName("normal")[0]; for (let i = 0; i < frontends.length; i++) {
const torDiv = peertube.getElementsByClassName("tor")[0]; const frontendDiv = document.getElementById(frontends[i])
if (protocol.value == 'normal') { for (let x = 0; x < protocols.length; x++) {
normalDiv.style.display = 'block'; const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0]
torDiv.style.display = 'none'; if (protocols[x] == protocol) {
} protocolDiv.style.display = 'block'
else if (protocol.value == 'tor') { } else {
normalDiv.style.display = 'none'; protocolDiv.style.display = 'none'
torDiv.style.display = 'block'; }
}
} }
} }
browser.storage.local.get( browser.storage.local.get(
[ [
"disablePeertubeTargets", "disablePeertubeTargets",
"peertubeTargetsProtocol" "protocol"
], ],
r => { r => {
enable.checked = !r.disablePeertubeTargets; enable.checked = !r.disablePeertubeTargets;
protocol.value = r.peertubeTargetsProtocol; protocol = r.protocol;
changeProtocolSettings(); changeProtocolSettings();
} }
) )
peertube.addEventListener("change", () => { peertube.addEventListener("change", () => {
changeProtocolSettings(); browser.storage.local.set({ disablePeertubeTargets: !enable.checked })
browser.storage.local.set({
disablePeertubeTargets: !enable.checked,
peertubeTargetsProtocol: protocol.value
})
}) })
utils.processDefaultCustomInstances('peertube', 'simpleertube', 'normal', document); for (let i = 0; i < frontends.length; i++) {
utils.processDefaultCustomInstances('peertube', 'simpleertube', 'tor', document); for (let x = 0; x < protocols.length; x++){
utils.latency('peertube', 'simpleertube', document, location) utils.processDefaultCustomInstances('peertube', frontends[i], protocols[x], document)
}
utils.latency('peertube', frontends[i], document, location)
}

View File

@ -6,12 +6,6 @@ section#peertube_page.option-block
h4(data-localise="__MSG_enable__") Enable h4(data-localise="__MSG_enable__") Enable
input#peertube-enable(type="checkbox") input#peertube-enable(type="checkbox")
.some-block.option-block
h4(data-localise="__MSG_protocol__") Protocol
select#peertube-protocol
option(value="normal" data-localise="__MSG_normal__") Normal
option(value="tor" data-localise="__MSG_tor__") Tor
#simpleertube #simpleertube
hr hr
.normal .normal
@ -21,6 +15,12 @@ section#peertube_page.option-block
+latency('simpleertube') +latency('simpleertube')
.tor .tor
include ../../widgets/instances.pug include ../../widgets/instances.pug
+instances('https://simpleertube.onion') +instances('http://simpleertube.onion')
.i2p
include ../../widgets/instances.pug
+instances('http://simpleertube.i2p')
.loki
include ../../widgets/instances.pug
+instances('http://simpleertube.loki')
script(type="module" src="./widgets/peertube.js") script(type="module" src="./widgets/peertube.js")

View File

@ -1,42 +1,61 @@
import utils from "../../../assets/javascripts/utils.js"; import utils from "../../../assets/javascripts/utils.js";
const enable = document.getElementById("quora-enable"); // UNCOMMENT ALL COMMENTS ONCE OTHER FRONTENDS EXIST
const protocol = document.getElementById("quora-protocol")
const quora = document.getElementById('quora_page');
function changeProtocolSettings() { const frontends = new Array("quetre")
const normalDiv = quora.getElementsByClassName("normal")[0]; const protocols = new Array("normal", "tor", "i2p", "loki")
const torDiv = quora.getElementsByClassName("tor")[0];
if (protocol.value == 'normal') { const enable = document.getElementById("quora-enable");
normalDiv.style.display = 'block'; const quora = document.getElementById('quora_page');
torDiv.style.display = 'none'; //const frontend = document.getElementById("quora-frontend");
} let protocol
else if (protocol.value == 'tor') {
normalDiv.style.display = 'none'; /*
torDiv.style.display = 'block'; function changeFrontendsSettings() {
for (let i = 0; i < frontends.length; i++) {
const frontendDiv = document.getElementById(frontends[i])
if (frontends[i] == frontend.value) {
frontendDiv.style.display = 'block'
} else {
frontendDiv.style.display = 'none'
}
} }
} }
*/
quora.addEventListener("change", () => { function changeProtocolSettings() {
changeProtocolSettings(); for (let i = 0; i < frontends.length; i++) {
browser.storage.local.set({ const frontendDiv = document.getElementById(frontends[i])
disableQuora: !enable.checked, for (let x = 0; x < protocols.length; x++) {
quoraProtocol: protocol.value, const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0]
}) if (protocols[x] == protocol) {
}) protocolDiv.style.display = 'block'
} else {
protocolDiv.style.display = 'none'
}
}
}
}
browser.storage.local.get( browser.storage.local.get(
[ [
"disableQuora", "disableQuora",
"quoraProtocol" "protocol"
], ],
r => { r => {
enable.checked = !r.disableQuora; enable.checked = !r.disableQuora;
protocol.value = r.quoraProtocol; protocol = r.protocol;
changeProtocolSettings(); changeProtocolSettings();
} }
) )
utils.processDefaultCustomInstances('quora', 'quetre', 'normal', document); quora.addEventListener("change", () => {
utils.processDefaultCustomInstances('quora', 'quetre', 'tor', document); browser.storage.local.set({ disableQuora: !enable.checked })
utils.latency('quora', 'quetre', document, location) })
for (let i = 0; i < frontends.length; i++) {
for (let x = 0; x < protocols.length; x++){
utils.processDefaultCustomInstances('quora', frontends[i], protocols[x], document)
}
utils.latency('quora', frontends[i], document, location)
}

View File

@ -6,12 +6,6 @@ section#quora_page.option-block
h4(data-localise="__MSG_enable__") Enable h4(data-localise="__MSG_enable__") Enable
input#quora-enable(type="checkbox") input#quora-enable(type="checkbox")
.some-block.option-block
h4(data-localise="__MSG_protocol__") Protocol
select#quora-protocol
option(value="normal" data-localise="__MSG_normal__") Normal
option(value="tor" data-localise="__MSG_tor__") Tor
#quetre #quetre
hr hr
.normal .normal
@ -21,6 +15,12 @@ section#quora_page.option-block
+latency('quetre') +latency('quetre')
.tor .tor
include ../../widgets/instances.pug include ../../widgets/instances.pug
+instances('https://quetre.onion') +instances('http://quetre.onion')
.i2p
include ../../widgets/instances.pug
+instances('http://quetre.i2p')
.loki
include ../../widgets/instances.pug
+instances('http://quetre.loki')
script(type="module" src="./widgets/quora.js") script(type="module" src="./widgets/quora.js")

View File

@ -1,52 +1,47 @@
import utils from "../../../assets/javascripts/utils.js"; import utils from "../../../assets/javascripts/utils.js";
const libredditDivElement = document.getElementById("libreddit") const frontends = new Array("libreddit", "teddit")
const tedditDivElement = document.getElementById("teddit") const protocols = new Array("normal", "tor", "i2p", "loki")
const enable = document.getElementById("reddit-enable"); const enable = document.getElementById("reddit-enable");
const frontend = document.getElementById("reddit-frontend");
const protocol = document.getElementById("reddit-protocol");
const reddit = document.getElementById('reddit_page'); const reddit = document.getElementById('reddit_page');
const frontend = document.getElementById("reddit-frontend");
let protocol
function changeProtocolSettings() { function changeFrontendsSettings() {
const normalLibredditDiv = libredditDivElement.getElementsByClassName("normal")[0]; for (let i = 0; i < frontends.length; i++) {
const torLibredditDiv = libredditDivElement.getElementsByClassName("tor")[0]; const frontendDiv = document.getElementById(frontends[i])
const normalTedditDiv = tedditDivElement.getElementsByClassName("normal")[0]; if (frontends[i] == frontend.value) {
const torTedditDiv = tedditDivElement.getElementsByClassName("tor")[0]; frontendDiv.style.display = 'block'
if (protocol.value == 'normal') { } else {
normalLibredditDiv.style.display = 'block'; frontendDiv.style.display = 'none'
normalTedditDiv.style.display = 'block'; }
torTedditDiv.style.display = 'none';
torLibredditDiv.style.display = 'none';
}
else if (protocol.value == 'tor') {
normalLibredditDiv.style.display = 'none';
normalTedditDiv.style.display = 'none';
torTedditDiv.style.display = 'block';
torLibredditDiv.style.display = 'block';
} }
} }
function changeFrontendsSettings() { function changeProtocolSettings() {
if (frontend.value == 'libreddit') { for (let i = 0; i < frontends.length; i++) {
libredditDivElement.style.display = 'block'; const frontendDiv = document.getElementById(frontends[i])
tedditDivElement.style.display = 'none'; for (let x = 0; x < protocols.length; x++) {
} const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0]
else if (frontend.value == 'teddit') { if (protocols[x] == protocol) {
libredditDivElement.style.display = 'none'; protocolDiv.style.display = 'block'
tedditDivElement.style.display = 'block'; } else {
protocolDiv.style.display = 'none'
}
}
} }
} }
browser.storage.local.get( browser.storage.local.get(
[ [
"disableReddit", "disableReddit",
"redditProtocol", "protocol",
"redditFrontend", "redditFrontend",
], ],
r => { r => {
enable.checked = !r.disableReddit enable.checked = !r.disableReddit
protocol.value = r.redditProtocol protocol = r.protocol
frontend.value = r.redditFrontend frontend.value = r.redditFrontend
changeFrontendsSettings(); changeFrontendsSettings();
changeProtocolSettings(); changeProtocolSettings();
@ -56,17 +51,14 @@ browser.storage.local.get(
reddit.addEventListener("change", () => { reddit.addEventListener("change", () => {
browser.storage.local.set({ browser.storage.local.set({
disableReddit: !enable.checked, disableReddit: !enable.checked,
redditProtocol: protocol.value, redditFrontend: frontend.value
redditFrontend: frontend.value,
}); });
changeFrontendsSettings(); changeFrontendsSettings();
changeProtocolSettings();
}) })
utils.processDefaultCustomInstances('reddit', 'libreddit', 'normal', document); for (let i = 0; i < frontends.length; i++) {
utils.processDefaultCustomInstances('reddit', 'libreddit', 'tor', document); for (let x = 0; x < protocols.length; x++){
utils.processDefaultCustomInstances('reddit', 'teddit', 'normal', document); utils.processDefaultCustomInstances('reddit', frontends[i], protocols[x], document)
utils.processDefaultCustomInstances('reddit', 'teddit', 'tor', document); }
utils.latency('reddit', frontends[i], document, location)
utils.latency('reddit', 'libreddit', document, location, true) }
utils.latency('reddit', 'teddit', document, location, true)

View File

@ -12,12 +12,6 @@ section#reddit_page.option-block
option(value="libreddit") Libreddit option(value="libreddit") Libreddit
option(value="teddit") Teddit option(value="teddit") Teddit
.some-block.option-block
h4(data-localise="__MSG_protocol__") Protocol
select#reddit-protocol
option(value="normal" data-localise="__MSG_normal__") Normal
option(value="tor" data-localise="__MSG_tor__") Tor
#libreddit #libreddit
hr hr
.normal .normal
@ -27,7 +21,13 @@ section#reddit_page.option-block
+latency('libreddit') +latency('libreddit')
.tor .tor
include ../../widgets/instances.pug include ../../widgets/instances.pug
+instances('https://libreddit.onion') +instances('http://libreddit.onion')
.i2p
include ../../widgets/instances.pug
+instances('http://libreddit.i2p')
.loki
include ../../widgets/instances.pug
+instances('http://libreddit.loki')
#teddit #teddit
hr hr
@ -37,6 +37,12 @@ section#reddit_page.option-block
+latency('teddit') +latency('teddit')
.tor .tor
include ../../widgets/instances.pug include ../../widgets/instances.pug
+instances('https://teddit.onion') +instances('http://teddit.onion')
.i2p
include ../../widgets/instances.pug
+instances('http://teddit.i2p')
.loki
include ../../widgets/instances.pug
+instances('http://teddit.loki')
script(type="module" src="./widgets/reddit.js") script(type="module" src="./widgets/reddit.js")

View File

@ -1,43 +1,61 @@
import utils from "../../../assets/javascripts/utils.js"; import utils from "../../../assets/javascripts/utils.js";
const enable = document.getElementById("reuters-enable"); // UNCOMMENT ALL COMMENTS ONCE OTHER FRONTENDS EXIST
const protocol = document.getElementById("reuters-protocol")
const reuters = document.getElementById('reuters_page');
function changeProtocolSettings() { const frontends = new Array("neuters")
const normalDiv = reuters.getElementsByClassName("normal")[0]; const protocols = new Array("normal", "tor", "i2p", "loki")
const torDiv = reuters.getElementsByClassName("tor")[0];
if (protocol.value == 'normal') { const enable = document.getElementById("reuters-enable");
const reuters = document.getElementById('reuters_page');
normalDiv.style.display = 'block'; //const frontend = document.getElementById("reuters-frontend");
torDiv.style.display = 'none'; let protocol
}
else if (protocol.value == 'tor') { /*
normalDiv.style.display = 'none'; function changeFrontendsSettings() {
torDiv.style.display = 'block'; for (let i = 0; i < frontends.length; i++) {
const frontendDiv = document.getElementById(frontends[i])
if (frontends[i] == frontend.value) {
frontendDiv.style.display = 'block'
} else {
frontendDiv.style.display = 'none'
}
} }
} }
*/
reuters.addEventListener("change", () => { function changeProtocolSettings() {
changeProtocolSettings(); for (let i = 0; i < frontends.length; i++) {
browser.storage.local.set({ const frontendDiv = document.getElementById(frontends[i])
disableReuters: !enable.checked, for (let x = 0; x < protocols.length; x++) {
reutersProtocol: protocol.value, const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0]
}) if (protocols[x] == protocol) {
}) protocolDiv.style.display = 'block'
} else {
protocolDiv.style.display = 'none'
}
}
}
}
browser.storage.local.get( browser.storage.local.get(
[ [
"disableReuters", "disableReuters",
"reutersProtocol" "protocol"
], ],
r => { r => {
enable.checked = !r.disableReuters; enable.checked = !r.disableReuters;
protocol.value = r.reutersProtocol; protocol = r.protocol;
changeProtocolSettings(); changeProtocolSettings();
} }
) )
utils.processDefaultCustomInstances('reuters', 'neuters', 'normal', document); reuters.addEventListener("change", () => {
utils.processDefaultCustomInstances('reuters', 'neuters', 'tor', document); browser.storage.local.set({ disableReuters: !enable.checked })
utils.latency('reuters', 'neuters', document, location) })
for (let i = 0; i < frontends.length; i++) {
for (let x = 0; x < protocols.length; x++){
utils.processDefaultCustomInstances('reuters', frontends[i], protocols[x], document)
}
utils.latency('reuters', frontends[i], document, location)
}

View File

@ -6,12 +6,6 @@ section#reuters_page.option-block
h4(data-localise="__MSG_enable__") Enable h4(data-localise="__MSG_enable__") Enable
input#reuters-enable(type="checkbox") input#reuters-enable(type="checkbox")
.some-block.option-block
h4(data-localise="__MSG_protocol__") Protocol
select#reuters-protocol
option(value="normal" data-localise="__MSG_normal__") Normal
option(value="tor" data-localise="__MSG_tor__") Tor
#neuters #neuters
hr hr
.normal .normal
@ -21,6 +15,12 @@ section#reuters_page.option-block
+latency('neuters') +latency('neuters')
.tor .tor
include ../../widgets/instances.pug include ../../widgets/instances.pug
+instances('https://neuters.onion') +instances('http://neuters.onion')
.i2p
include ../../widgets/instances.pug
+instances('http://neuters.i2p')
.loki
include ../../widgets/instances.pug
+instances('http://neuters.loki')
script(type="module" src="./widgets/reuters.js") script(type="module" src="./widgets/reuters.js")

View File

@ -1,39 +1,111 @@
import utils from "../../../assets/javascripts/utils.js"; import utils from "../../../assets/javascripts/utils.js";
// GOAL: to never mention frontends/protocls outside these two arrays, so that adding a new frontend/protocol is as easy as adding it here.
// This may be expanded across the whole project, where almost everything becomes a template, and the frontend/protocol parts just become a JSON file.
// ONCE FINISHED: add librex and see if it works
const frontends = new Array("searx", "searxng", "whoogle", "librex") // Add librex once /javascripts/search.js is made agnostic
const protocols = new Array("normal", "tor", "i2p", "loki")
//let frontendProtocols = (frontends.length)
// I will leave comments of my privious attemps so that people can learn from my mistakes. :)
/*
for (let i = 0; i < frontends.length; i++) {
this.frontends[i] = frontends[i].getElementsByClassName(protocol)
}
*/
// There was a class here, but I deleted a bit of it
/*
this.searxDiv = searxDiv.getElementsByClassName(protocol)[0];
this.searxngDiv = searxngDiv.getElementsByClassName(protocol)[0];
this.librexDiv = librexDiv.getElementsByClassName(protocol)[0];
*/
/*
* Here I was trying to solve the issue by making a 2D array, but I later realised I was overcomplicating things
for (var i = 0; i < frontends.length; i++) {
frontendProtocols[i] = new Array(protocols.length)
}
*/
/*
const searxDiv = document.getElementById("searx"); const searxDiv = document.getElementById("searx");
const searxngDiv = document.getElementById("searxng"); const searxngDiv = document.getElementById("searxng");
const whoogleDiv = document.getElementById("whoogle"); const whoogleDiv = document.getElementById("whoogle");
*/
const enable = document.getElementById("search-enable"); const enable = document.getElementById("search-enable");
const frontend = document.getElementById("search-frontend");
const protocol = document.getElementById("search-protocol");
const search = document.getElementById('search_page'); const search = document.getElementById('search_page');
const frontend = document.getElementById("search-frontend");
let protocol
function changeFrontendsSettings() { function changeFrontendsSettings() {
let SearxWhoogleElement = document.getElementById("searx-whoogle"); for (let i = 0; i < frontends.length; i++) {
const frontendDiv = document.getElementById(frontends[i])
if (frontends[i] == frontend.value) {
frontendDiv.style.display = 'block'
} else {
frontendDiv.style.display = 'none'
}
}
/*
if (frontend.value == 'searx') { if (frontend.value == 'searx') {
searxDiv.style.display = 'block'; searxDiv.style.display = 'block';
searxngDiv.style.display = 'none'; searxngDiv.style.display = 'none';
whoogleDiv.style.display = 'none'; whoogleDiv.style.display = 'none';
SearxWhoogleElement.style.display = 'block'; librexDiv.style.display = 'none';
} }
else if (frontend.value == 'searxng') { else if (frontend.value == 'searxng') {
searxDiv.style.display = 'none'; searxDiv.style.display = 'none';
searxngDiv.style.display = 'block'; searxngDiv.style.display = 'block';
whoogleDiv.style.display = 'none'; whoogleDiv.style.display = 'none';
SearxWhoogleElement.style.display = 'block'; librexDiv.style.display = 'none';
} }
else if (frontend.value == 'whoogle') { else if (frontend.value == 'whoogle') {
searxDiv.style.display = 'none'; searxDiv.style.display = 'none';
searxngDiv.style.display = 'none'; searxngDiv.style.display = 'none';
whoogleDiv.style.display = 'block'; whoogleDiv.style.display = 'block';
SearxWhoogleElement.style.display = 'block'; librexDiv.style.display = 'none';
} }
else if (frontend.value == 'librex') {
searxDiv.style.display = 'none';
searxDiv.style.display = 'none';
searxngDiv.style.display = 'none';
librexDiv.style.display = 'block';
}
*/
} }
function changeProtocolSettings() { function changeProtocolSettings() {
for (let i = 0; i < frontends.length; i++) {
const frontendDiv = document.getElementById(frontends[i])
//if (frontends[i] == frontend.value) { // Here we are checking if the frontend matches the current one. This skips the protocol checking for that frontend, speeding things up. I no longer do this as protocol setting is only set once in the ui so every frontend needs to get their protocols setup immidiately.
for (let x = 0; x < protocols.length; x++) {
const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0]
if (protocols[x] == protocol) { //if the frontend value equals the selected one, it will show. Otherwise, it will be hidden
protocolDiv.style.display = 'block'
} else {
protocolDiv.style.display = 'none'
}
}
/*
} else {
continue
}
*/
}
/*
* "Legacy" code
const normalsearxDiv = searxDiv.getElementsByClassName("normal")[0]; const normalsearxDiv = searxDiv.getElementsByClassName("normal")[0];
const torsearxDiv = searxDiv.getElementsByClassName("tor")[0]; const torsearxDiv = searxDiv.getElementsByClassName("tor")[0];
const i2psearxDiv = searxDiv.getElementsByClassName("i2p")[0]; const i2psearxDiv = searxDiv.getElementsByClassName("i2p")[0];
@ -42,10 +114,18 @@ function changeProtocolSettings() {
const torsearxngDiv = searxngDiv.getElementsByClassName("tor")[0]; const torsearxngDiv = searxngDiv.getElementsByClassName("tor")[0];
const i2psearxngDiv = searxngDiv.getElementsByClassName("i2p")[0]; const i2psearxngDiv = searxngDiv.getElementsByClassName("i2p")[0];
const normalwhoogleDiv = whoogleDiv.getElementsByClassName("normal")[0];
const torwhoogleDiv = whoogleDiv.getElementsByClassName("tor")[0]; const torwhoogleDiv = whoogleDiv.getElementsByClassName("tor")[0];
const i2pwhoogleDiv = whoogleDiv.getElementsByClassName("i2p")[0]; const i2pwhoogleDiv = whoogleDiv.getElementsByClassName("i2p")[0];
const normalwhoogleDiv = whoogleDiv.getElementsByClassName("normal")[0];
function protocolDisplay(proto) {
proto.searxngDiv = 'block'
}
protocolDisplay(protocol.value)
if (protocol.value == 'normal') { if (protocol.value == 'normal') {
normalsearxDiv.style.display = 'block'; normalsearxDiv.style.display = 'block';
normalsearxngDiv.style.display = 'block'; normalsearxngDiv.style.display = 'block';
@ -85,34 +165,42 @@ function changeProtocolSettings() {
i2psearxngDiv.style.display = 'block'; i2psearxngDiv.style.display = 'block';
i2pwhoogleDiv.style.display = 'block'; i2pwhoogleDiv.style.display = 'block';
} }
*/
} }
browser.storage.local.get( browser.storage.local.get(
[ [
"disableSearch", "disableSearch",
"searchFrontend", "searchFrontend",
"searchProtocol", "protocol",
], ],
r => { r => {
enable.checked = !r.disableSearch; enable.checked = !r.disableSearch;
frontend.value = r.searchFrontend; frontend.value = r.searchFrontend;
protocol.value = r.searchProtocol; protocol = r.protocol;
changeFrontendsSettings(); changeFrontendsSettings();
changeProtocolSettings(); changeProtocolSettings();
} }
); );
for (let i = 0; i < frontends.length; i++) {
for (let x = 0; x < protocols.length; x++){
utils.processDefaultCustomInstances('search', frontends[i], protocols[x], document)
}
utils.latency('search', frontends[i], document, location)
}
search.addEventListener("change", () => { search.addEventListener("change", () => {
browser.storage.local.set({ browser.storage.local.set({
disableSearch: !enable.checked, disableSearch: !enable.checked,
searchFrontend: frontend.value, searchFrontend: frontend.value,
searchProtocol: protocol.value,
}); });
changeFrontendsSettings(frontend.value); changeFrontendsSettings();
changeProtocolSettings(protocol.value);
}) })
/*
* more "legacy" code
utils.processDefaultCustomInstances('search', 'searx', 'normal', document); utils.processDefaultCustomInstances('search', 'searx', 'normal', document);
utils.processDefaultCustomInstances('search', 'searx', 'tor', document); utils.processDefaultCustomInstances('search', 'searx', 'tor', document);
utils.processDefaultCustomInstances('search', 'searx', 'i2p', document); utils.processDefaultCustomInstances('search', 'searx', 'i2p', document);
@ -126,3 +214,4 @@ utils.processDefaultCustomInstances('search', 'whoogle', 'i2p', document);
utils.latency('search', 'searx', document, location, true) utils.latency('search', 'searx', document, location, true)
utils.latency('search', 'searxng', document, location, true) utils.latency('search', 'searxng', document, location, true)
utils.latency('search', 'whoogle', document, location, true) utils.latency('search', 'whoogle', document, location, true)
*/

View File

@ -1,4 +1,3 @@
section#search_page.option-block section#search_page.option-block
.some-block.option-block .some-block.option-block
h1(data-localise="__MSG_search__") Search h1(data-localise="__MSG_search__") Search
@ -13,17 +12,10 @@ section#search_page.option-block
option(value="searxng") SearXNG option(value="searxng") SearXNG
option(value="searx") SearX option(value="searx") SearX
option(value="whoogle") Whoogle option(value="whoogle") Whoogle
option(value="librex") LibreX
#searx-whoogle
.some-block.option-block
h4(data-localise="__MSG_protocol__") Protocol
select#search-protocol
option(value="normal" data-localise="__MSG_normal__") Normal
option(value="tor" data-localise="__MSG_tor__") Tor
option(value="i2p" data-localise="__MSG_i2p__") I2P
.some-block .some-block
h4(data-localise="__MSG_searchNote__") Note: To use Search to its full potential, make LibRedirect as the Default Search Engine h4(data-localise="__MSG_searchNote__") Note: To use Search, make LibRedirect the Default Search Engine
#searx #searx
hr hr
@ -34,10 +26,13 @@ section#search_page.option-block
+latency('searx') +latency('searx')
.tor .tor
include ../../widgets/instances.pug include ../../widgets/instances.pug
+instances('https://searx.onion') +instances('http://searx.onion')
.i2p .i2p
include ../../widgets/instances.pug include ../../widgets/instances.pug
+instances('https://searx.i2p') +instances('http://searx.i2p')
.loki
include ../../widgets/instances.pug
+instances('http://searx.loki')
#searxng #searxng
hr hr
@ -47,10 +42,13 @@ section#search_page.option-block
+latency('searxng') +latency('searxng')
.tor .tor
include ../../widgets/instances.pug include ../../widgets/instances.pug
+instances('https://searxng.onion') +instances('http://searxng.onion')
.i2p .i2p
include ../../widgets/instances.pug include ../../widgets/instances.pug
+instances('https://searxng.i2p') +instances('http://searxng.i2p')
.loki
include ../../widgets/instances.pug
+instances('http://searxng.loki')
#whoogle #whoogle
hr hr
@ -60,9 +58,28 @@ section#search_page.option-block
+latency('whoogle') +latency('whoogle')
.tor .tor
include ../../widgets/instances.pug include ../../widgets/instances.pug
+instances('https://whoogle.onion') +instances('http://whoogle.onion')
.i2p .i2p
include ../../widgets/instances.pug include ../../widgets/instances.pug
+instances('https://whoogle.i2p') +instances('http://whoogle.i2p')
.loki
include ../../widgets/instances.pug
+instances('http://whoogle.loki')
script(type="module" src="./widgets/search.js") #librex
hr
.normal
include ../../widgets/instances.pug
+instances('https://librex.com')
+latency('librex')
.tor
include ../../widgets/instances.pug
+instances('http://librex.onion')
.i2p
include ../../widgets/instances.pug
+instances('http://librex.i2p')
.loki
include ../../widgets/instances.pug
+instances('http://librex.loki')
script(type="module" src="./widgets/search.js")

View File

@ -1,43 +1,61 @@
import utils from "../../../assets/javascripts/utils.js"; import utils from "../../../assets/javascripts/utils.js";
// UNCOMMENT ALL COMMENTS ONCE OTHER FRONTENDS EXIST
const frontends = new Array("send")
const protocols = new Array("normal", "tor", "i2p", "loki")
const enable = document.getElementById("sendTargets-enable"); const enable = document.getElementById("sendTargets-enable");
const protocol = document.getElementById("sendTargets-protocol")
const sendTargets = document.getElementById('sendTargets_page'); const sendTargets = document.getElementById('sendTargets_page');
//const frontend = document.getElementById("sendTargets-frontend");
let protocol
/*
function changeFrontendsSettings() {
for (let i = 0; i < frontends.length; i++) {
const frontendDiv = document.getElementById(frontends[i])
if (frontends[i] == frontend.value) {
frontendDiv.style.display = 'block'
} else {
frontendDiv.style.display = 'none'
}
}
}
*/
function changeProtocolSettings() { function changeProtocolSettings() {
let normalDiv = sendTargets.getElementsByClassName("normal")[0]; for (let i = 0; i < frontends.length; i++) {
let torDiv = sendTargets.getElementsByClassName("tor")[0]; const frontendDiv = document.getElementById(frontends[i])
if (protocol.value == 'normal') { for (let x = 0; x < protocols.length; x++) {
normalDiv.style.display = 'block'; const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0]
torDiv.style.display = 'none'; if (protocols[x] == protocol) {
} protocolDiv.style.display = 'block'
else if (protocol.value == 'tor') { } else {
normalDiv.style.display = 'none'; protocolDiv.style.display = 'none'
torDiv.style.display = 'block'; }
}
} }
} }
browser.storage.local.get( browser.storage.local.get(
[ [
"disableSendTarget", "disableSendTarget",
"sendTargetsProtocol", "protocol"
], ],
r => { r => {
enable.checked = !r.disableSendTarget; enable.checked = !r.disableSendTarget;
protocol.value = r.sendTargetsProtocol; protocol = r.protocol;
changeProtocolSettings(); changeProtocolSettings();
} }
) )
sendTargets.addEventListener("change", () => { sendTargets.addEventListener("change", () => {
changeProtocolSettings(); browser.storage.local.set({ disableSendTarget: !enable.checked })
browser.storage.local.set({
disableSendTarget: !enable.checked,
sendTargetsProtocol: protocol.value,
})
}) })
utils.processDefaultCustomInstances('sendTargets', 'send', 'normal', document); for (let i = 0; i < frontends.length; i++) {
utils.processDefaultCustomInstances('sendTargets', 'send', 'tor', document); for (let x = 0; x < protocols.length; x++){
utils.processDefaultCustomInstances('sendTargets', frontends[i], protocols[x], document)
utils.latency('sendTargets', 'send', document, location) }
utils.latency('sendTargets', frontends[i], document, location)
}

View File

@ -6,12 +6,6 @@ section#sendTargets_page.option-block
h4(data-localise="__MSG_enable__") Enable h4(data-localise="__MSG_enable__") Enable
input#sendTargets-enable(type="checkbox") input#sendTargets-enable(type="checkbox")
.some-block.option-block
h4(data-localise="__MSG_protocol__") Protocol
select#sendTargets-protocol
option(value="normal" data-localise="__MSG_normal__") Normal
option(value="tor" data-localise="__MSG_tor__") Tor
#send #send
hr hr
.normal .normal
@ -21,6 +15,12 @@ section#sendTargets_page.option-block
+latency('send') +latency('send')
.tor .tor
include ../../widgets/instances.pug include ../../widgets/instances.pug
+instances('https://send.onion') +instances('http://send.onion')
.i2p
include ../../widgets/instances.pug
+instances('http://send.i2p')
.loki
include ../../widgets/instances.pug
+instances('http://send.loki')
script(type="module" src="./widgets/sendTargets.js") script(type="module" src="./widgets/sendTargets.js")

View File

@ -1,53 +1,61 @@
import utils from "../../../assets/javascripts/utils.js"; import utils from "../../../assets/javascripts/utils.js";
const enable = document.getElementById("tiktok-enable"); // UNCOMMENT ALL COMMENTS ONCE OTHER FRONTENDS EXIST
const protocol = document.getElementById("tiktok-protocol")
const tiktok = document.getElementById('tiktok_page');
function changeProtocolSettings() { const frontends = new Array("proxiTok")
let normalDiv = tiktok.getElementsByClassName("normal")[0]; const protocols = new Array("normal", "tor", "i2p", "loki")
let torDiv = tiktok.getElementsByClassName("tor")[0];
if (protocol.value == 'normal') { const enable = document.getElementById("tiktok-enable");
normalDiv.style.display = 'block'; const tiktok = document.getElementById('tiktok_page');
torDiv.style.display = 'none'; //const frontend = document.getElementById("tiktok-frontend");
} let protocol
else if (protocol.value == 'tor') {
normalDiv.style.display = 'none'; /*
torDiv.style.display = 'block'; function changeFrontendsSettings() {
for (let i = 0; i < frontends.length; i++) {
const frontendDiv = document.getElementById(frontends[i])
if (frontends[i] == frontend.value) {
frontendDiv.style.display = 'block'
} else {
frontendDiv.style.display = 'none'
}
} }
} }
*/
tiktok.addEventListener("change", () => { function changeProtocolSettings() {
browser.storage.local.set({ for (let i = 0; i < frontends.length; i++) {
disableTiktok: !enable.checked, const frontendDiv = document.getElementById(frontends[i])
tiktokProtocol: protocol.value, for (let x = 0; x < protocols.length; x++) {
}); const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0]
changeProtocolSettings(); if (protocols[x] == protocol) {
}) protocolDiv.style.display = 'block'
} else {
protocolDiv.style.display = 'none'
}
}
}
}
browser.storage.local.get( browser.storage.local.get(
[ [
"disableTiktok", "disableTiktok",
"tiktokProtocol", "protocol"
], ],
r => { r => {
enable.checked = !r.disableTiktok; enable.checked = !r.disableTiktok;
protocol.value = r.tiktokProtocol; protocol = r.protocol;
changeProtocolSettings(); changeProtocolSettings();
let normalDiv = document.getElementsByClassName("normal")[0]; }
let torDiv = document.getElementsByClassName("tor")[0];
if (r.tiktokProtocol == 'normal') {
normalDiv.style.display = 'block';
torDiv.style.display = 'none';
}
else if (r.tiktokProtocol == 'tor') {
normalDiv.style.display = 'none';
torDiv.style.display = 'block';
}
}
) )
utils.processDefaultCustomInstances('tiktok', 'proxiTok', 'normal', document); tiktok.addEventListener("change", () => {
utils.processDefaultCustomInstances('tiktok', 'proxiTok', 'tor', document); browser.storage.local.set({ disableTiktok: !enable.checked });
})
utils.latency('tiktok', 'proxiTok', document, location) for (let i = 0; i < frontends.length; i++) {
for (let x = 0; x < protocols.length; x++){
utils.processDefaultCustomInstances('tiktok', frontends[i], protocols[x], document)
}
utils.latency('tiktok', frontends[i], document, location)
}

View File

@ -6,12 +6,6 @@ section#tiktok_page.option-block
h4(data-localise="__MSG_enable__") Enable h4(data-localise="__MSG_enable__") Enable
input#tiktok-enable(type="checkbox") input#tiktok-enable(type="checkbox")
.some-block.option-block
h4(data-localise="__MSG_protocol__") Protocol
select#tiktok-protocol
option(value="normal" data-localise="__MSG_normal__") Normal
option(value="tor" data-localise="__MSG_tor__") Tor
#proxiTok #proxiTok
hr hr
.normal .normal
@ -21,6 +15,12 @@ section#tiktok_page.option-block
+latency('proxiTok') +latency('proxiTok')
.tor .tor
include ../../widgets/instances.pug include ../../widgets/instances.pug
+instances('https://proxitok.onion') +instances('http://proxitok.onion')
.i2p
include ../../widgets/instances.pug
+instances('http://proxitok.i2p')
.loki
include ../../widgets/instances.pug
+instances('http://proxitok.loki')
script(type="module" src="./widgets/tiktok.js") script(type="module" src="./widgets/tiktok.js")

View File

@ -1,64 +1,35 @@
import utils from "../../../assets/javascripts/utils.js"; import utils from "../../../assets/javascripts/utils.js";
const enable = document.getElementById("translate-enable"); const frontends = new Array("simplyTranslate", "lingva")
const frontend = document.getElementById("translate-frontend"); const protocols = new Array("normal", "tor", "i2p", "loki")
const protocol = document.getElementById("translate-protocol");
const simplyTranslateDiv = document.getElementById("simplyTranslate");
const lingvaDiv = document.getElementById("lingva");
const enable = document.getElementById("translate-enable");
const translate = document.getElementById('translate_page'); const translate = document.getElementById('translate_page');
const frontend = document.getElementById("translate-frontend");
let protocol
function changeFrontendsSettings() { function changeFrontendsSettings() {
if (frontend.value == 'simplyTranslate') { for (let i = 0; i < frontends.length; i++) {
simplyTranslateDiv.style.display = 'block'; const frontendDiv = document.getElementById(frontends[i])
lingvaDiv.style.display = 'none'; if (frontends[i] == frontend.value) {
} frontendDiv.style.display = 'block'
else if (frontend.value == 'lingva') { } else {
simplyTranslateDiv.style.display = 'none'; frontendDiv.style.display = 'none'
lingvaDiv.style.display = 'block'; }
} }
} }
function changeProtocolSettings() { function changeProtocolSettings() {
const normalSimplyTranslateDiv = document.getElementById("simplyTranslate").getElementsByClassName("normal")[0]; for (let i = 0; i < frontends.length; i++) {
const torSimplyTranslateDiv = document.getElementById("simplyTranslate").getElementsByClassName("tor")[0]; const frontendDiv = document.getElementById(frontends[i])
const i2pSimplyTranslateDiv = document.getElementById("simplyTranslate").getElementsByClassName("i2p")[0]; for (let x = 0; x < protocols.length; x++) {
const lokiSimplyTranslateDiv = document.getElementById("simplyTranslate").getElementsByClassName("loki")[0]; const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0]
if (protocols[x] == protocol) {
const normalLingvaDiv = document.getElementById("lingva").getElementsByClassName("normal")[0]; protocolDiv.style.display = 'block'
const torLingvaDiv = document.getElementById("lingva").getElementsByClassName("tor")[0]; } else {
protocolDiv.style.display = 'none'
if (protocol.value == 'normal') { }
normalSimplyTranslateDiv.style.display = 'block'; }
normalLingvaDiv.style.display = 'block';
torSimplyTranslateDiv.style.display = 'none';
torLingvaDiv.style.display = 'none';
i2pSimplyTranslateDiv.style.display = 'none';
lokiSimplyTranslateDiv.style.display = 'none';
}
else if (protocol.value == 'tor') {
normalSimplyTranslateDiv.style.display = 'none';
normalLingvaDiv.style.display = 'none';
torSimplyTranslateDiv.style.display = 'block';
torLingvaDiv.style.display = 'block';
i2pSimplyTranslateDiv.style.display = 'none';
lokiSimplyTranslateDiv.style.display = 'none';
}
else if (protocol.value == 'i2p') {
normalSimplyTranslateDiv.style.display = 'none';
normalLingvaDiv.style.display = 'none';
torSimplyTranslateDiv.style.display = 'none';
torLingvaDiv.style.display = 'none';
i2pSimplyTranslateDiv.style.display = 'block';
lokiSimplyTranslateDiv.style.display = 'none';
}
else if (protocol.value == 'loki') {
normalSimplyTranslateDiv.style.display = 'none';
normalLingvaDiv.style.display = 'none';
torSimplyTranslateDiv.style.display = 'none';
torLingvaDiv.style.display = 'none';
i2pSimplyTranslateDiv.style.display = 'none';
lokiSimplyTranslateDiv.style.display = 'block';
} }
} }
@ -66,12 +37,12 @@ browser.storage.local.get(
[ [
"translateDisable", "translateDisable",
"translateFrontend", "translateFrontend",
"translateProtocol", "protocol"
], ],
r => { r => {
enable.checked = !r.translateDisable; enable.checked = !r.translateDisable;
frontend.value = r.translateFrontend; frontend.value = r.translateFrontend;
protocol.value = r.translateProtocol; protocol = r.protocol;
changeFrontendsSettings(); changeFrontendsSettings();
changeProtocolSettings(); changeProtocolSettings();
} }
@ -81,19 +52,13 @@ translate.addEventListener("change", () => {
browser.storage.local.set({ browser.storage.local.set({
translateDisable: !enable.checked, translateDisable: !enable.checked,
translateFrontend: frontend.value, translateFrontend: frontend.value,
translateProtocol: protocol.value,
}) })
changeProtocolSettings();
changeFrontendsSettings(); changeFrontendsSettings();
}) })
for (let i = 0; i < frontends.length; i++) {
utils.processDefaultCustomInstances('translate', 'simplyTranslate', 'normal', document); for (let x = 0; x < protocols.length; x++){
utils.processDefaultCustomInstances('translate', 'simplyTranslate', 'tor', document); utils.processDefaultCustomInstances('translate', frontends[i], protocols[x], document)
utils.processDefaultCustomInstances('translate', 'simplyTranslate', 'i2p', document); }
utils.processDefaultCustomInstances('translate', 'simplyTranslate', 'loki', document); utils.latency('translate', frontends[i], document, location)
utils.processDefaultCustomInstances('translate', 'lingva', 'normal', document); }
utils.processDefaultCustomInstances('translate', 'lingva', 'tor', document);
utils.latency('translate', 'simplyTranslate', document, location, true)
utils.latency('translate', 'lingva', document, location, true)

View File

@ -12,14 +12,6 @@ section#translate_page.option-block
option(value="simplyTranslate") SimplyTranslate option(value="simplyTranslate") SimplyTranslate
option(value="lingva") Lingva option(value="lingva") Lingva
.some-block.option-block
h4(data-localise="__MSG_protocol__") Protocol
select#translate-protocol
option(value="normal" data-localise="__MSG_normal__") Normal
option(value="tor" data-localise="__MSG_tor__") Tor
option(value="i2p" data-localise="__MSG_i2p__") I2P
option(value="loki" data-localise="__MSG_loki__") Lokinet
hr hr
#simplyTranslate #simplyTranslate
.normal .normal
@ -44,6 +36,13 @@ section#translate_page.option-block
+latency('lingva') +latency('lingva')
.tor .tor
include ../../widgets/instances.pug include ../../widgets/instances.pug
+instances('http://tyzxppdeoojdnaux.onion') +instances('http://lingvatranslate.onion')
.i2p
include ../../widgets/instances.pug
+instances('http://lingvatranslate.i2p')
.loki
include ../../widgets/instances.pug
+instances('http://lingvatranslate.loki')
script(type="module" src="./widgets/translate.js") script(type="module" src="./widgets/translate.js")

View File

@ -1,32 +1,52 @@
import utils from "../../../assets/javascripts/utils.js"; import utils from "../../../assets/javascripts/utils.js";
// UNCOMMENT ALL COMMENTS ONCE OTHER FRONTENDS EXIST
const frontends = new Array("nitter")
const protocols = new Array("normal", "tor", "i2p", "loki")
const enable = document.getElementById("twitter-enable"); const enable = document.getElementById("twitter-enable");
const protocol = document.getElementById("twitter-protocol");
const redirectType = document.getElementById("twitter-redirect_type");
const twitter = document.getElementById('twitter_page'); const twitter = document.getElementById('twitter_page');
const redirectType = document.getElementById("twitter-redirect_type");
//const frontend = document.getElementById("twitter-frontend");
let protocol
/*
function changeFrontendsSettings() {
for (let i = 0; i < frontends.length; i++) {
const frontendDiv = document.getElementById(frontends[i])
if (frontends[i] == frontend.value) {
frontendDiv.style.display = 'block'
} else {
frontendDiv.style.display = 'none'
}
}
}
*/
function changeProtocolSettings() { function changeProtocolSettings() {
let normalDiv = twitter.getElementsByClassName("normal")[0]; for (let i = 0; i < frontends.length; i++) {
let torDiv = twitter.getElementsByClassName("tor")[0]; const frontendDiv = document.getElementById(frontends[i])
if (protocol.value == 'normal') { for (let x = 0; x < protocols.length; x++) {
normalDiv.style.display = 'block'; const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0]
torDiv.style.display = 'none'; if (protocols[x] == protocol) {
} protocolDiv.style.display = 'block'
else if (protocol.value == 'tor') { } else {
normalDiv.style.display = 'none'; protocolDiv.style.display = 'none'
torDiv.style.display = 'block'; }
}
} }
} }
browser.storage.local.get( browser.storage.local.get(
[ [
"disableTwitter", "disableTwitter",
"twitterProtocol", "protocol",
"twitterRedirectType", "twitterRedirectType"
], ],
r => { r => {
enable.checked = !r.disableTwitter; enable.checked = !r.disableTwitter;
protocol.value = r.twitterProtocol; protocol = r.protocol;
redirectType.value = r.twitterRedirectType; redirectType.value = r.twitterRedirectType;
changeProtocolSettings(); changeProtocolSettings();
} }
@ -35,13 +55,13 @@ browser.storage.local.get(
twitter.addEventListener("change", () => { twitter.addEventListener("change", () => {
browser.storage.local.set({ browser.storage.local.set({
disableTwitter: !enable.checked, disableTwitter: !enable.checked,
twitterProtocol: protocol.value,
twitterRedirectType: redirectType.value, twitterRedirectType: redirectType.value,
}); });
changeProtocolSettings();
}) })
utils.processDefaultCustomInstances('twitter', 'nitter', 'normal', document); for (let i = 0; i < frontends.length; i++) {
utils.processDefaultCustomInstances('twitter', 'nitter', 'tor', document) for (let x = 0; x < protocols.length; x++){
utils.processDefaultCustomInstances('twitter', frontends[i], protocols[x], document)
utils.latency('twitter', 'nitter', document, location, true) }
utils.latency('twitter', frontends[i], document, location)
}

View File

@ -6,12 +6,6 @@ section#twitter_page.option-block
h4(data-localise="__MSG_enable__") Enable h4(data-localise="__MSG_enable__") Enable
input#twitter-enable(type="checkbox") input#twitter-enable(type="checkbox")
.some-block.option-block
h4(data-localise="__MSG_protocol__") Protocol
select#twitter-protocol
option(value="normal" data-localise="__MSG_normal__") Normal
option(value="tor" data-localise="__MSG_tor__") Tor
.some-block.option-block .some-block.option-block
h4(data-localise="__MSG_redirectType__") Redirect Type h4(data-localise="__MSG_redirectType__") Redirect Type
select#twitter-redirect_type select#twitter-redirect_type
@ -27,6 +21,13 @@ section#twitter_page.option-block
include ../../widgets/latency.pug include ../../widgets/latency.pug
+latency('nitter') +latency('nitter')
.tor .tor
+instances('https://nitter.onion') include ../../widgets/instances.pug
+instances('http://nitter.onion')
.i2p
include ../../widgets/instances.pug
+instances('http://nitter.i2p')
.loki
include ../../widgets/instances.pug
+instances('http://nitter.loki')
script(type="module" src="./widgets/twitter.js") script(type="module" src="./widgets/twitter.js")

View File

@ -1,52 +1,61 @@
import utils from "../../../assets/javascripts/utils.js"; import utils from "../../../assets/javascripts/utils.js";
const enable = document.getElementById("wikipedia-enable"); // UNCOMMENT ALL COMMENTS ONCE OTHER FRONTENDS EXIST
const protocolElement = document.getElementById("wikipedia-protocol");
const wikipedia = document.getElementById('wikipedia_page');
function changeProtocolSettings(protocol) { const frontends = new Array("wikiless")
const normalDiv = wikipedia.getElementsByClassName("normal")[0]; const protocols = new Array("normal", "tor", "i2p", "loki")
const torDiv = wikipedia.getElementsByClassName("tor")[0];
const i2pDiv = wikipedia.getElementsByClassName("i2p")[0]; const enable = document.getElementById("wikipedia-enable");
if (protocol == 'normal') { const wikipedia = document.getElementById('wikipedia_page');
normalDiv.style.display = 'block'; //const frontend = document.getElementById("wikipedia-frontend");
torDiv.style.display = 'none'; let protocol
i2pDiv.style.display = 'none';
/*
function changeFrontendsSettings() {
for (let i = 0; i < frontends.length; i++) {
const frontendDiv = document.getElementById(frontends[i])
if (frontends[i] == frontend.value) {
frontendDiv.style.display = 'block'
} else {
frontendDiv.style.display = 'none'
}
} }
else if (protocol == 'tor') { }
normalDiv.style.display = 'none'; */
torDiv.style.display = 'block';
i2pDiv.style.display = 'none'; function changeProtocolSettings() {
} for (let i = 0; i < frontends.length; i++) {
else if (protocol == 'i2p') { const frontendDiv = document.getElementById(frontends[i])
normalDiv.style.display = 'none'; for (let x = 0; x < protocols.length; x++) {
torDiv.style.display = 'none'; const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0]
i2pDiv.style.display = 'block'; if (protocols[x] == protocol) {
protocolDiv.style.display = 'block'
} else {
protocolDiv.style.display = 'none'
}
}
} }
} }
browser.storage.local.get( browser.storage.local.get(
[ [
"disableWikipedia", "disableWikipedia",
"wikipediaProtocol", "protocol"
], ],
r => { r => {
enable.checked = !r.disableWikipedia; enable.checked = !r.disableWikipedia;
protocolElement.value = r.wikipediaProtocol; protocol = r.protocol;
changeProtocolSettings(r.wikipediaProtocol); changeProtocolSettings();
} }
) )
wikipedia.addEventListener("change", () => { wikipedia.addEventListener("change", () => {
browser.storage.local.set({ browser.storage.local.set({ disableWikipedia: !enable.checked })
disableWikipedia: !enable.checked,
wikipediaProtocol: protocolElement.value,
})
changeProtocolSettings(protocolElement.value)
}) })
utils.processDefaultCustomInstances('wikipedia', 'wikiless', 'normal', document); for (let i = 0; i < frontends.length; i++) {
utils.processDefaultCustomInstances('wikipedia', 'wikiless', 'tor', document); for (let x = 0; x < protocols.length; x++) {
utils.processDefaultCustomInstances('wikipedia', 'wikiless', 'i2p', document); utils.processDefaultCustomInstances('wikipedia', frontends[i], protocols[x], document)
}
utils.latency('wikipedia', 'wikiless', document, location) utils.latency('wikipedia', frontends[i], document, location)
}

View File

@ -6,13 +6,6 @@ section#wikipedia_page.option-block
h4(data-localise="__MSG_enable__") Enable h4(data-localise="__MSG_enable__") Enable
input#wikipedia-enable(type="checkbox") input#wikipedia-enable(type="checkbox")
.some-block.option-block
h4(data-localise="__MSG_protocol__") Protocol
select#wikipedia-protocol
option(value="normal" data-localise="__MSG_normal__") Normal
option(value="tor" data-localise="__MSG_tor__") Tor
option(value="i2p" data-localise="__MSG_i2p__") I2P
#wikiless #wikiless
hr hr
.normal .normal
@ -22,10 +15,12 @@ section#wikipedia_page.option-block
+latency('wikiless') +latency('wikiless')
.tor .tor
include ../../widgets/instances.pug include ../../widgets/instances.pug
+instances('https://wikiless.onion') +instances('http://wikiless.onion')
.i2p .i2p
include ../../widgets/instances.pug include ../../widgets/instances.pug
+instances('https://wikiless.i2p') +instances('https://wikiless.i2p')
.loki
include ../../widgets/instances.pug
+instances('http://wikiless.loki')
script(type="module" src="./widgets/wikipedia.js") script(type="module" src="./widgets/wikipedia.js")

View File

@ -1,113 +1,65 @@
import youtubeHelper from "../../../assets/javascripts/youtube/youtube.js";
import utils from "../../../assets/javascripts/utils.js"; import utils from "../../../assets/javascripts/utils.js";
const frontends = new Array("invidious", "piped", "pipedMaterial")
const protocols = new Array("normal", "tor", "i2p", "loki")
const singleInstanceFrontends = new Array("freetube", "yatte")
const enable = document.getElementById("youtube-enable"); const enable = document.getElementById("youtube-enable");
const frontend = document.getElementById("youtube-frontend"); const youtube = document.getElementById('youtube_page');
const youtubeEmbedFrontend = document.getElementById("youtube-embed_frontend"); const youtubeEmbedFrontend = document.getElementById("youtube-embed_frontend");
const onlyEmbeddedVideo = document.getElementById("youtube-redirect_type"); const onlyEmbeddedVideo = document.getElementById("youtube-redirect_type");
const protocol = document.getElementById("youtube-protocol"); const embeddedFrontendDiv = document.getElementById("youtube-embedded_frontend");
const youtube = document.getElementById('youtube_page'); const frontend = document.getElementById("youtube-frontend");
let protocol
const invidiousDiv = document.getElementById("invidious");
const pipedDiv = document.getElementById("piped");
const pipedMaterialDiv = document.getElementById("pipedMaterial");
const freetubeYatteeDiv = document.getElementById("freetube-yatte");
function changeFrontendsSettings() {
if (frontend.value == 'invidious') {
invidiousDiv.style.display = 'block';
pipedDiv.style.display = 'none';
pipedMaterialDiv.style.display = 'none';
freetubeYatteeDiv.style.display = 'none';
}
else if (frontend.value == 'piped') {
invidiousDiv.style.display = 'none';
pipedDiv.style.display = 'block';
pipedMaterialDiv.style.display = 'none';
freetubeYatteeDiv.style.display = 'none';
}
else if (frontend.value == 'pipedMaterial') {
invidiousDiv.style.display = 'none';
pipedDiv.style.display = 'none';
pipedMaterialDiv.style.display = 'block';
freetubeYatteeDiv.style.display = 'none';
}
else if (frontend.value == 'freetube' || frontend.value == 'yatte') {
invidiousDiv.style.display = 'none';
pipedDiv.style.display = 'none';
pipedMaterialDiv.style.display = 'none';
freetubeYatteeDiv.style.display = 'block';
changeYoutubeEmbedFrontendsSettings();
}
}
function changeYoutubeEmbedFrontendsSettings() {
if (youtubeEmbedFrontend.value == 'invidious') {
pipedDiv.style.display = 'none';
pipedMaterialDiv.style.display = 'none';
invidiousDiv.style.display = 'block';
}
if (youtubeEmbedFrontend.value == 'piped') {
pipedDiv.style.display = 'block';
pipedMaterialDiv.style.display = 'none';
invidiousDiv.style.display = 'none';
}
if (youtubeEmbedFrontend.value == 'pipedMaterial') {
pipedDiv.style.display = 'none';
pipedMaterialDiv.style.display = 'block';
invidiousDiv.style.display = 'none';
}
else if (youtubeEmbedFrontend.value == 'youtube') {
pipedDiv.style.display = 'none';
pipedMaterialDiv.style.display = 'none';
invidiousDiv.style.display = 'none';
}
}
function changeProtocolSettings() { function changeProtocolSettings() {
const normalPipedDiv = document.getElementById('piped').getElementsByClassName("normal")[0]; for (let i = 0; i < frontends.length; i++) {
const torPipedDiv = document.getElementById('piped').getElementsByClassName("tor")[0]; const frontendDiv = document.getElementById(frontends[i])
for (let x = 0; x < protocols.length; x++) {
const normalPipedMaterialDiv = document.getElementById('pipedMaterial').getElementsByClassName("normal")[0]; const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0]
const torPipedMaterialDiv = document.getElementById('pipedMaterial').getElementsByClassName("tor")[0]; if (protocols[x] == protocol) {
protocolDiv.style.display = 'block'
const normalInvidiousDiv = document.getElementById('invidious').getElementsByClassName("normal")[0]; } else {
const torInvidiousDiv = document.getElementById('invidious').getElementsByClassName("tor")[0]; protocolDiv.style.display = 'none'
}
if (protocol.value == 'normal') { }
normalInvidiousDiv.style.display = 'block';
torInvidiousDiv.style.display = 'none';
normalPipedDiv.style.display = 'block';
torPipedDiv.style.display = 'none';
normalPipedMaterialDiv.style.display = 'block';
torPipedMaterialDiv.style.display = 'none';
}
else if (protocol.value == 'tor') {
normalInvidiousDiv.style.display = 'none';
torInvidiousDiv.style.display = 'block';
normalPipedDiv.style.display = 'none';
torPipedDiv.style.display = 'block';
normalPipedMaterialDiv.style.display = 'none';
torPipedMaterialDiv.style.display = 'block';
} }
} }
youtube.addEventListener("change", () => { function changeEmbedFrontendsSettings() {
browser.storage.local.set({ if (embeddedFrontendDiv.style.display == 'block') {
disableYoutube: !enable.checked, for (let i = 0; i < frontends.length; i++) {
youtubeFrontend: frontend.value, const embeddedFrontendDiv = document.getElementById(frontends[i])
youtubeEmbedFrontend: youtubeEmbedFrontend.value, if (frontends[i] == youtubeEmbedFrontend.value) {
onlyEmbeddedVideo: onlyEmbeddedVideo.value, embeddedFrontendDiv.style.display = 'block'
youtubeProtocol: protocol.value, } else {
}) embeddedFrontendDiv.style.display = 'none'
changeProtocolSettings(); }
changeYoutubeEmbedFrontendsSettings(); }
changeFrontendsSettings(); }
}) }
function changeFrontendsSettings() {
for (let i = 0; i < frontends.length; i++) {
const frontendDiv = document.getElementById(frontends[i])
if (frontends[i] == frontend.value) {
frontendDiv.style.display = 'block'
} else {
frontendDiv.style.display = 'none'
}
}
let singleInstanceFrontend = false
for (let i = 0; i < singleInstanceFrontends.length; i++) {
if (singleInstanceFrontends[i] == frontend.value) {
singleInstanceFrontend = true
}
}
if (singleInstanceFrontend == true) {
embeddedFrontendDiv.style.display = 'block'
} else {
embeddedFrontendDiv.style.display = 'none'
}
}
browser.storage.local.get( browser.storage.local.get(
[ [
@ -117,29 +69,33 @@ browser.storage.local.get(
"youtubeFrontend", "youtubeFrontend",
"youtubeEmbedFrontend", "youtubeEmbedFrontend",
"youtubeProtocol", "protocol"
], ],
r => { r => {
enable.checked = !r.disableYoutube; enable.checked = !r.disableYoutube;
onlyEmbeddedVideo.value = r.onlyEmbeddedVideo; onlyEmbeddedVideo.value = r.onlyEmbeddedVideo;
frontend.value = r.youtubeFrontend; frontend.value = r.youtubeFrontend;
protocol.value = r.youtubeProtocol; protocol = r.protocol;
changeFrontendsSettings(); changeFrontendsSettings();
changeProtocolSettings(); changeProtocolSettings();
changeEmbedFrontendsSettings();
youtubeEmbedFrontend.value = youtubeEmbedFrontend.value
if (r.frontend == "freetube" || r.frontend == "yatte") changeYoutubeEmbedFrontendsSettings()
} }
); );
utils.processDefaultCustomInstances('youtube', 'invidious', 'normal', document); youtube.addEventListener("change", () => {
utils.processDefaultCustomInstances('youtube', 'invidious', 'tor', document); browser.storage.local.set({
utils.processDefaultCustomInstances('youtube', 'pipedMaterial', 'normal', document); disableYoutube: !enable.checked,
utils.processDefaultCustomInstances('youtube', 'pipedMaterial', 'tor', document); youtubeEmbedFrontend: youtubeEmbedFrontend.value,
utils.processDefaultCustomInstances('youtube', 'piped', 'normal', document); onlyEmbeddedVideo: onlyEmbeddedVideo.value
utils.processDefaultCustomInstances('youtube', 'piped', 'tor', document); })
changeFrontendsSettings();
changeEmbedFrontendsSettings();
})
utils.latency('youtube', 'invidious', document, location, true) for (let i = 0; i < frontends.length; i++) {
utils.latency('youtube', 'piped', document, location, true) for (let x = 0; x < protocols.length; x++) {
utils.latency('youtube', 'pipedMaterial', document, location, true) utils.processDefaultCustomInstances('youtube', frontends[i], protocols[x], document)
}
utils.latency('youtube', frontends[i], document, location)
}

View File

@ -15,54 +15,70 @@ section#youtube_page.option-block
option(value="freetube") FreeTube option(value="freetube") FreeTube
option(value="yatte") Yattee option(value="yatte") Yattee
#freetube-yatte #youtube-embedded_frontend
.some-block.option-block .some-block.option-block
h4(data-localise="__MSG_embeddedVids__") Embedded Videos Frontend h4(data-localise="__MSG_embeddedVids__") Embedded Videos Frontend
select#youtube-embed_frontend select#youtube-embed_frontend
option(value="invidious") Invidious option(value="invidious") Invidious
option(value="piped") Piped option(value="piped") Piped
option(value="pipedMaterial") Piped-Material option(value="pipedMaterial") Piped-Material
option(value="youtube") Youtube
#invidious-piped-pipedMaterial .some-block.option-block
.some-block.option-block h4(data-localise="__MSG_redirectType__") Redirect Type
h4(data-localise="__MSG_protocol__") Protocol select#youtube-redirect_type
select#youtube-protocol option(value="both" data-localise="__MSG_both__") both
option(value="normal" data-localise="__MSG_normal__") Normal option(value="onlyEmbedded" data-localise="__MSG_onlyEmbedded__") Only Embedded
option(value="tor" data-localise="__MSG_tor__") Tor option(value="onlyNotEmbedded" data-localise="__MSG_onlyNotEmbedded__") Only Not Embedded
.some-block.option-block
h4(data-localise="__MSG_redirectType__") Redirect Type
select#youtube-redirect_type
option(value="both" data-localise="__MSG_both__") both
option(value="onlyEmbedded" data-localise="__MSG_onlyEmbedded__") Only Embedded
option(value="onlyNotEmbedded" data-localise="__MSG_onlyNotEmbedded__") Only Not Embedded
#invidious #invidious
hr hr
.normal .normal
include ../../widgets/instances.pug include ../../widgets/instances.pug
+instances('https://invidious.com') +instances('http://invidious.com')
include ../../widgets/latency.pug include ../../widgets/latency.pug
+latency('invidious') +latency('invidious')
.tor .tor
+instances('https://invidious.onion') include ../../widgets/instances.pug
+instances('http://invidious.onion')
.i2p
include ../../widgets/instances.pug
+instances('http://invidious.i2p')
.loki
include ../../widgets/instances.pug
+instances('http://invidious.loki')
#piped #piped
hr hr
.normal .normal
include ../../widgets/instances.pug
+instances('https://piped.com') +instances('https://piped.com')
include ../../widgets/latency.pug
+latency('piped') +latency('piped')
.tor .tor
+instances('https://piped.onion') +instances('http://piped.onion')
include ../../widgets/instances.pug
.i2p
include ../../widgets/instances.pug
+instances('http://piped.i2p')
.loki
include ../../widgets/instances.pug
+instances('http://piped.loki')
#pipedMaterial #pipedMaterial
hr hr
.normal .normal
include ../../widgets/instances.pug
+instances('https://piped-material.com') +instances('https://piped-material.com')
include ../../widgets/latency.pug
+latency('pipedMaterial') +latency('pipedMaterial')
.tor .tor
+instances('https://piped-material.onion') +instances('http://piped-material.onion')
include ../../widgets/instances.pug
.i2p
include ../../widgets/instances.pug
+instances('http://piped-material.i2p')
.loki
include ../../widgets/instances.pug
+instances('http://piped-material.loki')
script(type="module" src="./widgets/youtube.js") script(type="module" src="./widgets/youtube.js")

View File

@ -1,23 +1,61 @@
import utils from "../../../assets/javascripts/utils.js"; import utils from "../../../assets/javascripts/utils.js";
// UNCOMMENT ALL COMMENTS ONCE OTHER FRONTENDS EXIST
const frontends = new Array("beatbump")
const protocols = new Array("normal", "tor", "i2p", "loki")
let enable = document.getElementById("youtubeMusic-enable"); let enable = document.getElementById("youtubeMusic-enable");
const youtubeMusic = document.getElementById('youtubeMusic_page'); const youtubeMusic = document.getElementById('youtubeMusic_page');
//const frontend = document.getElementById("youtubeMusic-frontend");
let protocol
/*
function changeFrontendsSettings() {
for (let i = 0; i < frontends.length; i++) {
const frontendDiv = document.getElementById(frontends[i])
if (frontends[i] == frontend.value) {
frontendDiv.style.display = 'block'
} else {
frontendDiv.style.display = 'none'
}
}
}
*/
function changeProtocolSettings() {
for (let i = 0; i < frontends.length; i++) {
const frontendDiv = document.getElementById(frontends[i])
for (let x = 0; x < protocols.length; x++) {
const protocolDiv = frontendDiv.getElementsByClassName(protocols[x])[0]
if (protocols[x] == protocol) {
protocolDiv.style.display = 'block'
} else {
protocolDiv.style.display = 'none'
}
}
}
}
browser.storage.local.get( browser.storage.local.get(
[ [
"disableYoutubeMusic", "disableYoutubeMusic",
"protocol"
], ],
r => { r => {
enable.checked = !r.disableYoutubeMusic; enable.checked = !r.disableYoutubeMusic
protocol = r.protocol
changeProtocolSettings()
} }
); );
youtubeMusic.addEventListener("change", () => { youtubeMusic.addEventListener("change", () => {
browser.storage.local.set({ browser.storage.local.set({ disableYoutubeMusic: !enable.checked })
disableYoutubeMusic: !enable.checked,
})
}) })
utils.processDefaultCustomInstances('youtubeMusic', 'beatbump', 'normal', document); for (let i = 0; i < frontends.length; i++) {
for (let x = 0; x < protocols.length; x++) {
utils.latency('youtubeMusic', 'beatbump', document, location, true) utils.processDefaultCustomInstances('youtubeMusic', frontends[i], protocols[x], document)
}
utils.latency('youtubeMusic', frontends[i], document, location)
}

View File

@ -13,5 +13,14 @@ section#youtubeMusic_page.option-block
+instances('https://beatbump.wewe') +instances('https://beatbump.wewe')
include ../../widgets/latency.pug include ../../widgets/latency.pug
+latency('beatbump') +latency('beatbump')
.tor
+instances('http://beatbump.onion')
include ../../widgets/instances.pug
.i2p
include ../../widgets/instances.pug
+instances('http://beatbump.i2p')
.loki
include ../../widgets/instances.pug
+instances('http://beatbump.loki')
script(type="module" src="./widgets/youtubeMusic.js") script(type="module" src="./widgets/youtubeMusic.js")

View File

@ -130,7 +130,7 @@ browser.storage.local.get(
"disablePeertubeTargets", "disablePeertubeTargets",
"disableLbryTargets", "disableLbryTargets",
"disableSendTarget", "disableSendTarget",
'popupFrontends', "popupFrontends",
], ],
r => { r => {
disableTwitterCurrentSite.checked = !r.disableTwitter; disableTwitterAllSites.checked = !r.disableTwitter; disableTwitterCurrentSite.checked = !r.disableTwitter; disableTwitterAllSites.checked = !r.disableTwitter;
@ -327,4 +327,4 @@ for (const a of document.getElementsByTagName('a')) {
e.preventDefault(); e.preventDefault();
} }
}) })
} }