Make almost all instances follow new protocol structre
Closes https://github.com/libredirect/libredirect/issues/238 Closes https://github.com/libredirect/libredirect/issues/391
This commit is contained in:
parent
473dad301e
commit
3bc5cafe65
|
@ -29,7 +29,6 @@ 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 add -f src/instances
|
|
||||||
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
|
||||||
|
|
|
@ -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
|
|
||||||
|
|
|
@ -41,7 +41,9 @@ let
|
||||||
libremdbNormalRedirectsChecks,
|
libremdbNormalRedirectsChecks,
|
||||||
libremdbNormalCustomRedirects,
|
libremdbNormalCustomRedirects,
|
||||||
libremdbTorRedirectsChecks,
|
libremdbTorRedirectsChecks,
|
||||||
libremdbTorCustomRedirects;
|
libremdbTorCustomRedirects,
|
||||||
|
libremdbI2pCustomRedirects,
|
||||||
|
libremdbLokiCustomRedirects;
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
return new Promise(async resolve => {
|
return new Promise(async resolve => {
|
||||||
|
@ -55,6 +57,8 @@ function init() {
|
||||||
"libremdbNormalCustomRedirects",
|
"libremdbNormalCustomRedirects",
|
||||||
"libremdbTorRedirectsChecks",
|
"libremdbTorRedirectsChecks",
|
||||||
"libremdbTorCustomRedirects",
|
"libremdbTorCustomRedirects",
|
||||||
|
"libremdbI2pCustomRedirects",
|
||||||
|
"libremdbLokiCustomRedirects"
|
||||||
],
|
],
|
||||||
r => {
|
r => {
|
||||||
disableImdb = r.disableImdb;
|
disableImdb = r.disableImdb;
|
||||||
|
@ -65,6 +69,8 @@ function init() {
|
||||||
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();
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -86,7 +92,9 @@ function redirect(url, type, initiator, disableOverride) {
|
||||||
if (!targets.some(rx => rx.test(url.href))) return;
|
if (!targets.some(rx => rx.test(url.href))) return;
|
||||||
|
|
||||||
let instancesList = [];
|
let instancesList = [];
|
||||||
if (protocol == 'tor') instancesList = [...libremdbTorRedirectsChecks, ...libremdbTorCustomRedirects];
|
if (protocol == 'loki') instancesList = [...libremdbLokiCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') instancesList = [...libremdbI2pCustomRedirects];
|
||||||
|
else if (protocol == 'tor') instancesList = [...libremdbTorRedirectsChecks, ...libremdbTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...libremdbNormalRedirectsChecks, ...libremdbNormalCustomRedirects];
|
instancesList = [...libremdbNormalRedirectsChecks, ...libremdbNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -104,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; }
|
||||||
|
|
||||||
|
@ -123,11 +133,15 @@ 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 (protocol == 'tor') instancesList = [...libremdbTorRedirectsChecks, ...libremdbTorCustomRedirects];
|
if (protocol == 'loki') instancesList = [...libremdbLokiCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') instancesList = [...libremdbI2pCustomRedirects];
|
||||||
|
else if (protocol == 'tor') instancesList = [...libremdbTorRedirectsChecks, ...libremdbTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...libremdbNormalRedirectsChecks, ...libremdbNormalCustomRedirects];
|
instancesList = [...libremdbNormalRedirectsChecks, ...libremdbNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -157,6 +171,10 @@ function initDefaults() {
|
||||||
|
|
||||||
libremdbTorRedirectsChecks: [...redirects.libremdb.tor],
|
libremdbTorRedirectsChecks: [...redirects.libremdb.tor],
|
||||||
libremdbTorCustomRedirects: [],
|
libremdbTorCustomRedirects: [],
|
||||||
|
|
||||||
|
libremdbI2pCustomRedirects: [],
|
||||||
|
|
||||||
|
libremdbLokiCustomRedirects: []
|
||||||
}, () => resolve());
|
}, () => resolve());
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
|
@ -57,7 +57,8 @@ let
|
||||||
rimgoTorRedirectsChecks,
|
rimgoTorRedirectsChecks,
|
||||||
rimgoTorCustomRedirects,
|
rimgoTorCustomRedirects,
|
||||||
rimgoI2pRedirectsChecks,
|
rimgoI2pRedirectsChecks,
|
||||||
rimgoI2pCustomRedirects;
|
rimgoI2pCustomRedirects,
|
||||||
|
rimgoLokiCustomRedirects;
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
return new Promise(async resolve => {
|
return new Promise(async resolve => {
|
||||||
|
@ -73,6 +74,7 @@ function init() {
|
||||||
"rimgoTorCustomRedirects",
|
"rimgoTorCustomRedirects",
|
||||||
"rimgoI2pRedirectsChecks",
|
"rimgoI2pRedirectsChecks",
|
||||||
"rimgoI2pCustomRedirects",
|
"rimgoI2pCustomRedirects",
|
||||||
|
"rimgoLokiCustomRedirects"
|
||||||
],
|
],
|
||||||
r => {
|
r => {
|
||||||
disableImgur = r.disableImgur;
|
disableImgur = r.disableImgur;
|
||||||
|
@ -85,6 +87,7 @@ function init() {
|
||||||
rimgoTorCustomRedirects = r.rimgoTorCustomRedirects;
|
rimgoTorCustomRedirects = r.rimgoTorCustomRedirects;
|
||||||
rimgoI2pRedirectsChecks = r.rimgoI2pRedirectsChecks;
|
rimgoI2pRedirectsChecks = r.rimgoI2pRedirectsChecks;
|
||||||
rimgoI2pCustomRedirects = r.rimgoI2pCustomRedirects;
|
rimgoI2pCustomRedirects = r.rimgoI2pCustomRedirects;
|
||||||
|
rimgoLokiCustomRedirects = r.rimgoLokiCustomRedirects;
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -108,6 +111,7 @@ function all() {
|
||||||
...rimgoNormalCustomRedirects,
|
...rimgoNormalCustomRedirects,
|
||||||
...rimgoTorCustomRedirects,
|
...rimgoTorCustomRedirects,
|
||||||
...rimgoI2pCustomRedirects,
|
...rimgoI2pCustomRedirects,
|
||||||
|
...rimgoLokiCustomRedirects
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,8 +124,9 @@ function redirect(url, type, initiator, disableOverride) {
|
||||||
if (url.pathname.includes("delete/")) return;
|
if (url.pathname.includes("delete/")) return;
|
||||||
|
|
||||||
let instancesList = [];
|
let instancesList = [];
|
||||||
if (protocol == 'i2p') instancesList = [...rimgoI2pCustomRedirects, ...rimgoI2pRedirectsChecks];
|
if (protocol == 'loki') instancesList = [...rimgoLokiCustomRedirects];
|
||||||
if (protocol == 'tor') instancesList = [...rimgoTorRedirectsChecks, ...rimgoTorCustomRedirects];
|
else if (protocol == 'i2p') instancesList = [...rimgoI2pCustomRedirects, ...rimgoI2pRedirectsChecks];
|
||||||
|
else if (protocol == 'tor') instancesList = [...rimgoTorRedirectsChecks, ...rimgoTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...rimgoNormalRedirectsChecks, ...rimgoNormalCustomRedirects];
|
instancesList = [...rimgoNormalRedirectsChecks, ...rimgoNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -147,8 +152,9 @@ 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 (protocol == 'i2p') instancesList = [...rimgoI2pCustomRedirects, ...rimgoI2pRedirectsChecks];
|
if (protocol == 'loki') instancesList = [...rimgoLokiCustomRedirects];
|
||||||
if (protocol == 'tor') instancesList = [...rimgoTorRedirectsChecks, ...rimgoTorCustomRedirects];
|
else if (protocol == 'i2p') instancesList = [...rimgoI2pCustomRedirects, ...rimgoI2pRedirectsChecks];
|
||||||
|
else if (protocol == 'tor') instancesList = [...rimgoTorRedirectsChecks, ...rimgoTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...rimgoNormalRedirectsChecks, ...rimgoNormalCustomRedirects];
|
instancesList = [...rimgoNormalRedirectsChecks, ...rimgoNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -187,6 +193,8 @@ function initDefaults() {
|
||||||
|
|
||||||
rimgoI2pRedirectsChecks: [...redirects.rimgo.i2p],
|
rimgoI2pRedirectsChecks: [...redirects.rimgo.i2p],
|
||||||
rimgoI2pCustomRedirects: [],
|
rimgoI2pCustomRedirects: [],
|
||||||
|
|
||||||
|
rimgoLokiCustomRedirects: []
|
||||||
}, () => resolve());
|
}, () => resolve());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -41,7 +41,9 @@ let
|
||||||
bibliogramNormalRedirectsChecks,
|
bibliogramNormalRedirectsChecks,
|
||||||
bibliogramTorRedirectsChecks,
|
bibliogramTorRedirectsChecks,
|
||||||
bibliogramNormalCustomRedirects,
|
bibliogramNormalCustomRedirects,
|
||||||
bibliogramTorCustomRedirects;
|
bibliogramTorCustomRedirects,
|
||||||
|
bibliogramI2pCustomRedirects,
|
||||||
|
bibliogramLokiCustomRedirects;
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
return new Promise(async resolve => {
|
return new Promise(async resolve => {
|
||||||
|
@ -55,6 +57,8 @@ function init() {
|
||||||
"bibliogramTorRedirectsChecks",
|
"bibliogramTorRedirectsChecks",
|
||||||
"bibliogramNormalCustomRedirects",
|
"bibliogramNormalCustomRedirects",
|
||||||
"bibliogramTorCustomRedirects",
|
"bibliogramTorCustomRedirects",
|
||||||
|
"bibliogramI2pCustomRedirects",
|
||||||
|
"bibliogramLokiCustomRedirects"
|
||||||
],
|
],
|
||||||
r => {
|
r => {
|
||||||
disableInstagram = r.disableInstagram;
|
disableInstagram = r.disableInstagram;
|
||||||
|
@ -65,6 +69,8 @@ function init() {
|
||||||
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();
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -80,6 +86,8 @@ function all() {
|
||||||
...instagramRedirects.bibliogram.tor,
|
...instagramRedirects.bibliogram.tor,
|
||||||
...bibliogramNormalCustomRedirects,
|
...bibliogramNormalCustomRedirects,
|
||||||
...bibliogramTorCustomRedirects,
|
...bibliogramTorCustomRedirects,
|
||||||
|
...bibliogramI2pCustomRedirects,
|
||||||
|
...bibliogramLokiCustomRedirects
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +101,9 @@ function redirect(url, type, initiator, disableOverride) {
|
||||||
if (bypassPaths.some(rx => rx.test(url.pathname))) return;
|
if (bypassPaths.some(rx => rx.test(url.pathname))) return;
|
||||||
|
|
||||||
let instancesList = [];
|
let instancesList = [];
|
||||||
if (protocol == 'tor') instancesList = [...bibliogramTorRedirectsChecks, ...bibliogramTorCustomRedirects];
|
if (protocol == 'loki') instancesList = [...bibliogramLokiCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') instancesList = [...bibliogramI2pCustomRedirects];
|
||||||
|
else if (protocol == 'tor') instancesList = [...bibliogramTorRedirectsChecks, ...bibliogramTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...bibliogramNormalRedirectsChecks, ...bibliogramNormalCustomRedirects];
|
instancesList = [...bibliogramNormalRedirectsChecks, ...bibliogramNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -129,7 +139,9 @@ function switchInstance(url, disableOverride) {
|
||||||
if (!all().includes(protocolHost)) { resolve(); return; }
|
if (!all().includes(protocolHost)) { resolve(); return; }
|
||||||
|
|
||||||
let instancesList = [];
|
let instancesList = [];
|
||||||
if (protocol == 'tor') instancesList = [...bibliogramTorRedirectsChecks, ...bibliogramTorCustomRedirects];
|
if (protocol == 'loki') instancesList = [...bibliogramLokiCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') instancesList = [...bibliogramI2pCustomRedirects];
|
||||||
|
else if (protocol == 'tor') instancesList = [...bibliogramTorRedirectsChecks, ...bibliogramTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...bibliogramNormalRedirectsChecks, ...bibliogramNormalCustomRedirects];
|
instancesList = [...bibliogramNormalRedirectsChecks, ...bibliogramNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -164,7 +176,11 @@ function initDefaults() {
|
||||||
bibliogramTorRedirectsChecks: [],
|
bibliogramTorRedirectsChecks: [],
|
||||||
|
|
||||||
bibliogramNormalCustomRedirects: [...redirects.bibliogram.tor],
|
bibliogramNormalCustomRedirects: [...redirects.bibliogram.tor],
|
||||||
bibliogramTorCustomRedirects: []
|
bibliogramTorCustomRedirects: [],
|
||||||
|
|
||||||
|
bibliogramI2pCustomRedirects: [],
|
||||||
|
|
||||||
|
bibliogramLokiCustomRedirects: []
|
||||||
})
|
})
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,11 +34,14 @@ function setRedirects(val) {
|
||||||
let
|
let
|
||||||
disableLbryTargets,
|
disableLbryTargets,
|
||||||
protocol,
|
protocol,
|
||||||
|
protocolFallback,
|
||||||
lbryTargetsRedirects,
|
lbryTargetsRedirects,
|
||||||
librarianNormalRedirectsChecks,
|
librarianNormalRedirectsChecks,
|
||||||
librarianNormalCustomRedirects,
|
librarianNormalCustomRedirects,
|
||||||
librarianTorRedirectsChecks,
|
librarianTorRedirectsChecks,
|
||||||
librarianTorCustomRedirects;
|
librarianTorCustomRedirects,
|
||||||
|
librarianI2pCustomRedirects,
|
||||||
|
librarianLokiCustomRedirects;
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
|
@ -46,20 +49,26 @@ function init() {
|
||||||
[
|
[
|
||||||
"disableLbryTargets",
|
"disableLbryTargets",
|
||||||
"protocol",
|
"protocol",
|
||||||
|
"protocolFallback",
|
||||||
"lbryTargetsRedirects",
|
"lbryTargetsRedirects",
|
||||||
"librarianNormalRedirectsChecks",
|
"librarianNormalRedirectsChecks",
|
||||||
"librarianNormalCustomRedirects",
|
"librarianNormalCustomRedirects",
|
||||||
"librarianTorRedirectsChecks",
|
"librarianTorRedirectsChecks",
|
||||||
"librarianTorCustomRedirects",
|
"librarianTorCustomRedirects",
|
||||||
|
"librarianI2pCustomRedirects",
|
||||||
|
"librarianLokiCustomRedirects"
|
||||||
],
|
],
|
||||||
r => {
|
r => {
|
||||||
disableLbryTargets = r.disableLbryTargets;
|
disableLbryTargets = r.disableLbryTargets;
|
||||||
protocol = r.protocol;
|
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;
|
||||||
|
librarianI2pCustomRedirects = r.librarianI2pCustomRedirects;
|
||||||
|
librarianLokiCustomRedirects = r.librarianLokiCustomRedirects;
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -74,6 +83,8 @@ function all() {
|
||||||
...redirects.librarian.tor,
|
...redirects.librarian.tor,
|
||||||
...librarianNormalCustomRedirects,
|
...librarianNormalCustomRedirects,
|
||||||
...librarianTorCustomRedirects,
|
...librarianTorCustomRedirects,
|
||||||
|
...librarianI2pCustomRedirects,
|
||||||
|
...librarianLokiCustomRedirects
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +96,9 @@ function switchInstance(url, disableOverride) {
|
||||||
if (!all().includes(protocolHost)) { resolve(); return; }
|
if (!all().includes(protocolHost)) { resolve(); return; }
|
||||||
|
|
||||||
let instancesList = [];
|
let instancesList = [];
|
||||||
if (protocol == 'tor') instancesList = [...librarianTorRedirectsChecks, ...librarianTorCustomRedirects];
|
if (protocol == 'loki') instancesList = [...librarianLokiCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') instancesList = [...librarianI2pCustomRedirects];
|
||||||
|
else if (protocol == 'tor') instancesList = [...librarianTorRedirectsChecks, ...librarianTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...librarianNormalRedirectsChecks, ...librarianNormalCustomRedirects];
|
instancesList = [...librarianNormalRedirectsChecks, ...librarianNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -106,7 +119,9 @@ function redirect(url, type, initiator, disableOverride) {
|
||||||
if (type != "main_frame") return;
|
if (type != "main_frame") return;
|
||||||
|
|
||||||
let instancesList = [];
|
let instancesList = [];
|
||||||
if (protocol == 'tor') instancesList = [...librarianTorRedirectsChecks, ...librarianTorCustomRedirects];
|
if (protocol == 'loki') instancesList = [...librarianLokiCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') instancesList = [...librarianI2pCustomRedirects];
|
||||||
|
else if (protocol == 'tor') instancesList = [...librarianTorRedirectsChecks, ...librarianTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...librarianNormalRedirectsChecks, ...librarianNormalCustomRedirects];
|
instancesList = [...librarianNormalRedirectsChecks, ...librarianNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -133,6 +148,10 @@ function initDefaults() {
|
||||||
|
|
||||||
librarianTorRedirectsChecks: [...redirects.librarian.tor],
|
librarianTorRedirectsChecks: [...redirects.librarian.tor],
|
||||||
librarianTorCustomRedirects: [],
|
librarianTorCustomRedirects: [],
|
||||||
|
|
||||||
|
librarianI2pCustomRedirects: [],
|
||||||
|
|
||||||
|
librarianLokiCustomRedirects: []
|
||||||
}, () => resolve());
|
}, () => resolve());
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
|
@ -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,12 @@ async function initDefaults() {
|
||||||
mapsRedirects: redirects,
|
mapsRedirects: redirects,
|
||||||
facilNormalRedirectsChecks: [...redirects.facil.normal],
|
facilNormalRedirectsChecks: [...redirects.facil.normal],
|
||||||
facilNormalCustomRedirects: [],
|
facilNormalCustomRedirects: [],
|
||||||
|
|
||||||
|
facilTorCustomRedirects: [],
|
||||||
|
|
||||||
|
facilI2pCustomRedirects: [],
|
||||||
|
|
||||||
|
facilLokiCustomRedirects: []
|
||||||
}, () => resolve())
|
}, () => resolve())
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,8 @@ let
|
||||||
scribeNormalCustomRedirects,
|
scribeNormalCustomRedirects,
|
||||||
scribeTorRedirectsChecks,
|
scribeTorRedirectsChecks,
|
||||||
scribeTorCustomRedirects,
|
scribeTorCustomRedirects,
|
||||||
|
scribeI2pCustomRedirects,
|
||||||
|
scribeLokiCustomRedirects,
|
||||||
protocol,
|
protocol,
|
||||||
protocolFallback;
|
protocolFallback;
|
||||||
|
|
||||||
|
@ -74,6 +76,8 @@ function init() {
|
||||||
"scribeNormalCustomRedirects",
|
"scribeNormalCustomRedirects",
|
||||||
"scribeTorRedirectsChecks",
|
"scribeTorRedirectsChecks",
|
||||||
"scribeTorCustomRedirects",
|
"scribeTorCustomRedirects",
|
||||||
|
"scribeI2pCustomRedirects",
|
||||||
|
"scribeLokiCustomRedirects",
|
||||||
"protocol",
|
"protocol",
|
||||||
"protocolFallback"
|
"protocolFallback"
|
||||||
],
|
],
|
||||||
|
@ -84,6 +88,8 @@ function init() {
|
||||||
scribeNormalCustomRedirects = r.scribeNormalCustomRedirects;
|
scribeNormalCustomRedirects = r.scribeNormalCustomRedirects;
|
||||||
scribeTorRedirectsChecks = r.scribeTorRedirectsChecks;
|
scribeTorRedirectsChecks = r.scribeTorRedirectsChecks;
|
||||||
scribeTorCustomRedirects = r.scribeTorCustomRedirects;
|
scribeTorCustomRedirects = r.scribeTorCustomRedirects;
|
||||||
|
scribeI2pCustomRedirects = r.scribeI2pCustomRedirects;
|
||||||
|
scribeLokiCustomRedirects = r.scribeLokiCustomRedirects;
|
||||||
protocol = r.protocol;
|
protocol = r.protocol;
|
||||||
protocolFallback = r.protocolFallback;
|
protocolFallback = r.protocolFallback;
|
||||||
resolve();
|
resolve();
|
||||||
|
@ -105,13 +111,17 @@ 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 (protocol == 'tor') instancesList = [...scribeTorRedirectsChecks, ...scribeTorCustomRedirects];
|
if (protocol == 'loki') instancesList = [...scribeLokiCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') instancesList = [...scribeI2pCustomRedirects];
|
||||||
|
else if (protocol == 'tor') instancesList = [...scribeTorRedirectsChecks, ...scribeTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...scribeNormalRedirectsChecks, ...scribeNormalCustomRedirects];
|
instancesList = [...scribeNormalRedirectsChecks, ...scribeNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -132,11 +142,15 @@ 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 (protocol == 'tor') instancesList = [...scribeTorRedirectsChecks, ...scribeTorCustomRedirects];
|
if (protocol == 'loki') instancesList = [...scribeLokiCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') instancesList = [...scribeI2pCustomRedirects];
|
||||||
|
else if (protocol == 'tor') instancesList = [...scribeTorRedirectsChecks, ...scribeTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...scribeNormalRedirectsChecks, ...scribeNormalCustomRedirects];
|
instancesList = [...scribeNormalRedirectsChecks, ...scribeNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -173,6 +187,10 @@ function initDefaults() {
|
||||||
|
|
||||||
scribeTorRedirectsChecks: [...redirects.scribe.tor],
|
scribeTorRedirectsChecks: [...redirects.scribe.tor],
|
||||||
scribeTorCustomRedirects: [],
|
scribeTorCustomRedirects: [],
|
||||||
|
|
||||||
|
scribeI2pCustomRedirects: [],
|
||||||
|
|
||||||
|
scribeLokiCustomRedirects: []
|
||||||
}, () => resolve())
|
}, () => resolve())
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -39,6 +39,8 @@ let
|
||||||
simpleertubeNormalCustomRedirects,
|
simpleertubeNormalCustomRedirects,
|
||||||
simpleertubeTorRedirectsChecks,
|
simpleertubeTorRedirectsChecks,
|
||||||
simpleertubeTorCustomRedirects,
|
simpleertubeTorCustomRedirects,
|
||||||
|
simpleertubeI2pCustomRedirects,
|
||||||
|
simpleertubeLokiCustomRedirects,
|
||||||
peerTubeTargets,
|
peerTubeTargets,
|
||||||
protocol,
|
protocol,
|
||||||
protocolFallback;
|
protocolFallback;
|
||||||
|
@ -53,6 +55,8 @@ function init() {
|
||||||
"simpleertubeNormalCustomRedirects",
|
"simpleertubeNormalCustomRedirects",
|
||||||
"simpleertubeTorRedirectsChecks",
|
"simpleertubeTorRedirectsChecks",
|
||||||
"simpleertubeTorCustomRedirects",
|
"simpleertubeTorCustomRedirects",
|
||||||
|
"simpleertubeI2pCustomRedirects",
|
||||||
|
"simpleertubeLokiCustomRedirects",
|
||||||
"peerTubeTargets",
|
"peerTubeTargets",
|
||||||
"protocol",
|
"protocol",
|
||||||
"protocolFallback"
|
"protocolFallback"
|
||||||
|
@ -64,6 +68,8 @@ 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;
|
||||||
protocol = r.protocol;
|
protocol = r.protocol;
|
||||||
protocolFallback = r.protocolFallback;
|
protocolFallback = r.protocolFallback;
|
||||||
|
@ -82,6 +88,8 @@ function all() {
|
||||||
...redirects.simpleertube.tor,
|
...redirects.simpleertube.tor,
|
||||||
...simpleertubeNormalCustomRedirects,
|
...simpleertubeNormalCustomRedirects,
|
||||||
...simpleertubeTorCustomRedirects,
|
...simpleertubeTorCustomRedirects,
|
||||||
|
...simpleertubeI2pCustomRedirects,
|
||||||
|
...simpleertubeLokiCustomRedirects
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +101,9 @@ function redirect(url, type, initiator, disableOverride) {
|
||||||
if (type != "main_frame") return;
|
if (type != "main_frame") return;
|
||||||
|
|
||||||
let instancesList = [];
|
let instancesList = [];
|
||||||
if (protocol == 'tor') instancesList = [...simpleertubeTorRedirectsChecks, ...simpleertubeTorCustomRedirects];
|
if (protocol == 'loki') instancesList = [...simpleertubeLokiCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') instancesList = [...simpleertubeI2pCustomRedirects];
|
||||||
|
else if (protocol == 'tor') instancesList = [...simpleertubeTorRedirectsChecks, ...simpleertubeTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...simpleertubeNormalRedirectsChecks, ...simpleertubeNormalCustomRedirects];
|
instancesList = [...simpleertubeNormalRedirectsChecks, ...simpleertubeNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -112,7 +122,9 @@ function switchInstance(url, disableOverride) {
|
||||||
if (!all().includes(protocolHost)) { resolve(); return; }
|
if (!all().includes(protocolHost)) { resolve(); return; }
|
||||||
|
|
||||||
let instancesList = [];
|
let instancesList = [];
|
||||||
if (protocol == 'tor') instancesList = [...simpleertubeTorRedirectsChecks, ...simpleertubeTorCustomRedirects];
|
if (protocol == 'loki') instancesList = [...simpleertubeLokiCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') instancesList = [...simpleertubeI2pCustomRedirects];
|
||||||
|
else if (protocol == 'tor') instancesList = [...simpleertubeTorRedirectsChecks, ...simpleertubeTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...simpleertubeNormalRedirectsChecks, ...simpleertubeNormalCustomRedirects];
|
instancesList = [...simpleertubeNormalRedirectsChecks, ...simpleertubeNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -145,7 +157,11 @@ function initDefaults() {
|
||||||
simpleertubeNormalCustomRedirects: [],
|
simpleertubeNormalCustomRedirects: [],
|
||||||
|
|
||||||
simpleertubeTorRedirectsChecks: [...redirects.simpleertube.tor],
|
simpleertubeTorRedirectsChecks: [...redirects.simpleertube.tor],
|
||||||
simpleertubeTorCustomRedirects: []
|
simpleertubeTorCustomRedirects: [],
|
||||||
|
|
||||||
|
simpleertubeI2pCustomRedirects: [],
|
||||||
|
|
||||||
|
simpleertubeLokiCustomRedirects: []
|
||||||
}, () => resolve());
|
}, () => resolve());
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -41,7 +41,9 @@ let
|
||||||
quetreNormalRedirectsChecks,
|
quetreNormalRedirectsChecks,
|
||||||
quetreNormalCustomRedirects,
|
quetreNormalCustomRedirects,
|
||||||
quetreTorRedirectsChecks,
|
quetreTorRedirectsChecks,
|
||||||
quetreTorCustomRedirects;
|
quetreTorCustomRedirects,
|
||||||
|
quetreI2pCustomRedirects,
|
||||||
|
quetreLokiCustomRedirects;
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
return new Promise(async resolve => {
|
return new Promise(async resolve => {
|
||||||
|
@ -55,6 +57,8 @@ function init() {
|
||||||
"quetreNormalCustomRedirects",
|
"quetreNormalCustomRedirects",
|
||||||
"quetreTorRedirectsChecks",
|
"quetreTorRedirectsChecks",
|
||||||
"quetreTorCustomRedirects",
|
"quetreTorCustomRedirects",
|
||||||
|
"quetreI2pCustomRedirects",
|
||||||
|
"quetreLokiCustomRedirects"
|
||||||
],
|
],
|
||||||
r => {
|
r => {
|
||||||
disableQuora = r.disableQuora;
|
disableQuora = r.disableQuora;
|
||||||
|
@ -65,6 +69,8 @@ function init() {
|
||||||
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();
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -86,7 +92,9 @@ function redirect(url, type, initiator, disableOverride) {
|
||||||
if (!targets.some(rx => rx.test(url.href))) return;
|
if (!targets.some(rx => rx.test(url.href))) return;
|
||||||
|
|
||||||
let instancesList = [];
|
let instancesList = [];
|
||||||
if (protocol == 'tor') instancesList = [...quetreTorRedirectsChecks, ...quetreTorCustomRedirects];
|
if (protocol == 'loki') instancesList = [...quetreLokiCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') instancesList = [...quetreI2pCustomRedirects];
|
||||||
|
else if (protocol == 'tor') instancesList = [...quetreTorRedirectsChecks, ...quetreTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...quetreNormalRedirectsChecks, ...quetreNormalCustomRedirects];
|
instancesList = [...quetreNormalRedirectsChecks, ...quetreNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -104,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; }
|
||||||
|
|
||||||
|
@ -123,11 +133,15 @@ 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 (protocol == 'tor') instancesList = [...quetreTorRedirectsChecks, ...quetreTorCustomRedirects];
|
if (protocol == 'loki') instancesList = [...quetreLokiCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') instancesList = [...quetreI2pCustomRedirects];
|
||||||
|
else if (protocol == 'tor') instancesList = [...quetreTorRedirectsChecks, ...quetreTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...quetreNormalRedirectsChecks, ...quetreNormalCustomRedirects];
|
instancesList = [...quetreNormalRedirectsChecks, ...quetreNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -158,6 +172,10 @@ function initDefaults() {
|
||||||
|
|
||||||
quetreTorRedirectsChecks: [...redirects.quetre.tor],
|
quetreTorRedirectsChecks: [...redirects.quetre.tor],
|
||||||
quetreTorCustomRedirects: [],
|
quetreTorCustomRedirects: [],
|
||||||
|
|
||||||
|
quetreI2pCustomRedirects: [],
|
||||||
|
|
||||||
|
quetreLokiCustomRedirects: []
|
||||||
}, () => resolve());
|
}, () => resolve());
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
|
@ -43,14 +43,19 @@ let
|
||||||
redditFrontend,
|
redditFrontend,
|
||||||
redditRedirects,
|
redditRedirects,
|
||||||
protocol,
|
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 => {
|
||||||
|
@ -60,28 +65,38 @@ function init() {
|
||||||
"redditFrontend",
|
"redditFrontend",
|
||||||
"redditRedirects",
|
"redditRedirects",
|
||||||
"protocol",
|
"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;
|
||||||
protocol = r.protocol;
|
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();
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -100,12 +115,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 (protocol == 'normal') checkedInstances = [...libredditNormalRedirectsChecks, ...libredditNormalCustomRedirects];
|
if (protocol == 'loki') checkedInstances = [...libredditLokiCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') checkedInstances = [...libredditI2pCustomRedirects];
|
||||||
else if (protocol == 'tor') checkedInstances = [...libredditTorRedirectsChecks, ...libredditTorCustomRedirects];
|
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");
|
||||||
|
@ -127,9 +148,13 @@ function pasteLibredditCookies() {
|
||||||
return new Promise(async resolve => {
|
return new Promise(async resolve => {
|
||||||
await init();
|
await init();
|
||||||
if (disableReddit || redditFrontend != 'libreddit' || protocol === undefined) { resolve(); return; }
|
if (disableReddit || redditFrontend != 'libreddit' || protocol === undefined) { resolve(); return; }
|
||||||
let checkedInstances;
|
let checkedInstances = [];
|
||||||
if (protocol == 'normal') checkedInstances = [...libredditNormalRedirectsChecks, ...libredditNormalCustomRedirects]
|
if (protocol == 'loki') checkedInstances = [...libredditLokiCustomRedirects];
|
||||||
else if (protocol == '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");
|
||||||
|
@ -155,12 +180,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 (protocol == 'normal') checkedInstances = [...tedditNormalRedirectsChecks, ...tedditNormalCustomRedirects]
|
if (protocol == 'loki') checkedInstances = [...tedditLokiCustomRedirects];
|
||||||
else if (protocol == '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')
|
||||||
|
@ -182,9 +214,13 @@ function pasteTedditCookies() {
|
||||||
return new Promise(async resolve => {
|
return new Promise(async resolve => {
|
||||||
await init();
|
await init();
|
||||||
if (disableReddit || redditFrontend != 'teddit' || protocol === undefined) { resolve(); return; }
|
if (disableReddit || redditFrontend != 'teddit' || protocol === undefined) { resolve(); return; }
|
||||||
let checkedInstances;
|
let checkedInstances = [];
|
||||||
if (protocol == 'normal') checkedInstances = [...tedditNormalRedirectsChecks, ...tedditNormalCustomRedirects]
|
if (protocol == 'loki') checkedInstances = [...tedditLokiCustomRedirects];
|
||||||
else if (protocol == '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')
|
||||||
|
@ -209,8 +245,12 @@ function all() {
|
||||||
...redditRedirects.teddit.tor,
|
...redditRedirects.teddit.tor,
|
||||||
...libredditNormalCustomRedirects,
|
...libredditNormalCustomRedirects,
|
||||||
...libredditTorCustomRedirects,
|
...libredditTorCustomRedirects,
|
||||||
|
...libredditI2pCustomRedirects,
|
||||||
|
...libredditLokiCustomRedirects,
|
||||||
...tedditNormalCustomRedirects,
|
...tedditNormalCustomRedirects,
|
||||||
...tedditTorCustomRedirects,
|
...tedditTorCustomRedirects,
|
||||||
|
...tedditI2pCustomRedirects,
|
||||||
|
...tedditLokiCustomRedirects
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,7 +275,15 @@ function redirect(url, type, initiator, disableOverride) {
|
||||||
let libredditInstancesList = [];
|
let libredditInstancesList = [];
|
||||||
let tedditInstancesList = [];
|
let tedditInstancesList = [];
|
||||||
|
|
||||||
if (protocol == 'tor') {
|
if (protocol == 'loki') {
|
||||||
|
libredditInstancesList = [...libredditLokiCustomRedirects];
|
||||||
|
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];
|
||||||
}
|
}
|
||||||
|
@ -299,7 +347,9 @@ function switchInstance(url, disableOverride) {
|
||||||
if (!all().includes(protocolHost)) { resolve(); return; }
|
if (!all().includes(protocolHost)) { resolve(); return; }
|
||||||
let instancesList = [];
|
let instancesList = [];
|
||||||
if (redditFrontend == 'libreddit') {
|
if (redditFrontend == 'libreddit') {
|
||||||
if (protocol == 'tor') instancesList = [...libredditTorRedirectsChecks, ...libredditTorCustomRedirects];
|
if (protocol == 'loki') instancesList = [...libredditLokiCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') instancesList = [...libredditI2pCustomRedirects];
|
||||||
|
else if (protocol == 'tor') instancesList = [...libredditTorRedirectsChecks, ...libredditTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...libredditNormalRedirectsChecks, ...libredditNormalCustomRedirects];
|
instancesList = [...libredditNormalRedirectsChecks, ...libredditNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -309,7 +359,9 @@ function switchInstance(url, disableOverride) {
|
||||||
].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 (protocol == 'tor') instancesList = [...tedditTorRedirectsChecks, ...tedditTorCustomRedirects];
|
if (protocol == 'loki') instancesList = [...tedditLokiCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') instancesList = [...tedditI2pCustomRedirects];
|
||||||
|
else if (protocol == 'tor') instancesList = [...tedditTorRedirectsChecks, ...tedditTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...tedditNormalRedirectsChecks, ...tedditNormalCustomRedirects];
|
instancesList = [...tedditNormalRedirectsChecks, ...tedditNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -359,11 +411,19 @@ function initDefaults() {
|
||||||
libredditTorRedirectsChecks: [...redirects.libreddit.tor],
|
libredditTorRedirectsChecks: [...redirects.libreddit.tor],
|
||||||
libredditTorCustomRedirects: [],
|
libredditTorCustomRedirects: [],
|
||||||
|
|
||||||
|
libredditI2pCustomRedirects: [],
|
||||||
|
|
||||||
|
libredditLokiCustomRedirects: [],
|
||||||
|
|
||||||
tedditNormalRedirectsChecks: tedditNormalRedirectsChecks,
|
tedditNormalRedirectsChecks: tedditNormalRedirectsChecks,
|
||||||
tedditNormalCustomRedirects: [],
|
tedditNormalCustomRedirects: [],
|
||||||
|
|
||||||
tedditTorRedirectsChecks: [...redirects.teddit.tor],
|
tedditTorRedirectsChecks: [...redirects.teddit.tor],
|
||||||
tedditTorCustomRedirects: [],
|
tedditTorCustomRedirects: [],
|
||||||
|
|
||||||
|
tedditI2pCustomRedirects: [],
|
||||||
|
|
||||||
|
tedditLokiCustomRedirects: []
|
||||||
}, () => resolve());
|
}, () => resolve());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -18,6 +18,21 @@ for (let i = 0; i < frontends.length; i++) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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,
|
||||||
protocol,
|
protocol,
|
||||||
|
@ -26,7 +41,9 @@ let
|
||||||
neutersNormalRedirectsChecks,
|
neutersNormalRedirectsChecks,
|
||||||
neutersNormalCustomRedirects,
|
neutersNormalCustomRedirects,
|
||||||
neutersTorRedirectsChecks,
|
neutersTorRedirectsChecks,
|
||||||
neutersTorCustomRedirects;
|
neutersTorCustomRedirects,
|
||||||
|
neutersI2pCustomRedirects,
|
||||||
|
neutersLokiCustomRedirects;
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
return new Promise(async resolve => {
|
return new Promise(async resolve => {
|
||||||
|
@ -40,6 +57,8 @@ function init() {
|
||||||
"neutersNormalCustomRedirects",
|
"neutersNormalCustomRedirects",
|
||||||
"neutersTorRedirectsChecks",
|
"neutersTorRedirectsChecks",
|
||||||
"neutersTorCustomRedirects",
|
"neutersTorCustomRedirects",
|
||||||
|
"neutersI2pCustomRedirects",
|
||||||
|
"neutersLokiCustomRedirects"
|
||||||
],
|
],
|
||||||
r => {
|
r => {
|
||||||
disableReuters = r.disableReuters;
|
disableReuters = r.disableReuters;
|
||||||
|
@ -50,6 +69,8 @@ function init() {
|
||||||
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();
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -70,7 +91,9 @@ function redirect(url, type, initiator, disableOverride) {
|
||||||
if (!targets.some(rx => rx.test(url.href))) return;
|
if (!targets.some(rx => rx.test(url.href))) return;
|
||||||
|
|
||||||
let instancesList = [];
|
let instancesList = [];
|
||||||
if (protocol == 'tor') instancesList = [...neutersTorRedirectsChecks, ...neutersTorCustomRedirects];
|
if (protocol == 'loki') instancesList = [...neutersLokiCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') instancesList = [...neutersI2pCustomRedirects];
|
||||||
|
else if (protocol == 'tor') instancesList = [...neutersTorRedirectsChecks, ...neutersTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...neutersNormalRedirectsChecks, ...neutersNormalCustomRedirects];
|
instancesList = [...neutersNormalRedirectsChecks, ...neutersNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -103,11 +126,16 @@ function initDefaults() {
|
||||||
|
|
||||||
neutersTorRedirectsChecks: [...redirects.neuters.tor],
|
neutersTorRedirectsChecks: [...redirects.neuters.tor],
|
||||||
neutersTorCustomRedirects: [],
|
neutersTorCustomRedirects: [],
|
||||||
|
|
||||||
|
neutersI2pCustomRedirects: [],
|
||||||
|
|
||||||
|
neutersLokiCustomRedirects: []
|
||||||
}, () => resolve());
|
}, () => resolve());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
setRedirects,
|
||||||
redirect,
|
redirect,
|
||||||
initDefaults
|
initDefaults
|
||||||
};
|
};
|
||||||
|
|
|
@ -90,24 +90,28 @@ let
|
||||||
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,
|
librexNormalRedirectsChecks,
|
||||||
librexNormalCustomRedirects,
|
librexNormalCustomRedirects,
|
||||||
librexTorRedirectsChecks,
|
librexTorRedirectsChecks,
|
||||||
librexTorCustomRedirects,
|
librexTorCustomRedirects,
|
||||||
librexI2pRedirectsChecks,
|
librexI2pRedirectsChecks,
|
||||||
librexI2pCustomRedirects;
|
librexI2pCustomRedirects,
|
||||||
|
librexLokiCustomRedirects;
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
return new Promise(async resolve => {
|
return new Promise(async resolve => {
|
||||||
|
@ -124,24 +128,28 @@ function init() {
|
||||||
"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",
|
"librexNormalRedirectsChecks",
|
||||||
"librexNormalCustomRedirects",
|
"librexNormalCustomRedirects",
|
||||||
"librexTorRedirectsChecks",
|
"librexTorRedirectsChecks",
|
||||||
"librexTorCustomRedirects",
|
"librexTorCustomRedirects",
|
||||||
"librexI2pRedirectsChecks",
|
"librexI2pRedirectsChecks",
|
||||||
"librexI2pCustomRedirects"
|
"librexI2pCustomRedirects",
|
||||||
|
"librexLokiCustomRedirects"
|
||||||
],
|
],
|
||||||
r => {
|
r => {
|
||||||
disableSearch = r.disableSearch;
|
disableSearch = r.disableSearch;
|
||||||
|
@ -155,24 +163,28 @@ function init() {
|
||||||
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;
|
librexNormalRedirectsChecks = r.librexNormalRedirectsChecks;
|
||||||
librexNormalCustomRedirects = r.librexNormalCustomRedirects;
|
librexNormalCustomRedirects = r.librexNormalCustomRedirects;
|
||||||
librexTorRedirectsChecks = r.librexTorRedirectsChecks;
|
librexTorRedirectsChecks = r.librexTorRedirectsChecks;
|
||||||
librexTorCustomRedirects = r.librexTorCustomRedirects;
|
librexTorCustomRedirects = r.librexTorCustomRedirects;
|
||||||
librexI2pRedirectsChecks = r.librexI2pRedirectsChecks;
|
librexI2pRedirectsChecks = r.librexI2pRedirectsChecks;
|
||||||
librexI2pCustomRedirects = r.librexI2pCustomRedirects;
|
librexI2pCustomRedirects = r.librexI2pCustomRedirects;
|
||||||
|
librexLokiCustomRedirects = r.librexLokiCustomRedirects;
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -193,12 +205,14 @@ 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 (protocol == 'i2p') checkedInstances = [...searxI2pCustomRedirects, ...searxI2pRedirectsChecks];
|
if (protocol == 'loki') checkedInstances = [...searxLokiCustomRedirects];
|
||||||
if (protocol == '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') {
|
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
checkedInstances = [...searxNormalRedirectsChecks, ...searxNormalCustomRedirects];
|
checkedInstances = [...searxNormalRedirectsChecks, ...searxNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -229,8 +243,9 @@ function pasteSearxCookies() {
|
||||||
await init();
|
await init();
|
||||||
if (disableSearch || searchFrontend != 'searx') { resolve(); return; }
|
if (disableSearch || searchFrontend != 'searx') { resolve(); return; }
|
||||||
let checkedInstances = [];
|
let checkedInstances = [];
|
||||||
if (protocol == 'i2p') checkedInstances = [...searxI2pCustomRedirects, ...searxI2pRedirectsChecks];
|
if (protocol == 'loki') checkedInstances = [...searxLokiCustomRedirects];
|
||||||
if (protocol == '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') {
|
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
checkedInstances = [...searxNormalRedirectsChecks, ...searxNormalCustomRedirects];
|
checkedInstances = [...searxNormalRedirectsChecks, ...searxNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -266,12 +281,14 @@ 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 (protocol == 'i2p') checkedInstances = [...searxngI2pCustomRedirects, ...searxngI2pRedirectsChecks];
|
if (protocol == 'loki') checkedInstances = [...searxngLokiCustomRedirects];
|
||||||
if (protocol == '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') {
|
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
checkedInstances = [...searxngNormalRedirectsChecks, ...searxngNormalCustomRedirects];
|
checkedInstances = [...searxngNormalRedirectsChecks, ...searxngNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -304,8 +321,9 @@ function pasteSearxngCookies() {
|
||||||
await init();
|
await init();
|
||||||
if (disableSearch || searchFrontend != 'searxng', protocol === undefined) { resolve(); return; }
|
if (disableSearch || searchFrontend != 'searxng', protocol === undefined) { resolve(); return; }
|
||||||
let checkedInstances = [];
|
let checkedInstances = [];
|
||||||
if (protocol == 'i2p') checkedInstances = [...searxngI2pCustomRedirects, ...searxngI2pRedirectsChecks];
|
if (protocol == 'loki') checkedInstances = [...searxngLokiCustomRedirects];
|
||||||
if (protocol == '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') {
|
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
checkedInstances = [...searxngNormalRedirectsChecks, ...searxngNormalCustomRedirects];
|
checkedInstances = [...searxngNormalRedirectsChecks, ...searxngNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -343,12 +361,14 @@ function initLibrexCookies(test, from) {
|
||||||
...librexTorCustomRedirects,
|
...librexTorCustomRedirects,
|
||||||
...librexI2pRedirectsChecks,
|
...librexI2pRedirectsChecks,
|
||||||
...librexI2pCustomRedirects,
|
...librexI2pCustomRedirects,
|
||||||
|
...librexLokiCustomRedirects
|
||||||
].includes(protocolHost)) { resolve(); return; }
|
].includes(protocolHost)) { resolve(); return; }
|
||||||
|
|
||||||
if(!test) {
|
if(!test) {
|
||||||
let checkedInstances = [];
|
let checkedInstances = [];
|
||||||
if (protocol == 'i2p') checkedInstances = [...librexI2pCustomRedirects, ...librexI2pRedirectsChecks];
|
if (protocol == 'loki') checkedInstances = [...librexLokiCustomRedirects];
|
||||||
if (protocol == 'tor') checkedInstances = [...librexTorRedirectsChecks, ...librexTorCustomRedirects];
|
else if (protocol == 'i2p') checkedInstances = [...librexI2pCustomRedirects, ...librexI2pRedirectsChecks];
|
||||||
|
else if (protocol == 'tor') checkedInstances = [...librexTorRedirectsChecks, ...librexTorCustomRedirects];
|
||||||
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
checkedInstances = [...librexNormalRedirectsChecks, ...librexNormalCustomRedirects];
|
checkedInstances = [...librexNormalRedirectsChecks, ...librexNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -370,8 +390,9 @@ function pasteLibrexCookies() {
|
||||||
await init();
|
await init();
|
||||||
if (disableSearch || searchFrontend != 'librex', protocol === undefined) { resolve(); return; }
|
if (disableSearch || searchFrontend != 'librex', protocol === undefined) { resolve(); return; }
|
||||||
let checkedInstances = [];
|
let checkedInstances = [];
|
||||||
if (protocol == 'i2p') checkedInstances = [...librexI2pCustomRedirects, ...librexI2pRedirectsChecks];
|
if (protocol == 'loki') checkedInstances = [...librexLokiCustomRedirects];
|
||||||
if (protocol == 'tor') checkedInstances = [...librexTorRedirectsChecks, ...librexTorCustomRedirects];
|
else if (protocol == 'i2p') checkedInstances = [...librexI2pCustomRedirects, ...librexI2pRedirectsChecks];
|
||||||
|
else if (protocol == 'tor') checkedInstances = [...librexTorRedirectsChecks, ...librexTorCustomRedirects];
|
||||||
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
checkedInstances = [...librexNormalRedirectsChecks, ...librexNormalCustomRedirects];
|
checkedInstances = [...librexNormalRedirectsChecks, ...librexNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -396,8 +417,9 @@ function redirect(url, disableOverride) {
|
||||||
let path;
|
let path;
|
||||||
if (searchFrontend == 'searx') {
|
if (searchFrontend == 'searx') {
|
||||||
let instancesList = [];
|
let instancesList = [];
|
||||||
if (protocol == 'i2p') instancesList = [...searxI2pCustomRedirects, ...searxI2pRedirectsChecks];
|
if (protocol == 'loki') instancesList = [...searxLokiCustomRedirects];
|
||||||
if (protocol == 'tor') instancesList = [...searxTorRedirectsChecks, ...searxTorCustomRedirects];
|
else if (protocol == 'i2p') instancesList = [...searxI2pCustomRedirects, ...searxI2pRedirectsChecks];
|
||||||
|
else if (protocol == 'tor') instancesList = [...searxTorRedirectsChecks, ...searxTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...searxNormalRedirectsChecks, ...searxNormalCustomRedirects];
|
instancesList = [...searxNormalRedirectsChecks, ...searxNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -408,8 +430,9 @@ function redirect(url, disableOverride) {
|
||||||
}
|
}
|
||||||
else if (searchFrontend == 'searxng') {
|
else if (searchFrontend == 'searxng') {
|
||||||
let instancesList = [];
|
let instancesList = [];
|
||||||
if (protocol == 'i2p') instancesList = [...searxngI2pCustomRedirects, ...searxngI2pRedirectsChecks];
|
if (protocol == 'loki') instancesList = [...searxngLokiCustomRedirects];
|
||||||
if (protocol == 'tor') instancesList = [...searxngTorRedirectsChecks, ...searxngTorCustomRedirects];
|
else if (protocol == 'i2p') instancesList = [...searxngI2pCustomRedirects, ...searxngI2pRedirectsChecks];
|
||||||
|
else if (protocol == 'tor') instancesList = [...searxngTorRedirectsChecks, ...searxngTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...searxngNormalRedirectsChecks, ...searxngNormalCustomRedirects];
|
instancesList = [...searxngNormalRedirectsChecks, ...searxngNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -420,8 +443,9 @@ function redirect(url, disableOverride) {
|
||||||
}
|
}
|
||||||
else if (searchFrontend == 'whoogle') {
|
else if (searchFrontend == 'whoogle') {
|
||||||
let instancesList = [];
|
let instancesList = [];
|
||||||
if (protocol == 'i2p') instancesList = [...whoogleI2pCustomRedirects, ...whoogleI2pRedirectsChecks];
|
if (protocol == 'loki') instancesList = [...whoogleLokiCustomRedirects];
|
||||||
if (protocol == 'tor') instancesList = [...whoogleTorRedirectsChecks, ...whoogleTorCustomRedirects];
|
else if (protocol == 'i2p') instancesList = [...whoogleI2pCustomRedirects, ...whoogleI2pRedirectsChecks];
|
||||||
|
else if (protocol == 'tor') instancesList = [...whoogleTorRedirectsChecks, ...whoogleTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...whoogleNormalRedirectsChecks, ...whoogleNormalCustomRedirects];
|
instancesList = [...whoogleNormalRedirectsChecks, ...whoogleNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -432,8 +456,9 @@ function redirect(url, disableOverride) {
|
||||||
}
|
}
|
||||||
else if (searchFrontend == 'librex') {
|
else if (searchFrontend == 'librex') {
|
||||||
let instancesList = [];
|
let instancesList = [];
|
||||||
if (protocol == 'i2p') instancesList = [...librexI2pCustomRedirects, ...librexI2pRedirectsChecks];
|
if (protocol == 'loki') instancesList = [...librexLokiCustomRedirects];
|
||||||
if (protocol == 'tor') instancesList = [...librexTorRedirectsChecks, ...librexTorCustomRedirects];
|
else if (protocol == 'i2p') instancesList = [...librexI2pCustomRedirects, ...librexI2pRedirectsChecks];
|
||||||
|
else if (protocol == 'tor') instancesList = [...librexTorRedirectsChecks, ...librexTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...librexNormalRedirectsChecks, ...librexNormalCustomRedirects];
|
instancesList = [...librexNormalRedirectsChecks, ...librexNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -487,23 +512,33 @@ function switchInstance(url, disableOverride) {
|
||||||
...searxNormalCustomRedirects,
|
...searxNormalCustomRedirects,
|
||||||
...searxTorCustomRedirects,
|
...searxTorCustomRedirects,
|
||||||
...searxI2pCustomRedirects,
|
...searxI2pCustomRedirects,
|
||||||
|
...searxLokiCustomRedirects,
|
||||||
|
|
||||||
...searxngNormalCustomRedirects,
|
...searxngNormalCustomRedirects,
|
||||||
...searxngTorCustomRedirects,
|
...searxngTorCustomRedirects,
|
||||||
...searxngI2pCustomRedirects,
|
...searxngI2pCustomRedirects,
|
||||||
|
...searxngLokiCustomRedirects,
|
||||||
|
|
||||||
...whoogleNormalCustomRedirects,
|
...whoogleNormalCustomRedirects,
|
||||||
...whoogleTorCustomRedirects,
|
...whoogleTorCustomRedirects,
|
||||||
...whoogleI2pCustomRedirects,
|
...whoogleI2pCustomRedirects,
|
||||||
|
...whoogleLokiCustomRedirects,
|
||||||
|
|
||||||
...librexNormalCustomRedirects,
|
...librexNormalCustomRedirects,
|
||||||
...librexTorCustomRedirects,
|
...librexTorCustomRedirects,
|
||||||
...librexI2pCustomRedirects,
|
...librexI2pCustomRedirects,
|
||||||
|
...librexLokiCustomRedirects
|
||||||
].includes(protocolHost)) { resolve(); return; }
|
].includes(protocolHost)) { resolve(); return; }
|
||||||
|
|
||||||
let instancesList;
|
let instancesList;
|
||||||
|
|
||||||
if (protocol == 'tor') {
|
if (protocol == 'loki') {
|
||||||
|
if (searchFrontend == 'searx') instancesList = [...searxLokiCustomRedirects];
|
||||||
|
else if (searchFrontend == 'searxng') instancesList = [...searxngLokiCustomRedirects];
|
||||||
|
else if (searchFrontend == 'whoogle') instancesList = [...whoogleLokiCustomRedirects];
|
||||||
|
else if (searchFrontend == 'librex') instancesList = [...librexLokiCustomRedirects];
|
||||||
|
}
|
||||||
|
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];
|
||||||
|
@ -578,6 +613,8 @@ function initDefaults() {
|
||||||
whoogleI2pRedirectsChecks: [...redirects.whoogle.i2p],
|
whoogleI2pRedirectsChecks: [...redirects.whoogle.i2p],
|
||||||
whoogleI2pCustomRedirects: [],
|
whoogleI2pCustomRedirects: [],
|
||||||
|
|
||||||
|
whoogleLokiCustomRedirects: [],
|
||||||
|
|
||||||
|
|
||||||
searxNormalRedirectsChecks: searxNormalRedirectsChecks,
|
searxNormalRedirectsChecks: searxNormalRedirectsChecks,
|
||||||
searxNormalCustomRedirects: [],
|
searxNormalCustomRedirects: [],
|
||||||
|
@ -588,6 +625,8 @@ function initDefaults() {
|
||||||
searxI2pRedirectsChecks: [...redirects.searx.i2p],
|
searxI2pRedirectsChecks: [...redirects.searx.i2p],
|
||||||
searxI2pCustomRedirects: [],
|
searxI2pCustomRedirects: [],
|
||||||
|
|
||||||
|
searxLokiCustomRedirects: [],
|
||||||
|
|
||||||
|
|
||||||
searxngNormalRedirectsChecks: searxngNormalRedirectsChecks,
|
searxngNormalRedirectsChecks: searxngNormalRedirectsChecks,
|
||||||
searxngNormalCustomRedirects: [],
|
searxngNormalCustomRedirects: [],
|
||||||
|
@ -598,6 +637,8 @@ function initDefaults() {
|
||||||
searxngI2pRedirectsChecks: [...redirects.searxng.i2p],
|
searxngI2pRedirectsChecks: [...redirects.searxng.i2p],
|
||||||
searxngI2pCustomRedirects: [],
|
searxngI2pCustomRedirects: [],
|
||||||
|
|
||||||
|
searxngLokiCustomRedirects: [],
|
||||||
|
|
||||||
|
|
||||||
librexNormalRedirectsChecks: librexNormalRedirectsChecks,
|
librexNormalRedirectsChecks: librexNormalRedirectsChecks,
|
||||||
librexNormalCustomRedirects: [],
|
librexNormalCustomRedirects: [],
|
||||||
|
@ -606,7 +647,9 @@ function initDefaults() {
|
||||||
librexTorCustomRedirects: [],
|
librexTorCustomRedirects: [],
|
||||||
|
|
||||||
librexI2pRedirectsChecks: [...redirects.librex.i2p],
|
librexI2pRedirectsChecks: [...redirects.librex.i2p],
|
||||||
librexI2pCustomRedirects: []
|
librexI2pCustomRedirects: [],
|
||||||
|
|
||||||
|
librexLokiCustomRedirects: []
|
||||||
}, () => resolve())
|
}, () => resolve())
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -42,6 +42,8 @@ let
|
||||||
sendNormalCustomRedirects,
|
sendNormalCustomRedirects,
|
||||||
sendTorRedirectsChecks,
|
sendTorRedirectsChecks,
|
||||||
sendTorCustomRedirects,
|
sendTorCustomRedirects,
|
||||||
|
sendI2pCustomRedirects,
|
||||||
|
sendLokiCustomRedirects,
|
||||||
protocol,
|
protocol,
|
||||||
protocolFallback;
|
protocolFallback;
|
||||||
|
|
||||||
|
@ -57,6 +59,8 @@ function init() {
|
||||||
"sendNormalCustomRedirects",
|
"sendNormalCustomRedirects",
|
||||||
"sendTorRedirectsChecks",
|
"sendTorRedirectsChecks",
|
||||||
"sendTorCustomRedirects",
|
"sendTorCustomRedirects",
|
||||||
|
"sendI2pCustomRedirects",
|
||||||
|
"sendLokiCustomRedirects"
|
||||||
],
|
],
|
||||||
r => {
|
r => {
|
||||||
disableSendTarget = r.disableSendTarget;
|
disableSendTarget = r.disableSendTarget;
|
||||||
|
@ -65,6 +69,8 @@ function init() {
|
||||||
sendNormalCustomRedirects = r.sendNormalCustomRedirects;
|
sendNormalCustomRedirects = r.sendNormalCustomRedirects;
|
||||||
sendTorRedirectsChecks = r.sendTorRedirectsChecks;
|
sendTorRedirectsChecks = r.sendTorRedirectsChecks;
|
||||||
sendTorCustomRedirects = r.sendTorCustomRedirects;
|
sendTorCustomRedirects = r.sendTorCustomRedirects;
|
||||||
|
sendI2pCustomRedirects = r.sendI2pCustomRedirects;
|
||||||
|
sendLokiCustomRedirects = r.sendLokiCustomRedirects;
|
||||||
protocol = r.protocol;
|
protocol = r.protocol;
|
||||||
protocolFallback = r.protocolFallback;
|
protocolFallback = r.protocolFallback;
|
||||||
resolve();
|
resolve();
|
||||||
|
@ -83,6 +89,8 @@ function all() {
|
||||||
...sendNormalCustomRedirects,
|
...sendNormalCustomRedirects,
|
||||||
...sendTorRedirectsChecks,
|
...sendTorRedirectsChecks,
|
||||||
...sendTorCustomRedirects,
|
...sendTorCustomRedirects,
|
||||||
|
...sendI2pCustomRedirects,
|
||||||
|
...sendLokiCustomRedirects
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +103,9 @@ function switchInstance(url, disableOverride) {
|
||||||
if (url.pathname != '/') { resolve(); return; }
|
if (url.pathname != '/') { resolve(); return; }
|
||||||
|
|
||||||
let instancesList = [];
|
let instancesList = [];
|
||||||
if (protocol == 'tor') instancesList = [...sendTorRedirectsChecks, ...sendTorCustomRedirects];
|
if (protocol == 'loki') instancesList = [...sendLokiCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') instancesList = [...sendI2pCustomRedirects];
|
||||||
|
else if (protocol == 'tor') instancesList = [...sendTorRedirectsChecks, ...sendTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...sendNormalRedirectsChecks, ...sendNormalCustomRedirects];
|
instancesList = [...sendNormalRedirectsChecks, ...sendNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -116,7 +126,9 @@ function redirect(url, type, initiator, disableOverride) {
|
||||||
if (!targets.some(rx => rx.test(url.href))) return;
|
if (!targets.some(rx => rx.test(url.href))) return;
|
||||||
|
|
||||||
let instancesList = [];
|
let instancesList = [];
|
||||||
if (protocol == 'tor') instancesList = [...sendTorRedirectsChecks, ...sendTorCustomRedirects];
|
if (protocol == 'loki') instancesList = [...sendLokiCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') instancesList = [...sendI2pCustomRedirects];
|
||||||
|
else if (protocol == 'tor') instancesList = [...sendTorRedirectsChecks, ...sendTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...sendNormalRedirectsChecks, ...sendNormalCustomRedirects];
|
instancesList = [...sendNormalRedirectsChecks, ...sendNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -147,7 +159,11 @@ function initDefaults() {
|
||||||
sendNormalCustomRedirects: [],
|
sendNormalCustomRedirects: [],
|
||||||
|
|
||||||
sendTorRedirectsChecks: [...redirects.send.tor],
|
sendTorRedirectsChecks: [...redirects.send.tor],
|
||||||
sendTorCustomRedirects: []
|
sendTorCustomRedirects: [],
|
||||||
|
|
||||||
|
sendI2pCustomRedirects: [],
|
||||||
|
|
||||||
|
sendLokiCustomRedirects: []
|
||||||
}, () => resolve())
|
}, () => resolve())
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -42,13 +42,17 @@ function initProxiTokCookies(test, from) {
|
||||||
...proxiTokNormalCustomRedirects,
|
...proxiTokNormalCustomRedirects,
|
||||||
...proxiTokTorRedirectsChecks,
|
...proxiTokTorRedirectsChecks,
|
||||||
...proxiTokTorCustomRedirects,
|
...proxiTokTorCustomRedirects,
|
||||||
|
...proxiTokI2pCustomRedirects,
|
||||||
|
...proxiTokLokiCustomRedirects,
|
||||||
].includes(protocolHost)) resolve();
|
].includes(protocolHost)) resolve();
|
||||||
|
|
||||||
if (!test) {
|
if (!test) {
|
||||||
let instancesList = [];
|
let checkedInstances = [];
|
||||||
if (protocol == 'tor') instancesList = [...proxiTokTorRedirectsChecks, ...proxiTokTorCustomRedirects];
|
if (protocol == 'loki') checkedInstances = [...proxiTokI2pCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
else if (protocol == 'i2p') checkedInstances = [...proxiTokLokiCustomRedirects];
|
||||||
instancesList = [...proxiTokNormalRedirectsChecks, ...proxiTokNormalCustomRedirects];
|
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');
|
||||||
|
@ -61,10 +65,12 @@ function pasteProxiTokCookies() {
|
||||||
return new Promise(async resolve => {
|
return new Promise(async resolve => {
|
||||||
await init();
|
await init();
|
||||||
if (disableTiktok || protocol === undefined) { resolve(); return; }
|
if (disableTiktok || protocol === undefined) { resolve(); return; }
|
||||||
let instancesList = [];
|
let checkedInstances = [];
|
||||||
if (protocol == 'tor') instancesList = [...proxiTokTorRedirectsChecks, ...proxiTokTorCustomRedirects];
|
if (protocol == 'loki') checkedInstances = [...proxiTokI2pCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
else if (protocol == 'i2p') checkedInstances = [...proxiTokLokiCustomRedirects];
|
||||||
instancesList = [...proxiTokNormalRedirectsChecks, ...proxiTokNormalCustomRedirects];
|
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');
|
||||||
|
@ -80,7 +86,9 @@ let
|
||||||
proxiTokNormalRedirectsChecks,
|
proxiTokNormalRedirectsChecks,
|
||||||
proxiTokNormalCustomRedirects,
|
proxiTokNormalCustomRedirects,
|
||||||
proxiTokTorRedirectsChecks,
|
proxiTokTorRedirectsChecks,
|
||||||
proxiTokTorCustomRedirects;
|
proxiTokTorCustomRedirects,
|
||||||
|
proxiTokI2pCustomRedirects,
|
||||||
|
proxiTokLokiCustomRedirects;
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
return new Promise(async resolve => {
|
return new Promise(async resolve => {
|
||||||
|
@ -94,6 +102,8 @@ function init() {
|
||||||
"proxiTokNormalCustomRedirects",
|
"proxiTokNormalCustomRedirects",
|
||||||
"proxiTokTorRedirectsChecks",
|
"proxiTokTorRedirectsChecks",
|
||||||
"proxiTokTorCustomRedirects",
|
"proxiTokTorCustomRedirects",
|
||||||
|
"proxiTokI2pCustomRedirects",
|
||||||
|
"proxiTokLokiCustomRedirects"
|
||||||
],
|
],
|
||||||
r => {
|
r => {
|
||||||
disableTiktok = r.disableTiktok;
|
disableTiktok = r.disableTiktok;
|
||||||
|
@ -104,6 +114,8 @@ function init() {
|
||||||
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();
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -126,7 +138,9 @@ function redirect(url, type, initiator, disableOverride) {
|
||||||
if (!targets.some(rx => rx.test(url.href))) return;
|
if (!targets.some(rx => rx.test(url.href))) return;
|
||||||
|
|
||||||
let instancesList = [];
|
let instancesList = [];
|
||||||
if (protocol == 'tor') instancesList = [...proxiTokTorRedirectsChecks, ...proxiTokTorCustomRedirects];
|
if (protocol == 'loki') instancesList = [...proxiTokI2pCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') instancesList = [...proxiTokLokiCustomRedirects];
|
||||||
|
else if (protocol == 'tor') instancesList = [...proxiTokTorRedirectsChecks, ...proxiTokTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...proxiTokNormalRedirectsChecks, ...proxiTokNormalCustomRedirects];
|
instancesList = [...proxiTokNormalRedirectsChecks, ...proxiTokNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -144,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; }
|
||||||
|
|
||||||
|
@ -163,11 +179,15 @@ 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 (protocol == 'tor') instancesList = [...proxiTokTorRedirectsChecks, ...proxiTokTorCustomRedirects];
|
if (protocol == 'loki') instancesList = [...proxiTokI2pCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') instancesList = [...proxiTokLokiCustomRedirects];
|
||||||
|
else if (protocol == 'tor') instancesList = [...proxiTokTorRedirectsChecks, ...proxiTokTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...proxiTokNormalRedirectsChecks, ...proxiTokNormalCustomRedirects];
|
instancesList = [...proxiTokNormalRedirectsChecks, ...proxiTokNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -198,6 +218,10 @@ function initDefaults() {
|
||||||
|
|
||||||
proxiTokTorRedirectsChecks: [...redirects.proxiTok.tor],
|
proxiTokTorRedirectsChecks: [...redirects.proxiTok.tor],
|
||||||
proxiTokTorCustomRedirects: [],
|
proxiTokTorCustomRedirects: [],
|
||||||
|
|
||||||
|
proxiTokI2pCustomRedirects: [],
|
||||||
|
|
||||||
|
proxiTokLokiCustomRedirects: []
|
||||||
}, () => resolve());
|
}, () => resolve());
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
|
@ -31,11 +31,13 @@ let
|
||||||
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 => {
|
||||||
|
@ -53,12 +55,14 @@ function init() {
|
||||||
"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;
|
||||||
|
@ -73,11 +77,13 @@ function init() {
|
||||||
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();
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -117,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) {
|
||||||
|
@ -126,7 +134,9 @@ function copyPasteLingvaLocalStorage(test, url, tabId) {
|
||||||
);
|
);
|
||||||
|
|
||||||
let checkedInstances = [];
|
let checkedInstances = [];
|
||||||
if (protocol == 'tor') checkedInstances = [...lingvaTorRedirectsChecks, ...lingvaTorCustomRedirects];
|
if (protocol == 'loki') checkedInstances = [...lingvaLokiCustomRedirects]; //...lingvaLokiRedirectsChecks,
|
||||||
|
else if (protocol == 'i2p') checkedInstances = [...lingvaI2pCustomRedirects]; //...lingvaI2pRedirectsChecks,
|
||||||
|
else if (protocol == 'tor') checkedInstances = [...lingvaTorRedirectsChecks, ...lingvaTorCustomRedirects];
|
||||||
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
checkedInstances = [...lingvaNormalRedirectsChecks, ...lingvaNormalCustomRedirects];
|
checkedInstances = [...lingvaNormalRedirectsChecks, ...lingvaNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -149,7 +159,9 @@ function pasteLingvaLocalStorage() {
|
||||||
await init();
|
await init();
|
||||||
if (translateDisable || translateFrontend != 'lingva') { resolve(); return; }
|
if (translateDisable || translateFrontend != 'lingva') { resolve(); return; }
|
||||||
let checkedInstances = [];
|
let checkedInstances = [];
|
||||||
if (protocol == 'tor') checkedInstances = [...lingvaTorRedirectsChecks, ...lingvaTorCustomRedirects];
|
if (protocol == 'loki') checkedInstances = [...lingvaLokiCustomRedirects]; //...lingvaLokiRedirectsChecks,
|
||||||
|
else if (protocol == 'i2p') checkedInstances = [...lingvaI2pCustomRedirects]; //...lingvaI2pRedirectsChecks,
|
||||||
|
else if (protocol == 'tor') checkedInstances = [...lingvaTorRedirectsChecks, ...lingvaTorCustomRedirects];
|
||||||
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
checkedInstances = [...lingvaNormalRedirectsChecks, ...lingvaNormalCustomRedirects];
|
checkedInstances = [...lingvaNormalRedirectsChecks, ...lingvaNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -172,11 +184,11 @@ function copyPasteSimplyTranslateCookies(test, from) {
|
||||||
...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 (protocol == 'loki') checkedInstances = [...simplyTranslateLokiRedirectsChecks, ...simplyTranslateLokiCustomReidrects]
|
if (protocol == 'loki') checkedInstances = [...simplyTranslateLokiRedirectsChecks, ...simplyTranslateLokiCustomRedirects]
|
||||||
else if (protocol == 'i2p') checkedInstances = [...simplyTranslateI2pCustomRedirects, ...simplyTranslateI2pRedirectsChecks];
|
else if (protocol == 'i2p') checkedInstances = [...simplyTranslateI2pCustomRedirects, ...simplyTranslateI2pRedirectsChecks];
|
||||||
else if (protocol == 'tor') checkedInstances = [...simplyTranslateTorRedirectsChecks, ...simplyTranslateTorCustomRedirects];
|
else if (protocol == 'tor') checkedInstances = [...simplyTranslateTorRedirectsChecks, ...simplyTranslateTorCustomRedirects];
|
||||||
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
|
@ -197,7 +209,7 @@ function pasteSimplyTranslateCookies() {
|
||||||
await init();
|
await init();
|
||||||
if (translateDisable || translateFrontend != 'simplyTranslate') { resolve(); return; }
|
if (translateDisable || translateFrontend != 'simplyTranslate') { resolve(); return; }
|
||||||
let checkedInstances = [];
|
let checkedInstances = [];
|
||||||
if (protocol == 'loki') checkedInstances = [...simplyTranslateLokiRedirectsChecks, ...simplyTranslateLokiCustomReidrects]
|
if (protocol == 'loki') checkedInstances = [...simplyTranslateLokiRedirectsChecks, ...simplyTranslateLokiCustomRedirects]
|
||||||
else if (protocol == 'i2p') checkedInstances = [...simplyTranslateI2pCustomRedirects, ...simplyTranslateI2pRedirectsChecks];
|
else if (protocol == 'i2p') checkedInstances = [...simplyTranslateI2pCustomRedirects, ...simplyTranslateI2pRedirectsChecks];
|
||||||
else if (protocol == 'tor') checkedInstances = [...simplyTranslateTorRedirectsChecks, ...simplyTranslateTorCustomRedirects];
|
else if (protocol == 'tor') checkedInstances = [...simplyTranslateTorRedirectsChecks, ...simplyTranslateTorCustomRedirects];
|
||||||
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
|
@ -218,7 +230,7 @@ function redirect(url, disableOverride) {
|
||||||
|
|
||||||
if (translateFrontend == 'simplyTranslate') {
|
if (translateFrontend == 'simplyTranslate') {
|
||||||
let instancesList = [];
|
let instancesList = [];
|
||||||
if (protocol == 'loki') instancesList = [...simplyTranslateLokiRedirectsChecks, ...simplyTranslateLokiCustomReidrects];
|
if (protocol == 'loki') instancesList = [...simplyTranslateLokiRedirectsChecks, ...simplyTranslateLokiCustomRedirects];
|
||||||
else if (protocol == 'i2p') instancesList = [...simplyTranslateI2pRedirectsChecks, ...simplyTranslateI2pCustomRedirects];
|
else if (protocol == 'i2p') instancesList = [...simplyTranslateI2pRedirectsChecks, ...simplyTranslateI2pCustomRedirects];
|
||||||
else if (protocol == 'tor') instancesList = [...simplyTranslateTorRedirectsChecks, ...simplyTranslateTorCustomRedirects];
|
else if (protocol == 'tor') instancesList = [...simplyTranslateTorRedirectsChecks, ...simplyTranslateTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
|
@ -238,6 +250,8 @@ function redirect(url, disableOverride) {
|
||||||
params[pair[0]] = pair[1];
|
params[pair[0]] = pair[1];
|
||||||
}
|
}
|
||||||
let instancesList = [];
|
let instancesList = [];
|
||||||
|
if (protocol == 'loki') instancesList = [...lingvaLokiCustomRedirects]; //...lingvaLokiRedirectsChecks,
|
||||||
|
else if (protocol == 'i2p') instancesList = [...lingvaI2pCustomRedirects]; //...lingvaI2pRedirectsChecks,
|
||||||
if (protocol == 'tor') instancesList = [...lingvaTorRedirectsChecks, ...lingvaTorCustomRedirects];
|
if (protocol == 'tor') instancesList = [...lingvaTorRedirectsChecks, ...lingvaTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...lingvaNormalRedirectsChecks, ...lingvaNormalCustomRedirects];
|
instancesList = [...lingvaNormalRedirectsChecks, ...lingvaNormalCustomRedirects];
|
||||||
|
@ -266,24 +280,26 @@ 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 (protocol == 'loki') {
|
if (protocol == 'loki') {
|
||||||
if (translateFrontend == 'simplyTranslate') instancesList = [...simplyTranslateLokiRedirectsChecks, ...simplyTranslateLokiCustomReidrects];
|
if (translateFrontend == 'simplyTranslate') instancesList = [...simplyTranslateLokiRedirectsChecks, ...simplyTranslateLokiCustomRedirects];
|
||||||
//else if (translateFrontend == 'lingva') instancesList = [...lingvaLokiRedirectsChecks, ...lingvaLokiCustomRedirects];
|
else if (translateFrontend == 'lingva') instancesList = [...lingvaLokiCustomRedirects]; //...lingvaLokiRedirectsChecks,
|
||||||
}
|
}
|
||||||
else if (protocol == 'i2p') {
|
else if (protocol == 'i2p') {
|
||||||
if (translateFrontend == 'simplyTranslate') instancesList = [...simplyTranslateI2pRedirectsChecks, ...simplyTranslateI2pCustomRedirects];
|
if (translateFrontend == 'simplyTranslate') instancesList = [...simplyTranslateI2pRedirectsChecks, ...simplyTranslateI2pCustomRedirects];
|
||||||
//else if (translateFrontend == 'lingva') instancesList = [...lingvaI2PRedirectsChecks, ...lingvaI2PCustomRedirects];
|
else if (translateFrontend == 'lingva') instancesList = [...lingvaI2pCustomRedirects]; //...lingvaI2pRedirectsChecks,
|
||||||
}
|
}
|
||||||
else if (protocol == 'tor') {
|
else if (protocol == 'tor') {
|
||||||
if (translateFrontend == 'simplyTranslate') instancesList = [...simplyTranslateTorRedirectsChecks, ...simplyTranslateTorCustomRedirects];
|
if (translateFrontend == 'simplyTranslate') instancesList = [...simplyTranslateTorRedirectsChecks, ...simplyTranslateTorCustomRedirects];
|
||||||
|
@ -329,12 +345,14 @@ function initDefaults() {
|
||||||
simplyTranslateI2pRedirectsChecks: [...redirects.simplyTranslate.i2p],
|
simplyTranslateI2pRedirectsChecks: [...redirects.simplyTranslate.i2p],
|
||||||
simplyTranslateI2pCustomRedirects: [],
|
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: [],
|
||||||
|
lingvaI2pCustomRedirects: [],
|
||||||
|
lingvaLokiCustomRedirects: []
|
||||||
}, () => resolve())
|
}, () => resolve())
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -46,7 +46,9 @@ let
|
||||||
nitterNormalRedirectsChecks,
|
nitterNormalRedirectsChecks,
|
||||||
nitterNormalCustomRedirects,
|
nitterNormalCustomRedirects,
|
||||||
nitterTorRedirectsChecks,
|
nitterTorRedirectsChecks,
|
||||||
nitterTorCustomRedirects;
|
nitterTorCustomRedirects,
|
||||||
|
nitterI2pCustomRedirects,
|
||||||
|
nitterLokiCustomRedirects;
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
return new Promise(async resolve => {
|
return new Promise(async resolve => {
|
||||||
|
@ -61,6 +63,8 @@ function init() {
|
||||||
"nitterNormalCustomRedirects",
|
"nitterNormalCustomRedirects",
|
||||||
"nitterTorRedirectsChecks",
|
"nitterTorRedirectsChecks",
|
||||||
"nitterTorCustomRedirects",
|
"nitterTorCustomRedirects",
|
||||||
|
"nitterI2pCustomRedirects",
|
||||||
|
"nitterLokiCustomRedirects"
|
||||||
],
|
],
|
||||||
r => {
|
r => {
|
||||||
disableTwitter = r.disableTwitter;
|
disableTwitter = r.disableTwitter;
|
||||||
|
@ -72,6 +76,8 @@ function init() {
|
||||||
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();
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -87,6 +93,8 @@ function all() {
|
||||||
...nitterTorRedirectsChecks,
|
...nitterTorRedirectsChecks,
|
||||||
...nitterNormalCustomRedirects,
|
...nitterNormalCustomRedirects,
|
||||||
...nitterTorCustomRedirects,
|
...nitterTorCustomRedirects,
|
||||||
|
...nitterI2pCustomRedirects,
|
||||||
|
...nitterLokiCustomRedirects
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +107,9 @@ function redirect(url, type, initiator, disableOverride) {
|
||||||
if (twitterRedirectType == 'main_frame' && type != "main_frame") return;
|
if (twitterRedirectType == 'main_frame' && type != "main_frame") return;
|
||||||
|
|
||||||
let instancesList = [];
|
let instancesList = [];
|
||||||
if (protocol == 'tor') instancesList = [...nitterTorRedirectsChecks, ...nitterTorCustomRedirects];
|
if (protocol == 'loki') instancesList = [...nitterI2pCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') instancesList = [...nitterLokiCustomRedirects];
|
||||||
|
else if (protocol == 'tor') instancesList = [...nitterTorRedirectsChecks, ...nitterTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...nitterNormalRedirectsChecks, ...nitterNormalCustomRedirects];
|
instancesList = [...nitterNormalRedirectsChecks, ...nitterNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -136,7 +146,9 @@ 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 (protocol == 'tor') instancesList = [...nitterTorRedirectsChecks, ...nitterTorCustomRedirects];
|
if (protocol == 'loki') instancesList = [...nitterI2pCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') instancesList = [...nitterLokiCustomRedirects];
|
||||||
|
else if (protocol == 'tor') instancesList = [...nitterTorRedirectsChecks, ...nitterTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...nitterNormalRedirectsChecks, ...nitterNormalCustomRedirects];
|
instancesList = [...nitterNormalRedirectsChecks, ...nitterNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -177,7 +189,9 @@ function initNitterCookies(test, from) {
|
||||||
) { resolve(); return; }
|
) { resolve(); return; }
|
||||||
if (!test) {
|
if (!test) {
|
||||||
let checkedInstances = [];
|
let checkedInstances = [];
|
||||||
if (protocol == 'tor') checkedInstances = [...nitterTorRedirectsChecks, ...nitterTorCustomRedirects];
|
if (protocol == 'loki') checkedInstances = [...nitterI2pCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') checkedInstances = [...nitterLokiCustomRedirects];
|
||||||
|
else if (protocol == 'tor') checkedInstances = [...nitterTorRedirectsChecks, ...nitterTorCustomRedirects];
|
||||||
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
checkedInstances = [...nitterNormalRedirectsChecks, ...nitterNormalCustomRedirects];
|
checkedInstances = [...nitterNormalRedirectsChecks, ...nitterNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -210,7 +224,9 @@ function pasteNitterCookies() {
|
||||||
await init();
|
await init();
|
||||||
if (disableTwitter || protocol === undefined) { resolve(); return; }
|
if (disableTwitter || protocol === undefined) { resolve(); return; }
|
||||||
let checkedInstances = [];
|
let checkedInstances = [];
|
||||||
if (protocol == 'tor') checkedInstances = [...nitterTorRedirectsChecks, ...nitterTorCustomRedirects];
|
if (protocol == 'loki') checkedInstances = [...nitterI2pCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') checkedInstances = [...nitterLokiCustomRedirects];
|
||||||
|
else if (protocol == 'tor') checkedInstances = [...nitterTorRedirectsChecks, ...nitterTorCustomRedirects];
|
||||||
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
checkedInstances = [...nitterNormalRedirectsChecks, ...nitterNormalCustomRedirects];
|
checkedInstances = [...nitterNormalRedirectsChecks, ...nitterNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -261,6 +277,10 @@ function initDefaults() {
|
||||||
|
|
||||||
nitterTorRedirectsChecks: [...redirects.nitter.tor],
|
nitterTorRedirectsChecks: [...redirects.nitter.tor],
|
||||||
nitterTorCustomRedirects: [],
|
nitterTorCustomRedirects: [],
|
||||||
|
|
||||||
|
nitterI2pCustomRedirects: [],
|
||||||
|
|
||||||
|
nitterLokiCustomRedirects: []
|
||||||
}, () => resolve());
|
}, () => resolve());
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -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,7 +42,7 @@ 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 });
|
||||||
|
@ -54,6 +55,7 @@ function updateInstances() {
|
||||||
sendTargetsHelper.setRedirects(instances.send);
|
sendTargetsHelper.setRedirects(instances.send);
|
||||||
tiktokHelper.setRedirects(instances.proxiTok);
|
tiktokHelper.setRedirects(instances.proxiTok);
|
||||||
lbryHelper.setRedirects(instances.librarian);
|
lbryHelper.setRedirects(instances.librarian);
|
||||||
|
reutersHelper.setRedirects(instances.neuters);
|
||||||
|
|
||||||
console.info("Successfully updated Instances");
|
console.info("Successfully updated Instances");
|
||||||
resolve(true); return;
|
resolve(true); return;
|
||||||
|
|
|
@ -41,7 +41,8 @@ let
|
||||||
wikilessI2pRedirectsChecks,
|
wikilessI2pRedirectsChecks,
|
||||||
wikilessNormalCustomRedirects,
|
wikilessNormalCustomRedirects,
|
||||||
wikilessTorCustomRedirects,
|
wikilessTorCustomRedirects,
|
||||||
wikilessI2pCustomRedirects;
|
wikilessI2pCustomRedirects,
|
||||||
|
wikilessLokiCustomRedirects;
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
return new Promise(async resolve => {
|
return new Promise(async resolve => {
|
||||||
|
@ -57,6 +58,7 @@ function init() {
|
||||||
"wikilessNormalCustomRedirects",
|
"wikilessNormalCustomRedirects",
|
||||||
"wikilessTorCustomRedirects",
|
"wikilessTorCustomRedirects",
|
||||||
"wikilessI2pCustomRedirects",
|
"wikilessI2pCustomRedirects",
|
||||||
|
"wikilessLokiCustomRedirects"
|
||||||
],
|
],
|
||||||
r => {
|
r => {
|
||||||
disableWikipedia = r.disableWikipedia;
|
disableWikipedia = r.disableWikipedia;
|
||||||
|
@ -69,6 +71,7 @@ function init() {
|
||||||
wikilessNormalCustomRedirects = r.wikilessNormalCustomRedirects;
|
wikilessNormalCustomRedirects = r.wikilessNormalCustomRedirects;
|
||||||
wikilessTorCustomRedirects = r.wikilessTorCustomRedirects;
|
wikilessTorCustomRedirects = r.wikilessTorCustomRedirects;
|
||||||
wikilessI2pCustomRedirects = r.wikilessI2pCustomRedirects;
|
wikilessI2pCustomRedirects = r.wikilessI2pCustomRedirects;
|
||||||
|
wikilessLokiCustomRedirects = r.wikilessLokiCustomRedirects;
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -89,13 +92,15 @@ 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 (protocol == 'i2p') checkedInstances = [...wikilessI2pCustomRedirects, ...wikilessI2pRedirectsChecks];
|
if (protocol == 'loki') checkedInstances = [...wikilessLokiCustomRedirects];
|
||||||
if (protocol == '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') {
|
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
checkedInstances = [...wikilessNormalRedirectsChecks, ...wikilessNormalCustomRedirects];
|
checkedInstances = [...wikilessNormalRedirectsChecks, ...wikilessNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -111,7 +116,8 @@ function pasteWikilessCookies() {
|
||||||
await init();
|
await init();
|
||||||
if (disableWikipedia || protocol === undefined) { resolve(); return; }
|
if (disableWikipedia || protocol === undefined) { resolve(); return; }
|
||||||
let checkedInstances = [];
|
let checkedInstances = [];
|
||||||
if (protocol == 'i2p') checkedInstances = [...wikilessI2pCustomRedirects, ...wikilessI2pRedirectsChecks];
|
if (protocol == 'loki') checkedInstances = [...wikilessLokiCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') checkedInstances = [...wikilessI2pCustomRedirects, ...wikilessI2pRedirectsChecks];
|
||||||
else if (protocol == 'tor') checkedInstances = [...wikilessTorRedirectsChecks, ...wikilessTorCustomRedirects];
|
else if (protocol == 'tor') checkedInstances = [...wikilessTorRedirectsChecks, ...wikilessTorCustomRedirects];
|
||||||
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((checkedInstances.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
checkedInstances = [...wikilessNormalRedirectsChecks, ...wikilessNormalCustomRedirects];
|
checkedInstances = [...wikilessNormalRedirectsChecks, ...wikilessNormalCustomRedirects];
|
||||||
|
@ -136,7 +142,8 @@ function redirect(url, disableOverride) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let instancesList = [];
|
let instancesList = [];
|
||||||
if (protocol == 'i2p') instancesList = [...wikilessI2pCustomRedirects, ...wikilessI2pRedirectsChecks];
|
if (protocol == 'loki') instancesList = [...wikilessLokiCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') instancesList = [...wikilessI2pCustomRedirects, ...wikilessI2pRedirectsChecks];
|
||||||
else if (protocol == 'tor') instancesList = [...wikilessTorRedirectsChecks, ...wikilessTorCustomRedirects];
|
else if (protocol == 'tor') instancesList = [...wikilessTorRedirectsChecks, ...wikilessTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...wikilessNormalRedirectsChecks, ...wikilessNormalCustomRedirects];
|
instancesList = [...wikilessNormalRedirectsChecks, ...wikilessNormalCustomRedirects];
|
||||||
|
@ -172,12 +179,14 @@ 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 (protocol == 'i2p') instancesList = [...wikilessI2pCustomRedirects, ...wikilessI2pRedirectsChecks];
|
if (protocol == 'loki') instancesList = [...wikilessLokiCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') instancesList = [...wikilessI2pCustomRedirects, ...wikilessI2pRedirectsChecks];
|
||||||
else if (protocol == 'tor') instancesList = [...wikilessTorRedirectsChecks, ...wikilessTorCustomRedirects];
|
else if (protocol == 'tor') instancesList = [...wikilessTorRedirectsChecks, ...wikilessTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...wikilessNormalRedirectsChecks, ...wikilessNormalCustomRedirects];
|
instancesList = [...wikilessNormalRedirectsChecks, ...wikilessNormalCustomRedirects];
|
||||||
|
@ -214,6 +223,7 @@ function initDefaults() {
|
||||||
wikilessNormalCustomRedirects: [],
|
wikilessNormalCustomRedirects: [],
|
||||||
wikilessTorCustomRedirects: [],
|
wikilessTorCustomRedirects: [],
|
||||||
wikilessI2pCustomRedirects: [],
|
wikilessI2pCustomRedirects: [],
|
||||||
|
wikilessLokiCustomRedirects: []
|
||||||
}, () => resolve());
|
}, () => resolve());
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -33,14 +33,19 @@ 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,
|
||||||
|
@ -48,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
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -64,14 +71,20 @@ let
|
||||||
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 => {
|
||||||
|
@ -88,14 +101,20 @@ function init() {
|
||||||
"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;
|
||||||
|
@ -109,14 +128,20 @@ function init() {
|
||||||
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();
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -139,12 +164,18 @@ function all() {
|
||||||
|
|
||||||
...invidiousNormalCustomRedirects,
|
...invidiousNormalCustomRedirects,
|
||||||
...invidiousTorCustomRedirects,
|
...invidiousTorCustomRedirects,
|
||||||
|
...invidiousI2pCustomRedirects,
|
||||||
|
...invidiousLokiCustomRedirects,
|
||||||
|
|
||||||
...pipedNormalCustomRedirects,
|
...pipedNormalCustomRedirects,
|
||||||
...pipedTorCustomRedirects,
|
...pipedTorCustomRedirects,
|
||||||
|
...pipedI2pCustomRedirects,
|
||||||
|
...pipedLokiCustomRedirects,
|
||||||
|
|
||||||
...pipedMaterialNormalCustomRedirects,
|
...pipedMaterialNormalCustomRedirects,
|
||||||
...pipedMaterialTorCustomRedirects,
|
...pipedMaterialTorCustomRedirects,
|
||||||
|
...pipedMaterialI2pCustomRedirects,
|
||||||
|
...pipedMaterialLokiCustomRedirects
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,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';
|
||||||
|
@ -171,14 +202,16 @@ 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 (protocol == 'tor') instancesList = [...invidiousTorRedirectsChecks, ...invidiousTorCustomRedirects];
|
if (protocol == 'loki') instancesList = [...invidiousLokiCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') instancesList = [...invidiousI2pCustomRedirects];
|
||||||
|
else if (protocol == 'tor') instancesList = [...invidiousTorRedirectsChecks, ...invidiousTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...invidiousNormalRedirectsChecks, ...invidiousNormalCustomRedirects];
|
instancesList = [...invidiousNormalRedirectsChecks, ...invidiousNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -188,7 +221,9 @@ function redirect(url, type, initiator, disableOverride) {
|
||||||
}
|
}
|
||||||
if (isPiped || ((isFreetube || isYatte) && sub_frame && isFrontendPiped)) {
|
if (isPiped || ((isFreetube || isYatte) && sub_frame && isFrontendPiped)) {
|
||||||
let instancesList = [];
|
let instancesList = [];
|
||||||
if (protocol == 'tor') instancesList = [...pipedTorRedirectsChecks, ...pipedTorCustomRedirects];
|
if (protocol == 'loki') instancesList = [...pipedLokiCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') instancesList = [...pipedI2pCustomRedirects];
|
||||||
|
else if (protocol == 'tor') instancesList = [...pipedTorRedirectsChecks, ...pipedTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...pipedNormalRedirectsChecks, ...pipedNormalCustomRedirects];
|
instancesList = [...pipedNormalRedirectsChecks, ...pipedNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -198,7 +233,9 @@ function redirect(url, type, initiator, disableOverride) {
|
||||||
}
|
}
|
||||||
if (isPipedMaterial || ((isFreetube || isYatte) && sub_frame && isFrontendPipedMaterial)) {
|
if (isPipedMaterial || ((isFreetube || isYatte) && sub_frame && isFrontendPipedMaterial)) {
|
||||||
let instancesList = [];
|
let instancesList = [];
|
||||||
if (protocol == 'tor') instancesList = [...pipedMaterialTorRedirectsChecks, ...pipedMaterialTorCustomRedirects];
|
if (protocol == 'loki') instancesList = [...pipedMaterialLokiCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') instancesList = [...pipedMaterialI2pCustomRedirects];
|
||||||
|
else if (protocol == 'tor') instancesList = [...pipedMaterialTorRedirectsChecks, ...pipedMaterialTorCustomRedirects];
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
instancesList = [...pipedMaterialNormalRedirectsChecks, ...pipedMaterialNormalCustomRedirects];
|
instancesList = [...pipedMaterialNormalRedirectsChecks, ...pipedMaterialNormalCustomRedirects];
|
||||||
}
|
}
|
||||||
|
@ -224,9 +261,18 @@ 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 (protocol == 'loki') {
|
||||||
if (protocol == 'tor') {
|
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];
|
if (youtubeFrontend == 'invidious') instancesList = [...invidiousTorRedirectsChecks, ...invidiousTorCustomRedirects];
|
||||||
else if (youtubeFrontend == 'piped') instancesList = [...pipedTorRedirectsChecks, ...pipedTorCustomRedirects];
|
else if (youtubeFrontend == 'piped') instancesList = [...pipedTorRedirectsChecks, ...pipedTorCustomRedirects];
|
||||||
else if (youtubeFrontend == 'pipedMaterial') instancesList = [...pipedMaterialTorRedirectsChecks, ...pipedMaterialTorCustomRedirects];
|
else if (youtubeFrontend == 'pipedMaterial') instancesList = [...pipedMaterialTorRedirectsChecks, ...pipedMaterialTorCustomRedirects];
|
||||||
|
@ -285,18 +331,30 @@ function initDefaults() {
|
||||||
invidiousTorRedirectsChecks: [...redirects.invidious.tor],
|
invidiousTorRedirectsChecks: [...redirects.invidious.tor],
|
||||||
invidiousTorCustomRedirects: [],
|
invidiousTorCustomRedirects: [],
|
||||||
|
|
||||||
|
invidiousI2pCustomRedirects: [],
|
||||||
|
|
||||||
|
invidiousLokiCustomRedirects: [],
|
||||||
|
|
||||||
pipedNormalRedirectsChecks: pipedNormalRedirectsChecks,
|
pipedNormalRedirectsChecks: pipedNormalRedirectsChecks,
|
||||||
pipedNormalCustomRedirects: [],
|
pipedNormalCustomRedirects: [],
|
||||||
|
|
||||||
pipedTorRedirectsChecks: [...redirects.piped.tor],
|
pipedTorRedirectsChecks: [...redirects.piped.tor],
|
||||||
pipedTorCustomRedirects: [],
|
pipedTorCustomRedirects: [],
|
||||||
|
|
||||||
|
pipedI2pCustomRedirects: [],
|
||||||
|
|
||||||
|
pipedLokiCustomRedirects: [],
|
||||||
|
|
||||||
pipedMaterialNormalRedirectsChecks: pipedMaterialNormalRedirectsChecks,
|
pipedMaterialNormalRedirectsChecks: pipedMaterialNormalRedirectsChecks,
|
||||||
pipedMaterialNormalCustomRedirects: [],
|
pipedMaterialNormalCustomRedirects: [],
|
||||||
|
|
||||||
pipedMaterialTorRedirectsChecks: [...redirects.pipedMaterial.tor],
|
pipedMaterialTorRedirectsChecks: [...redirects.pipedMaterial.tor],
|
||||||
pipedMaterialTorCustomRedirects: [],
|
pipedMaterialTorCustomRedirects: [],
|
||||||
|
|
||||||
|
pipedMaterialI2pCustomRedirects: [],
|
||||||
|
|
||||||
|
pipedMaterialLokiCustomRedirects: [],
|
||||||
|
|
||||||
youtubeEmbedFrontend: 'invidious'
|
youtubeEmbedFrontend: 'invidious'
|
||||||
}, () => resolve())
|
}, () => resolve())
|
||||||
})
|
})
|
||||||
|
@ -314,11 +372,15 @@ 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 (protocol == 'tor') checkedInstances = [...invidiousTorRedirectsChecks, ...invidiousTorCustomRedirects]
|
if (protocol == 'loki') checkedInstances = [...invidiousLokiCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') checkedInstances = [...invidiousI2pCustomRedirects];
|
||||||
|
else if (protocol == 'tor') checkedInstances = [...invidiousTorRedirectsChecks, ...invidiousTorCustomRedirects]
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
checkedInstances = [...invidiousNormalRedirectsChecks, ...invidiousNormalCustomRedirects]
|
checkedInstances = [...invidiousNormalRedirectsChecks, ...invidiousNormalCustomRedirects]
|
||||||
}
|
}
|
||||||
|
@ -335,7 +397,9 @@ function pasteInvidiousCookies() {
|
||||||
await init();
|
await init();
|
||||||
if (disableYoutube || youtubeFrontend != 'invidious') { resolve(); return; }
|
if (disableYoutube || youtubeFrontend != 'invidious') { resolve(); return; }
|
||||||
let checkedInstances = [];
|
let checkedInstances = [];
|
||||||
if (protocol == 'tor') checkedInstances = [...invidiousTorRedirectsChecks, ...invidiousTorCustomRedirects]
|
if (protocol == 'loki') checkedInstances = [...invidiousLokiCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') checkedInstances = [...invidiousI2pCustomRedirects];
|
||||||
|
else if (protocol == 'tor') checkedInstances = [...invidiousTorRedirectsChecks, ...invidiousTorCustomRedirects]
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
checkedInstances = [...invidiousNormalRedirectsChecks, ...invidiousNormalCustomRedirects]
|
checkedInstances = [...invidiousNormalRedirectsChecks, ...invidiousNormalCustomRedirects]
|
||||||
}
|
}
|
||||||
|
@ -354,13 +418,17 @@ 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 (protocol == 'tor') checkedInstances = [...pipedTorRedirectsChecks, ...pipedTorCustomRedirects]
|
if (protocol == 'loki') checkedInstances = [...pipedLokiCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') checkedInstances = [...pipedI2pCustomRedirects];
|
||||||
|
else if (protocol == 'tor') checkedInstances = [...pipedTorRedirectsChecks, ...pipedTorCustomRedirects]
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
checkedInstances = [...pipedNormalCustomRedirects, ...pipedNormalRedirectsChecks]
|
checkedInstances = [...pipedNormalCustomRedirects, ...pipedNormalRedirectsChecks]
|
||||||
}
|
}
|
||||||
|
@ -379,7 +447,9 @@ function pastePipedLocalStorage() {
|
||||||
await init();
|
await init();
|
||||||
if (disableYoutube || youtubeFrontend != 'piped') { resolve(); return; }
|
if (disableYoutube || youtubeFrontend != 'piped') { resolve(); return; }
|
||||||
let checkedInstances = [];
|
let checkedInstances = [];
|
||||||
if (protocol == 'tor') checkedInstances = [...pipedTorRedirectsChecks, ...pipedTorCustomRedirects]
|
if (protocol == 'loki') checkedInstances = [...pipedLokiCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') checkedInstances = [...pipedI2pCustomRedirects];
|
||||||
|
else if (protocol == 'tor') checkedInstances = [...pipedTorRedirectsChecks, ...pipedTorCustomRedirects]
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
checkedInstances = [...pipedNormalCustomRedirects, ...pipedNormalRedirectsChecks]
|
checkedInstances = [...pipedNormalCustomRedirects, ...pipedNormalRedirectsChecks]
|
||||||
}
|
}
|
||||||
|
@ -401,13 +471,17 @@ function copyPastePipedMaterialLocalStorage(test, url, tabId,) {
|
||||||
...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 (protocol == 'tor') checkedInstances = [...pipedMaterialTorRedirectsChecks, ...pipedMaterialTorCustomRedirects]
|
if (protocol == 'loki') checkedInstances = [...pipedMaterialLokiCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') checkedInstances = [...pipedMaterialI2pCustomRedirects];
|
||||||
|
else if (protocol == 'tor') checkedInstances = [...pipedMaterialTorRedirectsChecks, ...pipedMaterialTorCustomRedirects]
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
checkedInstances = [...pipedMaterialNormalRedirectsChecks, ...pipedMaterialNormalCustomRedirects]
|
checkedInstances = [...pipedMaterialNormalRedirectsChecks, ...pipedMaterialNormalCustomRedirects]
|
||||||
}
|
}
|
||||||
|
@ -428,7 +502,9 @@ function pastePipedMaterialLocalStorage() {
|
||||||
await init();
|
await init();
|
||||||
if (disableYoutube || youtubeFrontend != 'pipedMaterial') { resolve(); return; }
|
if (disableYoutube || youtubeFrontend != 'pipedMaterial') { resolve(); return; }
|
||||||
let checkedInstances = [];
|
let checkedInstances = [];
|
||||||
if (protocol == 'tor') checkedInstances = [...pipedMaterialTorRedirectsChecks, ...pipedMaterialTorCustomRedirects]
|
if (protocol == 'loki') checkedInstances = [...pipedMaterialLokiCustomRedirects];
|
||||||
|
else if (protocol == 'i2p') checkedInstances = [...pipedMaterialI2pCustomRedirects];
|
||||||
|
else if (protocol == 'tor') checkedInstances = [...pipedMaterialTorRedirectsChecks, ...pipedMaterialTorCustomRedirects]
|
||||||
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
if ((instancesList.length === 0 && protocolFallback) || protocol == 'normal') {
|
||||||
checkedInstances = [...pipedMaterialNormalRedirectsChecks, ...pipedMaterialNormalCustomRedirects]
|
checkedInstances = [...pipedMaterialNormalRedirectsChecks, ...pipedMaterialNormalCustomRedirects]
|
||||||
}
|
}
|
||||||
|
@ -447,7 +523,17 @@ function removeXFrameOptions(e) {
|
||||||
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 (protocol == 'tor') {
|
if (protocol == 'loki') {
|
||||||
|
if (youtubeFrontend == 'invidious') instancesList = [...invidiousLokiCustomRedirects]; //...invidiousLokiRedirectsChecks,
|
||||||
|
if (youtubeFrontend == 'piped') instancesList = [...pipedLokiCustomRedirects]; //...pipedLokiRedirectsChecks,
|
||||||
|
if (youtubeFrontend == 'pipedMaterial') instancesList = [...pipedMaterialLokiCustomRedirects]; //...pipedMaterialLokiRedirectsChecks,
|
||||||
|
}
|
||||||
|
else if (protocol == 'i2p') {
|
||||||
|
if (youtubeFrontend == 'invidious') instancesList = [...invidiousI2pCustomRedirects]; //...invidiousI2pRedirectsChecks,
|
||||||
|
if (youtubeFrontend == 'piped') instancesList = [...pipedI2pCustomRedirects]; //...pipedI2pRedirectsChecks,
|
||||||
|
if (youtubeFrontend == 'pipedMaterial') instancesList = [...pipedMaterialI2pCustomRedirects]; //...pipedMaterialI2pRedirectsChecks,
|
||||||
|
}
|
||||||
|
else if (protocol == 'tor') {
|
||||||
if (youtubeFrontend == 'invidious') instancesList = [...invidiousTorRedirectsChecks, ...invidiousTorCustomRedirects];
|
if (youtubeFrontend == 'invidious') instancesList = [...invidiousTorRedirectsChecks, ...invidiousTorCustomRedirects];
|
||||||
if (youtubeFrontend == 'piped') instancesList = [...pipedTorRedirectsChecks, ...pipedTorCustomRedirects];
|
if (youtubeFrontend == 'piped') instancesList = [...pipedTorRedirectsChecks, ...pipedTorCustomRedirects];
|
||||||
if (youtubeFrontend == 'pipedMaterial') instancesList = [...pipedMaterialTorRedirectsChecks, ...pipedMaterialTorCustomRedirects];
|
if (youtubeFrontend == 'pipedMaterial') instancesList = [...pipedMaterialTorRedirectsChecks, ...pipedMaterialTorCustomRedirects];
|
||||||
|
|
|
@ -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,12 @@ async function initDefaults() {
|
||||||
|
|
||||||
beatbumpNormalRedirectsChecks: [...redirects.beatbump.normal],
|
beatbumpNormalRedirectsChecks: [...redirects.beatbump.normal],
|
||||||
beatbumpNormalCustomRedirects: [],
|
beatbumpNormalCustomRedirects: [],
|
||||||
|
|
||||||
|
beatbumpTorCustomRedirects: [],
|
||||||
|
|
||||||
|
beatbumpI2pCustomRedirects: [],
|
||||||
|
|
||||||
|
beatbumpLokiCustomRedirects: []
|
||||||
}, () => resolve())
|
}, () => resolve())
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue