Adding tor to twitter and youtube #32
This commit is contained in:
parent
f0d70837fc
commit
ef222d2ca5
|
@ -16,7 +16,7 @@
|
|||
"https://invidious.privacy.gd",
|
||||
"https://invidious.namazso.eu"
|
||||
],
|
||||
"onion": [
|
||||
"tor": [
|
||||
"http://c7hqkpkpemu6e7emz5b4vyz7idjgdvgaaa3dyimmeojqbgpea3xqjoid.onion",
|
||||
"http://w6ijuptxiku4xpnnaetxvnkc5vqcdu7mgns2u77qefoixi63vbvnpnqd.onion",
|
||||
"http://kbjggqkzv65ivcqj6bumvp337z6264huv5kpkwuv6gu5yjiskvan7fad.onion",
|
||||
|
@ -73,7 +73,7 @@
|
|||
"https://tw.artemislena.eu",
|
||||
"https://de.nttr.stream"
|
||||
],
|
||||
"onion": [
|
||||
"tor": [
|
||||
"http://3nzoldnxplag42gqjs23xvghtzf6t6yzssrtytnntc6ppc7xxuoneoad.onion",
|
||||
"http://nitter.l4qlywnpwqsluw65ts7md3khrivpirse744un3x7mlskqauz5pyuzgqd.onion",
|
||||
"http://nitter7bryz3jv7e3uekphigvmoyoem4al3fynerxkj22dmoxoq553qd.onion",
|
||||
|
@ -126,7 +126,7 @@
|
|||
"https://teddit.adminforge.de",
|
||||
"https://teddit.bus-hit.me"
|
||||
],
|
||||
"onion": [
|
||||
"tor": [
|
||||
"http://teddit4w6cmzmj5kimhfcavs7yo5s7alszvsi2khqutqtlaanpcftfyd.onion",
|
||||
"http://snoo.ioensistjs7wd746zluwixvojbbkxhr37lepdvwtdfeav673o64iflqd.onion",
|
||||
"http://ibarajztopxnuhabfu7fg6gbudynxofbnmvis3ltj6lfx47b6fhrd5qd.onion",
|
||||
|
@ -142,7 +142,7 @@
|
|||
"https://wikiless.sethforprivacy.com",
|
||||
"https://wiki.604kph.xyz"
|
||||
],
|
||||
"onion": [
|
||||
"tor": [
|
||||
"http://dj2tbh2nqfxyfmvq33cjmhuw7nb6am7thzd3zsjvizeqf374fixbrxyd.onion"
|
||||
]
|
||||
},
|
||||
|
@ -166,7 +166,7 @@
|
|||
"https://simplytranslate.pussthecat.org",
|
||||
"https://translate.northboot.xyz"
|
||||
],
|
||||
"onion": [
|
||||
"tor": [
|
||||
"http://fyng2tsmzmvxmojzbbwmfnsn2lrcyftf4cw6rk5j2v2huliazud3fjid.onion",
|
||||
"http://xxtbwyb5z5bdvy2f6l2yquu5qilgkjeewno4qfknvb3lkg3nmoklitid.onion"
|
||||
]
|
||||
|
@ -276,7 +276,7 @@
|
|||
"https://xeek.com",
|
||||
"https://searx.roflcopter.fr"
|
||||
],
|
||||
"onion": [
|
||||
"tor": [
|
||||
"http://3afisqjw2rxm6z7mmstyt5rx75qfqrgxnkzftknbp2vhipr2nrmrjdyd.onion",
|
||||
"http://searxbgetrkiwxhdwi6svpgh7eotopqyxhbqiokrwzg7dcte44t36kyd.onion",
|
||||
"http://suche.xyzco456vwisukfg.onion",
|
||||
|
@ -321,7 +321,7 @@
|
|||
"https://rimgo.totaldarkness.net",
|
||||
"https://rimgo.bus-hit.me"
|
||||
],
|
||||
"onion": [
|
||||
"tor": [
|
||||
"http://l4d4owboqr6xcmd6lf64gbegel62kbudu3x3jnldz2mx6mhn3bsv3zyd.onion",
|
||||
"http://jx3dpcwedpzu2mh54obk5gvl64i2ln7pt5mrzd75s4jnndkqwzaim7ad.onion"
|
||||
]
|
||||
|
|
|
@ -90,6 +90,7 @@ function isFirefox() {
|
|||
|
||||
function processDefaultCustomInstances(
|
||||
name,
|
||||
protocol,
|
||||
nameHelper,
|
||||
document,
|
||||
getNameRedirectsChecks,
|
||||
|
@ -99,32 +100,33 @@ function processDefaultCustomInstances(
|
|||
) {
|
||||
|
||||
let nameCustomInstances = [];
|
||||
let nameCheckListElement = document.getElementById(`${name}-checklist`);
|
||||
let nameCheckListElement = document.getElementById(`${name}-${protocol}-checklist`);
|
||||
let nameDefaultRedirects;
|
||||
|
||||
function calcNameCheckBoxes() {
|
||||
let isTrue = true;
|
||||
for (const item of nameHelper.getRedirects()[name].normal)
|
||||
for (const item of nameHelper.getRedirects()[name][protocol])
|
||||
if (!nameDefaultRedirects.includes(item)) {
|
||||
isTrue = false;
|
||||
break;
|
||||
}
|
||||
for (const element of nameCheckListElement.getElementsByTagName('input'))
|
||||
element.checked = nameDefaultRedirects.includes(element.id)
|
||||
document.getElementById(`${name}-toogle-all`).checked = isTrue;
|
||||
document.getElementById(`${name}-${protocol}-toogle-all`).checked = isTrue;
|
||||
}
|
||||
|
||||
nameDefaultRedirects = getNameRedirectsChecks();
|
||||
|
||||
nameCheckListElement.innerHTML =
|
||||
[
|
||||
`<div>Toggle All<input type="checkbox" id="${name}-toogle-all" /></div>`,
|
||||
...nameHelper.getRedirects()[name].normal.map((x) => `<div>${x}<input type="checkbox" id="${x}" /></div>`),
|
||||
`<div>Toggle All<input type="checkbox" id="${name}-${protocol}-toogle-all" /></div>`,
|
||||
...nameHelper.getRedirects()[name][protocol].map((x) => `<div>${x}<input type="checkbox" id="${x}" /></div>`),
|
||||
].join('\n<hr>\n');
|
||||
|
||||
calcNameCheckBoxes();
|
||||
document.getElementById(`${name}-toogle-all`).addEventListener("change", (event) => {
|
||||
document.getElementById(`${name}-${protocol}-toogle-all`).addEventListener("change", (event) => {
|
||||
if (event.target.checked)
|
||||
nameDefaultRedirects = [...nameHelper.getRedirects()[name].normal];
|
||||
nameDefaultRedirects = [...nameHelper.getRedirects()[name][protocol]];
|
||||
else
|
||||
nameDefaultRedirects = [];
|
||||
setNameRedirectsChecks(nameDefaultRedirects);
|
||||
|
@ -132,7 +134,7 @@ function processDefaultCustomInstances(
|
|||
});
|
||||
|
||||
for (let element of nameCheckListElement.getElementsByTagName('input')) {
|
||||
if (element.id != `${name}-toogle-all`)
|
||||
if (element.id != `${name}-${protocol}-toogle-all`)
|
||||
document.getElementById(element.id).addEventListener("change", (event) => {
|
||||
if (event.target.checked)
|
||||
nameDefaultRedirects.push(element.id)
|
||||
|
@ -147,7 +149,7 @@ function processDefaultCustomInstances(
|
|||
|
||||
nameCustomInstances = getNameCustomRedirects();
|
||||
function calcNameCustomInstances() {
|
||||
document.getElementById(`${name}-custom-checklist`).innerHTML =
|
||||
document.getElementById(`${name}-${protocol}-custom-checklist`).innerHTML =
|
||||
nameCustomInstances.map(
|
||||
(x) => `<div>${x}<button class="add" id="clear-${x}">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px"
|
||||
|
@ -170,12 +172,12 @@ function processDefaultCustomInstances(
|
|||
}
|
||||
}
|
||||
calcNameCustomInstances();
|
||||
document.getElementById(`custom-${name}-instance-form`).addEventListener("submit", (event) => {
|
||||
document.getElementById(`custom-${name}-${protocol}-instance-form`).addEventListener("submit", (event) => {
|
||||
event.preventDefault();
|
||||
let nameCustomInstanceInput = document.getElementById(`${name}-custom-instance`);
|
||||
let nameCustomInstanceInput = document.getElementById(`${name}-${protocol}-custom-instance`);
|
||||
let url = new URL(nameCustomInstanceInput.value);
|
||||
let protocolHost = `${url.protocol}//${url.host}`;
|
||||
if (nameCustomInstanceInput.validity.valid && !nameHelper.getRedirects()[name].normal.includes(protocolHost)) {
|
||||
if (nameCustomInstanceInput.validity.valid && !nameHelper.getRedirects()[name][protocol].includes(protocolHost)) {
|
||||
if (!nameCustomInstances.includes(protocolHost)) {
|
||||
nameCustomInstances.push(protocolHost)
|
||||
setNameCustomRedirects(nameCustomInstances);
|
||||
|
|
|
@ -16,7 +16,7 @@ let redirects = {
|
|||
"https://rimgo.totaldarkness.net",
|
||||
"https://rimgo.bus-hit.me"
|
||||
],
|
||||
"onion": [
|
||||
"tor": [
|
||||
"http://l4d4owboqr6xcmd6lf64gbegel62kbudu3x3jnldz2mx6mhn3bsv3zyd.onion",
|
||||
"http://jx3dpcwedpzu2mh54obk5gvl64i2ln7pt5mrzd75s4jnndkqwzaim7ad.onion"
|
||||
]
|
||||
|
|
|
@ -47,7 +47,7 @@ let redirects = {
|
|||
"https://teddit.adminforge.de",
|
||||
"https://teddit.bus-hit.me"
|
||||
],
|
||||
"onion": [
|
||||
"tor": [
|
||||
"http://teddit4w6cmzmj5kimhfcavs7yo5s7alszvsi2khqutqtlaanpcftfyd.onion",
|
||||
"http://snoo.ioensistjs7wd746zluwixvojbbkxhr37lepdvwtdfeav673o64iflqd.onion",
|
||||
"http://ibarajztopxnuhabfu7fg6gbudynxofbnmvis3ltj6lfx47b6fhrd5qd.onion",
|
||||
|
|
|
@ -100,7 +100,7 @@ let redirects = {
|
|||
"https://xeek.com",
|
||||
"https://searx.roflcopter.fr",
|
||||
],
|
||||
"onion": [
|
||||
"tor": [
|
||||
"http://3afisqjw2rxm6z7mmstyt5rx75qfqrgxnkzftknbp2vhipr2nrmrjdyd.onion",
|
||||
"http://searxbgetrkiwxhdwi6svpgh7eotopqyxhbqiokrwzg7dcte44t36kyd.onion",
|
||||
"http://suche.xyzco456vwisukfg.onion",
|
||||
|
|
|
@ -20,7 +20,7 @@ let redirects = {
|
|||
"https://simplytranslate.pussthecat.org",
|
||||
"https://translate.northboot.xyz"
|
||||
],
|
||||
"onion": [
|
||||
"tor": [
|
||||
"http://fyng2tsmzmvxmojzbbwmfnsn2lrcyftf4cw6rk5j2v2huliazud3fjid.onion",
|
||||
"http://xxtbwyb5z5bdvy2f6l2yquu5qilgkjeewno4qfknvb3lkg3nmoklitid.onion"
|
||||
]
|
||||
|
|
|
@ -63,7 +63,7 @@ let redirects = {
|
|||
"https://tw.artemislena.eu",
|
||||
"https://nitter.eu.org"
|
||||
],
|
||||
"onion": [
|
||||
"tor": [
|
||||
"http://3nzoldnxplag42gqjs23xvghtzf6t6yzssrtytnntc6ppc7xxuoneoad.onion",
|
||||
"http://nitter.l4qlywnpwqsluw65ts7md3khrivpirse744un3x7mlskqauz5pyuzgqd.onion",
|
||||
"http://nitter7bryz3jv7e3uekphigvmoyoem4al3fynerxkj22dmoxoq553qd.onion",
|
||||
|
@ -83,13 +83,15 @@ let redirects = {
|
|||
},
|
||||
};
|
||||
const getRedirects = () => redirects;
|
||||
const getCustomRedirects = function () {
|
||||
|
||||
function getCustomRedirects() {
|
||||
return {
|
||||
"nitter": {
|
||||
"normal": [...nitterRedirectsChecks, ...nitterCustomRedirects]
|
||||
"normal": [...nitterNormalRedirectsChecks, ...nitterNormalCustomRedirects]
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
function setRedirects(val) {
|
||||
redirects.nitter = val;
|
||||
browser.storage.sync.set({ twitterRedirects: redirects })
|
||||
|
@ -102,22 +104,39 @@ function setRedirects(val) {
|
|||
setNitterRedirectsChecks(nitterRedirectsChecks);
|
||||
}
|
||||
|
||||
let nitterRedirectsChecks;
|
||||
const getNitterRedirectsChecks = () => nitterRedirectsChecks;
|
||||
function setNitterRedirectsChecks(val) {
|
||||
nitterRedirectsChecks = val;
|
||||
browser.storage.sync.set({ nitterRedirectsChecks })
|
||||
console.log("nitterRedirectsChecks: ", val)
|
||||
let nitterNormalRedirectsChecks;
|
||||
const getNitterNormalRedirectsChecks = () => nitterNormalRedirectsChecks;
|
||||
function setNitterNormalRedirectsChecks(val) {
|
||||
nitterNormalRedirectsChecks = val;
|
||||
browser.storage.sync.set({ nitterNormalRedirectsChecks })
|
||||
console.log("nitterNormalRedirectsChecks: ", val)
|
||||
}
|
||||
|
||||
let nitterCustomRedirects = [];
|
||||
const getNitterCustomRedirects = () => nitterCustomRedirects;
|
||||
function setNitterCustomRedirects(val) {
|
||||
nitterCustomRedirects = val;
|
||||
browser.storage.sync.set({ nitterCustomRedirects })
|
||||
console.log("nitterCustomRedirects: ", val)
|
||||
let nitterNormalCustomRedirects = [];
|
||||
const getNitterNormalCustomRedirects = () => nitterNormalCustomRedirects;
|
||||
function setNitterNormalCustomRedirects(val) {
|
||||
nitterNormalCustomRedirects = val;
|
||||
browser.storage.sync.set({ nitterNormalCustomRedirects })
|
||||
console.log("nitterNormalCustomRedirects: ", val)
|
||||
}
|
||||
|
||||
let nitterTorRedirectsChecks;
|
||||
const getNitterTorRedirectsChecks = () => nitterTorRedirectsChecks;
|
||||
function setNitterTorRedirectsChecks(val) {
|
||||
nitterTorRedirectsChecks = val;
|
||||
browser.storage.sync.set({ nitterTorRedirectsChecks })
|
||||
console.log("nitterTorRedirectsChecks: ", val)
|
||||
}
|
||||
|
||||
let nitterTorCustomRedirects = [];
|
||||
const getNitterTorCustomRedirects = () => nitterTorCustomRedirects;
|
||||
function setNitterTorCustomRedirects(val) {
|
||||
nitterTorCustomRedirects = val;
|
||||
browser.storage.sync.set({ nitterTorCustomRedirects })
|
||||
console.log("nitterTorCustomRedirects: ", val)
|
||||
}
|
||||
|
||||
|
||||
let disable;
|
||||
const getDisable = () => disable;
|
||||
function setDisable(val) {
|
||||
|
@ -125,19 +144,38 @@ function setDisable(val) {
|
|||
browser.storage.sync.set({ disableTwitter: disable })
|
||||
}
|
||||
|
||||
let protocol;
|
||||
const getprotocol = () => protocol;
|
||||
function setProtocol(val) {
|
||||
protocol = val;
|
||||
browser.storage.sync.set({ nitterProtocol: val })
|
||||
console.log("nitterProtocol: ", val)
|
||||
}
|
||||
|
||||
function isTwitter(url, initiator) {
|
||||
if (disable) return false;
|
||||
if (url.pathname.split("/").includes("home")) return null;
|
||||
if (
|
||||
commonHelper.isFirefox() &&
|
||||
initiator && ([...redirects.nitter.normal, ...nitterCustomRedirects].includes(initiator.origin) || targets.includes(initiator.host))
|
||||
initiator && (
|
||||
[
|
||||
...redirects.nitter.normal,
|
||||
...redirects.nitter.tor,
|
||||
...nitterTorCustomRedirects,
|
||||
...nitterNormalCustomRedirects
|
||||
].includes(initiator.origin) || targets.includes(initiator.host))
|
||||
) return false;
|
||||
|
||||
return targets.includes(url.host)
|
||||
}
|
||||
|
||||
function redirect(url) {
|
||||
let instancesList = [...nitterRedirectsChecks, ...nitterCustomRedirects];
|
||||
let instancesList;
|
||||
if (protocol == 'normal')
|
||||
instancesList = [...nitterNormalRedirectsChecks, ...nitterNormalCustomRedirects];
|
||||
else if (protocol == 'tor')
|
||||
instancesList = [...nitterTorRedirectsChecks, ...nitterTorCustomRedirects];
|
||||
|
||||
if (instancesList.length === 0) return null;
|
||||
let randomInstance = commonHelper.getRandomInstance(instancesList)
|
||||
|
||||
|
@ -157,16 +195,24 @@ async function init() {
|
|||
[
|
||||
"disableTwitter",
|
||||
"twitterRedirects",
|
||||
"nitterRedirectsChecks",
|
||||
"nitterCustomRedirects",
|
||||
"nitterNormalRedirectsChecks",
|
||||
"nitterNormalCustomRedirects",
|
||||
"nitterTorRedirectsChecks",
|
||||
"nitterTorCustomRedirects",
|
||||
"nitterProtocol",
|
||||
],
|
||||
(result) => {
|
||||
disable = result.disableTwitter ?? false;
|
||||
|
||||
if (result.twitterRedirects) redirects = result.twitterRedirects;
|
||||
|
||||
nitterRedirectsChecks = result.nitterRedirectsChecks ?? [...redirects.nitter.normal];
|
||||
nitterCustomRedirects = result.nitterCustomRedirects ?? [];
|
||||
nitterNormalRedirectsChecks = result.nitterNormalRedirectsChecks ?? [...redirects.nitter.normal];
|
||||
nitterNormalCustomRedirects = result.nitterNormalCustomRedirects ?? [];
|
||||
|
||||
nitterTorRedirectsChecks = result.nitterTorRedirectsChecks ?? [...redirects.nitter.tor];
|
||||
nitterTorCustomRedirects = result.nitterTorCustomRedirects ?? [];
|
||||
|
||||
protocol = result.nitterProtocol ?? "normal";
|
||||
|
||||
resolve();
|
||||
}
|
||||
|
@ -182,11 +228,20 @@ export default {
|
|||
getDisable,
|
||||
setDisable,
|
||||
|
||||
getNitterRedirectsChecks,
|
||||
setNitterRedirectsChecks,
|
||||
getNitterNormalRedirectsChecks,
|
||||
setNitterNormalRedirectsChecks,
|
||||
|
||||
getNitterCustomRedirects,
|
||||
setNitterCustomRedirects,
|
||||
getNitterNormalCustomRedirects,
|
||||
setNitterNormalCustomRedirects,
|
||||
|
||||
getNitterTorRedirectsChecks,
|
||||
setNitterTorRedirectsChecks,
|
||||
|
||||
getNitterTorCustomRedirects,
|
||||
setNitterTorCustomRedirects,
|
||||
|
||||
getprotocol,
|
||||
setProtocol,
|
||||
|
||||
redirect,
|
||||
isTwitter,
|
||||
|
|
|
@ -12,7 +12,7 @@ let redirects = {
|
|||
"https://wikiless.sethforprivacy.com",
|
||||
"https://wiki.604kph.xyz"
|
||||
],
|
||||
"onion": [
|
||||
"tor": [
|
||||
"http://dj2tbh2nqfxyfmvq33cjmhuw7nb6am7thzd3zsjvizeqf374fixbrxyd.onion"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@ browser.storage.sync.get(
|
|||
let prefs = getCookie();
|
||||
let changed = false;
|
||||
|
||||
if (result.invidiousAlwaysProxy !== undefined && prefs.local !== result.invidiousAlwaysProxy) {
|
||||
prefs.local = result.invidiousAlwaysProxy;
|
||||
if (result.invidiousAlwaysProxy !== undefined && prefs.sync !== result.invidiousAlwaysProxy) {
|
||||
prefs.sync = result.invidiousAlwaysProxy;
|
||||
changed = true;
|
||||
}
|
||||
if (result.invidiousVideoQuality !== undefined && prefs.quality !== result.invidiousVideoQuality) {
|
||||
|
|
|
@ -32,7 +32,7 @@ let redirects = {
|
|||
"https://youtube.076.ne.jp",
|
||||
"https://invidious.namazso.eu"
|
||||
],
|
||||
"onion": [
|
||||
"tor": [
|
||||
"http://c7hqkpkpemu6e7emz5b4vyz7idjgdvgaaa3dyimmeojqbgpea3xqjoid.onion",
|
||||
"http://w6ijuptxiku4xpnnaetxvnkc5vqcdu7mgns2u77qefoixi63vbvnpnqd.onion",
|
||||
"http://kbjggqkzv65ivcqj6bumvp337z6264huv5kpkwuv6gu5yjiskvan7fad.onion",
|
||||
|
@ -48,7 +48,8 @@ let redirects = {
|
|||
"https://piped.silkky.cloud",
|
||||
"https://piped.tokhmi.xyz",
|
||||
"https://piped.mint.lgbt",
|
||||
]
|
||||
],
|
||||
"tor": []
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -57,10 +58,12 @@ const getRedirects = () => redirects;
|
|||
const getCustomRedirects = function () {
|
||||
return {
|
||||
"invidious": {
|
||||
"normal": [...invidiousRedirectsChecks, ...invidiousCustomRedirects]
|
||||
"normal": [...invidiousNormalRedirectsChecks, ...invidiousNormalCustomRedirects],
|
||||
"tor": [...invidiousTorRedirectsChecks, ...invidiousTorCustomRedirects]
|
||||
},
|
||||
"piped": {
|
||||
"normal": [...pipedRedirectsChecks, ...pipedCustomRedirects]
|
||||
"normal": [...pipedNormalRedirectsChecks, ...pipedNormalCustomRedirects],
|
||||
"tor": [...pipedTorRedirectsChecks, ...pipedTorCustomRedirects]
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -71,38 +74,76 @@ function setInvidiousRedirects(val) {
|
|||
console.log("invidiousRedirects: ", val)
|
||||
}
|
||||
|
||||
let invidiousRedirectsChecks;
|
||||
const getInvidiousRedirectsChecks = () => invidiousRedirectsChecks;
|
||||
function setInvidiousRedirectsChecks(val) {
|
||||
invidiousRedirectsChecks = val;
|
||||
browser.storage.sync.set({ invidiousRedirectsChecks })
|
||||
console.log("invidiousRedirectsChecks: ", val)
|
||||
let invidiousNormalRedirectsChecks;
|
||||
const getInvidiousNormalRedirectsChecks = () => invidiousNormalRedirectsChecks;
|
||||
function setInvidiousNormalRedirectsChecks(val) {
|
||||
invidiousNormalRedirectsChecks = val;
|
||||
browser.storage.sync.set({ invidiousNormalRedirectsChecks })
|
||||
console.log("invidiousNormalRedirectsChecks: ", val)
|
||||
}
|
||||
|
||||
let invidiousCustomRedirects = [];
|
||||
const getInvidiousCustomRedirects = () => invidiousCustomRedirects;
|
||||
function setInvidiousCustomRedirects(val) {
|
||||
invidiousCustomRedirects = val;
|
||||
browser.storage.sync.set({ invidiousCustomRedirects })
|
||||
console.log("invidiousCustomRedirects: ", val)
|
||||
let invidiousNormalCustomRedirects = [];
|
||||
const getInvidiousNormalCustomRedirects = () => invidiousNormalCustomRedirects;
|
||||
function setInvidiousNormalCustomRedirects(val) {
|
||||
invidiousNormalCustomRedirects = val;
|
||||
browser.storage.sync.set({ invidiousNormalCustomRedirects })
|
||||
console.log("invidiousNormalCustomRedirects: ", val)
|
||||
}
|
||||
|
||||
let pipedRedirectsChecks;
|
||||
const getPipedRedirectsChecks = () => pipedRedirectsChecks;
|
||||
function setPipedRedirectsChecks(val) {
|
||||
pipedRedirectsChecks = val;
|
||||
browser.storage.sync.set({ pipedRedirectsChecks })
|
||||
console.log("pipedRedirectsChecks: ", val)
|
||||
|
||||
let invidiousTorRedirectsChecks;
|
||||
const getInvidiousTorRedirectsChecks = () => invidiousTorRedirectsChecks;
|
||||
function setInvidiousTorRedirectsChecks(val) {
|
||||
invidiousTorRedirectsChecks = val;
|
||||
browser.storage.sync.set({ invidiousTorRedirectsChecks })
|
||||
console.log("invidiousTorRedirectsChecks: ", val)
|
||||
}
|
||||
|
||||
let pipedCustomRedirects = [];
|
||||
const getPipedCustomRedirects = () => pipedCustomRedirects;
|
||||
function setPipedCustomRedirects(val) {
|
||||
pipedCustomRedirects = val;
|
||||
browser.storage.sync.set({ pipedCustomRedirects })
|
||||
console.log("pipedCustomRedirects: ", val)
|
||||
let invidiousTorCustomRedirects = [];
|
||||
const getInvidiousTorCustomRedirects = () => invidiousTorCustomRedirects;
|
||||
function setInvidiousTorCustomRedirects(val) {
|
||||
invidiousTorCustomRedirects = val;
|
||||
browser.storage.sync.set({ invidiousTorCustomRedirects })
|
||||
console.log("invidiousTorCustomRedirects: ", val)
|
||||
}
|
||||
|
||||
|
||||
let pipedNormalRedirectsChecks;
|
||||
const getPipedNormalRedirectsChecks = () => pipedNormalRedirectsChecks;
|
||||
function setPipedNormalRedirectsChecks(val) {
|
||||
pipedNormalRedirectsChecks = val;
|
||||
browser.storage.sync.set({ pipedNormalRedirectsChecks })
|
||||
console.log("pipedNormalRedirectsChecks: ", val)
|
||||
}
|
||||
|
||||
let pipedNormalCustomRedirects = [];
|
||||
const getPipedNormalCustomRedirects = () => pipedNormalCustomRedirects;
|
||||
function setPipedNormalCustomRedirects(val) {
|
||||
pipedNormalCustomRedirects = val;
|
||||
browser.storage.sync.set({ pipedNormalCustomRedirects })
|
||||
console.log("pipedNormalCustomRedirects: ", val)
|
||||
}
|
||||
|
||||
|
||||
let pipedTorRedirectsChecks;
|
||||
const getPipedTorRedirectsChecks = () => pipedTorRedirectsChecks;
|
||||
function setPipedTorRedirectsChecks(val) {
|
||||
pipedTorRedirectsChecks = val;
|
||||
browser.storage.sync.set({ pipedTorRedirectsChecks })
|
||||
console.log("pipedTorRedirectsChecks: ", val)
|
||||
}
|
||||
|
||||
let pipedTorCustomRedirects = [];
|
||||
const getPipedTorCustomRedirects = () => pipedTorCustomRedirects;
|
||||
function setPipedTorCustomRedirects(val) {
|
||||
pipedTorCustomRedirects = val;
|
||||
browser.storage.sync.set({ pipedTorCustomRedirects })
|
||||
console.log("pipedTorCustomRedirects: ", val)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function setPipedRedirects(val) {
|
||||
redirects.piped = val;
|
||||
browser.storage.sync.set({ youtubeRedirects: redirects })
|
||||
|
@ -117,6 +158,15 @@ function setDisable(val) {
|
|||
console.log("disableYoutube: ", disable)
|
||||
}
|
||||
|
||||
|
||||
let protocol;
|
||||
const getprotocol = () => protocol;
|
||||
function setProtocol(val) {
|
||||
protocol = val;
|
||||
browser.storage.sync.set({ youtubeProtocol: val })
|
||||
console.log("youtubeProtocol: ", val)
|
||||
}
|
||||
|
||||
let invidiousAlwaysProxy;
|
||||
function setInvidiousAlwaysProxy(val) {
|
||||
invidiousAlwaysProxy = val;
|
||||
|
@ -215,11 +265,19 @@ function setAlwaysusePreferred(val) {
|
|||
|
||||
function isYoutube(url, initiator) {
|
||||
if (disable) return false;
|
||||
|
||||
if (
|
||||
initiator && (
|
||||
[...redirects.invidious.normal, ...invidiousCustomRedirects].includes(initiator.origin) ||
|
||||
[...redirects.piped.normal, ...pipedCustomRedirects].includes(initiator.origin) ||
|
||||
[
|
||||
...redirects.invidious.normal,
|
||||
...invidiousNormalCustomRedirects,
|
||||
...redirects.invidious.tor,
|
||||
...invidiousTorCustomRedirects,
|
||||
|
||||
...redirects.piped.normal,
|
||||
...redirects.piped.tor,
|
||||
...pipedNormalCustomRedirects,
|
||||
...pipedTorCustomRedirects
|
||||
].includes(initiator.origin) ||
|
||||
targets.includes(initiator.host)
|
||||
)
|
||||
) return false;
|
||||
|
@ -227,15 +285,27 @@ function isYoutube(url, initiator) {
|
|||
let isTargets = targets.some((rx) => rx.test(url.href));
|
||||
let protocolHost = `${url.protocol}//${url.host}`;
|
||||
|
||||
let isInvidious = redirects.invidious.normal.includes(protocolHost);
|
||||
let isInvidious = [...redirects.invidious.normal, ...redirects.invidious.tor].includes(protocolHost);
|
||||
if (isInvidious) {
|
||||
let myInvidiousInstances = [...invidiousRedirectsChecks, ...invidiousCustomRedirects];
|
||||
let myInvidiousInstances = [
|
||||
...invidiousNormalRedirectsChecks,
|
||||
...invidiousNormalCustomRedirects,
|
||||
|
||||
...invidiousTorRedirectsChecks,
|
||||
...invidiousTorCustomRedirects,
|
||||
];
|
||||
for (const item of myInvidiousInstances) if (item == protocolHost) isInvidious = false;
|
||||
}
|
||||
|
||||
let isPiped = redirects.piped.normal.includes(protocolHost);
|
||||
let isPiped = [...redirects.piped.normal, ...redirects.piped.tor].includes(protocolHost);
|
||||
if (isPiped) {
|
||||
let myPipedInstances = [...pipedRedirectsChecks, ...pipedCustomRedirects];
|
||||
let myPipedInstances = [
|
||||
...pipedNormalRedirectsChecks,
|
||||
...pipedNormalCustomRedirects,
|
||||
|
||||
...pipedTorRedirectsChecks,
|
||||
...pipedTorCustomRedirects,
|
||||
];
|
||||
for (const item of myPipedInstances) if (item == protocolHost) isPiped = false;
|
||||
}
|
||||
|
||||
|
@ -272,7 +342,10 @@ function redirect(url, type) {
|
|||
!(frontend == 'freetube' && freetubeFrontend == 'invidious' && type === "sub_frame")
|
||||
) return null;
|
||||
|
||||
let instancesList = [...invidiousRedirectsChecks, ...invidiousCustomRedirects];
|
||||
let instancesList;
|
||||
if (protocol == 'normal') instancesList = [...invidiousNormalRedirectsChecks, ...invidiousNormalCustomRedirects];
|
||||
else if (protocol == 'tor') instancesList = [...invidiousTorRedirectsChecks, ...invidiousTorCustomRedirects];
|
||||
|
||||
if (instancesList.length === 0) return null;
|
||||
let randomInstance = commonHelper.getRandomInstance(instancesList);
|
||||
|
||||
|
@ -286,7 +359,9 @@ function redirect(url, type) {
|
|||
!(frontend == 'freetube' && freetubeFrontend == 'piped' && type == "sub_frame")
|
||||
) return null;
|
||||
|
||||
let instancesList = [...pipedRedirectsChecks, ...pipedCustomRedirects];
|
||||
let instancesList;
|
||||
if (protocol == 'normal') instancesList = [...pipedNormalRedirectsChecks, ...pipedNormalCustomRedirects];
|
||||
else if (protocol == 'tor') instancesList = [...pipedTorRedirectsChecks, ...pipedTorCustomRedirects];
|
||||
if (instancesList.length === 0) return null;
|
||||
let randomInstance = commonHelper.getRandomInstance(instancesList);
|
||||
|
||||
|
@ -297,22 +372,54 @@ function redirect(url, type) {
|
|||
|
||||
function isPipedorInvidious(url, type) {
|
||||
let protocolHost = `${url.protocol}//${url.host}`;
|
||||
return (type === "main_frame" || type === "sub_frame") && [...redirects.invidious.normal, ...redirects.piped.normal].includes(protocolHost);
|
||||
return (type === "main_frame" || type === "sub_frame") && [
|
||||
...redirects.invidious.normal,
|
||||
...invidiousNormalCustomRedirects,
|
||||
...redirects.invidious.tor,
|
||||
...invidiousTorCustomRedirects,
|
||||
|
||||
...redirects.piped.normal,
|
||||
...redirects.piped.tor,
|
||||
...pipedNormalCustomRedirects,
|
||||
...pipedTorCustomRedirects,
|
||||
].includes(protocolHost);
|
||||
}
|
||||
|
||||
function isUrlPipedorInvidious(url) {
|
||||
url = new URL(url);
|
||||
let protocolHost = `${url.protocol}//${url.host}`;
|
||||
return [...redirects.invidious.normal, ...redirects.piped.normal].includes(protocolHost);
|
||||
return [
|
||||
...redirects.invidious.normal,
|
||||
...redirects.invidious.tor,
|
||||
...invidiousNormalCustomRedirects,
|
||||
...invidiousTorCustomRedirects,
|
||||
|
||||
...redirects.piped.normal,
|
||||
...redirects.piped.tor,
|
||||
...pipedNormalCustomRedirects,
|
||||
...pipedTorCustomRedirects,
|
||||
|
||||
].includes(protocolHost);
|
||||
}
|
||||
|
||||
function addUrlParams(url) {
|
||||
|
||||
let protocolHost = `${url.protocol}//${url.host}`;
|
||||
let isChanged = false;
|
||||
|
||||
console.log("protocolHost", protocolHost)
|
||||
if (redirects.invidious.normal.includes(protocolHost)) {
|
||||
console.log("protocolHost", protocolHost);
|
||||
console.log([
|
||||
...redirects.invidious.normal,
|
||||
...redirects.invidious.tor,
|
||||
...invidiousNormalCustomRedirects,
|
||||
...invidiousTorCustomRedirects,
|
||||
])
|
||||
if (
|
||||
[
|
||||
...redirects.invidious.normal,
|
||||
...redirects.invidious.tor,
|
||||
...invidiousNormalCustomRedirects,
|
||||
...invidiousTorCustomRedirects,
|
||||
].includes(protocolHost)) {
|
||||
if (!url.searchParams.has("dark_mode") && theme != "DEFAULT") {
|
||||
url.searchParams.append("dark_mode", theme);
|
||||
isChanged = true;
|
||||
|
@ -348,7 +455,13 @@ function addUrlParams(url) {
|
|||
isChanged = true;
|
||||
}
|
||||
|
||||
} else if (redirects.piped.normal.includes(protocolHost)) {
|
||||
} else if (
|
||||
[
|
||||
...redirects.piped.normal,
|
||||
...redirects.piped.tor,
|
||||
...pipedNormalCustomRedirects,
|
||||
...pipedTorCustomRedirects,
|
||||
].includes(protocolHost)) {
|
||||
|
||||
if (!url.searchParams.has("theme") && theme != "DEFAULT") {
|
||||
url.searchParams.append("theme", theme);
|
||||
|
@ -396,17 +509,28 @@ async function init() {
|
|||
"youtubeAutoplay",
|
||||
"youtubeRedirects",
|
||||
"youtubeFrontend",
|
||||
"invidiousRedirectsChecks",
|
||||
"invidiousCustomRedirects",
|
||||
"pipedRedirectsChecks",
|
||||
"pipedCustomRedirects",
|
||||
|
||||
"invidiousNormalRedirectsChecks",
|
||||
"invidiousNormalCustomRedirects",
|
||||
|
||||
"invidiousTorRedirectsChecks",
|
||||
"invidiousTorCustomRedirects",
|
||||
|
||||
"pipedNormalRedirectsChecks",
|
||||
"pipedNormalCustomRedirects",
|
||||
|
||||
"pipedTorRedirectsChecks",
|
||||
"pipedTorCustomRedirects",
|
||||
"alwaysusePreferred",
|
||||
"freetubeFrontend",
|
||||
|
||||
"youtubeProtocol",
|
||||
],
|
||||
(result) => {
|
||||
if (result.youtubeRedirects) redirects = result.youtubeRedirects;
|
||||
|
||||
disable = result.disableYoutube ?? false;
|
||||
protocol = result.youtubeProtocol ?? 'normal';
|
||||
frontend = result.youtubeFrontend ?? 'piped';
|
||||
freetubeFrontend = result.freetubeFrontend ?? 'invidious';
|
||||
|
||||
|
@ -420,11 +544,17 @@ async function init() {
|
|||
invidiousPlayerStyle = result.invidiousPlayerStyle ?? 'DEFAULT';
|
||||
invidiousSubtitles = result.invidiousSubtitles || '';
|
||||
|
||||
invidiousRedirectsChecks = result.invidiousRedirectsChecks ?? [...redirects.invidious.normal];
|
||||
invidiousCustomRedirects = result.invidiousCustomRedirects ?? [];
|
||||
invidiousNormalRedirectsChecks = result.invidiousNormalRedirectsChecks ?? [...redirects.invidious.normal];
|
||||
invidiousNormalCustomRedirects = result.invidiousNormalCustomRedirects ?? [];
|
||||
|
||||
pipedRedirectsChecks = result.pipedRedirectsChecks ?? [...redirects.piped.normal];
|
||||
pipedCustomRedirects = result.pipedCustomRedirects ?? [];
|
||||
invidiousTorRedirectsChecks = result.invidiousTorRedirectsChecks ?? [...redirects.invidious.tor];
|
||||
invidiousTorCustomRedirects = result.invidiousTorCustomRedirects ?? [];
|
||||
|
||||
pipedNormalRedirectsChecks = result.pipedNormalRedirectsChecks ?? [...redirects.piped.normal];
|
||||
pipedNormalCustomRedirects = result.pipedNormalCustomRedirects ?? [];
|
||||
|
||||
pipedTorRedirectsChecks = result.pipedTorRedirectsChecks ?? [...redirects.piped.tor];
|
||||
pipedTorCustomRedirects = result.pipedTorCustomRedirects ?? [];
|
||||
|
||||
persistInvidiousPrefs = result.persistInvidiousPrefs ?? false;
|
||||
|
||||
|
@ -460,6 +590,9 @@ export default {
|
|||
getDisable,
|
||||
setDisable,
|
||||
|
||||
getprotocol,
|
||||
setProtocol,
|
||||
|
||||
setInvidiousAlwaysProxy,
|
||||
getInvidiousAlwaysProxy,
|
||||
|
||||
|
@ -487,17 +620,29 @@ export default {
|
|||
getPersistInvidiousPrefs,
|
||||
setPersistInvidiousPrefs,
|
||||
|
||||
getInvidiousRedirectsChecks,
|
||||
setInvidiousRedirectsChecks,
|
||||
getInvidiousNormalRedirectsChecks,
|
||||
setInvidiousNormalRedirectsChecks,
|
||||
|
||||
getInvidiousCustomRedirects,
|
||||
setInvidiousCustomRedirects,
|
||||
getInvidiousNormalCustomRedirects,
|
||||
setInvidiousNormalCustomRedirects,
|
||||
|
||||
getPipedRedirectsChecks,
|
||||
setPipedRedirectsChecks,
|
||||
getPipedNormalRedirectsChecks,
|
||||
setPipedNormalRedirectsChecks,
|
||||
|
||||
getPipedCustomRedirects,
|
||||
setPipedCustomRedirects,
|
||||
getPipedNormalCustomRedirects,
|
||||
setPipedNormalCustomRedirects,
|
||||
|
||||
getInvidiousTorRedirectsChecks,
|
||||
setInvidiousTorRedirectsChecks,
|
||||
|
||||
getInvidiousTorCustomRedirects,
|
||||
setInvidiousTorCustomRedirects,
|
||||
|
||||
getPipedTorRedirectsChecks,
|
||||
setPipedTorRedirectsChecks,
|
||||
|
||||
getPipedTorCustomRedirects,
|
||||
setPipedTorCustomRedirects,
|
||||
|
||||
getAlwaysusePreferred,
|
||||
setAlwaysusePreferred,
|
||||
|
|
|
@ -11,6 +11,7 @@ imgurHelper.init().then(() => {
|
|||
|
||||
commonHelper.processDefaultCustomInstances(
|
||||
'rimgo',
|
||||
'normal',
|
||||
imgurHelper,
|
||||
document,
|
||||
imgurHelper.getRimgoRedirectsChecks,
|
||||
|
|
|
@ -11,6 +11,7 @@ instagramHelper.init().then(() => {
|
|||
|
||||
commonHelper.processDefaultCustomInstances(
|
||||
'bibliogram',
|
||||
'normal',
|
||||
instagramHelper,
|
||||
document,
|
||||
instagramHelper.getBibliogramRedirectsChecks,
|
||||
|
|
|
@ -11,6 +11,7 @@ mediumHelper.init().then(() => {
|
|||
|
||||
commonHelper.processDefaultCustomInstances(
|
||||
'scribe',
|
||||
'normal',
|
||||
mediumHelper,
|
||||
document,
|
||||
mediumHelper.getScribeRedirectsChecks,
|
||||
|
|
|
@ -37,6 +37,7 @@ redditHelper.init().then(() => {
|
|||
|
||||
commonHelper.processDefaultCustomInstances(
|
||||
'libreddit',
|
||||
'normal',
|
||||
redditHelper,
|
||||
document,
|
||||
redditHelper.getLibredditRedirectsChecks,
|
||||
|
@ -47,6 +48,7 @@ redditHelper.init().then(() => {
|
|||
|
||||
commonHelper.processDefaultCustomInstances(
|
||||
'teddit',
|
||||
'normal',
|
||||
redditHelper,
|
||||
document,
|
||||
redditHelper.getTedditRedirectsChecks,
|
||||
|
|
|
@ -38,6 +38,7 @@ searchHelper.init().then(() => {
|
|||
|
||||
commonHelper.processDefaultCustomInstances(
|
||||
'searx',
|
||||
'normal',
|
||||
searchHelper,
|
||||
document,
|
||||
searchHelper.getSearxRedirectsChecks,
|
||||
|
@ -48,6 +49,7 @@ searchHelper.init().then(() => {
|
|||
|
||||
commonHelper.processDefaultCustomInstances(
|
||||
'whoogle',
|
||||
'normal',
|
||||
searchHelper,
|
||||
document,
|
||||
searchHelper.getWhoogleRedirectsChecks,
|
||||
|
|
|
@ -11,6 +11,7 @@ tiktokHelper.init().then(() => {
|
|||
|
||||
commonHelper.processDefaultCustomInstances(
|
||||
'proxiTok',
|
||||
'normal',
|
||||
tiktokHelper,
|
||||
document,
|
||||
tiktokHelper.getProxiTokRedirectsChecks,
|
||||
|
|
|
@ -58,6 +58,7 @@ translateHelper.init().then(() => {
|
|||
|
||||
commonHelper.processDefaultCustomInstances(
|
||||
'simplyTranslate',
|
||||
'normal',
|
||||
translateHelper,
|
||||
document,
|
||||
translateHelper.getSimplyTranslateRedirectsChecks,
|
||||
|
@ -68,6 +69,7 @@ translateHelper.init().then(() => {
|
|||
|
||||
commonHelper.processDefaultCustomInstances(
|
||||
'lingva',
|
||||
'normal',
|
||||
translateHelper,
|
||||
document,
|
||||
translateHelper.getLingvaRedirectsChecks,
|
||||
|
|
|
@ -115,20 +115,30 @@
|
|||
<input id="disable-nitter" type="checkbox" checked />
|
||||
</div>
|
||||
|
||||
<div class="some-block option-block">
|
||||
<h4>Protocol</h4>
|
||||
<select id="protocol">
|
||||
<option value="normal">Normal</option>
|
||||
<option value="tor">Tor</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div id="normal">
|
||||
|
||||
<div class="some-block option-block">
|
||||
<h4>Default Instances</h4>
|
||||
</div>
|
||||
<div class="checklist" id="nitter-checklist"></div>
|
||||
<div class="checklist" id="nitter-normal-checklist"></div>
|
||||
<hr>
|
||||
<div class="some-block option-block">
|
||||
<h4>Custom Instances</h4>
|
||||
</div>
|
||||
<form id="custom-nitter-instance-form">
|
||||
<form id="custom-nitter-normal-instance-form">
|
||||
<div class="some-block option-block">
|
||||
<input id="nitter-custom-instance" placeholder="https://nitter.com" type="url" />
|
||||
<button type="submit" class="add" id="nitter-add-instance">
|
||||
<input id="nitter-normal-custom-instance" placeholder="https://nitter.com" type="url" />
|
||||
<button type="submit" class="add" id="nitter-normal-add-instance">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px"
|
||||
fill="currentColor">
|
||||
<path d="M0 0h24v24H0V0z" fill="none" />
|
||||
|
@ -137,7 +147,33 @@
|
|||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<div class="checklist" id="nitter-custom-checklist"></div>
|
||||
<div class="checklist" id="nitter-normal-custom-checklist"></div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="tor">
|
||||
<div class="some-block option-block">
|
||||
<h4>Default Tor Instances</h4>
|
||||
</div>
|
||||
<div class="checklist" id="nitter-tor-checklist"></div>
|
||||
<hr>
|
||||
<div class="some-block option-block">
|
||||
<h4>Custom Instances</h4>
|
||||
</div>
|
||||
<form id="custom-nitter-tor-instance-form">
|
||||
<div class="some-block option-block">
|
||||
<input id="nitter-tor-custom-instance" placeholder="https://nitter.com" type="url" />
|
||||
<button type="submit" class="add" id="nitter-tor-add-instance">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px"
|
||||
fill="currentColor">
|
||||
<path d="M0 0h24v24H0V0z" fill="none" />
|
||||
<path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<div class="checklist" id="nitter-tor-custom-checklist"></div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
|
|
|
@ -6,16 +6,54 @@ disableTwitterElement.addEventListener("change",
|
|||
(event) => twitterHelper.setDisable(!event.target.checked)
|
||||
);
|
||||
|
||||
let protocolElement = document.getElementById("protocol")
|
||||
protocolElement.addEventListener("change",
|
||||
(event) => {
|
||||
let protocol = event.target.options[protocolElement.selectedIndex].value
|
||||
twitterHelper.setProtocol(protocol);
|
||||
changeProtocolSettings(protocol);
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
function changeProtocolSettings(protocol) {
|
||||
let normalDiv = document.getElementById("normal");
|
||||
let torDiv = document.getElementById("tor");
|
||||
if (protocol == 'normal') {
|
||||
normalDiv.style.display = 'block';
|
||||
torDiv.style.display = 'none';
|
||||
}
|
||||
else if (protocol == 'tor') {
|
||||
normalDiv.style.display = 'none';
|
||||
torDiv.style.display = 'block';
|
||||
}
|
||||
}
|
||||
|
||||
twitterHelper.init().then(() => {
|
||||
disableTwitterElement.checked = !twitterHelper.getDisable();
|
||||
|
||||
let protocol = twitterHelper.getprotocol();
|
||||
protocolElement.value = protocol;
|
||||
changeProtocolSettings(protocol);
|
||||
|
||||
commonHelper.processDefaultCustomInstances(
|
||||
'nitter',
|
||||
'normal',
|
||||
twitterHelper,
|
||||
document,
|
||||
twitterHelper.getNitterRedirectsChecks,
|
||||
twitterHelper.setNitterRedirectsChecks,
|
||||
twitterHelper.getNitterCustomRedirects,
|
||||
twitterHelper.setNitterCustomRedirects
|
||||
twitterHelper.getNitterNormalRedirectsChecks,
|
||||
twitterHelper.setNitterNormalRedirectsChecks,
|
||||
twitterHelper.getNitterNormalCustomRedirects,
|
||||
twitterHelper.setNitterNormalCustomRedirects
|
||||
)
|
||||
commonHelper.processDefaultCustomInstances(
|
||||
'nitter',
|
||||
'tor',
|
||||
twitterHelper,
|
||||
document,
|
||||
twitterHelper.getNitterTorRedirectsChecks,
|
||||
twitterHelper.setNitterTorRedirectsChecks,
|
||||
twitterHelper.getNitterTorCustomRedirects,
|
||||
twitterHelper.setNitterTorCustomRedirects
|
||||
)
|
||||
});
|
|
@ -10,6 +10,7 @@ wikipediaHelper.init().then(() => {
|
|||
|
||||
commonHelper.processDefaultCustomInstances(
|
||||
'wikiless',
|
||||
'normal',
|
||||
wikipediaHelper,
|
||||
document,
|
||||
wikipediaHelper.getWikilessRedirectsChecks,
|
||||
|
|
|
@ -26,6 +26,7 @@ persistInvidiousPrefsElement.addEventListener("change",
|
|||
(event) => youtubeHelper.setPersistInvidiousPrefs(event.target.checked)
|
||||
);
|
||||
|
||||
|
||||
youtubeHelper.init().then(() => {
|
||||
invidiousPlayerStyleElement.value = youtubeHelper.getInvidiousPlayerStyle();
|
||||
invidiousAlwaysProxyElement.checked = youtubeHelper.getInvidiousAlwaysProxy();
|
||||
|
@ -35,12 +36,24 @@ youtubeHelper.init().then(() => {
|
|||
|
||||
commonHelper.processDefaultCustomInstances(
|
||||
'invidious',
|
||||
'normal',
|
||||
youtubeHelper,
|
||||
document,
|
||||
youtubeHelper.getInvidiousRedirectsChecks,
|
||||
youtubeHelper.setInvidiousRedirectsChecks,
|
||||
youtubeHelper.getInvidiousCustomRedirects,
|
||||
youtubeHelper.setInvidiousCustomRedirects
|
||||
)
|
||||
youtubeHelper.getInvidiousNormalRedirectsChecks,
|
||||
youtubeHelper.setInvidiousNormalRedirectsChecks,
|
||||
youtubeHelper.getInvidiousNormalCustomRedirects,
|
||||
youtubeHelper.setInvidiousNormalCustomRedirects
|
||||
);
|
||||
|
||||
commonHelper.processDefaultCustomInstances(
|
||||
'invidious',
|
||||
'tor',
|
||||
youtubeHelper,
|
||||
document,
|
||||
youtubeHelper.getInvidiousTorRedirectsChecks,
|
||||
youtubeHelper.setInvidiousTorRedirectsChecks,
|
||||
youtubeHelper.getInvidiousTorCustomRedirects,
|
||||
youtubeHelper.setInvidiousTorCustomRedirects
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
@ -4,13 +4,24 @@ import commonHelper from "../../../assets/javascripts/helpers/common.js";
|
|||
youtubeHelper.init().then(() => {
|
||||
commonHelper.processDefaultCustomInstances(
|
||||
'piped',
|
||||
'normal',
|
||||
youtubeHelper,
|
||||
document,
|
||||
youtubeHelper.getPipedRedirectsChecks,
|
||||
youtubeHelper.setPipedRedirectsChecks,
|
||||
youtubeHelper.getPipedCustomRedirects,
|
||||
youtubeHelper.setPipedCustomRedirects
|
||||
)
|
||||
youtubeHelper.getPipedNormalRedirectsChecks,
|
||||
youtubeHelper.setPipedNormalRedirectsChecks,
|
||||
youtubeHelper.getPipedNormalCustomRedirects,
|
||||
youtubeHelper.setPipedNormalCustomRedirects
|
||||
);
|
||||
commonHelper.processDefaultCustomInstances(
|
||||
'piped',
|
||||
'tor',
|
||||
youtubeHelper,
|
||||
document,
|
||||
youtubeHelper.getPipedTorRedirectsChecks,
|
||||
youtubeHelper.setPipedTorRedirectsChecks,
|
||||
youtubeHelper.getPipedTorCustomRedirects,
|
||||
youtubeHelper.setPipedTorCustomRedirects
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -138,6 +138,15 @@
|
|||
</div>
|
||||
|
||||
<div id="invidious-piped">
|
||||
|
||||
<div class="some-block option-block">
|
||||
<h4>Protocol</h4>
|
||||
<select id="protocol">
|
||||
<option value="normal">Normal</option>
|
||||
<option value="tor">Tor</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="some-block option-block">
|
||||
<h4>Redirect Type</h4>
|
||||
<select id="only-embed">
|
||||
|
@ -225,54 +234,111 @@
|
|||
|
||||
<hr>
|
||||
|
||||
|
||||
<div id="invidious-normal">
|
||||
<div class="some-block option-block">
|
||||
<h4>Default Instances</h4>
|
||||
</div>
|
||||
<div class="checklist" id="invidious-checklist">
|
||||
<div class="checklist" id="invidious-normal-checklist">
|
||||
</div>
|
||||
<hr>
|
||||
<div class="some-block option-block">
|
||||
<h4>Custom Instances</h4>
|
||||
</div>
|
||||
<form id="custom-invidious-instance-form">
|
||||
<form id="custom-invidious-normal-instance-form">
|
||||
<div class="some-block option-block">
|
||||
<input id="invidious-custom-instance" placeholder="https://invidious.com" type="url" />
|
||||
<button type="submit" class="add" id="invidious-add-instance">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor">
|
||||
<input id="invidious-normal-custom-instance" placeholder="https://invidious.com" type="url" />
|
||||
<button type="submit" class="add" id="invidious-normal-add-instance">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px"
|
||||
fill="currentColor">
|
||||
<path d="M0 0h24v24H0V0z" fill="none" />
|
||||
<path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<div class="checklist" id="invidious-custom-checklist"></div>
|
||||
<div class="checklist" id="invidious-normal-custom-checklist"></div>
|
||||
</div>
|
||||
|
||||
<div id="invidious-tor">
|
||||
<div class="some-block option-block">
|
||||
<h4>Default Instances</h4>
|
||||
</div>
|
||||
<div class="checklist" id="invidious-tor-checklist">
|
||||
</div>
|
||||
<hr>
|
||||
<div class="some-block option-block">
|
||||
<h4>Custom Instances</h4>
|
||||
</div>
|
||||
<form id="custom-invidious-tor-instance-form">
|
||||
<div class="some-block option-block">
|
||||
<input id="invidious-tor-custom-instance" placeholder="https://invidious.com" type="url" />
|
||||
<button type="submit" class="add" id="invidious-tor-add-instance">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px"
|
||||
fill="currentColor">
|
||||
<path d="M0 0h24v24H0V0z" fill="none" />
|
||||
<path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<div class="checklist" id="invidious-tor-custom-checklist"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="piped">
|
||||
<hr>
|
||||
|
||||
<div id="piped-normal">
|
||||
<div class="some-block option-block">
|
||||
<h4>Default Instances</h4>
|
||||
</div>
|
||||
<div class="checklist" id="piped-checklist">
|
||||
<div class="checklist" id="piped-normal-checklist">
|
||||
</div>
|
||||
<hr>
|
||||
<div class="some-block option-block">
|
||||
<h4>Custom Instances</h4>
|
||||
</div>
|
||||
<form id="custom-piped-instance-form">
|
||||
<form id="custom-piped-normal-instance-form">
|
||||
<div class="some-block option-block">
|
||||
<input id="piped-custom-instance" placeholder="https://piped.com" type="url" />
|
||||
<button type="submit" class="add" id="piped-add-instance">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor">
|
||||
<input id="piped-normal-custom-instance" placeholder="https://piped.com" type="url" />
|
||||
<button type="submit" class="add" id="piped-normal-add-instance">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px"
|
||||
fill="currentColor">
|
||||
<path d="M0 0h24v24H0V0z" fill="none" />
|
||||
<path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<div class="checklist" id="piped-custom-checklist"></div>
|
||||
<div class="checklist" id="piped-normal-custom-checklist"></div>
|
||||
</div>
|
||||
|
||||
<div id="piped-tor">
|
||||
<div class="some-block option-block">
|
||||
<h4>Default Instances</h4>
|
||||
</div>
|
||||
<div class="checklist" id="piped-tor-checklist">
|
||||
</div>
|
||||
<hr>
|
||||
<div class="some-block option-block">
|
||||
<h4>Custom Instances</h4>
|
||||
</div>
|
||||
<form id="custom-piped-tor-instance-form">
|
||||
<div class="some-block option-block">
|
||||
<input id="piped-tor-custom-instance" placeholder="https://piped.com" type="url" />
|
||||
<button type="submit" class="add" id="piped-tor-add-instance">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px"
|
||||
fill="currentColor">
|
||||
<path d="M0 0h24v24H0V0z" fill="none" />
|
||||
<path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<div class="checklist" id="piped-tor-custom-checklist"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
|
|
@ -103,6 +103,35 @@ alwaysUsePreferredElement.addEventListener("change",
|
|||
(event) => youtubeHelper.setAlwaysusePreferred(event.target.checked)
|
||||
);
|
||||
|
||||
let protocolElement = document.getElementById("protocol")
|
||||
protocolElement.addEventListener("change",
|
||||
(event) => {
|
||||
let protocol = event.target.options[protocolElement.selectedIndex].value
|
||||
youtubeHelper.setProtocol(protocol);
|
||||
changeProtocolSettings(protocol);
|
||||
}
|
||||
);
|
||||
|
||||
function changeProtocolSettings(protocol) {
|
||||
let normalPipedDiv = document.getElementById("piped-normal");
|
||||
let torPipedDiv = document.getElementById("piped-tor");
|
||||
|
||||
let normalInvidiousDiv = document.getElementById("invidious-normal");
|
||||
let torInvidiousDiv = document.getElementById("invidious-tor");
|
||||
if (protocol == 'normal') {
|
||||
normalPipedDiv.style.display = 'block';
|
||||
normalInvidiousDiv.style.display = 'block';
|
||||
torInvidiousDiv.style.display = 'none';
|
||||
torPipedDiv.style.display = 'none';
|
||||
}
|
||||
else if (protocol == 'tor') {
|
||||
normalPipedDiv.style.display = 'none';
|
||||
normalInvidiousDiv.style.display = 'none';
|
||||
torInvidiousDiv.style.display = 'block';
|
||||
torPipedDiv.style.display = 'block';
|
||||
}
|
||||
}
|
||||
|
||||
youtubeHelper.init().then(() => {
|
||||
disableYoutubeElement.checked = !youtubeHelper.getDisable();
|
||||
themeElement.checked = youtubeHelper.getTheme();
|
||||
|
@ -115,6 +144,10 @@ youtubeHelper.init().then(() => {
|
|||
youtubeFrontendElement.value = frontend;
|
||||
changeFrontendsSettings(frontend);
|
||||
|
||||
let protocol = youtubeHelper.getprotocol();
|
||||
protocolElement.value = protocol;
|
||||
changeProtocolSettings(protocol);
|
||||
|
||||
let freetubeFrontend = youtubeHelper.getFreetubeFrontend()
|
||||
freetubeFrontendElement.value = freetubeFrontend
|
||||
if (frontend == "freetube") changeFreetubeFrontendsSettings(freetubeFrontend);
|
||||
|
|
|
@ -141,35 +141,18 @@
|
|||
</svg>
|
||||
<h4>Medium</h4>
|
||||
</div>
|
||||
|
||||
<input id="disable-medium" type="checkbox" checked />
|
||||
</div>
|
||||
|
||||
<div class="buttons">
|
||||
<a class="button" id="more-options">
|
||||
<span data-localise="__MSG_moreOptions__">More Options </span>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512">
|
||||
<path d="M384,224V408a40,40,0,0,1-40,40H104a40,40,0,0,1-40-40V168a40,40,0,0,1,40-40H271.48" style="
|
||||
fill: none;
|
||||
stroke: inherit;
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
stroke-width: 32px;
|
||||
" />
|
||||
<polyline points="336 64 448 64 448 176" style="
|
||||
fill: none;
|
||||
stroke: inherit;
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
stroke-width: 32px;
|
||||
" />
|
||||
<line x1="224" y1="288" x2="440" y2="72" style="
|
||||
fill: none;
|
||||
stroke: inherit;
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
stroke-width: 32px;
|
||||
" />
|
||||
<span>Settings </span>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24"
|
||||
width="24px" fill="currentColor">
|
||||
<g>
|
||||
<path
|
||||
d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z" />
|
||||
</g>
|
||||
</svg>
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
body {
|
||||
width: 230px;
|
||||
min-height: auto;
|
||||
background-color: var(--bg-main);
|
||||
}
|
Loading…
Reference in New Issue