diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 4dba8a7..b7ee220 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -17,10 +17,6 @@ async function getConfig() { }) } -function camelCase(str) { - return str.charAt(0).toUpperCase() + str.slice(1) -} - function init() { return new Promise(async resolve => { browser.storage.local.get(["network", "networkFallback"], r => { @@ -31,8 +27,8 @@ function init() { //cur = current for (const service in config.services) { options[service] = {} - browser.storage.local.get([`disable${camelCase(service)}`, `${service}RedirectType`, `${service}Frontend`], r => { - options[service].disabled = r["disable" + camelCase(service)] + browser.storage.local.get([`disable${utils.camelCase(service)}`, `${service}RedirectType`, `${service}Frontend`], r => { + options[service].disabled = r["disable" + utils.camelCase(service)] options[service].frontend = r[service + "Frontend"] options[service].redirectType = r[service + "RedirectType"] // console.log(r) @@ -42,11 +38,11 @@ function init() { options[frontend].checks = [] options[frontend].custom = [] for (const network in config.networks) { - browser.storage.local.get([`${frontend}${camelCase(network)}RedirectsChecks`, `${frontend}${camelCase(network)}CustomRedirects`], r => { + browser.storage.local.get([`${frontend}${utils.camelCase(network)}RedirectsChecks`, `${frontend}${utils.camelCase(network)}CustomRedirects`], r => { // console.log(r) - // console.log(`${frontend}${camelCase(network)}RedirectsChecks`) - options[frontend].checks = r[frontend + camelCase(network) + "RedirectsChecks"] - options[frontend].custom = r[frontend + camelCase(network) + "CustomRedirects"] + // console.log(`${frontend}${utils.camelCase(network)}RedirectsChecks`) + options[frontend].checks = r[frontend + utils.camelCase(network) + "RedirectsChecks"] + options[frontend].custom = r[frontend + utils.camelCase(network) + "CustomRedirects"] }) } } @@ -72,6 +68,7 @@ function redirect(url, type, initiator) { let frontend = options[service].frontend let network = options.network let networkFallback = options.networkFallback + let redirectType = options[service].redirectType if (url.pathname == "/") return for (const service in config.services) { if (options[service].disabled && !disableOverride) continue @@ -82,9 +79,9 @@ function redirect(url, type, initiator) { if (initiator && (all(service).includes(initiator.origin) || targets.includes(initiator.host))) continue if (!targets.some(rx => rx.test(url.href))) continue - if (type != options[service].redirectType && type != "both") continue + if (type != redirectType && type != "both") continue // browser.storage.local.get(`${service}Frontend`, (frontend = r[service + "Frontend"])) - let instanceList = [...[service + camelCase(network) + "RedirectsChecks"], ...[service + camelCase(network) + "CustomRedirects"]] + let instanceList = [...[service + utils.camelCase(network) + "RedirectsChecks"], ...[service + utils.camelCase(network) + "CustomRedirects"]] if (instanceList.length === 0 && networkFallback) instanceList = [...[service + "ClearnetRedirectsChecks"], ...[service + "ClearnetCustomRedirects"]] if (instanceList.length === 0 && redirects.indexOf(frontend) != -1) return randomInstance = utils.getRandomInstance(instanceList) @@ -400,13 +397,13 @@ function initDefaults() { browser.storage.local.set({ [defaultOption]: config.services[service].defaults[defaultOption] }) } for (const frontend in config.services[service].frontends) { - let clearnetChecks = redirects[frontend][clearnet] + let clearnetChecks = redirects[frontend].clearnet for (const instance of [...r.cloudflareBlackList, ...r.authenticateBlackList, ...r.offlineBlackList]) { let i = clearnetChecks.indexOf(instance) if (i > -1) clearnetChecks.splice(i, 1) } for (const network in config.networks) { - console.log(redirects[frontend][network]) + // console.log(redirects[frontend][network]) switch (network) { case "clearnet": browser.storage.local.set({ @@ -416,8 +413,8 @@ function initDefaults() { break default: browser.storage.local.set({ - [frontend + camelCase(network) + "RedirectsChecks"]: [...redirects[frontend][network]], - [frontend + camelCase(network) + "CustomRedirects"]: [], + [frontend + utils.camelCase(network) + "RedirectsChecks"]: [...redirects[frontend][network]], + [frontend + utils.camelCase(network) + "CustomRedirects"]: [], }) } } diff --git a/src/assets/javascripts/utils.js b/src/assets/javascripts/utils.js index 50ada76..9c5947a 100644 --- a/src/assets/javascripts/utils.js +++ b/src/assets/javascripts/utils.js @@ -123,17 +123,16 @@ async function processDefaultCustomInstances(target, name, protocol, document) { let redirectsChecks = `${name}${camelCase(protocol)}RedirectsChecks` let customRedirects = `${name}${camelCase(protocol)}CustomRedirects` - let redirectsKey = `${target}Redirects` let redirects async function getFromStorage() { return new Promise(async resolve => - browser.storage.local.get([redirectsChecks, customRedirects, redirectsKey, latencyKey], r => { + browser.storage.local.get([redirectsChecks, customRedirects, "redirects", latencyKey], r => { nameDefaultRedirects = r[redirectsChecks] nameCustomInstances = r[customRedirects] instancesLatency = r[latencyKey] ?? [] - redirects = r[redirectsKey] + redirects = r.redirects resolve() }) ) @@ -298,9 +297,9 @@ async function testLatency(element, instances, frontend) { let myList = {} let latencyThreshold let redirectsChecks = [] - browser.storage.local.get(["latencyThreshold", `${frontend}NormalRedirectsChecks`], r => { + browser.storage.local.get(["latencyThreshold", `${frontend}ClearnetRedirectsChecks`], r => { latencyThreshold = r.latencyThreshold - redirectsChecks = r[`${frontend}NormalRedirectsChecks`] + redirectsChecks = r[`${frontend}ClearnetRedirectsChecks`] }) for (const href of instances) await ping(href).then(time => { @@ -315,7 +314,7 @@ async function testLatency(element, instances, frontend) { redirectsChecks.splice(redirectsChecks.indexOf(href), 1) } - browser.storage.local.set({ [`${frontend}NormalRedirectsChecks`]: redirectsChecks }) + browser.storage.local.set({ [`${frontend}ClearnetRedirectsChecks`]: redirectsChecks }) let text if (time == 5000) text = "5000ms+" @@ -516,10 +515,10 @@ function latency(name, frontend, document, location) { let redirects = r[key] const oldHtml = latencyLabel.innerHTML latencyLabel.innerHTML = "..." - testLatency(latencyLabel, redirects[frontend].normal, frontend).then(r => { + testLatency(latencyLabel, redirects[frontend].clearnet, frontend).then(r => { browser.storage.local.set({ [`${frontend}Latency`]: r }) latencyLabel.innerHTML = oldHtml - processDefaultCustomInstances(name, frontend, "normal", document) + processDefaultCustomInstances(name, frontend, "clearnet", document) latencyElement.removeEventListener("click", reloadWindow) }) }) @@ -537,4 +536,5 @@ export default { switchInstance, copyRaw, unify, + camelCase, } diff --git a/src/config/config.json b/src/config/config.json index 6c4d802..97fd838 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -1,19 +1,19 @@ { "networks": { "clearnet": { - "url": "org", + "tld": "org", "name": "Clearnet" }, "tor": { - "url": "onion", + "tld": "onion", "name": "Tor" }, "i2p": { - "url": "i2p", + "tld": "i2p", "name": "I2P" }, "loki": { - "url": "loki", + "tld": "loki", "name": "Lokinet" } }, @@ -72,14 +72,14 @@ "^https?:\\/{2}(www\\.|)(youtube|youtube-nocookie)\\.com\\/embed\\/..*" ], "name": "Youtube", - "defaults": { - "disableYoutube": false, - "enableYoutubeCustomSettings": false, - "onlyEmbeddedVideo": "both", - "youtubeFrontend": "invidious", - "youtubeEmbedFrontend": "invidious" + "options": { + "disabled": false, + "redirectType": "both", + "frontend": "invidious", + "embedFrontend": "invidious" }, - "imageType": "png" + "imageType": "png", + "embeddable": true }, "youtubeMusic": { "frontends": { @@ -88,11 +88,12 @@ }, "targets": ["^https?:\\/{2}music\\.youtube\\.com(\\/.*|$)"], "name": "YT Music", - "defaults": { - "disableYoutubeMusic": false, - "youtubeMusicFrontend": "beatbump" + "options": { + "disabled": false, + "frontend": "beatbump" }, - "imageType": "png" + "imageType": "png", + "embeddable": false }, "twitter": { "frontends": { @@ -123,11 +124,12 @@ }, "targets": ["^https?:\\/{2}(www\\.|mobile\\.|)twitter\\.com", "^https?:\\/{2}(pbs\\.|video\\.|)twimg\\.com", "^https?:\\/{2}platform\\.twitter\\.com/embed", "^https?:\\/{2}t\\.co"], "name": "Twitter", - "defaults": { - "disableTwitter": false, - "twitterRedirectType": "both" + "options": { + "disabled": false, + "redirectType": "both" }, - "imageType": "png" + "imageType": "png", + "embeddable": true }, "instagram": { "frontends": { @@ -141,10 +143,9 @@ }, "targets": ["^https?:\\/{2}(www\\.)?instagram\\.com"], "name": "Instagram", - "defaults": { - "disableInstagram": false - }, - "imageType": "png" + "options": { "disabled": false }, + "imageType": "png", + "embeddable": false }, "tiktok": { "frontends": { @@ -152,10 +153,9 @@ }, "targets": ["^https?:\\/{2}(www\\.|)tiktok\\.com.*"], "name": "TikTok", - "defaults": { - "disableTiktok": false - }, - "imageType": "png" + "options": { "disabled": false }, + "imageType": "png", + "embeddable": false }, "reddit": { "frontends": { @@ -185,11 +185,12 @@ }, "targets": ["^https?:\\/{2}(www\\.|old\\.|np\\.|new\\.|amp\\.|)reddit\\.com", "^https?:\\/{2}(i\\.|preview\\.)redd\\.it"], "name": "Reddit", - "defaults": { - "disableReddit": false, - "redditFrontend": "libreddit" + "options": { + "disabled": false, + "frontend": "libreddit" }, - "imageType": "png" + "imageType": "png", + "embeddable": false }, "imgur": { "frontends": { @@ -199,8 +200,9 @@ }, "targets": ["^https?:\\/{2}([im]\\.)?imgur\\.(com|io)(\\/|$)"], "name": "Imgur", - "defaults": { "disableImgur": false }, - "imageType": "png" + "options": { "disabled": false }, + "imageType": "png", + "embeddable": false }, "wikipedia": { "frontends": { @@ -212,8 +214,9 @@ }, "targets": ["^https?:\\/{2}([a-z]+\\.)*wikipedia\\.org"], "name": "Wikipedia", - "defaults": { "disableWikipedia": true }, - "imageType": "svg" + "options": { "disabled": true }, + "imageType": "svg", + "embeddable": false }, "medium": { "frontends": { @@ -242,8 +245,9 @@ "^writingcooperative\\.com " ], "name": "Medium", - "defaults": { "disableMedium": false }, - "imageType": "svg" + "options": { "disabled": false }, + "imageType": "svg", + "embeddable": false }, "quora": { "frontends": { @@ -253,10 +257,9 @@ }, "targets": ["^https?:\\/{2}([a-z]+\\.)*quora\\.com.*"], "name": "Quora", - "defaults": { - "disableQuora": false - }, - "imageType": "png" + "options": { "disabled": false }, + "imageType": "png", + "embeddable": false }, "imdb": { "frontends": { @@ -266,10 +269,9 @@ }, "targets": ["^https?:\\/{2}(?:www\\.|)imdb\\.com.*"], "name": "IMDb", - "defaults": { - "disableImdb": true - }, - "imageType": "svg" + "options": { "disabled": true }, + "imageType": "svg", + "embeddable": false }, "reuters": { "frontends": { @@ -279,10 +281,9 @@ }, "targets": ["^https?:\\/{2}(www\\.|)reuters\\.com.*"], "name": "Reuters", - "defaults": { - "disableReuters": true - }, - "imageType": "svg" + "options": { "disabled": true }, + "imageType": "svg", + "embeddable": false }, "peertube": { "frontends": { @@ -292,10 +293,9 @@ }, "targets": "datajson", "name": "PeerTube", - "defaults": { - "disablePeertube": true - }, - "imageType": "svg" + "options": { "disabled": true }, + "imageType": "svg", + "embeddable": false }, "lbry": { "frontends": { @@ -309,12 +309,13 @@ "singleInstanceFrontends": ["lbryDesktop"], "targets": ["^https?:\\/{2}odysee\\.com", "^https?:\\/{2}lbry\\.tv"], "name": "LBRY", - "defaults": { - "disableLbry": true, - "lbryFrontend": "librarian", - "lbryRedirectType": "both" + "options": { + "disabled": true, + "frontend": "librarian", + "redirectType": "both" }, - "imageType": "png" + "imageType": "png", + "embeddable": true }, "search": { "frontends": { @@ -377,12 +378,12 @@ }, "targets": ["^https?:\\/{2}search\\.libredirect\\.invalid"], "name": "Search", - "defaults": { - "disableSearch": false, - "searchFrontend": "searxng", - "searxngCustomSettings": false + "options": { + "disabled": false, + "frontend": "searxng" }, - "imageType": "svg" + "imageType": "svg", + "embeddable": false }, "translate": { "frontends": { @@ -399,11 +400,12 @@ }, "targets": ["^https?:\\/{2}translate\\.google(\\.[a-z]{2,3}){1,2}\\/"], "name": "Translate", - "defaults": { - "translateDisable": false, - "translateFrontend": "simplyTranslate" + "options": { + "disabled": false, + "frontend": "simplyTranslate" }, - "imageType": "svg" + "imageType": "svg", + "embeddable": false }, "maps": { "frontends": { @@ -414,11 +416,12 @@ "singleInstanceFrontends": ["osm"], "targets": ["^https?:\\/{2}(((www|maps)\\.)?(google\\.).*(\\/maps)|maps\\.(google\\.).*)"], "name": "Maps", - "defaults": { - "disableMaps": false, - "mapsFrontend": "osm" + "options": { + "disabled": false, + "frontend": "osm" }, - "imageType": "svg" + "imageType": "svg", + "embeddable": false }, "sendTargets": { "frontends": { @@ -428,10 +431,9 @@ }, "targets": ["^https?:\\/{2}send\\.libredirect\\.invalid\\/$", "^https?:\\/{2}send\\.firefox\\.com\\/$", "^https?:\\/{2}sendfiles\\.online\\/$"], "name": "Send Files", - "defaults": { - "disableSendTargets": false - }, - "imageType": "svg" + "options": { "disabled": false }, + "imageType": "svg", + "embeddable": false } } } diff --git a/src/pages/options/index.html b/src/pages/options/index.html index 077b3da..5c0aedd 100644 --- a/src/pages/options/index.html +++ b/src/pages/options/index.html @@ -78,7 +78,7 @@

+
+
+

Frontend

+ +
+ <% if (config.services[service].embeddable) { %> + <% if (config.services[service].singleInstanceFrontends) { %> +
+
+

Embedded Videos Frontend

+ +
+
+ <% } %> +
+

Redirect Type

+ +
+ <% } %> +
+ <% config.services[service].frontends.forEach(frontend=>{ %> +
+ <% config.networks.forEach(network=>{ %> +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ <% if (network == "clearnet") { %> +
+ + +
+ <% } %> +
+ <% }); %> + <% }); %> + +<% }); %> + \ No newline at end of file diff --git a/src/pages/options/widgets/services.js b/src/pages/options/widgets/services.js new file mode 100644 index 0000000..5f370a1 --- /dev/null +++ b/src/pages/options/widgets/services.js @@ -0,0 +1,81 @@ +import utils from "../../../assets/javascripts/utils.js" + +// const frontends = new Array("librarian") +// const protocols = new Array("clearnet", "tor", "i2p", "loki") + +let config, + network, + divs = {} + +async function getConfig() { + return new Promise(resolve => { + fetch("/config/config.json") + .then(response => response.text()) + .then(data => { + config = JSON.parse(data) + resolve() + }) + }) +} + +getConfig() + +browser.storage.local.get("network", r => { + network = r.network +}) + +function changeFrontendsSettings(service) { + for (const frontend in config.services[service].frontends) { + const frontendDiv = document.getElementById(frontend) + if (frontend == divs[service].frontend.value) { + frontendDiv.style.display = "block" + } else { + frontendDiv.style.display = "none" + } + } +} + +function changeNetworkSettings(selectedNetwork) { + for (const frontend in config.frontends) { + const frontendDiv = document.getElementById(frontend) + for (const network in config.networks) { + const networkDiv = frontendDiv.getElementsByClassName(network)[0] + if (network == selectedNetwork) { + networkDiv.style.display = "block" + } else { + networkDiv.style.display = "none" + } + } + } +} + +for (service in config.services) { + divs[service][service] = document.getElementById(`${service}_page`) + for (const option in config.services[service].options) { + divs[service][option] = document.getElementById(`${service}-${option}`) + + browser.storage.local.get([`${service + utils.camelCase(option)}`], r => { + if (typeof config.services[service].options[option] == "boollean") divs[service][option].checked = !r[service + utils.camelCase(option)] + else divs[service][option].value = !r[service + utils.camelCase(option)] + }) + + divs[service][option].addEventListener("change", () => { + if (typeof config.services[service].options[option] == "boollean") { + browser.storage.local.set({ [service + utils.camelCase(option)]: !divs[service][option].checked }) + } else { + browser.storage.local.set({ [service + utils.camelCase(option)]: divs[service][option].value }) + } + changeFrontendsSettings() + }) + } + + changeFrontendsSettings(service) + changeNetworkSettings(network) + + for (const frontend in config.services[service].frontends) { + for (const network in config.networks) { + utils.processDefaultCustomInstances(service, frontend, network, document) + } + utils.latency(service, frontend, document, location) + } +} diff --git a/src/pages/options/widgets/tiktok.js b/src/pages/options/widgets/tiktok.js index 38ec9ea..f382ad5 100644 --- a/src/pages/options/widgets/tiktok.js +++ b/src/pages/options/widgets/tiktok.js @@ -3,7 +3,7 @@ import utils from "../../../assets/javascripts/utils.js" // UNCOMMENT ALL COMMENTS ONCE OTHER FRONTENDS EXIST const frontends = new Array("proxiTok") -const protocols = new Array("normal", "tor", "i2p", "loki") +const protocols = new Array("clearnet", "tor", "i2p", "loki") const enable = document.getElementById("tiktok-enable") const tiktok = document.getElementById("tiktok_page") @@ -39,7 +39,7 @@ function changeProtocolSettings() { browser.storage.local.get(["disableTiktok", "protocol"], r => { enable.checked = !r.disableTiktok - protocol = r.protocol + protocol = r.network changeProtocolSettings() }) diff --git a/src/pages/options/widgets/tiktok.pug b/src/pages/options/widgets/tiktok.pug index 29ab5e2..986bd27 100644 --- a/src/pages/options/widgets/tiktok.pug +++ b/src/pages/options/widgets/tiktok.pug @@ -8,7 +8,7 @@ section#tiktok_page.option-block #proxiTok hr - .normal + .clearnet include ../../widgets/instances.pug +instances('https://proxitok.com') include ../../widgets/latency.pug diff --git a/src/pages/options/widgets/translate.js b/src/pages/options/widgets/translate.js index e100813..c70b679 100644 --- a/src/pages/options/widgets/translate.js +++ b/src/pages/options/widgets/translate.js @@ -1,7 +1,7 @@ import utils from "../../../assets/javascripts/utils.js" const frontends = new Array("simplyTranslate", "lingva") -const protocols = new Array("normal", "tor", "i2p", "loki") +const protocols = new Array("clearnet", "tor", "i2p", "loki") const enable = document.getElementById("translate-enable") const translate = document.getElementById("translate_page") @@ -36,7 +36,7 @@ function changeProtocolSettings() { browser.storage.local.get(["translateDisable", "translateFrontend", "protocol"], r => { enable.checked = !r.translateDisable frontend.value = r.translateFrontend - protocol = r.protocol + protocol = r.network changeFrontendsSettings() changeProtocolSettings() }) diff --git a/src/pages/options/widgets/translate.pug b/src/pages/options/widgets/translate.pug index 4836c0f..40d42bc 100644 --- a/src/pages/options/widgets/translate.pug +++ b/src/pages/options/widgets/translate.pug @@ -14,7 +14,7 @@ section#translate_page.option-block hr #simplyTranslate - .normal + .clearnet include ../../widgets/instances.pug +instances('https://simplytranslate.org') include ../../widgets/latency.pug @@ -30,7 +30,7 @@ section#translate_page.option-block +instances('http://simplytranslate.loki') #lingva - .normal + .clearnet include ../../widgets/instances.pug +instances('https://lingvatranslate.com') +latency('lingva') diff --git a/src/pages/options/widgets/twitter.js b/src/pages/options/widgets/twitter.js index 5ad760b..52d7a73 100644 --- a/src/pages/options/widgets/twitter.js +++ b/src/pages/options/widgets/twitter.js @@ -3,7 +3,7 @@ import utils from "../../../assets/javascripts/utils.js" // UNCOMMENT ALL COMMENTS ONCE OTHER FRONTENDS EXIST const frontends = new Array("nitter") -const protocols = new Array("normal", "tor", "i2p", "loki") +const protocols = new Array("clearnet", "tor", "i2p", "loki") const enable = document.getElementById("twitter-enable") const twitter = document.getElementById("twitter_page") @@ -40,7 +40,7 @@ function changeProtocolSettings() { browser.storage.local.get(["disableTwitter", "protocol", "twitterRedirectType"], r => { enable.checked = !r.disableTwitter - protocol = r.protocol + protocol = r.network redirectType.value = r.twitterRedirectType changeProtocolSettings() }) diff --git a/src/pages/options/widgets/twitter.pug b/src/pages/options/widgets/twitter.pug index 6e61054..fa7f132 100644 --- a/src/pages/options/widgets/twitter.pug +++ b/src/pages/options/widgets/twitter.pug @@ -15,7 +15,7 @@ section#twitter_page.option-block #nitter hr - .normal + .clearnet include ../../widgets/instances.pug +instances('https://nitter.com') include ../../widgets/latency.pug diff --git a/src/pages/options/widgets/wikipedia.js b/src/pages/options/widgets/wikipedia.js index 9d06488..120af91 100644 --- a/src/pages/options/widgets/wikipedia.js +++ b/src/pages/options/widgets/wikipedia.js @@ -3,7 +3,7 @@ import utils from "../../../assets/javascripts/utils.js" // UNCOMMENT ALL COMMENTS ONCE OTHER FRONTENDS EXIST const frontends = new Array("wikiless") -const protocols = new Array("normal", "tor", "i2p", "loki") +const protocols = new Array("clearnet", "tor", "i2p", "loki") const enable = document.getElementById("wikipedia-enable") const wikipedia = document.getElementById("wikipedia_page") @@ -39,7 +39,7 @@ function changeProtocolSettings() { browser.storage.local.get(["disableWikipedia", "protocol"], r => { enable.checked = !r.disableWikipedia - protocol = r.protocol + protocol = r.network changeProtocolSettings() }) diff --git a/src/pages/options/widgets/wikipedia.pug b/src/pages/options/widgets/wikipedia.pug index c9aee64..a0ad37c 100644 --- a/src/pages/options/widgets/wikipedia.pug +++ b/src/pages/options/widgets/wikipedia.pug @@ -8,7 +8,7 @@ section#wikipedia_page.option-block #wikiless hr - .normal + .clearnet include ../../widgets/instances.pug +instances('https://wikiless.com') include ../../widgets/latency.pug diff --git a/src/pages/options/widgets/youtube.js b/src/pages/options/widgets/youtube.js index 065a195..4e4bbba 100644 --- a/src/pages/options/widgets/youtube.js +++ b/src/pages/options/widgets/youtube.js @@ -1,7 +1,7 @@ import utils from "../../../assets/javascripts/utils.js" const frontends = new Array("invidious", "piped", "pipedMaterial", "cloudtube") -const protocols = new Array("normal", "tor", "i2p", "loki") +const protocols = new Array("clearnet", "tor", "i2p", "loki") const singleInstanceFrontends = new Array("freetube", "yatte") const enable = document.getElementById("youtube-enable") @@ -66,7 +66,7 @@ browser.storage.local.get(["disableYoutube", "onlyEmbeddedVideo", "youtubeRedire onlyEmbeddedVideo.value = r.onlyEmbeddedVideo youtubeEmbedFrontend.value = r.youtubeEmbedFrontend frontend.value = r.youtubeFrontend - protocol = r.protocol + protocol = r.network changeFrontendsSettings() changeProtocolSettings() diff --git a/src/pages/options/widgets/youtube.pug b/src/pages/options/widgets/youtube.pug index 33a43c3..cf48d9b 100644 --- a/src/pages/options/widgets/youtube.pug +++ b/src/pages/options/widgets/youtube.pug @@ -34,7 +34,7 @@ section#youtube_page.option-block #invidious hr - .normal + .clearnet include ../../widgets/instances.pug +instances('http://invidious.com') include ../../widgets/latency.pug @@ -51,7 +51,7 @@ section#youtube_page.option-block #piped hr - .normal + .clearnet include ../../widgets/instances.pug +instances('https://piped.com') include ../../widgets/latency.pug @@ -68,7 +68,7 @@ section#youtube_page.option-block #pipedMaterial hr - .normal + .clearnet include ../../widgets/instances.pug +instances('https://piped-material.com') include ../../widgets/latency.pug @@ -85,7 +85,7 @@ section#youtube_page.option-block #cloudtube hr - .normal + .clearnet include ../../widgets/instances.pug +instances('https://cloudtube.com') include ../../widgets/latency.pug diff --git a/src/pages/options/widgets/youtubeMusic.js b/src/pages/options/widgets/youtubeMusic.js index ad51ce7..bb985b2 100644 --- a/src/pages/options/widgets/youtubeMusic.js +++ b/src/pages/options/widgets/youtubeMusic.js @@ -1,7 +1,7 @@ import utils from "../../../assets/javascripts/utils.js" const frontends = new Array("beatbump", "hyperpipe") -const protocols = new Array("normal", "tor", "i2p", "loki") +const protocols = new Array("clearnet", "tor", "i2p", "loki") let enable = document.getElementById("youtubeMusic-enable") const youtubeMusic = document.getElementById("youtubeMusic_page") @@ -36,7 +36,7 @@ function changeProtocolSettings() { browser.storage.local.get(["disableYoutubeMusic", "youtubeMusicFrontend", "protocol"], r => { enable.checked = !r.disableYoutubeMusic frontend.value = r.youtubeMusicFrontend - protocol = r.protocol + protocol = r.network changeFrontendsSettings() changeProtocolSettings() }) diff --git a/src/pages/options/widgets/youtubeMusic.pug b/src/pages/options/widgets/youtubeMusic.pug index bcba3d2..9c2c08c 100644 --- a/src/pages/options/widgets/youtubeMusic.pug +++ b/src/pages/options/widgets/youtubeMusic.pug @@ -14,7 +14,7 @@ section#youtubeMusic_page.option-block #beatbump hr - .normal + .clearnet include ../../widgets/instances.pug +instances('https://beatbump.org') include ../../widgets/latency.pug @@ -31,7 +31,7 @@ section#youtubeMusic_page.option-block #hyperpipe hr - .normal + .clearnet include ../../widgets/instances.pug +instances('https://hyperpipe.org') include ../../widgets/latency.pug