Unify won't save in storage anymore. Fixed Piped Unify
This commit is contained in:
parent
c3a5208fdc
commit
e618299a04
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
|
|
|
@ -339,7 +339,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),
|
||||
|
@ -365,7 +369,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
|
||||
}
|
||||
|
@ -375,33 +379,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 => {
|
||||
|
@ -474,10 +451,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)
|
||||
|
@ -540,8 +513,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)
|
||||
|
@ -567,7 +540,6 @@ export default {
|
|||
processDefaultCustomInstances,
|
||||
latency,
|
||||
copyCookie,
|
||||
getCookiesFromStorage,
|
||||
getPreferencesFromToken,
|
||||
switchInstance,
|
||||
copyRaw,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -71,17 +71,6 @@ browser.runtime.onInstalled.addListener(details => {
|
|||
// }
|
||||
})
|
||||
|
||||
youtubeHelper.pasteInvidiousCookies()
|
||||
translateHelper.pasteSimplyTranslateCookies()
|
||||
twitterHelper.pasteNitterCookies()
|
||||
wikipediaHelper.pasteWikilessCookies()
|
||||
searchHelper.pasteSearxCookies()
|
||||
searchHelper.pasteSearxngCookies()
|
||||
searchHelper.pasteLibrexCookies()
|
||||
redditHelper.pasteLibredditCookies()
|
||||
redditHelper.pasteTedditCookies()
|
||||
tiktokHelper.pasteProxiTokCookies()
|
||||
|
||||
let BYPASSTABs = []
|
||||
browser.webRequest.onBeforeRequest.addListener(
|
||||
details => {
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta charset="UTF-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title data-localise="__MSG_instanceIsOff__">Initializing Cookies</title>
|
||||
<link href="../stylesheets/styles.css" rel="stylesheet" />
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 30px;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
div {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div>
|
||||
<p>Initializing Cookies...</p>
|
||||
</div>
|
||||
<script type="module" src="incognito.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,22 +0,0 @@
|
|||
import youtubeHelper from "../../assets/javascripts/youtube/youtube.js"
|
||||
import twitterHelper from "../../assets/javascripts/twitter.js"
|
||||
import redditHelper from "../../assets/javascripts/reddit.js"
|
||||
import searchHelper from "../../assets/javascripts/search.js"
|
||||
import translateHelper from "../../assets/javascripts/translate/translate.js"
|
||||
import wikipediaHelper from "../../assets/javascripts/wikipedia.js"
|
||||
import tiktokHelper from "../../assets/javascripts/tiktok.js"
|
||||
|
||||
window.browser = window.browser || window.chrome
|
||||
|
||||
await youtubeHelper.pasteInvidiousCookies()
|
||||
await translateHelper.pasteSimplyTranslateCookies()
|
||||
await twitterHelper.pasteNitterCookies()
|
||||
await wikipediaHelper.pasteWikilessCookies()
|
||||
await searchHelper.pasteSearxCookies()
|
||||
await searchHelper.pasteSearxngCookies()
|
||||
await searchHelper.pasteLibrexCookies()
|
||||
await redditHelper.pasteLibredditCookies()
|
||||
await redditHelper.pasteTedditCookies()
|
||||
await tiktokHelper.pasteProxiTokCookies()
|
||||
|
||||
window.close()
|
|
@ -56,31 +56,7 @@ importSettingsElement.addEventListener("change", () => {
|
|||
reader.onload = async () => {
|
||||
const data = JSON.parse(reader.result)
|
||||
if ("theme" in data && "disableImgur" in data && "imgurRedirects" in data) {
|
||||
browser.storage.local.clear(() => {
|
||||
browser.storage.local.set({ ...data }, async () => {
|
||||
await youtubeHelper.pasteInvidiousCookies()
|
||||
await youtubeHelper.pastePipedLocalStorage()
|
||||
await youtubeHelper.pastePipedMaterialLocalStorage()
|
||||
|
||||
await translateHelper.pasteSimplyTranslateCookies()
|
||||
await translateHelper.pasteLingvaLocalStorage()
|
||||
|
||||
await twitterHelper.pasteNitterCookies()
|
||||
|
||||
await wikipediaHelper.pasteWikilessCookies()
|
||||
|
||||
await searchHelper.pasteSearxCookies()
|
||||
await searchHelper.pasteSearxngCookies()
|
||||
await searchHelper.pasteLibrexCookies()
|
||||
|
||||
await redditHelper.pasteLibredditCookies()
|
||||
await redditHelper.pasteTedditCookies()
|
||||
|
||||
await tiktokHelper.pasteProxiTokCookies()
|
||||
|
||||
location.reload()
|
||||
})
|
||||
})
|
||||
browser.storage.local.clear(() => browser.storage.local.set({ ...data }, () => location.reload()))
|
||||
} else {
|
||||
console.log("incompatible settings")
|
||||
importError()
|
||||
|
@ -156,14 +132,14 @@ protocolFallbackCheckbox.addEventListener("change", event => {
|
|||
browser.storage.local.set({ protocolFallback: event.target.checked })
|
||||
})
|
||||
|
||||
let latencyOutput = document.getElementById("latency-output")
|
||||
let latencyInput = document.getElementById("latency-input")
|
||||
latencyInput.addEventListener("change", event => {
|
||||
browser.storage.local.set({ latencyThreshold: event.target.value})
|
||||
})
|
||||
latencyInput.addEventListener("input", event => {
|
||||
latencyOutput.value = event.target.value
|
||||
})
|
||||
// let latencyOutput = document.getElementById("latency-output")
|
||||
// let latencyInput = document.getElementById("latency-input")
|
||||
// latencyInput.addEventListener("change", event => {
|
||||
// browser.storage.local.set({ latencyThreshold: event.target.value })
|
||||
// })
|
||||
// latencyInput.addEventListener("input", event => {
|
||||
// latencyOutput.value = event.target.value
|
||||
// })
|
||||
|
||||
let nameCustomInstanceInput = document.getElementById("exceptions-custom-instance")
|
||||
let instanceTypeElement = document.getElementById("exceptions-custom-instance-type")
|
||||
|
@ -198,7 +174,7 @@ browser.storage.local.get(
|
|||
themeElement.value = r.theme
|
||||
protocolElement.value = r.protocol
|
||||
protocolFallbackCheckbox.checked = r.protocolFallback
|
||||
latencyOutput.value = r.latencyThreshold
|
||||
// latencyOutput.value = r.latencyThreshold
|
||||
// firstPartyIsolate.checked = r.firstPartyIsolate;
|
||||
|
||||
let protocolFallbackElement = document.getElementById("protocol-fallback")
|
||||
|
|
Loading…
Reference in New Issue