diff options
Diffstat (limited to 'src/assets')
-rw-r--r-- | src/assets/javascripts/reddit.js | 62 | ||||
-rw-r--r-- | src/assets/javascripts/search.js | 101 | ||||
-rw-r--r-- | src/assets/javascripts/tiktok.js | 24 | ||||
-rw-r--r-- | src/assets/javascripts/translate/translate.js | 51 | ||||
-rw-r--r-- | src/assets/javascripts/twitter.js | 38 | ||||
-rw-r--r-- | src/assets/javascripts/utils.js | 44 | ||||
-rw-r--r-- | src/assets/javascripts/wikipedia.js | 23 | ||||
-rw-r--r-- | src/assets/javascripts/youtube/youtube.js | 75 |
8 files changed, 9 insertions, 409 deletions
diff --git a/src/assets/javascripts/reddit.js b/src/assets/javascripts/reddit.js index 699dcf1a..d1bf7b99 100644 --- a/src/assets/javascripts/reddit.js +++ b/src/assets/javascripts/reddit.js @@ -145,36 +145,6 @@ function initLibredditCookies(test, from) { }) } -function pasteLibredditCookies() { - return new Promise(async resolve => { - await init() - if (disableReddit || redditFrontend != "libreddit" || protocol === undefined) { - resolve() - return - } - let checkedInstances = [] - if (protocol == "loki") checkedInstances = [...libredditLokiCustomRedirects] - 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, "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") - utils.getCookiesFromStorage("libreddit", checkedInstances, "subscriptions") - utils.getCookiesFromStorage("libreddit", checkedInstances, "filters") - resolve() - }) -} - function initTedditCookies(test, from) { return new Promise(async resolve => { await init() @@ -211,36 +181,6 @@ function initTedditCookies(test, from) { }) } -function pasteTedditCookies() { - return new Promise(async resolve => { - await init() - if (disableReddit || redditFrontend != "teddit" || protocol === undefined) { - resolve() - return - } - let checkedInstances = [] - if (protocol == "loki") checkedInstances = [...tedditLokiCustomRedirects] - 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, "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() - }) -} - function all() { return [ ...redditRedirects.libreddit.normal, @@ -442,9 +382,7 @@ function initDefaults() { export default { setRedirects, initLibredditCookies, - pasteLibredditCookies, initTedditCookies, - pasteTedditCookies, redirect, initDefaults, diff --git a/src/assets/javascripts/search.js b/src/assets/javascripts/search.js index b076f5d0..2a5f4867 100644 --- a/src/assets/javascripts/search.js +++ b/src/assets/javascripts/search.js @@ -240,41 +240,6 @@ function initSearxCookies(test, from) { }) } -function pasteSearxCookies() { - return new Promise(async resolve => { - await init() - if (disableSearch || searchFrontend != "searx") { - resolve() - return - } - let checkedInstances = [] - if (protocol == "loki") checkedInstances = [...searxLokiCustomRedirects] - else if (protocol == "i2p") checkedInstances = [...searxI2pCustomRedirects, ...searxI2pRedirectsChecks] - else if (protocol == "tor") checkedInstances = [...searxTorRedirectsChecks, ...searxTorCustomRedirects] - if ((checkedInstances.length === 0 && protocolFallback) || protocol == "normal") { - checkedInstances = [...searxNormalRedirectsChecks, ...searxNormalCustomRedirects] - } - utils.getCookiesFromStorage("searx", checkedInstances, "advanced_search") - utils.getCookiesFromStorage("searx", checkedInstances, "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() - }) -} - function initSearxngCookies(test, from) { return new Promise(async resolve => { await init() @@ -326,43 +291,6 @@ function initSearxngCookies(test, from) { }) } -function pasteSearxngCookies() { - return new Promise(async resolve => { - await init() - if ((disableSearch || searchFrontend != "searxng", protocol === undefined)) { - resolve() - return - } - let checkedInstances = [] - if (protocol == "loki") checkedInstances = [...searxngLokiCustomRedirects] - else if (protocol == "i2p") checkedInstances = [...searxngI2pCustomRedirects, ...searxngI2pRedirectsChecks] - else if (protocol == "tor") checkedInstances = [...searxngTorRedirectsChecks, ...searxngTorCustomRedirects] - if ((checkedInstances.length === 0 && protocolFallback) || protocol == "normal") { - checkedInstances = [...searxngNormalRedirectsChecks, ...searxngNormalCustomRedirects] - } - utils.getCookiesFromStorage("searxng", checkedInstances, "autocomplete") - utils.getCookiesFromStorage("searxng", checkedInstances, "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() - }) -} - function initLibrexCookies(test, from) { return new Promise(async resolve => { await init() @@ -403,32 +331,6 @@ function initLibrexCookies(test, from) { }) } -function pasteLibrexCookies() { - return new Promise(async resolve => { - await init() - if ((disableSearch || searchFrontend != "librex", protocol === undefined)) { - resolve() - return - } - let checkedInstances = [] - if (protocol == "loki") checkedInstances = [...librexLokiCustomRedirects] - else if (protocol == "i2p") checkedInstances = [...librexI2pCustomRedirects, ...librexI2pRedirectsChecks] - else if (protocol == "tor") checkedInstances = [...librexTorRedirectsChecks, ...librexTorCustomRedirects] - if ((checkedInstances.length === 0 && protocolFallback) || protocol == "normal") { - checkedInstances = [...librexNormalRedirectsChecks, ...librexNormalCustomRedirects] - } - utils.getCookiesFromStorage("librex", checkedInstances, "bibliogram") - utils.getCookiesFromStorage("librex", checkedInstances, "disable_special") - utils.getCookiesFromStorage("librex", checkedInstances, "invidious") - utils.getCookiesFromStorage("librex", checkedInstances, "libreddit") - utils.getCookiesFromStorage("librex", checkedInstances, "nitter") - utils.getCookiesFromStorage("librex", checkedInstances, "proxitok") - utils.getCookiesFromStorage("librex", checkedInstances, "theme") - utils.getCookiesFromStorage("librex", checkedInstances, "wikiless") - resolve() - }) -} - function redirect(url, disableOverride) { if (disableSearch && !disableOverride) return if (!targets.some(rx => rx.test(url.href))) return @@ -691,11 +593,8 @@ function initDefaults() { export default { setRedirects, initSearxCookies, - pasteSearxCookies, initSearxngCookies, - pasteSearxngCookies, initLibrexCookies, - pasteLibrexCookies, redirect, initDefaults, switchInstance, diff --git a/src/assets/javascripts/tiktok.js b/src/assets/javascripts/tiktok.js index ba4a9ff1..9d2660d4 100644 --- a/src/assets/javascripts/tiktok.js +++ b/src/assets/javascripts/tiktok.js @@ -62,26 +62,6 @@ function initProxiTokCookies(test, from) { }) } -function pasteProxiTokCookies() { - return new Promise(async resolve => { - await init() - if (disableTiktok || protocol === undefined) { - resolve() - return - } - let checkedInstances = [] - if (protocol == "loki") checkedInstances = [...proxiTokI2pCustomRedirects] - else if (protocol == "i2p") checkedInstances = [...proxiTokLokiCustomRedirects] - else if (protocol == "tor") checkedInstances = [...proxiTokTorRedirectsChecks, ...proxiTokTorCustomRedirects] - if ((checkedInstances.length === 0 && protocolFallback) || protocol == "normal") { - checkedInstances = [...proxiTokNormalRedirectsChecks, ...proxiTokNormalCustomRedirects] - } - utils.getCookiesFromStorage("proxitok", checkedInstances, "theme") - utils.getCookiesFromStorage("proxitok", checkedInstances, "api-legacy") - resolve() - }) -} - let disableTiktok, protocol, protocolFallback, @@ -248,13 +228,9 @@ function initDefaults() { export default { setRedirects, - redirect, reverse, switchInstance, - initProxiTokCookies, - pasteProxiTokCookies, - initDefaults, } diff --git a/src/assets/javascripts/translate/translate.js b/src/assets/javascripts/translate/translate.js index 5512f7f1..893be4e2 100644 --- a/src/assets/javascripts/translate/translate.js +++ b/src/assets/javascripts/translate/translate.js @@ -160,33 +160,6 @@ function copyPasteLingvaLocalStorage(test, url, tabId) { }) } -function pasteLingvaLocalStorage() { - return new Promise(async resolve => { - await init() - if (translateDisable || translateFrontend != "lingva") { - resolve() - return - } - let checkedInstances = [] - 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") { - checkedInstances = [...lingvaNormalRedirectsChecks, ...lingvaNormalCustomRedirects] - } - for (const to of checkedInstances) - browser.tabs.create({ url: to }, tab => - browser.tabs.executeScript(tab.id, { - file: "/assets/javascripts/translate/set_lingva_preferences.js", - runAt: "document_start", - }) - ) - resolve() - }) -} - function copyPasteSimplyTranslateCookies(test, from) { return new Promise(async resolve => { await init() @@ -223,28 +196,6 @@ function copyPasteSimplyTranslateCookies(test, from) { }) } -function pasteSimplyTranslateCookies() { - return new Promise(async resolve => { - await init() - if (translateDisable || translateFrontend != "simplyTranslate") { - resolve() - return - } - let checkedInstances = [] - if (protocol == "loki") checkedInstances = [...simplyTranslateLokiRedirectsChecks, ...simplyTranslateLokiCustomRedirects] - else if (protocol == "i2p") checkedInstances = [...simplyTranslateI2pCustomRedirects, ...simplyTranslateI2pRedirectsChecks] - else if (protocol == "tor") checkedInstances = [...simplyTranslateTorRedirectsChecks, ...simplyTranslateTorCustomRedirects] - if ((checkedInstances.length === 0 && protocolFallback) || protocol == "normal") { - checkedInstances = [...simplyTranslateNormalRedirectsChecks, ...simplyTranslateNormalCustomRedirects] - } - 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() - }) -} - function redirect(url, disableOverride) { if (translateDisable && !disableOverride) return if (!targets.some(rx => rx.test(url.href))) return @@ -403,9 +354,7 @@ function initDefaults() { export default { copyPasteSimplyTranslateCookies, - pasteSimplyTranslateCookies, copyPasteLingvaLocalStorage, - pasteLingvaLocalStorage, setRedirects, redirect, initDefaults, diff --git a/src/assets/javascripts/twitter.js b/src/assets/javascripts/twitter.js index 1ec4d8eb..b3c33560 100644 --- a/src/assets/javascripts/twitter.js +++ b/src/assets/javascripts/twitter.js @@ -215,43 +215,6 @@ function initNitterCookies(test, from) { }) } -function pasteNitterCookies() { - return new Promise(async resolve => { - await init() - if (disableTwitter || protocol === undefined) { - resolve() - return - } - let checkedInstances = [] - 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") { - checkedInstances = [...nitterNormalRedirectsChecks, ...nitterNormalCustomRedirects] - } - 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") - - utils.getCookiesFromStorage("nitter", checkedInstances, "replaceInstagram") - utils.getCookiesFromStorage("nitter", checkedInstances, "replaceReddit") - utils.getCookiesFromStorage("nitter", checkedInstances, "replaceTwitter") - utils.getCookiesFromStorage("nitter", checkedInstances, "replaceYouTube") - resolve() - }) -} - function initDefaults() { return new Promise(resolve => { fetch("/instances/data.json") @@ -299,6 +262,5 @@ export default { reverse, removeXFrameOptions, initNitterCookies, - pasteNitterCookies, initDefaults, } diff --git a/src/assets/javascripts/utils.js b/src/assets/javascripts/utils.js index f070deca..e9a30400 100644 --- a/src/assets/javascripts/utils.js +++ b/src/assets/javascripts/utils.js @@ -302,7 +302,11 @@ function copyCookie(frontend, targetUrl, urls, name) { return new Promise(resolve => { browser.storage.local.get("firstPartyIsolate", r => { let query - if (!r.firstPartyIsolate) query = { url: protocolHost(targetUrl), name: name } + if (!r.firstPartyIsolate) + query = { + url: protocolHost(targetUrl), + name: name, + } else query = { url: protocolHost(targetUrl), @@ -328,7 +332,7 @@ function copyCookie(frontend, targetUrl, urls, name) { secure: true, expirationDate: cookie.expirationDate, } - browser.cookies.set(setQuery, () => browser.storage.local.set({ [`${frontend}_${name}`]: cookie }, () => resolve())) + browser.cookies.set(setQuery) } break } @@ -338,33 +342,6 @@ function copyCookie(frontend, targetUrl, urls, name) { }) } -function getCookiesFromStorage(frontend, urls, name) { - let key = `${frontend}_${name}` - browser.storage.local.get([key, "firstPartyIsolate"], r => { - const cookie = r[key] - if (cookie === undefined) return - for (const url of urls) { - let query = r.firstPartyIsolate - ? { - url: url, - name: cookie.name, - value: cookie.value, - secure: true, - expirationDate: null, - firstPartyDomain: new URL(url).hostname, - } - : { - url: url, - name: cookie.name, - value: cookie.value, - secure: true, - expirationDate: cookie.expirationDate, - } - browser.cookies.set(query) - } - }) -} - function getPreferencesFromToken(frontend, targetUrl, urls, name, endpoint) { return new Promise(resolve => { browser.storage.local.get("firstPartyIsolate", r => { @@ -437,10 +414,6 @@ function unify(test) { resolve() return } - if (currTab.incognito) { - resolve() - return - } let result = await youtubeHelper.copyPasteInvidiousCookies(test, url) if (!result) result = await youtubeHelper.copyPastePipedLocalStorage(test, url, currTab.id) @@ -503,8 +476,8 @@ function switchInstance(test) { } function latency(name, frontend, document, location) { - let latencyElement = document.getElementById(`latency - ${frontend} `) - let latencyLabel = document.getElementById(`latency - ${frontend} -label`) + let latencyElement = document.getElementById(`latency-${frontend}`) + let latencyLabel = document.getElementById(`latency-${frontend}-label`) latencyElement.addEventListener("click", async () => { let reloadWindow = () => location.reload() latencyElement.addEventListener("click", reloadWindow) @@ -530,7 +503,6 @@ export default { processDefaultCustomInstances, latency, copyCookie, - getCookiesFromStorage, getPreferencesFromToken, switchInstance, copyRaw, diff --git a/src/assets/javascripts/wikipedia.js b/src/assets/javascripts/wikipedia.js index cf19b208..04191d1a 100644 --- a/src/assets/javascripts/wikipedia.js +++ b/src/assets/javascripts/wikipedia.js @@ -113,26 +113,6 @@ function initWikilessCookies(test, from) { }) } -function pasteWikilessCookies() { - return new Promise(async resolve => { - await init() - if (disableWikipedia || protocol === undefined) { - resolve() - return - } - let checkedInstances = [] - if (protocol == "loki") checkedInstances = [...wikilessLokiCustomRedirects] - else if (protocol == "i2p") checkedInstances = [...wikilessI2pCustomRedirects, ...wikilessI2pRedirectsChecks] - else if (protocol == "tor") checkedInstances = [...wikilessTorRedirectsChecks, ...wikilessTorCustomRedirects] - if ((checkedInstances.length === 0 && protocolFallback) || protocol == "normal") { - checkedInstances = [...wikilessNormalRedirectsChecks, ...wikilessNormalCustomRedirects] - } - utils.getCookiesFromStorage("wikiless", checkedInstances, "theme") - utils.getCookiesFromStorage("wikiless", checkedInstances, "default_lang") - resolve() - }) -} - function redirect(url, disableOverride) { if (disableWikipedia && !disableOverride) return if (!targets.test(url.href)) return @@ -252,10 +232,7 @@ function initDefaults() { export default { setRedirects, - initWikilessCookies, - pasteWikilessCookies, - redirect, initDefaults, switchInstance, diff --git a/src/assets/javascripts/youtube/youtube.js b/src/assets/javascripts/youtube/youtube.js index e8a77ff6..7e02dcd2 100644 --- a/src/assets/javascripts/youtube/youtube.js +++ b/src/assets/javascripts/youtube/youtube.js @@ -573,25 +573,6 @@ function copyPasteInvidiousCookies(test, from) { }) } -function pasteInvidiousCookies() { - return new Promise(async resolve => { - await init() - if (disableYoutube || youtubeFrontend != "invidious") { - resolve() - return - } - let checkedInstances = [] - if (protocol == "loki") checkedInstances = [...invidiousLokiCustomRedirects] - else if (protocol == "i2p") checkedInstances = [...invidiousI2pCustomRedirects] - else if (protocol == "tor") checkedInstances = [...invidiousTorRedirectsChecks, ...invidiousTorCustomRedirects] - if ((checkedInstances.length === 0 && protocolFallback) || protocol == "normal") { - checkedInstances = [...invidiousNormalRedirectsChecks, ...invidiousNormalCustomRedirects] - } - utils.getCookiesFromStorage("invidious", checkedInstances, "PREFS") - resolve() - }) -} - function copyPastePipedLocalStorage(test, url, tabId) { return new Promise(async resolve => { await init() @@ -619,7 +600,7 @@ function copyPastePipedLocalStorage(test, url, tabId) { 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 ((checkedInstances.length === 0 && protocolFallback) || protocol == "normal") { checkedInstances = [...pipedNormalCustomRedirects, ...pipedNormalRedirectsChecks] } const i = checkedInstances.indexOf(protocolHost) @@ -636,31 +617,6 @@ function copyPastePipedLocalStorage(test, url, tabId) { resolve(true) }) } -function pastePipedLocalStorage() { - return new Promise(async resolve => { - await init() - if (disableYoutube || youtubeFrontend != "piped") { - resolve() - return - } - let checkedInstances = [] - 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") { - checkedInstances = [...pipedNormalCustomRedirects, ...pipedNormalRedirectsChecks] - } - for (const to of checkedInstances) { - browser.tabs.create({ url: to }, tab => - browser.tabs.executeScript(tab.id, { - file: "/assets/javascripts/youtube/set_piped_preferences.js", - runAt: "document_start", - }) - ) - } - resolve() - }) -} function copyPastePipedMaterialLocalStorage(test, url, tabId) { return new Promise(async resolve => { @@ -711,32 +667,6 @@ function copyPastePipedMaterialLocalStorage(test, url, tabId) { }) } -function pastePipedMaterialLocalStorage() { - return new Promise(async resolve => { - await init() - if (disableYoutube || youtubeFrontend != "pipedMaterial") { - resolve() - return - } - let checkedInstances = [] - if (protocol == "loki") checkedInstances = [...pipedMaterialLokiCustomRedirects] - else if (protocol == "i2p") checkedInstances = [...pipedMaterialI2pCustomRedirects] - else if (protocol == "tor") checkedInstances = [...pipedMaterialTorCustomRedirects] //...pipedMaterialTorRedirectsChecks, - if ((instancesList.length === 0 && protocolFallback) || protocol == "normal") { - checkedInstances = [...pipedMaterialNormalRedirectsChecks, ...pipedMaterialNormalCustomRedirects] - } - for (const to of checkedInstances) { - browser.tabs.create({ url: to }, tab => - browser.tabs.executeScript(tab.id, { - file: "/assets/javascripts/youtube/set_pipedMaterial_preferences.js", - runAt: "document_start", - }) - ) - } - resolve() - }) -} - function removeXFrameOptions(e) { let isChanged = false @@ -843,11 +773,8 @@ function removeXFrameOptions(e) { export default { setRedirects, copyPastePipedLocalStorage, - pastePipedLocalStorage, copyPastePipedMaterialLocalStorage, - pastePipedMaterialLocalStorage, copyPasteInvidiousCookies, - pasteInvidiousCookies, redirect, reverse, switchInstance, |