Fixed bugs
This commit is contained in:
parent
16d8069191
commit
587b16e107
|
@ -1,4 +1,6 @@
|
||||||
|
|
||||||
|
window.browser = window.browser || window.chrome;
|
||||||
|
|
||||||
function getCookie() {
|
function getCookie() {
|
||||||
for (const c of document.cookie.split(";")) {
|
for (const c of document.cookie.split(";")) {
|
||||||
while (c.charAt(0) == " ") c = c.substring(1, c.length);
|
while (c.charAt(0) == " ") c = c.substring(1, c.length);
|
||||||
|
|
|
@ -435,12 +435,12 @@ function changeInstance(url) {
|
||||||
return randomInstance;
|
return randomInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isPipedorInvidious(url, details) {
|
function isPipedorInvidious(url, type) {
|
||||||
let protocolHost = `${url.protocol}//${url.host}`;
|
let protocolHost = `${url.protocol}//${url.host}`;
|
||||||
return (details.type === "main_frame" || details.type === "sub_frame") && [
|
return (type === "main_frame" || type === "sub_frame") && [
|
||||||
...redirects.invidious.normal,
|
...redirects.invidious.normal,
|
||||||
...invidiousNormalCustomRedirects,
|
|
||||||
...redirects.invidious.tor,
|
...redirects.invidious.tor,
|
||||||
|
...invidiousNormalCustomRedirects,
|
||||||
...invidiousTorCustomRedirects,
|
...invidiousTorCustomRedirects,
|
||||||
|
|
||||||
...redirects.piped.normal,
|
...redirects.piped.normal,
|
||||||
|
@ -450,9 +450,26 @@ function isPipedorInvidious(url, details) {
|
||||||
].includes(protocolHost);
|
].includes(protocolHost);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isUrlPipedorInvidious(url) {
|
function isUrlPipedorInvidious(url, frontend) {
|
||||||
url = new URL(url);
|
url = new URL(url);
|
||||||
let protocolHost = `${url.protocol}//${url.host}`;
|
let protocolHost = `${url.protocol}//${url.host}`;
|
||||||
|
|
||||||
|
if (frontend == 'invidious')
|
||||||
|
return [
|
||||||
|
...redirects.invidious.normal,
|
||||||
|
...redirects.invidious.tor,
|
||||||
|
...invidiousNormalCustomRedirects,
|
||||||
|
...invidiousTorCustomRedirects,
|
||||||
|
].includes(protocolHost);
|
||||||
|
|
||||||
|
if (frontend == 'piped')
|
||||||
|
return [
|
||||||
|
...redirects.piped.normal,
|
||||||
|
...redirects.piped.tor,
|
||||||
|
...pipedNormalCustomRedirects,
|
||||||
|
...pipedTorCustomRedirects,
|
||||||
|
].includes(protocolHost);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
...redirects.invidious.normal,
|
...redirects.invidious.normal,
|
||||||
...redirects.invidious.tor,
|
...redirects.invidious.tor,
|
||||||
|
@ -463,15 +480,14 @@ function isUrlPipedorInvidious(url) {
|
||||||
...redirects.piped.tor,
|
...redirects.piped.tor,
|
||||||
...pipedNormalCustomRedirects,
|
...pipedNormalCustomRedirects,
|
||||||
...pipedTorCustomRedirects,
|
...pipedTorCustomRedirects,
|
||||||
|
|
||||||
].includes(protocolHost);
|
].includes(protocolHost);
|
||||||
}
|
}
|
||||||
|
|
||||||
function addUrlParams(url) {
|
function addUrlParams(url) {
|
||||||
|
console.log("addUrlParams");
|
||||||
let protocolHost = `${url.protocol}//${url.host}`;
|
let protocolHost = `${url.protocol}//${url.host}`;
|
||||||
let isChanged = false;
|
let isChanged = false;
|
||||||
console.log("protocolHost", protocolHost);
|
console.log("AddingprotocolHost", protocolHost);
|
||||||
console.log([
|
console.log([
|
||||||
...redirects.invidious.normal,
|
...redirects.invidious.normal,
|
||||||
...redirects.invidious.tor,
|
...redirects.invidious.tor,
|
||||||
|
|
|
@ -38,11 +38,5 @@
|
||||||
},
|
},
|
||||||
"web_accessible_resources": [
|
"web_accessible_resources": [
|
||||||
"assets/javascripts/helpers/youtube/invidious-cookies.js"
|
"assets/javascripts/helpers/youtube/invidious-cookies.js"
|
||||||
],
|
]
|
||||||
"browser_specific_settings": {
|
|
||||||
"gecko": {
|
|
||||||
"id": "7esoorv3@alefvanoon.anonaddy.me",
|
|
||||||
"strict_min_version": "67.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -75,6 +75,7 @@ browser.webRequest.onBeforeRequest.addListener(
|
||||||
if (wikipediaHelper.isWikipedia(url, initiator)) newUrl = wikipediaHelper.redirect(url);
|
if (wikipediaHelper.isWikipedia(url, initiator)) newUrl = wikipediaHelper.redirect(url);
|
||||||
|
|
||||||
if (youtubeHelper.isPipedorInvidious(newUrl ?? url, details.type)) newUrl = youtubeHelper.addUrlParams(newUrl ?? url);
|
if (youtubeHelper.isPipedorInvidious(newUrl ?? url, details.type)) newUrl = youtubeHelper.addUrlParams(newUrl ?? url);
|
||||||
|
else console.log("isPipedorInvidiousisFalse");
|
||||||
|
|
||||||
if (bybassTabs.includes(details.tabId)) newUrl = null;
|
if (bybassTabs.includes(details.tabId)) newUrl = null;
|
||||||
|
|
||||||
|
@ -108,6 +109,6 @@ browser.tabs.onRemoved.addListener((tabId) => {
|
||||||
|
|
||||||
browser.tabs.onUpdated.addListener(
|
browser.tabs.onUpdated.addListener(
|
||||||
(tabId, changeInfo) => {
|
(tabId, changeInfo) => {
|
||||||
if (changeInfo.url && youtubeHelper.isUrlPipedorInvidious(changeInfo.url))
|
if (changeInfo.url && youtubeHelper.isUrlPipedorInvidious(changeInfo.url, 'invidious'))
|
||||||
youtubeHelper.invidiousInitCookies(tabId);
|
youtubeHelper.invidiousInitCookies(tabId);
|
||||||
});
|
});
|
|
@ -49,6 +49,7 @@ input[type="text"],
|
||||||
select {
|
select {
|
||||||
padding: 5px 10px;
|
padding: 5px 10px;
|
||||||
width: 350px;
|
width: 350px;
|
||||||
|
font-weight: bold;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
background-color: var(--bg-main);
|
background-color: var(--bg-main);
|
||||||
|
|
Loading…
Reference in New Issue