Fixing not working in Tor #291
This commit is contained in:
parent
663085de63
commit
ff9d4b0a9d
|
@ -126,18 +126,16 @@ function setLibredditCookies() {
|
|||
let checkedInstances;
|
||||
if (redditProtocol == 'normal') checkedInstances = [...libredditNormalRedirectsChecks, ...libredditNormalCustomRedirects]
|
||||
else if (redditProtocol == 'tor') checkedInstances = [...libredditTorRedirectsChecks, ...libredditTorCustomRedirects]
|
||||
for (const to of checkedInstances) {
|
||||
utils.getCookiesFromStorage('libreddit', to, "theme");
|
||||
utils.getCookiesFromStorage('libreddit', to, "front_page");
|
||||
utils.getCookiesFromStorage('libreddit', to, "layout");
|
||||
utils.getCookiesFromStorage('libreddit', to, "wide");
|
||||
utils.getCookiesFromStorage('libreddit', to, "post_sort");
|
||||
utils.getCookiesFromStorage('libreddit', to, "comment_sort");
|
||||
utils.getCookiesFromStorage('libreddit', to, "show_nsfw");
|
||||
utils.getCookiesFromStorage('libreddit', to, "autoplay_videos");
|
||||
utils.getCookiesFromStorage('libreddit', to, "use_hls");
|
||||
utils.getCookiesFromStorage('libreddit', to, "hide_hls_notification");
|
||||
}
|
||||
utils.getCookiesFromStorage('libreddit', checkedInstances, "theme");
|
||||
utils.getCookiesFromStorage('libreddit', checkedInstances, "front_page");
|
||||
utils.getCookiesFromStorage('libreddit', checkedInstances, "layout");
|
||||
utils.getCookiesFromStorage('libreddit', checkedInstances, "wide");
|
||||
utils.getCookiesFromStorage('libreddit', checkedInstances, "post_sort");
|
||||
utils.getCookiesFromStorage('libreddit', checkedInstances, "comment_sort");
|
||||
utils.getCookiesFromStorage('libreddit', checkedInstances, "show_nsfw");
|
||||
utils.getCookiesFromStorage('libreddit', checkedInstances, "autoplay_videos");
|
||||
utils.getCookiesFromStorage('libreddit', checkedInstances, "use_hls");
|
||||
utils.getCookiesFromStorage('libreddit', checkedInstances, "hide_hls_notification");
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
|
@ -181,20 +179,18 @@ function setTedditCookies() {
|
|||
let checkedInstances;
|
||||
if (redditProtocol == 'normal') checkedInstances = [...tedditNormalRedirectsChecks, ...tedditNormalCustomRedirects]
|
||||
else if (redditProtocol == 'tor') checkedInstances = [...tedditTorRedirectsChecks, ...tedditTorCustomRedirects]
|
||||
for (const to of checkedInstances) {
|
||||
utils.getCookiesFromStorage('teddit', to, 'collapse_child_comments')
|
||||
utils.getCookiesFromStorage('teddit', to, 'domain_instagram')
|
||||
utils.getCookiesFromStorage('teddit', to, 'domain_twitter')
|
||||
utils.getCookiesFromStorage('teddit', to, 'domain_youtube')
|
||||
utils.getCookiesFromStorage('teddit', to, 'flairs')
|
||||
utils.getCookiesFromStorage('teddit', to, 'highlight_controversial')
|
||||
utils.getCookiesFromStorage('teddit', to, 'nsfw_enabled')
|
||||
utils.getCookiesFromStorage('teddit', to, 'post_media_max_height')
|
||||
utils.getCookiesFromStorage('teddit', to, 'show_upvoted_percentage')
|
||||
utils.getCookiesFromStorage('teddit', to, 'show_upvotes')
|
||||
utils.getCookiesFromStorage('teddit', to, 'theme')
|
||||
utils.getCookiesFromStorage('teddit', to, 'videos_muted')
|
||||
}
|
||||
utils.getCookiesFromStorage('teddit', checkedInstances, 'collapse_child_comments')
|
||||
utils.getCookiesFromStorage('teddit', checkedInstances, 'domain_instagram')
|
||||
utils.getCookiesFromStorage('teddit', checkedInstances, 'domain_twitter')
|
||||
utils.getCookiesFromStorage('teddit', checkedInstances, 'domain_youtube')
|
||||
utils.getCookiesFromStorage('teddit', checkedInstances, 'flairs')
|
||||
utils.getCookiesFromStorage('teddit', checkedInstances, 'highlight_controversial')
|
||||
utils.getCookiesFromStorage('teddit', checkedInstances, 'nsfw_enabled')
|
||||
utils.getCookiesFromStorage('teddit', checkedInstances, 'post_media_max_height')
|
||||
utils.getCookiesFromStorage('teddit', checkedInstances, 'show_upvoted_percentage')
|
||||
utils.getCookiesFromStorage('teddit', checkedInstances, 'show_upvotes')
|
||||
utils.getCookiesFromStorage('teddit', checkedInstances, 'theme')
|
||||
utils.getCookiesFromStorage('teddit', checkedInstances, 'videos_muted')
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
|
|
|
@ -182,25 +182,23 @@ function setSearxCookies() {
|
|||
let checkedInstances;
|
||||
if (searchProtocol == 'normal') checkedInstances = [...searxNormalRedirectsChecks, ...searxNormalCustomRedirects]
|
||||
else if (searchProtocol == 'tor') checkedInstances = [...searxTorRedirectsChecks, ...searxTorCustomRedirects]
|
||||
for (const to of checkedInstances) {
|
||||
utils.getCookiesFromStorage('searx', to, 'advanced_search');
|
||||
utils.getCookiesFromStorage('searx', to, 'autocomplete');
|
||||
utils.getCookiesFromStorage('searx', to, 'categories');
|
||||
utils.getCookiesFromStorage('searx', to, 'disabled_engines');
|
||||
utils.getCookiesFromStorage('searx', to, 'disabled_plugins');
|
||||
utils.getCookiesFromStorage('searx', to, 'doi_resolver');
|
||||
utils.getCookiesFromStorage('searx', to, 'enabled_engines');
|
||||
utils.getCookiesFromStorage('searx', to, 'enabled_plugins');
|
||||
utils.getCookiesFromStorage('searx', to, 'image_proxy');
|
||||
utils.getCookiesFromStorage('searx', to, 'language');
|
||||
utils.getCookiesFromStorage('searx', to, 'locale');
|
||||
utils.getCookiesFromStorage('searx', to, 'method');
|
||||
utils.getCookiesFromStorage('searx', to, 'oscar-style');
|
||||
utils.getCookiesFromStorage('searx', to, 'results_on_new_tab');
|
||||
utils.getCookiesFromStorage('searx', to, 'safesearch');
|
||||
utils.getCookiesFromStorage('searx', to, 'theme');
|
||||
utils.getCookiesFromStorage('searx', to, 'tokens');
|
||||
}
|
||||
utils.getCookiesFromStorage('searx', checkedInstances, 'advanced_search');
|
||||
utils.getCookiesFromStorage('searx', checkedInstances, 'autocomplete');
|
||||
utils.getCookiesFromStorage('searx', checkedInstances, 'categories');
|
||||
utils.getCookiesFromStorage('searx', checkedInstances, 'disabled_engines');
|
||||
utils.getCookiesFromStorage('searx', checkedInstances, 'disabled_plugins');
|
||||
utils.getCookiesFromStorage('searx', checkedInstances, 'doi_resolver');
|
||||
utils.getCookiesFromStorage('searx', checkedInstances, 'enabled_engines');
|
||||
utils.getCookiesFromStorage('searx', checkedInstances, 'enabled_plugins');
|
||||
utils.getCookiesFromStorage('searx', checkedInstances, 'image_proxy');
|
||||
utils.getCookiesFromStorage('searx', checkedInstances, 'language');
|
||||
utils.getCookiesFromStorage('searx', checkedInstances, 'locale');
|
||||
utils.getCookiesFromStorage('searx', checkedInstances, 'method');
|
||||
utils.getCookiesFromStorage('searx', checkedInstances, 'oscar-style');
|
||||
utils.getCookiesFromStorage('searx', checkedInstances, 'results_on_new_tab');
|
||||
utils.getCookiesFromStorage('searx', checkedInstances, 'safesearch');
|
||||
utils.getCookiesFromStorage('searx', checkedInstances, 'theme');
|
||||
utils.getCookiesFromStorage('searx', checkedInstances, 'tokens');
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
|
@ -254,27 +252,25 @@ function setSearxngCookies() {
|
|||
let checkedInstances;
|
||||
if (searchProtocol == 'normal') checkedInstances = [...searxngNormalRedirectsChecks, ...searxngNormalCustomRedirects]
|
||||
else if (searchProtocol == 'tor') checkedInstances = [...searxngTorRedirectsChecks, ...searxngTorCustomRedirects]
|
||||
for (const to of checkedInstances) {
|
||||
utils.getCookiesFromStorage('searxng', to, 'autocomplete');
|
||||
utils.getCookiesFromStorage('searxng', to, 'categories');
|
||||
utils.getCookiesFromStorage('searxng', to, 'disabled_engines');
|
||||
utils.getCookiesFromStorage('searxng', to, 'disabled_plugins');
|
||||
utils.getCookiesFromStorage('searxng', to, 'doi_resolver');
|
||||
utils.getCookiesFromStorage('searxng', to, 'enabled_plugins');
|
||||
utils.getCookiesFromStorage('searxng', to, 'enabled_engines');
|
||||
utils.getCookiesFromStorage('searxng', to, 'image_proxy');
|
||||
utils.getCookiesFromStorage('searxng', to, 'infinite_scroll');
|
||||
utils.getCookiesFromStorage('searxng', to, 'language');
|
||||
utils.getCookiesFromStorage('searxng', to, 'locale');
|
||||
utils.getCookiesFromStorage('searxng', to, 'maintab');
|
||||
utils.getCookiesFromStorage('searxng', to, 'method');
|
||||
utils.getCookiesFromStorage('searxng', to, 'query_in_title');
|
||||
utils.getCookiesFromStorage('searxng', to, 'results_on_new_tab');
|
||||
utils.getCookiesFromStorage('searxng', to, 'safesearch');
|
||||
utils.getCookiesFromStorage('searxng', to, 'simple_style');
|
||||
utils.getCookiesFromStorage('searxng', to, 'theme');
|
||||
utils.getCookiesFromStorage('searxng', to, 'tokens');
|
||||
}
|
||||
utils.getCookiesFromStorage('searxng', checkedInstances, 'autocomplete');
|
||||
utils.getCookiesFromStorage('searxng', checkedInstances, 'categories');
|
||||
utils.getCookiesFromStorage('searxng', checkedInstances, 'disabled_engines');
|
||||
utils.getCookiesFromStorage('searxng', checkedInstances, 'disabled_plugins');
|
||||
utils.getCookiesFromStorage('searxng', checkedInstances, 'doi_resolver');
|
||||
utils.getCookiesFromStorage('searxng', checkedInstances, 'enabled_plugins');
|
||||
utils.getCookiesFromStorage('searxng', checkedInstances, 'enabled_engines');
|
||||
utils.getCookiesFromStorage('searxng', checkedInstances, 'image_proxy');
|
||||
utils.getCookiesFromStorage('searxng', checkedInstances, 'infinite_scroll');
|
||||
utils.getCookiesFromStorage('searxng', checkedInstances, 'language');
|
||||
utils.getCookiesFromStorage('searxng', checkedInstances, 'locale');
|
||||
utils.getCookiesFromStorage('searxng', checkedInstances, 'maintab');
|
||||
utils.getCookiesFromStorage('searxng', checkedInstances, 'method');
|
||||
utils.getCookiesFromStorage('searxng', checkedInstances, 'query_in_title');
|
||||
utils.getCookiesFromStorage('searxng', checkedInstances, 'results_on_new_tab');
|
||||
utils.getCookiesFromStorage('searxng', checkedInstances, 'safesearch');
|
||||
utils.getCookiesFromStorage('searxng', checkedInstances, 'simple_style');
|
||||
utils.getCookiesFromStorage('searxng', checkedInstances, 'theme');
|
||||
utils.getCookiesFromStorage('searxng', checkedInstances, 'tokens');
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
|
|
|
@ -56,10 +56,8 @@ function setProxiTokCookies() {
|
|||
let checkedInstances;
|
||||
if (tiktokProtocol == 'normal') checkedInstances = [...proxiTokNormalRedirectsChecks, ...proxiTokNormalCustomRedirects]
|
||||
else if (tiktokProtocol == 'tor') checkedInstances = [...proxiTokTorRedirectsChecks, ...proxiTokTorCustomRedirects]
|
||||
for (const to of checkedInstances) {
|
||||
utils.getCookiesFromStorage('proxitok', to, 'theme');
|
||||
utils.getCookiesFromStorage('proxitok', to, 'api-legacy');
|
||||
}
|
||||
utils.getCookiesFromStorage('proxitok', checkedInstances, 'theme');
|
||||
utils.getCookiesFromStorage('proxitok', checkedInstances, 'api-legacy');
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
|
|
|
@ -160,12 +160,10 @@ function setSimplyTranslateCookies() {
|
|||
let checkedInstances;
|
||||
if (translateProtocol == 'normal') checkedInstances = [...simplyTranslateNormalRedirectsChecks, ...simplyTranslateNormalCustomRedirects]
|
||||
else if (translateProtocol == 'tor') checkedInstances = [...simplyTranslateTorRedirectsChecks, ...simplyTranslateTorCustomRedirects]
|
||||
for (const to of checkedInstances) {
|
||||
utils.getCookiesFromStorage('simplyTranslate', to, 'from_lang');
|
||||
utils.getCookiesFromStorage('simplyTranslate', to, 'to_lang');
|
||||
utils.getCookiesFromStorage('simplyTranslate', to, 'tts_enabled');
|
||||
utils.getCookiesFromStorage('simplyTranslate', to, 'use_text_fields');
|
||||
}
|
||||
utils.getCookiesFromStorage('simplyTranslate', checkedInstances, 'from_lang');
|
||||
utils.getCookiesFromStorage('simplyTranslate', checkedInstances, 'to_lang');
|
||||
utils.getCookiesFromStorage('simplyTranslate', checkedInstances, 'tts_enabled');
|
||||
utils.getCookiesFromStorage('simplyTranslate', checkedInstances, 'use_text_fields');
|
||||
resolve();
|
||||
}
|
||||
)
|
||||
|
|
|
@ -177,22 +177,20 @@ function setNitterCookies() {
|
|||
let checkedInstances;
|
||||
if (twitterProtocol == 'normal') checkedInstances = [...nitterNormalRedirectsChecks, ...nitterNormalCustomRedirects]
|
||||
else if (twitterProtocol == 'tor') checkedInstances = [...nitterTorRedirectsChecks, ...nitterTorCustomRedirects]
|
||||
for (const to of checkedInstances) {
|
||||
utils.getCookiesFromStorage('nitter', to, 'theme');
|
||||
utils.getCookiesFromStorage('nitter', to, 'infiniteScroll');
|
||||
utils.getCookiesFromStorage('nitter', to, 'stickyProfile');
|
||||
utils.getCookiesFromStorage('nitter', to, 'bidiSupport');
|
||||
utils.getCookiesFromStorage('nitter', to, 'hideTweetStats');
|
||||
utils.getCookiesFromStorage('nitter', to, 'hideBanner');
|
||||
utils.getCookiesFromStorage('nitter', to, 'hidePins');
|
||||
utils.getCookiesFromStorage('nitter', to, 'hideReplies');
|
||||
utils.getCookiesFromStorage('nitter', to, 'squareAvatars');
|
||||
utils.getCookiesFromStorage('nitter', to, 'mp4Playback');
|
||||
utils.getCookiesFromStorage('nitter', to, 'hlsPlayback');
|
||||
utils.getCookiesFromStorage('nitter', to, 'proxyVideos');
|
||||
utils.getCookiesFromStorage('nitter', to, 'muteVideos');
|
||||
utils.getCookiesFromStorage('nitter', to, 'autoplayGifs');
|
||||
}
|
||||
utils.getCookiesFromStorage('nitter', checkedInstances, 'theme');
|
||||
utils.getCookiesFromStorage('nitter', checkedInstances, 'infiniteScroll');
|
||||
utils.getCookiesFromStorage('nitter', checkedInstances, 'stickyProfile');
|
||||
utils.getCookiesFromStorage('nitter', checkedInstances, 'bidiSupport');
|
||||
utils.getCookiesFromStorage('nitter', checkedInstances, 'hideTweetStats');
|
||||
utils.getCookiesFromStorage('nitter', checkedInstances, 'hideBanner');
|
||||
utils.getCookiesFromStorage('nitter', checkedInstances, 'hidePins');
|
||||
utils.getCookiesFromStorage('nitter', checkedInstances, 'hideReplies');
|
||||
utils.getCookiesFromStorage('nitter', checkedInstances, 'squareAvatars');
|
||||
utils.getCookiesFromStorage('nitter', checkedInstances, 'mp4Playback');
|
||||
utils.getCookiesFromStorage('nitter', checkedInstances, 'hlsPlayback');
|
||||
utils.getCookiesFromStorage('nitter', checkedInstances, 'proxyVideos');
|
||||
utils.getCookiesFromStorage('nitter', checkedInstances, 'muteVideos');
|
||||
utils.getCookiesFromStorage('nitter', checkedInstances, 'autoplayGifs');
|
||||
resolve();
|
||||
}
|
||||
)
|
||||
|
|
|
@ -282,28 +282,58 @@ async function testLatency(element, instances) {
|
|||
|
||||
function copyCookie(frontend, targetUrl, urls, name) {
|
||||
return new Promise(resolve => {
|
||||
browser.cookies.get(
|
||||
{ url: protocolHost(targetUrl), name: name },
|
||||
async r => {
|
||||
function setCookies(url, name, value) {
|
||||
return new Promise(resolve => browser.cookies.set({ url: url, name: name, value: value }, () => resolve()))
|
||||
}
|
||||
if (r) {
|
||||
console.log(name, r.value);
|
||||
for (const url of urls) await setCookies(url, name, r.value)
|
||||
browser.storage.local.set({ [`${frontend}_${name}`]: r.value }, () => resolve())
|
||||
} else resolve();
|
||||
}
|
||||
)
|
||||
browser.cookies.getAll(
|
||||
{ url: protocolHost(targetUrl), name: name, firstPartyDomain: null },
|
||||
cookies => {
|
||||
browser.privacy.websites.firstPartyIsolate.get({},
|
||||
async firstPartyIsolate => {
|
||||
function setCookie(url, name, value, expirationDate) {
|
||||
console.log('firstPartyDomain', firstPartyIsolate.value ? new URL(url).hostname : '')
|
||||
return new Promise(resolve =>
|
||||
browser.cookies.set(
|
||||
{
|
||||
url: url,
|
||||
name: name,
|
||||
value: value,
|
||||
firstPartyDomain: firstPartyIsolate.value ? new URL(url).hostname : '',
|
||||
expirationDate: expirationDate,
|
||||
},
|
||||
() => resolve()
|
||||
)
|
||||
)
|
||||
}
|
||||
for (const cookie of cookies)
|
||||
if (cookie.name == name) {
|
||||
console.log('cookie', cookie);
|
||||
for (const url of urls) await setCookie(url, cookie.name, cookie.value, cookie.expirationDate)
|
||||
browser.storage.local.set({ [`${frontend}_${name}`]: cookie }, () => resolve())
|
||||
break;
|
||||
}
|
||||
resolve();
|
||||
}
|
||||
)
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
function getCookiesFromStorage(frontend, to, name) {
|
||||
function getCookiesFromStorage(frontend, urls, name) {
|
||||
let key = `${frontend}_${name}`;
|
||||
browser.storage.local.get(
|
||||
key,
|
||||
r => {
|
||||
if (r[key] !== undefined) browser.cookies.set({ url: to, name: name, value: r[key] })
|
||||
const cookie = r[key];
|
||||
if (cookie !== undefined)
|
||||
browser.privacy.websites.firstPartyIsolate.get({},
|
||||
firstPartyIsolate => {
|
||||
for (const url of urls)
|
||||
browser.cookies.set({
|
||||
url: url,
|
||||
name: cookie.name,
|
||||
value: cookie.value,
|
||||
expirationDate: cookie.expirationDate,
|
||||
firstPartyDomain: firstPartyIsolate.value ? new URL(url).hostname : '',
|
||||
})
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
|
@ -104,10 +104,8 @@ function setWikilessCookies() {
|
|||
let checkedInstances;
|
||||
if (wikipediaProtocol == 'normal') checkedInstances = [...wikilessNormalRedirectsChecks, ...wikilessNormalCustomRedirects]
|
||||
else if (wikipediaProtocol == 'tor') checkedInstances = [...wikilessTorRedirectsChecks, ...wikilessTorCustomRedirects]
|
||||
for (const to of checkedInstances) {
|
||||
utils.getCookiesFromStorage('wikiless', to, 'theme');
|
||||
utils.getCookiesFromStorage('wikiless', to, 'default_lang');
|
||||
}
|
||||
utils.getCookiesFromStorage('wikiless', checkedInstances, 'theme');
|
||||
utils.getCookiesFromStorage('wikiless', checkedInstances, 'default_lang');
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
|
|
|
@ -328,8 +328,7 @@ function setInvidiousCookies() {
|
|||
let checkedInstances;
|
||||
if (youtubeProtocol == 'normal') checkedInstances = [...invidiousNormalRedirectsChecks, ...invidiousNormalCustomRedirects]
|
||||
else if (youtubeProtocol == 'tor') checkedInstances = [...invidiousTorRedirectsChecks, ...invidiousTorCustomRedirects]
|
||||
for (const to of checkedInstances)
|
||||
utils.getCookiesFromStorage('invidious', to, 'PREFS');
|
||||
utils.getCookiesFromStorage('invidious', checkedInstances, 'PREFS');
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
"storage",
|
||||
"unlimitedStorage",
|
||||
"cookies",
|
||||
"browserSettings",
|
||||
"privacy",
|
||||
"contextMenus",
|
||||
"<all_urls>"
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue