From 09b05f764f3890a2978ea935bc296da2b09b423b Mon Sep 17 00:00:00 2001 From: marcelocripe <69278712+marcelocripe@users.noreply.github.com> Date: Fri, 29 Jul 2022 13:56:06 -0300 Subject: [PATCH 01/67] Update LibreDirect messages pt_BR 07-29-2022 --- src/_locales/pt_BR/messages.json | 198 +++++++++++++++---------------- 1 file changed, 97 insertions(+), 101 deletions(-) diff --git a/src/_locales/pt_BR/messages.json b/src/_locales/pt_BR/messages.json index 53b1de5..42e2f49 100644 --- a/src/_locales/pt_BR/messages.json +++ b/src/_locales/pt_BR/messages.json @@ -1,215 +1,211 @@ { - "youtube": { - "message": "YouTube", - "description": "used in the settings page" + "extensionName": { + "message": "LibRedirect", + "description": "Nome da Extensão" }, - "ytmusic": { - "message": "Música YT", - "description": "used in the settings page" - }, - "cancel": { - "message": "Cancelar", - "description": "used in instance_offline.html" - }, - "unifySettings": { - "message": "Unificar configurações" - }, - "twitter": { - "message": "Twitter", - "description": "used in the settings page" - }, - "i2p": { - "message": "I2P" + "extensionDescription": { + "message": "Uma extensão para os navegadores de internet que redireciona os sítios/sites populares para interfaces gráficas e interfaces de textos alternativos e amigáveis ​​à sua privacidade", + "description": "Descrição da extensão" }, "switchInstance": { - "message": "Mudar de instância", - "description": "used in manifest.json as shortcut description" + "message": "Trocar a Instância", + "description": "Utilizado no arquivo manifest.json como descrição do atalho" }, "settings": { "message": "Configurações", - "description": "used in the popup" + "description": "Utilizado na janela da caixa de diálogo" }, "general": { "message": "Geral", - "description": "used in the settings page" + "description": "Utilizado na página de configurações" }, "search": { - "message": "Buscar", - "description": "used in the settings page" + "message": "Pesquisar", + "description": "Utilizado na página de configurações" }, "translate": { "message": "Traduzir", - "description": "used in the settings page" + "description": "Utilizado na página de configurações" }, "maps": { "message": "Mapas", - "description": "used in the settings page" + "description": "Utilizado na página de configurações" }, "sendFiles": { - "message": "Enviar arquivos", - "description": "used in the settings page" + "message": "Enviar Arquivos", + "description": "Utilizado na página de configurações" + }, + "youtube": { + "message": "YouTube", + "description": "Utilizado na página de configurações" + }, + "instagram": { + "message": "Instagram", + "description": "Utilizado na página de configurações" + }, + "twitter": { + "message": "Twitter", + "description": "Utilizado na página de configurações" }, "reddit": { "message": "Reddit", - "description": "used in the settings page" + "description": "Utilizado na página de configurações" }, "tiktok": { "message": "TikTok", - "description": "used in the settings page" + "description": "Utilizado na página de configurações" + }, + "ytmusic": { + "message": "YouTube Músicas", + "description": "Utilizado na página de configurações" }, "imgur": { "message": "Imgur", - "description": "used in the settings page" - }, - "extensionName": { - "message": "LibRedirect", - "description": "name of the extension" + "description": "Utilizado na página de configurações" }, "wikipedia": { - "message": "Wikipedia", - "description": "used in the settings page" + "message": "Wikipédia", + "description": "Utilizado na página de configurações" }, "peertube": { "message": "PeerTube", - "description": "used in the settings page" + "description": "Utilizado na página de configurações" }, "medium": { "message": "Medium", - "description": "used in the settings page" - }, - "tor": { - "message": "Tor", - "description": "used in the settings page" + "description": "Utilizado na página de configurações" }, "theme": { "message": "Tema", - "description": "used in the settings page" + "description": "Utilizado na página de configurações" }, "system": { "message": "Sistema", - "description": "used in the settings page" + "description": "Utilizado na página de configurações" }, "light": { "message": "Claro", - "description": "used in the settings page" + "description": "Utilizado na página de configurações" }, "dark": { "message": "Escuro", - "description": "used in the settings page" + "description": "Utilizado na página de configurações" }, "autoRedirect": { - "message": "Redirecionar automaticamente instâncias offline a instâncias online", - "description": "used in the settings page" + "message": "Redirecionar automaticamente as instâncias que estão desconectadas (off-line) para o estado de conectadas (on-line)", + "description": "Utilizado na página de configurações" }, "exceptions": { "message": "Exceções", - "description": "used in the settings page" + "description": "Utilizado na página de configurações" }, "updateInstances": { - "message": "Atualizar instâncias", - "description": "used in the settings page" + "message": "Atualizar as Instâncias", + "description": "Utilizado na página de configurações" }, "importSettings": { - "message": "Importar configurações", - "description": "used in the settings page" + "message": "Importar as Configurações", + "description": "Utilizado na página de configurações" }, "exportSettings": { - "message": "Exportar configurações", - "description": "used in the settings page" + "message": "Exportar as Configurações", + "description": "Utilizado na página de configurações" }, "resetSettings": { - "message": "Redefinir configurações", - "description": "used in the settings page" + "message": "Redefinir as Configurações", + "description": "Utilizado na página de configurações" }, "customPopup": { - "message": "Personalizar popup", - "description": "used in the settings page" + "message": "Personalizar a Janela", + "description": "Utilizado na página de configurações" }, "enable": { - "message": "Ligar", - "description": "used in the settings page" + "message": "Ativar", + "description": "Utilizado na página de configurações" }, "protocol": { "message": "Protocolo", - "description": "used in the settings page" + "description": "Utilizado na página de configurações" }, "normal": { "message": "Normal", - "description": "used in the settings page" + "description": "Utilizado na página de configurações" }, "defaultInstances": { - "message": "Instâncias padrão", - "description": "used in the settings page" + "message": "Instâncias Padrão", + "description": "Utilizado na página de configurações" }, "customInstances": { - "message": "Instâncias personalizadas", - "description": "used in the settings page" + "message": "Instâncias Personalizadas", + "description": "Utilizado na página de configurações" }, "toggleAll": { - "message": "Ligar tudo", - "description": "used in the settings page" + "message": "Ativar Tudo", + "description": "Utilizado na página de configurações" }, "frontend": { - "message": "Frontend", - "description": "used in the settings page" + "message": "Interface Gráfica", + "description": "Utilizado na página de configurações" }, "notFullyPrivate": { - "message": "Este não é um frontend totalmente privado." + "message": "Esta não é uma interface gráfica totalmente privada." }, "searchNote": { - "message": "Repare bem: Tire a máxima vantagem de pesquisas na internet fazendo o LibRedirect seu buscador padrão.", - "description": "used in the settings page" + "message": "Observação: Utilize a pesquisa do LibRedirect com todo o seu potencial para torná-lo o seu mecanismo de pesquisa padrão.", + "description": "Utilizado na página de configurações" }, "redirectType": { - "message": "Tipo de redirecionamento", - "description": "used in the settings page" + "message": "Tipo de Redirecionamento", + "description": "Utilizado na página de configurações" }, "embeddedVids": { - "message": "Frontend de vídeos integrados", - "description": "used in the settings page" + "message": "Interface Gráfica para Incorporar os Vídeos", + "description": "Utilizado na página de configurações" }, "both": { "message": "ambos", - "description": "used in the settings page" + "description": "Utilizado na página de configurações" }, "onlyEmbedded": { - "message": "somente integrados", - "description": "used in the settings page" + "message": "apenas os incorporados", + "description": "Utilizado na página de configurações" }, "onlyNotEmbedded": { - "message": "somente não integrados", - "description": "used in the settings page" + "message": "apenas os não incorporados", + "description": "Utilizado na página de configurações" }, "instanceOffline": { - "message": "Esta instância está offline, você será redirecionado após ", - "description": "used in instance_offline.html" + "message": "Esta instância está desconectada (off-line), você será redirecionado após ", + "description": "Utilizado no arquivo instance_offline.html" + }, + "cancel": { + "message": "Cancelar", + "description": "Utilizado no arquivo instance_offline.html" }, "instanceIsOff": { - "message": "Instância está offline", - "description": "used in instance_offline.html" + "message": "A instância está desconectada (off-line)", + "description": "Utilizado no arquivo instance_offline.html" }, "redirectionCanceled": { - "message": "Redirecionamento cancelado", - "description": "used in instance_offline.js" + "message": "O Redirecionamento Foi Cancelado", + "description": "Utilizado no arquivo instance_offline.js" }, "copyRaw": { - "message": "Copiar link original" + "message": "Cópiar em Formato Bruto" }, "copied": { "message": "Copiado" }, + "unifySettings": { + "message": "Unificar as Configurações" + }, "lbry": { "message": "LBRY" }, "testInstancesLatency": { - "message": "Teste latência das instâncias" + "message": "Testar a Latência das Instâncias" }, - "extensionDescription": { - "message": "Uma extensão web que redireciona os sites populares para frontends e backends alternativos que respeitam sua privacidade", - "description": "description of the extension" - }, - "instagram": { - "message": "Instagram", - "description": "used in the settings page" + "protocolFallback": { + "message": "Retornar ao normal se não houver outras instâncias disponíveis para o protocolo atual" } } From 2798fe385736cf7f3b7b12de2e6e5acbb52fd235 Mon Sep 17 00:00:00 2001 From: marcelocripe <69278712+marcelocripe@users.noreply.github.com> Date: Fri, 29 Jul 2022 14:06:40 -0300 Subject: [PATCH 02/67] Update LibreDirect messages pt_BR 07-29-2022 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is the latest pt_BR translation file 07-29-2022 - - - - - Este é o arquivo mais recente da tradução pt_BR 29-07-2022 --- src/_locales/pt_BR/messages.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/_locales/pt_BR/messages.json b/src/_locales/pt_BR/messages.json index 42e2f49..dd303ab 100644 --- a/src/_locales/pt_BR/messages.json +++ b/src/_locales/pt_BR/messages.json @@ -1,7 +1,7 @@ { "extensionName": { "message": "LibRedirect", - "description": "Nome da Extensão" + "description": "Nome da extensão" }, "extensionDescription": { "message": "Uma extensão para os navegadores de internet que redireciona os sítios/sites populares para interfaces gráficas e interfaces de textos alternativos e amigáveis ​​à sua privacidade", @@ -56,7 +56,7 @@ "description": "Utilizado na página de configurações" }, "ytmusic": { - "message": "YouTube Músicas", + "message": "Músicas do YouTube", "description": "Utilizado na página de configurações" }, "imgur": { @@ -163,15 +163,15 @@ "description": "Utilizado na página de configurações" }, "both": { - "message": "ambos", + "message": "Ambos", "description": "Utilizado na página de configurações" }, "onlyEmbedded": { - "message": "apenas os incorporados", + "message": "Apenas os incorporados", "description": "Utilizado na página de configurações" }, "onlyNotEmbedded": { - "message": "apenas os não incorporados", + "message": "Apenas os não incorporados", "description": "Utilizado na página de configurações" }, "instanceOffline": { @@ -191,7 +191,7 @@ "description": "Utilizado no arquivo instance_offline.js" }, "copyRaw": { - "message": "Cópiar em Formato Bruto" + "message": "Copiar o Link Original" }, "copied": { "message": "Copiado" From 77b1f094b05a7efc6e5a7a743125ce63ada3da0b Mon Sep 17 00:00:00 2001 From: BobIsMyManager Date: Tue, 2 Aug 2022 23:10:45 +0100 Subject: [PATCH 03/67] Push part of config draft I had more exiting stuff like ejs, but I accidentially deleted the files D: --- src/config/config.json | 98 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 src/config/config.json diff --git a/src/config/config.json b/src/config/config.json new file mode 100644 index 0000000..d918a0a --- /dev/null +++ b/src/config/config.json @@ -0,0 +1,98 @@ +{ + "networks": { + "normal": { + "url": "org", + "name": "Clearnet" + }, + "tor": { + "url": "onion", + "name": "Tor" + }, + "i2p": { + "url": "i2p", + "name": "I2P" + }, + "loki": { + "url": "loki", + "name": "Lokinet" + } + }, + "services": { + "youtube": { + "frontends": { + "invidious": { + "preferences": { + "method": "cookies", + "cookies": ["PREFS"] + } + }, + "piped": { + "preferences": { + "method": "localstorage", + "localstorage": [ + "bufferGoal", + "comments", + "disableLBRY", + "enabledCodecs", + "hl", + "homepage", + "instance", + "listen", + "minimizeDescription", + "playerAutoPlay", + "proxyLBRY", + "quality", + "region", + "selectedSkip", + "sponsorblock", + "theme", + "volume", + "watchHistory" + ] + } + }, + "pipedMaterial": { + "preferences": { + "method": "localstorage", + "localstorage": ["PREFERENCES"] + } + }, + "cloudtube": { + "preferences": { + "method": "token", + "token": "token", + "fetchEndpoint": "/api/settings", + "setEndpoint": "/settings" + } + } + }, + "singleInstanceFrontends": { + "freetube": {}, + "yatte": {} + }, + "targets": [ + "/^https?:\\/{2}(www.|music.|m.|)youtube.com(\\/.*|$)/", + "/^https?:\\/{2}img.youtube.com\\/vi\\/.*\\/..*/", + "/^https?:\\/{2}(i|s).ytimg.com\\/vi\\/.*\\/..*/", + "/^https?:\\/{2}(www.|music.|)youtube.com\\/watch?v=..*/", + "/^https?:\\/{2}youtu.be\\/..*/", + "/^https?:\\/{2}(www.|)(youtube|youtube-nocookie).com\\/embed\\/..*/" + ], + "name": "Youtube", + "defaults": { + "disableYoutube": false, + "enableYoutubeCustomSettings": false, + "onlyEmbeddedVideo": "both", + "youtubeFrontend": "invidious", + "youtubeEmbedFrontend": "invidious" + }, + "youtubeMusic": { + "frontends": { + "beatbump": {}, + "hyperpipe": {} + }, + "targets": ["^https?:\\/{2}music\.youtube\.com(\\/.*|$)"] + } + } + } +} From c5330235469b730b1bd575f17c6aa8eb7705f63a Mon Sep 17 00:00:00 2001 From: Hygna Date: Tue, 6 Sep 2022 19:31:50 +0100 Subject: [PATCH 04/67] Finish initial config.json draft --- src/config/config.json | 381 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 360 insertions(+), 21 deletions(-) diff --git a/src/config/config.json b/src/config/config.json index d918a0a..9051d11 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -1,6 +1,6 @@ { "networks": { - "normal": { + "clearnet": { "url": "org", "name": "Clearnet" }, @@ -22,13 +22,11 @@ "frontends": { "invidious": { "preferences": { - "method": "cookies", "cookies": ["PREFS"] } }, "piped": { "preferences": { - "method": "localstorage", "localstorage": [ "bufferGoal", "comments", @@ -53,30 +51,25 @@ }, "pipedMaterial": { "preferences": { - "method": "localstorage", "localstorage": ["PREFERENCES"] } }, "cloudtube": { "preferences": { - "method": "token", "token": "token", "fetchEndpoint": "/api/settings", "setEndpoint": "/settings" } } }, - "singleInstanceFrontends": { - "freetube": {}, - "yatte": {} - }, + "singleInstanceFrontends": ["freetube", "yatte"], "targets": [ - "/^https?:\\/{2}(www.|music.|m.|)youtube.com(\\/.*|$)/", - "/^https?:\\/{2}img.youtube.com\\/vi\\/.*\\/..*/", - "/^https?:\\/{2}(i|s).ytimg.com\\/vi\\/.*\\/..*/", - "/^https?:\\/{2}(www.|music.|)youtube.com\\/watch?v=..*/", - "/^https?:\\/{2}youtu.be\\/..*/", - "/^https?:\\/{2}(www.|)(youtube|youtube-nocookie).com\\/embed\\/..*/" + "^https?:\\/{2}(www\\.|music\\.|m\\.|)youtube.com(\\/.*|$)", + "^https?:\\/{2}img\\.youtube.com\\/vi\\/.*\\/..*", + "^https?:\\/{2}(i|s)\\.ytimg.com\\/vi\\/.*\\/..*", + "^https?:\\/{2}(www\\.|music\\.|)youtube.com\\/watch?v=..*", + "^https?:\\/{2}youtu\\.be\\/..*", + "^https?:\\/{2}(www\\.|)(youtube|youtube-nocookie)\\.com\\/embed\\/..*" ], "name": "Youtube", "defaults": { @@ -86,13 +79,359 @@ "youtubeFrontend": "invidious", "youtubeEmbedFrontend": "invidious" }, - "youtubeMusic": { - "frontends": { - "beatbump": {}, - "hyperpipe": {} + "imageType": "png" + }, + "youtubeMusic": { + "frontends": { + "beatbump": {}, + "hyperpipe": {} + }, + "targets": ["^https?:\\/{2}music\\.youtube\\.com(\\/.*|$)"], + "name": "YT Music", + "defaults": { + "disableYoutubeMusic": false, + "youtubeMusicFrontend": "beatbump" + }, + "imageType": "png" + }, + "twitter": { + "frontends": { + "nitter": { + "preferences": { + "cookies": [ + "theme", + "infiniteScroll", + "stickyProfile", + "bidiSupport", + "hideTweetStats", + "hideBanner", + "hidePins", + "hideReplies", + "squareAvatars", + "mp4Playback", + "hlsPlayback", + "proxyVideos", + "muteVideos", + "autoplayGifs", + "replaceInstagram", + "replaceReddit", + "replaceTwitter", + "replaceYouTube" + ] + } + } + }, + "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" + }, + "imageType": "png" + }, + "instagram": { + "frontends": { + "bibliogram": { + "preferences": { + "token": "token", + "fetchEndpoint": "/settings.json", + "setEndpoint": "/applysettings" + } + } + }, + "targets": ["^https?:\\/{2}(www\\.)?instagram\\.com"], + "name": "Instagram", + "defaults": { + "disableInstagram": false + }, + "imageType": "png" + }, + "tiktok": { + "frontends": { + "proxiTok": {} + }, + "targets": ["^https?:\\/{2}(www\\.|)tiktok\\.com.*"], + "name": "TikTok", + "defaults": { + "disableTiktok": false + }, + "imageType": "png" + }, + "reddit": { + "frontends": { + "libreddit": { + "preferences": { + "cookies": ["theme", "front_page", "layout", "wide", "post_sort", "comment_sort", "show_nsfw", "autoplay_videos", "use_hls", "hide_hls_notification", "subscriptions", "filters"] + } }, - "targets": ["^https?:\\/{2}music\.youtube\.com(\\/.*|$)"] - } + "teddit": { + "preferences": { + "cookies": [ + "collapse_child_comments", + "domain_instagram", + "domain_twitter", + "domain_youtube", + "flairs", + "highlight_controversial", + "nsfw_enabled", + "post_media_max_height", + "show_upvoted_percentage", + "show_upvotes", + "theme", + "videos_muted" + ] + } + } + }, + "targets": ["^https?:\\/{2}(www\\.|old\\.|np\\.|new\\.|amp\\.|)reddit\\.com", "^https?:\\/{2}(i\\.|preview\\.)redd\\.it"], + "name": "Reddit", + "defaults": { + "disableReddit": false, + "redditFrontend": "libreddit" + }, + "imageType": "png" + }, + "imgur": { + "frontends": { + "rimgo": { + "preferences": {} + } + }, + "targets": ["^https?:\\/{2}([im]\\.)?imgur\\.(com|io)(\\/|$)"], + "name": "Imgur", + "defaults": { "disableImgur": false }, + "imageType": "png" + }, + "wikipedia": { + "frontends": { + "wikiless": { + "preferences": { + "cookies": ["theme", "default_lang"] + } + } + }, + "targets": ["^https?:\\/{2}([a-z]+\\.)*wikipedia\\.org"], + "name": "Wikipedia", + "defaults": { "disableWikipedia": true }, + "imageType": "svg" + }, + "medium": { + "frontends": { + "scribe": { + "preferences": {} + } + }, + "targets": [ + "(?:.*\\.)*(? Date: Wed, 7 Sep 2022 18:05:18 +0100 Subject: [PATCH 05/67] Started work on services.js --- src/assets/javascripts/services.js | 105 ++++ src/config/config.json | 874 ++++++++++++++--------------- src/pages/background/background.js | 5 + 3 files changed, 547 insertions(+), 437 deletions(-) create mode 100644 src/assets/javascripts/services.js diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js new file mode 100644 index 0000000..cf193e3 --- /dev/null +++ b/src/assets/javascripts/services.js @@ -0,0 +1,105 @@ +window.browser = window.browser || window.chrome + +import utils from "./utils.js" + +let config + +function getConfig() { + return new Promise(async resolve => { + fetch("/config/config.json") + .then(response => response.text()) + .then(data => { + config = JSON.parse(data) + }) + resolve() + }) +} + +let redirects = {} +let disabled, curNetwork, networkFallback, redirectType + +function init() { + return new Promise(async resolve => { + browser.storage.local.get(["network", "networkFallback"], r => { + curNetwork = r.network + networkFallback = r.networkFallback + }) + //cur = current + getConfig() + for (service in config.services) { + redirects = {} + browser.storage.local.get([`disable${camelCase(service)}`, `${service}Redirects`, `${service}RedirectType,`, `${service}Frontend`], r => { + disabled = r["disable" + camelCase(service)] + redirects = r[service + "Redirects"] + frontend = r[service + "Frontend"] + }) + for (frontend in config[service].frontends) { + redirects[frontend] = {} + for (network in config.networks) { + browser.storage.local.get([`${frontend}${camelCase(network)}RedirectsChecks`, `${frontend}${camelCase(network)}CustomRedirects`], r => { + redirects[frontend][network] = [...r[frontend + camelCase(network) + "RedirectsChecks"], ...r[frontend + camelCase(network) + "CustomRedirects"]] + }) + } + } + } + resolve() + }) +} + +init() +browser.storage.onChanged.addListener(init) + +function redirect(url, type, initiator) { + if (url.pathname == "/") return + for (curService in config.services) { + if (disabled && !disableOverride) continue + if (initiator && (all().includes(initiator.origin) || targets.includes(initiator.host))) continue + //if (!targets.some(rx => rx.test(url.href))) continue + if (!target.test(url)) continue + if (type != redirectType && type != "both") continue + let instanceList = redirects[frontend][curNetwork] + if (instanceList.length === 0 && networkFallback) instanceList = redirects[frontend].clearnet + if (instanceList.length === 0) return + const randomInstance = utils.getRandomInstance(instanceList) + return `${randomInstance}${url.pathname}${url.search}` + } +} + +function initDefaults() { + return new Promise(resolve => { + fetch("/instances/data.json") + .then(response => response.text()) + .then(data => { + let dataJson = JSON.parse(data) + redirects = dataJson + browser.storage.local.get(["cloudflareBlackList", "authenticateBlackList", "offlineBlackList"], async r => { + for (service in config.services) { + for (frontend in service.frontends) { + for (const instance of [...r.cloudflareBlackList, ...r.authenticateBlackList, ...r.offlineBlackList]) { + let i = redirects[frontend]["clearnet"].indexOf(instance) + if (i > -1) redirects[frontend]["clearnet"].splice(i, 1) + } + browser.storage.local.set({ + ["disable" + camelCase(service)]: false, + [service + "Redirects"]: redirects, + [service + "RedirectType"]: "both", + }) + for (frontend in service.frontends) { + for (protocol in config.protocols) { + browser.storage.local.set({ + [frontend + camelCase(protocol) + "RedirectsChecks"]: [...redirects[frontend][protocol]], + [frontend + camelCase(protocol) + "CustomRedirects"]: [], + }) + } + } + ;() => resolve() + } + } + }) + }) + }) +} + +export default { + redirect, +} diff --git a/src/config/config.json b/src/config/config.json index 9051d11..db99177 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -1,437 +1,437 @@ -{ - "networks": { - "clearnet": { - "url": "org", - "name": "Clearnet" - }, - "tor": { - "url": "onion", - "name": "Tor" - }, - "i2p": { - "url": "i2p", - "name": "I2P" - }, - "loki": { - "url": "loki", - "name": "Lokinet" - } - }, - "services": { - "youtube": { - "frontends": { - "invidious": { - "preferences": { - "cookies": ["PREFS"] - } - }, - "piped": { - "preferences": { - "localstorage": [ - "bufferGoal", - "comments", - "disableLBRY", - "enabledCodecs", - "hl", - "homepage", - "instance", - "listen", - "minimizeDescription", - "playerAutoPlay", - "proxyLBRY", - "quality", - "region", - "selectedSkip", - "sponsorblock", - "theme", - "volume", - "watchHistory" - ] - } - }, - "pipedMaterial": { - "preferences": { - "localstorage": ["PREFERENCES"] - } - }, - "cloudtube": { - "preferences": { - "token": "token", - "fetchEndpoint": "/api/settings", - "setEndpoint": "/settings" - } - } - }, - "singleInstanceFrontends": ["freetube", "yatte"], - "targets": [ - "^https?:\\/{2}(www\\.|music\\.|m\\.|)youtube.com(\\/.*|$)", - "^https?:\\/{2}img\\.youtube.com\\/vi\\/.*\\/..*", - "^https?:\\/{2}(i|s)\\.ytimg.com\\/vi\\/.*\\/..*", - "^https?:\\/{2}(www\\.|music\\.|)youtube.com\\/watch?v=..*", - "^https?:\\/{2}youtu\\.be\\/..*", - "^https?:\\/{2}(www\\.|)(youtube|youtube-nocookie)\\.com\\/embed\\/..*" - ], - "name": "Youtube", - "defaults": { - "disableYoutube": false, - "enableYoutubeCustomSettings": false, - "onlyEmbeddedVideo": "both", - "youtubeFrontend": "invidious", - "youtubeEmbedFrontend": "invidious" - }, - "imageType": "png" - }, - "youtubeMusic": { - "frontends": { - "beatbump": {}, - "hyperpipe": {} - }, - "targets": ["^https?:\\/{2}music\\.youtube\\.com(\\/.*|$)"], - "name": "YT Music", - "defaults": { - "disableYoutubeMusic": false, - "youtubeMusicFrontend": "beatbump" - }, - "imageType": "png" - }, - "twitter": { - "frontends": { - "nitter": { - "preferences": { - "cookies": [ - "theme", - "infiniteScroll", - "stickyProfile", - "bidiSupport", - "hideTweetStats", - "hideBanner", - "hidePins", - "hideReplies", - "squareAvatars", - "mp4Playback", - "hlsPlayback", - "proxyVideos", - "muteVideos", - "autoplayGifs", - "replaceInstagram", - "replaceReddit", - "replaceTwitter", - "replaceYouTube" - ] - } - } - }, - "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" - }, - "imageType": "png" - }, - "instagram": { - "frontends": { - "bibliogram": { - "preferences": { - "token": "token", - "fetchEndpoint": "/settings.json", - "setEndpoint": "/applysettings" - } - } - }, - "targets": ["^https?:\\/{2}(www\\.)?instagram\\.com"], - "name": "Instagram", - "defaults": { - "disableInstagram": false - }, - "imageType": "png" - }, - "tiktok": { - "frontends": { - "proxiTok": {} - }, - "targets": ["^https?:\\/{2}(www\\.|)tiktok\\.com.*"], - "name": "TikTok", - "defaults": { - "disableTiktok": false - }, - "imageType": "png" - }, - "reddit": { - "frontends": { - "libreddit": { - "preferences": { - "cookies": ["theme", "front_page", "layout", "wide", "post_sort", "comment_sort", "show_nsfw", "autoplay_videos", "use_hls", "hide_hls_notification", "subscriptions", "filters"] - } - }, - "teddit": { - "preferences": { - "cookies": [ - "collapse_child_comments", - "domain_instagram", - "domain_twitter", - "domain_youtube", - "flairs", - "highlight_controversial", - "nsfw_enabled", - "post_media_max_height", - "show_upvoted_percentage", - "show_upvotes", - "theme", - "videos_muted" - ] - } - } - }, - "targets": ["^https?:\\/{2}(www\\.|old\\.|np\\.|new\\.|amp\\.|)reddit\\.com", "^https?:\\/{2}(i\\.|preview\\.)redd\\.it"], - "name": "Reddit", - "defaults": { - "disableReddit": false, - "redditFrontend": "libreddit" - }, - "imageType": "png" - }, - "imgur": { - "frontends": { - "rimgo": { - "preferences": {} - } - }, - "targets": ["^https?:\\/{2}([im]\\.)?imgur\\.(com|io)(\\/|$)"], - "name": "Imgur", - "defaults": { "disableImgur": false }, - "imageType": "png" - }, - "wikipedia": { - "frontends": { - "wikiless": { - "preferences": { - "cookies": ["theme", "default_lang"] - } - } - }, - "targets": ["^https?:\\/{2}([a-z]+\\.)*wikipedia\\.org"], - "name": "Wikipedia", - "defaults": { "disableWikipedia": true }, - "imageType": "svg" - }, - "medium": { - "frontends": { - "scribe": { - "preferences": {} - } - }, - "targets": [ - "(?:.*\\.)*(? { @@ -86,6 +88,7 @@ browser.webRequest.onBeforeRequest.addListener( return null } + /* let newUrl = youtubeMusicHelper.redirect(url, details.type) if (!newUrl) newUrl = youtubeHelper.redirect(url, details.type, initiator) if (!newUrl) newUrl = twitterHelper.redirect(url, details.type, initiator) @@ -104,6 +107,8 @@ browser.webRequest.onBeforeRequest.addListener( if (!newUrl) newUrl = translateHelper.redirect(url) if (!newUrl) newUrl = searchHelper.redirect(url) if (!newUrl) newUrl = wikipediaHelper.redirect(url) + */ + let newUrl = servicesHelper.redirect(url, details.type, initiator) if (details.frameAncestors && details.frameAncestors.length > 0 && generalHelper.isException(new URL(details.frameAncestors[0].url))) newUrl = null From 44b9db669710d3a0be06c7aa12c2c787a7ba5cca Mon Sep 17 00:00:00 2001 From: Hygna Date: Wed, 7 Sep 2022 20:57:15 +0100 Subject: [PATCH 06/67] Added basic support for irregular url structures --- src/assets/javascripts/services.js | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index cf193e3..70d9423 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -50,18 +50,32 @@ init() browser.storage.onChanged.addListener(init) function redirect(url, type, initiator) { + let randomInstance if (url.pathname == "/") return - for (curService in config.services) { + for (service in config.services) { if (disabled && !disableOverride) continue if (initiator && (all().includes(initiator.origin) || targets.includes(initiator.host))) continue //if (!targets.some(rx => rx.test(url.href))) continue if (!target.test(url)) continue if (type != redirectType && type != "both") continue - let instanceList = redirects[frontend][curNetwork] - if (instanceList.length === 0 && networkFallback) instanceList = redirects[frontend].clearnet - if (instanceList.length === 0) return - const randomInstance = utils.getRandomInstance(instanceList) - return `${randomInstance}${url.pathname}${url.search}` + for (frontend in service.frontends) { + let instanceList = redirects[frontend][curNetwork] + if (instanceList.length === 0 && networkFallback) instanceList = redirects[frontend].clearnet + if (instanceList.length === 0) return + randomInstance = utils.getRandomInstance(instanceList) + } + } + switch (frontend) { + case "beatbump": + return `${randomInstance}${url.pathname}${url.search}` + .replace("/watch?v=", "/listen?id=") + .replace("/channel/", "/artist/") + .replace("/playlist?list=", "/playlist/VL") + .replace(/\/search\?q=.*/, searchQuery => searchQuery.replace("?q=", "/") + "?filter=EgWKAQIIAWoKEAMQBBAKEAkQBQ%3D%3D") + case "hyperpipe": + return `${randomInstance}${url.pathname}${url.search}`.replace(/\/search\?q=.*/, searchQuery => searchQuery.replace("?q=", "/")) + default: + return `${randomInstance}${url.pathname}${url.search}` } } @@ -102,4 +116,5 @@ function initDefaults() { export default { redirect, + initDefaults, } From f360a6ff1f4e803efe25931bc2d3613915aa608e Mon Sep 17 00:00:00 2001 From: Hygna Date: Wed, 7 Sep 2022 21:01:29 +0100 Subject: [PATCH 07/67] Fix beatbump search redirect from master --- src/assets/javascripts/services.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 70d9423..9b5c08c 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -71,7 +71,7 @@ function redirect(url, type, initiator) { .replace("/watch?v=", "/listen?id=") .replace("/channel/", "/artist/") .replace("/playlist?list=", "/playlist/VL") - .replace(/\/search\?q=.*/, searchQuery => searchQuery.replace("?q=", "/") + "?filter=EgWKAQIIAWoKEAMQBBAKEAkQBQ%3D%3D") + .replace(/\/search\?q=.*/, searchQuery => searchQuery.replace("?q=", "/") + "?filter=song") case "hyperpipe": return `${randomInstance}${url.pathname}${url.search}`.replace(/\/search\?q=.*/, searchQuery => searchQuery.replace("?q=", "/")) default: From 4492914535f410515a1221bd07373bd19b208ada Mon Sep 17 00:00:00 2001 From: Hygna Date: Thu, 8 Sep 2022 21:04:25 +0100 Subject: [PATCH 08/67] Add almost all irregular url structures --- src/assets/javascripts/services.js | 272 ++++++++++++++++------------- 1 file changed, 152 insertions(+), 120 deletions(-) diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 9b5c08c..5512916 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -1,120 +1,152 @@ -window.browser = window.browser || window.chrome - -import utils from "./utils.js" - -let config - -function getConfig() { - return new Promise(async resolve => { - fetch("/config/config.json") - .then(response => response.text()) - .then(data => { - config = JSON.parse(data) - }) - resolve() - }) -} - -let redirects = {} -let disabled, curNetwork, networkFallback, redirectType - -function init() { - return new Promise(async resolve => { - browser.storage.local.get(["network", "networkFallback"], r => { - curNetwork = r.network - networkFallback = r.networkFallback - }) - //cur = current - getConfig() - for (service in config.services) { - redirects = {} - browser.storage.local.get([`disable${camelCase(service)}`, `${service}Redirects`, `${service}RedirectType,`, `${service}Frontend`], r => { - disabled = r["disable" + camelCase(service)] - redirects = r[service + "Redirects"] - frontend = r[service + "Frontend"] - }) - for (frontend in config[service].frontends) { - redirects[frontend] = {} - for (network in config.networks) { - browser.storage.local.get([`${frontend}${camelCase(network)}RedirectsChecks`, `${frontend}${camelCase(network)}CustomRedirects`], r => { - redirects[frontend][network] = [...r[frontend + camelCase(network) + "RedirectsChecks"], ...r[frontend + camelCase(network) + "CustomRedirects"]] - }) - } - } - } - resolve() - }) -} - -init() -browser.storage.onChanged.addListener(init) - -function redirect(url, type, initiator) { - let randomInstance - if (url.pathname == "/") return - for (service in config.services) { - if (disabled && !disableOverride) continue - if (initiator && (all().includes(initiator.origin) || targets.includes(initiator.host))) continue - //if (!targets.some(rx => rx.test(url.href))) continue - if (!target.test(url)) continue - if (type != redirectType && type != "both") continue - for (frontend in service.frontends) { - let instanceList = redirects[frontend][curNetwork] - if (instanceList.length === 0 && networkFallback) instanceList = redirects[frontend].clearnet - if (instanceList.length === 0) return - randomInstance = utils.getRandomInstance(instanceList) - } - } - switch (frontend) { - case "beatbump": - return `${randomInstance}${url.pathname}${url.search}` - .replace("/watch?v=", "/listen?id=") - .replace("/channel/", "/artist/") - .replace("/playlist?list=", "/playlist/VL") - .replace(/\/search\?q=.*/, searchQuery => searchQuery.replace("?q=", "/") + "?filter=song") - case "hyperpipe": - return `${randomInstance}${url.pathname}${url.search}`.replace(/\/search\?q=.*/, searchQuery => searchQuery.replace("?q=", "/")) - default: - return `${randomInstance}${url.pathname}${url.search}` - } -} - -function initDefaults() { - return new Promise(resolve => { - fetch("/instances/data.json") - .then(response => response.text()) - .then(data => { - let dataJson = JSON.parse(data) - redirects = dataJson - browser.storage.local.get(["cloudflareBlackList", "authenticateBlackList", "offlineBlackList"], async r => { - for (service in config.services) { - for (frontend in service.frontends) { - for (const instance of [...r.cloudflareBlackList, ...r.authenticateBlackList, ...r.offlineBlackList]) { - let i = redirects[frontend]["clearnet"].indexOf(instance) - if (i > -1) redirects[frontend]["clearnet"].splice(i, 1) - } - browser.storage.local.set({ - ["disable" + camelCase(service)]: false, - [service + "Redirects"]: redirects, - [service + "RedirectType"]: "both", - }) - for (frontend in service.frontends) { - for (protocol in config.protocols) { - browser.storage.local.set({ - [frontend + camelCase(protocol) + "RedirectsChecks"]: [...redirects[frontend][protocol]], - [frontend + camelCase(protocol) + "CustomRedirects"]: [], - }) - } - } - ;() => resolve() - } - } - }) - }) - }) -} - -export default { - redirect, - initDefaults, -} +window.browser = window.browser || window.chrome + +import utils from "./utils.js" + +let config + +function getConfig() { + return new Promise(async resolve => { + fetch("/config/config.json") + .then(response => response.text()) + .then(data => { + config = JSON.parse(data) + }) + resolve() + }) +} + +let redirects = {} +let disabled, curNetwork, networkFallback, redirectType + +function init() { + return new Promise(async resolve => { + browser.storage.local.get(["network", "networkFallback"], r => { + curNetwork = r.network + networkFallback = r.networkFallback + }) + //cur = current + getConfig() + for (service in config.services) { + redirects = {} + browser.storage.local.get([`disable${camelCase(service)}`, `${service}Redirects`, `${service}RedirectType,`, `${service}Frontend`], r => { + disabled = r["disable" + camelCase(service)] + redirects = r[service + "Redirects"] + frontend = r[service + "Frontend"] + }) + for (frontend in config[service].frontends) { + redirects[frontend] = {} + for (network in config.networks) { + browser.storage.local.get([`${frontend}${camelCase(network)}RedirectsChecks`, `${frontend}${camelCase(network)}CustomRedirects`], r => { + redirects[frontend][network] = [...r[frontend + camelCase(network) + "RedirectsChecks"], ...r[frontend + camelCase(network) + "CustomRedirects"]] + }) + } + } + } + resolve() + }) +} + +init() +browser.storage.onChanged.addListener(init) + +function redirect(url, type, initiator) { + let randomInstance, frontend + if (url.pathname == "/") return + for (service in config.services) { + if (disabled && !disableOverride) continue + if (initiator && (all().includes(initiator.origin) || targets.includes(initiator.host))) continue + //if (!targets.some(rx => rx.test(url.href))) continue + if (!target.test(url)) continue + if (type != redirectType && type != "both") continue + browser.storage.local.get(`${service}Frontend`, (frontend = r[service + "Frontend"])) + let instanceList = redirects[frontend][curNetwork] + if (instanceList.length === 0 && networkFallback) instanceList = redirects[frontend].clearnet + if (instanceList.length === 0) return + randomInstance = utils.getRandomInstance(instanceList) + } + switch (frontend) { + // This is where all instance-specific code must be ran to convert the service url to one that can be understood by the frontend. + case "beatbump": + return `${randomInstance}${url.pathname}${url.search}` + .replace("/watch?v=", "/listen?id=") + .replace("/channel/", "/artist/") + .replace("/playlist?list=", "/playlist/VL") + .replace(/\/search\?q=.*/, searchQuery => searchQuery.replace("?q=", "/") + "?filter=song") + case "hyperpipe": + return `${randomInstance}${url.pathname}${url.search}`.replace(/\/search\?q=.*/, searchQuery => searchQuery.replace("?q=", "/")) + case "bibliogram": + const reservedPaths = ["u", "p", "privacy"] + if (url.pathname === "/" || reservedPaths.includes(url.pathname.split("/")[1])) return `${randomInstance}${url.pathname}${url.search}` + if (url.pathname.startsWith("/reel") || url.pathname.startsWith("/tv")) return `${randomInstance}/p${url.pathname.replace(/\/reel|\/tv/i, "")}${url.search}` + else return `${randomInstance}/u${url.pathname}${url.search}` // Likely a user profile, redirect to '/u/...' + case "lbryDesktop": + return url.href.replace(/^https?:\/{2}odysee\.com\//, "lbry://").replace(/:(?=[a-zA-Z0-9])/g, "#") + case "neuters": + if (url.pathname.startsWith("/article/") || url.pathname.startsWith("/pf/") || url.pathname.startsWith("/arc/") || url.pathname.startsWith("/resizer/")) return null + else if (url.pathname.endsWith("/")) return `${randomInstance}${url.pathname}` + else return `${randomInstance}${url.pathname}/` + case "searx": + case "searxng": + return `${randomInstance}/?q=${encodeURIComponent(url.searchParams.get("q"))}` + case "whoogle": + return `${randomInstance}/search${encodeURIComponent(url.searchParams.get("q"))}` + case "librex": + return `${randomInstance}/search.php${encodeURIComponent(url.searchParams.get("q"))}` + case "send": + return randomInstance + case "nitter": + if (url.host.split(".")[0] === "pbs" || url.host.split(".")[0] === "video") { + const [, id, format, extra] = url.search.match(/(.*)\?format=(.*)&(.*)/) + const query = encodeURIComponent(`${id}.${format}?${extra}`) + return `${randomInstance}/pic${url.pathname}${query}` + } else if (url.pathname.split("/").includes("tweets")) return `${randomInstance}${url.pathname.replace("/tweets", "")}${url.search}` + else if (url.host == "t.co") return `${randomInstance}/t.co${url.pathname}` + else return `${randomInstance}${url.pathname}${url.search}` + case "yatte": + return url.href.replace(/^https?:\/{2}/, "yattee://") + case "freetube": + return `freetube://https://youtube.com${url.pathname}${url.search}` + case "simplyTranslate": + return `${randomInstance}/${url.search}` + default: + return `${randomInstance}${url.pathname}${url.search}` + } // TODO: Wikiless, All youtube frontends by changing regex, lingva +} + +function initDefaults() { + return new Promise(resolve => { + fetch("/instances/data.json") + .then(response => response.text()) + .then(data => { + let dataJson = JSON.parse(data) + redirects = dataJson + browser.storage.local.get(["cloudflareBlackList", "authenticateBlackList", "offlineBlackList"], async r => { + for (service in config.services) { + for (defaultOption in service.defaults) { + browser.storage.local.set({ + [defaultOption]: defaultOption.value, + }) + } + for (frontend in service.frontends) { + for (const instance of [...r.cloudflareBlackList, ...r.authenticateBlackList, ...r.offlineBlackList]) { + let i = redirects[frontend]["clearnet"].indexOf(instance) + if (i > -1) redirects[frontend]["clearnet"].splice(i, 1) + } + for (network in config.networks) { + browser.storage.local.set({ + [frontend + camelCase(network) + "RedirectsChecks"]: [...redirects[frontend][network]], + [frontend + camelCase(network) + "CustomRedirects"]: [], + }) + } + } + } + ;() => resolve() + }) + }) + }) +} + +export default { + redirect, + initDefaults, +} From 36d01024c887b324f5a4044a88cf79b13c2aba48 Mon Sep 17 00:00:00 2001 From: Hygna Date: Thu, 8 Sep 2022 21:15:36 +0100 Subject: [PATCH 09/67] Make redirect not return on a single instance frontend --- src/assets/javascripts/services.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 5512916..973e44b 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -61,7 +61,7 @@ function redirect(url, type, initiator) { browser.storage.local.get(`${service}Frontend`, (frontend = r[service + "Frontend"])) let instanceList = redirects[frontend][curNetwork] if (instanceList.length === 0 && networkFallback) instanceList = redirects[frontend].clearnet - if (instanceList.length === 0) return + if (instanceList.length === 0 && redirects.indexOf(frontend) != -1) return randomInstance = utils.getRandomInstance(instanceList) } switch (frontend) { From 4cab752e05dd479c4c3da7c06c276de51ca9f637 Mon Sep 17 00:00:00 2001 From: Hygna Date: Fri, 9 Sep 2022 15:55:33 +0100 Subject: [PATCH 10/67] All irregular url structures completed --- src/assets/javascripts/services.js | 259 ++++++++++++++- src/config/config.json | 2 +- src/pages/background/background.js | 499 +++++++++++++++-------------- 3 files changed, 505 insertions(+), 255 deletions(-) diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 973e44b..9c88043 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -6,11 +6,13 @@ let config function getConfig() { return new Promise(async resolve => { + let data fetch("/config/config.json") .then(response => response.text()) .then(data => { - config = JSON.parse(data) + data = JSON.parse(data) }) + config = data resolve() }) } @@ -25,7 +27,6 @@ function init() { networkFallback = r.networkFallback }) //cur = current - getConfig() for (service in config.services) { redirects = {} browser.storage.local.get([`disable${camelCase(service)}`, `${service}Redirects`, `${service}RedirectType,`, `${service}Frontend`], r => { @@ -46,6 +47,8 @@ function init() { }) } +getConfig() +console.log(config) init() browser.storage.onChanged.addListener(init) @@ -54,9 +57,13 @@ function redirect(url, type, initiator) { if (url.pathname == "/") return for (service in config.services) { if (disabled && !disableOverride) continue + let targets = service.targets + if (targets == "datajson") { + browser.storage.local.get(`${service}Targets`, (targets = r[service + "Targets"])) + } + if (initiator && (all().includes(initiator.origin) || targets.includes(initiator.host))) continue - //if (!targets.some(rx => rx.test(url.href))) continue - if (!target.test(url)) continue + if (!targets.some(rx => rx.test(url.href))) continue if (type != redirectType && type != "both") continue browser.storage.local.get(`${service}Frontend`, (frontend = r[service + "Frontend"])) let instanceList = redirects[frontend][curNetwork] @@ -64,6 +71,26 @@ function redirect(url, type, initiator) { if (instanceList.length === 0 && redirects.indexOf(frontend) != -1) return randomInstance = utils.getRandomInstance(instanceList) } + + // Here is a (temperory) space for defining constants required in 2 or more switch cases. + // When possible, try have the two switch cases share all their code as done with searx and searxng. + // Do not do that when they do not share 100% of their code. + + const mapCentreRegex = /@(-?\d[0-9.]*),(-?\d[0-9.]*),(\d{1,2})[.z]/ + const dataLatLngRegex = /!3d(-?[0-9]{1,}.[0-9]{1,})!4d(-?[0-9]{1,}.[0-9]{1,})/ + const placeRegex = /\/place\/(.*)\// + function convertMapCentre() { + let [, lat, lon, zoom] = 0 + if (url.pathname.match(mapCentreRegex)) { + // Set map centre if present + ;[, lat, lon, zoom] = url.pathname.match(mapCentreRegex) + } else if (url.searchParams.has("center")) { + ;[lat, lon] = url.searchParams.get("center").split(",") + zoom = url.searchParams.get("zoom") ?? "17" + } + return [zoom, lon, lat] + } + switch (frontend) { // This is where all instance-specific code must be ran to convert the service url to one that can be understood by the frontend. case "beatbump": @@ -108,9 +135,229 @@ function redirect(url, type, initiator) { return `freetube://https://youtube.com${url.pathname}${url.search}` case "simplyTranslate": return `${randomInstance}/${url.search}` + case "osm": { + if (initiator && initiator.host === "earth.google.com") return + travelModes = { + driving: "fossgis_osrm_car", + walking: "fossgis_osrm_foot", + bicycling: "fossgis_osrm_bike", + transit: "fossgis_osrm_car", // not implemented on OSM, default to car. + } + + function addressToLatLng(address) { + const xmlhttp = new XMLHttpRequest() + xmlhttp.open("GET", `https://nominatim.openstreetmap.org/search/${address}?format=json&limit=1`, false) + xmlhttp.send() + if (xmlhttp.status === 200) { + const json = JSON.parse(xmlhttp.responseText)[0] + if (json) { + console.log("json", json) + return [`${json.lat},${json.lon}`, `${json.boundingbox[2]},${json.boundingbox[1]},${json.boundingbox[3]},${json.boundingbox[0]}`] + } + } + console.info("Error: Status is " + xmlhttp.status) + } + + let mapCentre = "#" + let prefs = {} + + const mapCentreData = convertMapCentre() + if (mapCentreData[0] && mapCentreData[1] && mapCentreData[2]) mapCentre = `#map=${mapCentreData[0]}/${mapCentreData[1]}/${mapCentreData[2]}` + if (url.searchParams.get("layer")) prefs.layers = osmLayers[url.searchParams.get("layer")] + + if (url.pathname.includes("/embed")) { + // Handle Google Maps Embed API + // https://www.google.com/maps/embed/v1/place?key=AIzaSyD4iE2xVSpkLLOXoyqT-RuPwURN3ddScAI&q=Eiffel+Tower,Paris+France + //console.log("embed life") + + let query = "" + if (url.searchParams.has("q")) query = url.searchParams.get("q") + else if (url.searchParams.has("query")) query = url.searchParams.has("query") + else if (url.searchParams.has("pb")) + try { + query = url.searchParams.get("pb").split(/!2s(.*?)!/)[1] + } catch (error) { + console.error(error) + } // Unable to find map marker in URL. + + let [coords, boundingbox] = addressToLatLng(query) + prefs.bbox = boundingbox + prefs.marker = coords + prefs.layer = "mapnik" + let prefsEncoded = new URLSearchParams(prefs).toString() + return `${randomInstance}/export/embed.html?${prefsEncoded}` + } else if (url.pathname.includes("/dir")) { + // Handle Google Maps Directions + // https://www.google.com/maps/dir/?api=1&origin=Space+Needle+Seattle+WA&destination=Pike+Place+Market+Seattle+WA&travelmode=bicycling + + let travMod = url.searchParams.get("travelmode") + if (url.searchParams.has("travelmode")) prefs.engine = travelModes[travMod] + + let orgVal = url.searchParams.get("origin") + let destVal = url.searchParams.get("destination") + + let org + addressToLatLng(orgVal, a => (org = a)) + let dest + addressToLatLng(destVal, a => (dest = a)) + prefs.route = `${org};${dest}` + + let prefsEncoded = new URLSearchParams(prefs).toString() + return `${randomInstance}/directions?${prefsEncoded}${mapCentre}` + } else if (url.pathname.includes("data=") && url.pathname.match(dataLatLngRegex)) { + // Get marker from data attribute + // https://www.google.com/maps/place/41%C2%B001'58.2%22N+40%C2%B029'18.2%22E/@41.032833,40.4862063,17z/data=!3m1!4b1!4m6!3m5!1s0x0:0xf64286eaf72fc49d!7e2!8m2!3d41.0328329!4d40.4883948 + //console.log("data life") + + let [, mlat, mlon] = url.pathname.match(dataLatLngRegex) + + return `${randomInstance}/search?query=${mlat}%2C${mlon}` + } else if (url.searchParams.has("ll")) { + // Get marker from ll param + // https://maps.google.com/?ll=38.882147,-76.99017 + //console.log("ll life") + + const [mlat, mlon] = url.searchParams.get("ll").split(",") + + return `${randomInstance}/search?query=${mlat}%2C${mlon}` + } else if (url.searchParams.has("viewpoint")) { + // Get marker from viewpoint param. + // https://www.google.com/maps/@?api=1&map_action=pano&viewpoint=48.857832,2.295226&heading=-45&pitch=38&fov=80 + //console.log("viewpoint life") + + const [mlat, mlon] = url.searchParams.get("viewpoint").split(",") + + return `${randomInstance}/search?query=${mlat}%2C${mlon}` + } else { + // Use query as search if present. + //console.log("normal life") + + let query + if (url.searchParams.has("q")) query = url.searchParams.get("q") + else if (url.searchParams.has("query")) query = url.searchParams.get("query") + else if (url.pathname.match(placeRegex)) query = url.pathname.match(placeRegex)[1] + + let prefsEncoded = new URLSearchParams(prefs).toString() + if (query) return `${randomInstance}/search?query="${query}${mapCentre}&${prefsEncoded}` + } + + let prefsEncoded = new URLSearchParams(prefs).toString() + console.log("mapCentre", mapCentre) + console.log("prefs", prefs) + console.log("prefsEncoded", prefsEncoded) + return `${randomInstance}/${mapCentre}&${prefsEncoded}` + } + case "facil": { + if (initiator && initiator.host === "earth.google.com") return + let travelModes = { + driving: "car", + walking: "pedestrian", + bicycling: "bicycle", + transit: "car", // not implemented on Facil, default to car. + } + const mapCentreData = convertMapCentre() + let mapCentre = "#" + if (mapCentreData[0] && mapCentreData[1] && mapCentreData[2]) mapCentre = `#${mapCentreData[0]}/${mapCentreData[1]}/${mapCentreData[2]}` + + if (url.pathname.includes("/embed")) { + // Handle Google Maps Embed API + // https://www.google.com/maps/embed/v1/place?key=AIzaSyD4iE2xVSpkLLOXoyqT-RuPwURN3ddScAI&q=Eiffel+Tower,Paris+France + //console.log("embed life") + + let query = "" + if (url.searchParams.has("q")) query = url.searchParams.get("q") + else if (url.searchParams.has("query")) query = url.searchParams.has("query") + else if (url.searchParams.has("pb")) + try { + query = url.searchParams.get("pb").split(/!2s(.*?)!/)[1] + } catch (error) { + console.error(error) + } // Unable to find map marker in URL. + + return `${randomInstance}/#q=${query}` + } else if (url.pathname.includes("/dir")) { + // Handle Google Maps Directions + // https://www.google.com/maps/dir/?api=1&origin=Space+Needle+Seattle+WA&destination=Pike+Place+Market+Seattle+WA&travelmode=bicycling + + let travMod = url.searchParams.get("travelmode") + + let orgVal = url.searchParams.get("origin") + let destVal = url.searchParams.get("destination") + + return `${randomInstance}/#q=${orgVal}%20to%20${destVal}%20by%20${travelModes[travMod]}` + } else if (url.pathname.includes("data=") && url.pathname.match(dataLatLngRegex)) { + // Get marker from data attribute + // https://www.google.com/maps/place/41%C2%B001'58.2%22N+40%C2%B029'18.2%22E/@41.032833,40.4862063,17z/data=!3m1!4b1!4m6!3m5!1s0x0:0xf64286eaf72fc49d!7e2!8m2!3d41.0328329!4d40.4883948 + //console.log("data life") + + let [, mlat, mlon] = url.pathname.match(dataLatLngRegex) + + return `${randomInstance}/#q=${mlat}%2C${mlon}` + } else if (url.searchParams.has("ll")) { + // Get marker from ll param + // https://maps.google.com/?ll=38.882147,-76.99017 + //console.log("ll life") + + const [mlat, mlon] = url.searchParams.get("ll").split(",") + + return `${randomInstance}/#q=${mlat}%2C${mlon}` + } else if (url.searchParams.has("viewpoint")) { + // Get marker from viewpoint param. + // https://www.google.com/maps/@?api=1&map_action=pano&viewpoint=48.857832,2.295226&heading=-45&pitch=38&fov=80 + //console.log("viewpoint life") + + const [mlat, mlon] = url.searchParams.get("viewpoint").split(",") + + return `${randomInstance}/#q=${mlat}%2C${mlon}` + } else { + // Use query as search if present. + //console.log("normal life") + + let query + if (url.searchParams.has("q")) query = url.searchParams.get("q") + else if (url.searchParams.has("query")) query = url.searchParams.get("query") + else if (url.pathname.match(placeRegex)) query = url.pathname.match(placeRegex)[1] + + if (query) return `${randomInstance}/${mapCentre}/Mpnk/${query}` + } + } + case "wikiless": + let GETArguments = [] + if (url.search.length > 0) { + let search = url.search.substring(1) //get rid of '?' + let argstrings = search.split("&") + for (let i = 0; i < argstrings.length; i++) { + let args = argstrings[i].split("=") + GETArguments.push([args[0], args[1]]) + } + } + + let link = `${randomInstance}${url.pathname}` + let urlSplit = url.host.split(".") + if (urlSplit[0] != "wikipedia" && urlSplit[0] != "www") { + if (urlSplit[0] == "m") GETArguments.push(["mobileaction", "toggle_view_mobile"]) + else GETArguments.push(["lang", urlSplit[0]]) + if (urlSplit[1] == "m") GETArguments.push(["mobileaction", "toggle_view_mobile"]) + // wikiless doesn't have mobile view support yet + } + for (let i = 0; i < GETArguments.length; i++) link += (i == 0 ? "?" : "&") + GETArguments[i][0] + "=" + GETArguments[i][1] + return link + + case "lingva": + let params_arr = url.search.split("&") + params_arr[0] = params_arr[0].substring(1) + let params = {} + for (let i = 0; i < params_arr.length; i++) { + let pair = params_arr[i].split("=") + params[pair[0]] = pair[1] + } + if (params.sl && params.tl && params.text) { + return `${randomInstance}/${params.sl}/${params.tl}/${params.text}` + } + return randomInstance default: return `${randomInstance}${url.pathname}${url.search}` - } // TODO: Wikiless, All youtube frontends by changing regex, lingva + } } function initDefaults() { @@ -124,7 +371,7 @@ function initDefaults() { for (service in config.services) { for (defaultOption in service.defaults) { browser.storage.local.set({ - [defaultOption]: defaultOption.value, + [defaultOption]: service.defaults[defaultOption], }) } for (frontend in service.frontends) { diff --git a/src/config/config.json b/src/config/config.json index db99177..3d4d3f8 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -64,7 +64,7 @@ }, "singleInstanceFrontends": ["freetube", "yatte"], "targets": [ - "^https?:\\/{2}(www\\.|music\\.|m\\.|)youtube.com(\\/.*|$)", + "^https?:\\/{2}(www\\.|music\\.|m\\.|)youtube.com(\\(?!iframe_api)/.*|$)", "^https?:\\/{2}img\\.youtube.com\\/vi\\/.*\\/..*", "^https?:\\/{2}(i|s)\\.ytimg.com\\/vi\\/.*\\/..*", "^https?:\\/{2}(www\\.|music\\.|)youtube.com\\/watch?v=..*", diff --git a/src/pages/background/background.js b/src/pages/background/background.js index 87d498e..e93e3d0 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -1,248 +1,251 @@ -"use strict" - -import generalHelper from "../../assets/javascripts/general.js" -import utils from "../../assets/javascripts/utils.js" - -import youtubeHelper from "../../assets/javascripts/youtube/youtube.js" -import youtubeMusicHelper from "../../assets/javascripts/youtubeMusic.js" -import twitterHelper from "../../assets/javascripts/twitter.js" -import instagramHelper from "../../assets/javascripts/instagram.js" -import redditHelper from "../../assets/javascripts/reddit.js" -import searchHelper from "../../assets/javascripts/search.js" -import translateHelper from "../../assets/javascripts/translate/translate.js" -import mapsHelper from "../../assets/javascripts/maps.js" -import wikipediaHelper from "../../assets/javascripts/wikipedia.js" -import mediumHelper from "../../assets/javascripts/medium.js" -import quoraHelper from "../../assets/javascripts/quora.js" -import libremdbHelper from "../../assets/javascripts/imdb.js" -import reutersHelper from "../../assets/javascripts/reuters.js" -import imgurHelper from "../../assets/javascripts/imgur.js" -import tiktokHelper from "../../assets/javascripts/tiktok.js" -import sendTargetsHelper from "../../assets/javascripts/sendTargets.js" -import peertubeHelper from "../../assets/javascripts/peertube.js" -import lbryHelper from "../../assets/javascripts/lbry.js" - -import servicesHelper from "../../assets/javascripts/services.js" - -window.browser = window.browser || window.chrome - -browser.runtime.onInstalled.addListener(details => { - function initDefaults() { - fetch("/instances/blacklist.json") - .then(response => response.text()) - .then(async data => { - browser.storage.local.clear(() => { - browser.storage.local.set({ cloudflareBlackList: JSON.parse(data).cloudflare }, () => { - browser.storage.local.set({ authenticateBlackList: JSON.parse(data).authenticate }, () => { - browser.storage.local.set({ offlineBlackList: JSON.parse(data).offline }, () => { - generalHelper.initDefaults() - youtubeHelper.initDefaults() - youtubeMusicHelper.initDefaults() - twitterHelper.initDefaults() - instagramHelper.initDefaults() - mapsHelper.initDefaults() - searchHelper.initDefaults() - translateHelper.initDefaults() - mediumHelper.initDefaults() - quoraHelper.initDefaults() - libremdbHelper.initDefaults() - reutersHelper.initDefaults() - redditHelper.initDefaults() - wikipediaHelper.initDefaults() - imgurHelper.initDefaults() - tiktokHelper.initDefaults() - sendTargetsHelper.initDefaults() - peertubeHelper.initDefaults() - lbryHelper.initDefaults() - }) - }) - }) - }) - }) - } - if (details.reason == "install") initDefaults() - - // if (details.reason == 'install' || (details.reason == "update" && details.previousVersion != browser.runtime.getManifest().version)) { - // if (details.reason == "update") - // browser.storage.local.get(null, r => { - // if (r.theme) { - // const old = encodeURIComponent(JSON.stringify(r)) - // browser.tabs.create({ url: browser.runtime.getURL(`/pages/background/reset_warning.html?data=${old}`) }); - // } - // initDefaults(); - // }) - // else initDefaults(); - // } -}) - -let BYPASSTABs = [] -browser.webRequest.onBeforeRequest.addListener( - details => { - const url = new URL(details.url) - if (new RegExp(/^chrome-extension:\/{2}.*\/instances\/.*.json$/).test(url.href) && details.type == "xmlhttprequest") return - let initiator - try { - if (details.originUrl) initiator = new URL(details.originUrl) - else if (details.initiator) initiator = new URL(details.initiator) - } catch { - return null - } - - /* - let newUrl = youtubeMusicHelper.redirect(url, details.type) - if (!newUrl) newUrl = youtubeHelper.redirect(url, details.type, initiator) - if (!newUrl) newUrl = twitterHelper.redirect(url, details.type, initiator) - if (!newUrl) newUrl = instagramHelper.redirect(url, details.type, initiator) - if (!newUrl) newUrl = mapsHelper.redirect(url, initiator) - if (!newUrl) newUrl = redditHelper.redirect(url, details.type, initiator) - if (!newUrl) newUrl = mediumHelper.redirect(url, details.type, initiator) - if (!newUrl) newUrl = quoraHelper.redirect(url, details.type, initiator) - if (!newUrl) newUrl = libremdbHelper.redirect(url, details.type, initiator) - if (!newUrl) newUrl = reutersHelper.redirect(url, details.type, initiator) - if (!newUrl) newUrl = imgurHelper.redirect(url, details.type, initiator) - if (!newUrl) newUrl = tiktokHelper.redirect(url, details.type, initiator) - if (!newUrl) newUrl = sendTargetsHelper.redirect(url, details.type, initiator) - if (!newUrl) newUrl = peertubeHelper.redirect(url, details.type, initiator) - if (!newUrl) newUrl = lbryHelper.redirect(url, details.type, initiator) - if (!newUrl) newUrl = translateHelper.redirect(url) - if (!newUrl) newUrl = searchHelper.redirect(url) - if (!newUrl) newUrl = wikipediaHelper.redirect(url) - */ - let newUrl = servicesHelper.redirect(url, details.type, initiator) - - if (details.frameAncestors && details.frameAncestors.length > 0 && generalHelper.isException(new URL(details.frameAncestors[0].url))) newUrl = null - - if (generalHelper.isException(url)) newUrl = "BYPASSTAB" - if (BYPASSTABs.includes(details.tabId)) newUrl = null - - if (newUrl) { - if (newUrl === "CANCEL") { - console.log(`Canceled ${url}`) - return { cancel: true } - } - if (newUrl === "BYPASSTAB") { - console.log(`Bypassed ${details.tabId} ${url}`) - if (!BYPASSTABs.includes(details.tabId)) BYPASSTABs.push(details.tabId) - return null - } - console.info("Redirecting", url.href, "=>", newUrl) - return { redirectUrl: newUrl } - } - return null - }, - { urls: [""] }, - ["blocking"] -) - -browser.tabs.onRemoved.addListener(tabId => { - const i = BYPASSTABs.indexOf(tabId) - if (i > -1) { - BYPASSTABs.splice(i, 1) - console.log("Removed BYPASSTABs", tabId) - } -}) - -browser.webRequest.onHeadersReceived.addListener( - e => { - let response = youtubeHelper.removeXFrameOptions(e) - if (!response) response = twitterHelper.removeXFrameOptions(e) - return response - }, - { urls: [""] }, - ["blocking", "responseHeaders"] -) - -async function redirectOfflineInstance(url, tabId) { - let newUrl = await youtubeHelper.switchInstance(url, true) - if (!newUrl) newUrl = await twitterHelper.switchInstance(url, true) - if (!newUrl) newUrl = await instagramHelper.switchInstance(url, true) - if (!newUrl) newUrl = await redditHelper.switchInstance(url, true) - if (!newUrl) newUrl = await searchHelper.switchInstance(url, true) - if (!newUrl) newUrl = await translateHelper.switchInstance(url, true) - if (!newUrl) newUrl = await mediumHelper.switchInstance(url, true) - if (!newUrl) newUrl = await quoraHelper.switchInstance(url, true) - if (!newUrl) newUrl = await libremdbHelper.switchInstance(url, true) - if (!newUrl) newUrl = await tiktokHelper.switchInstance(url, true) - if (!newUrl) newUrl = await imgurHelper.switchInstance(url, true) - if (!newUrl) newUrl = await wikipediaHelper.switchInstance(url, true) - if (!newUrl) newUrl = await peertubeHelper.switchInstance(url, true) - if (!newUrl) newUrl = await lbryHelper.switchInstance(url, true) - if (!newUrl) newUrl = await youtubeMusicHelper.switchInstance(url, true) - - if (newUrl) { - if (counter >= 5) { - browser.tabs.update(tabId, { - url: `/pages/errors/instance_offline.html?url=${encodeURIComponent(newUrl)}`, - }) - counter = 0 - } else { - browser.tabs.update(tabId, { url: newUrl }) - counter++ - } - } -} -let counter = 0 - -function isAutoRedirect() { - return new Promise(resolve => browser.storage.local.get("autoRedirect", r => resolve(r.autoRedirect == true))) -} - -browser.webRequest.onResponseStarted.addListener( - async details => { - if (!(await isAutoRedirect())) return null - if (details.type == "main_frame" && details.statusCode >= 500) redirectOfflineInstance(new URL(details.url), details.tabId) - }, - { urls: [""] } -) - -browser.webRequest.onErrorOccurred.addListener( - async details => { - if (!(await isAutoRedirect())) return - if (details.type == "main_frame") redirectOfflineInstance(new URL(details.url), details.tabId) - }, - { urls: [""] } -) - -browser.commands.onCommand.addListener(command => { - if (command === "switchInstance") utils.switchInstance() - else if (command == "copyRaw") utils.copyRaw() - else if (command == "unify") utils.unify() -}) - -browser.contextMenus.create({ - id: "settings", - title: browser.i18n.getMessage("Settings"), - contexts: ["browser_action"], -}) - -browser.contextMenus.create({ - id: "switchInstance", - title: browser.i18n.getMessage("switchInstance"), - contexts: ["browser_action"], -}) - -browser.contextMenus.create({ - id: "copyRaw", - title: browser.i18n.getMessage("copyRaw"), - contexts: ["browser_action"], -}) - -browser.contextMenus.create({ - id: "unify", - title: browser.i18n.getMessage("unifySettings"), - contexts: ["browser_action"], -}) - -browser.contextMenus.onClicked.addListener(info => { - if (info.menuItemId == "switchInstance") utils.switchInstance() - else if (info.menuItemId == "settings") browser.runtime.openOptionsPage() - else if (info.menuItemId == "copyRaw") utils.copyRaw() - else if (info.menuItemId == "unify") utils.unify() -}) - -browser.runtime.onMessage.addListener((message, sender, sendResponse) => { - if (message.function === "unify") utils.unify(false).then(r => sendResponse({ response: r })) - return true -}) - -browser.storage.local.set({ version: browser.runtime.getManifest().version }) +"use strict" + +import generalHelper from "../../assets/javascripts/general.js" +import utils from "../../assets/javascripts/utils.js" + +import youtubeHelper from "../../assets/javascripts/youtube/youtube.js" +import youtubeMusicHelper from "../../assets/javascripts/youtubeMusic.js" +import twitterHelper from "../../assets/javascripts/twitter.js" +import instagramHelper from "../../assets/javascripts/instagram.js" +import redditHelper from "../../assets/javascripts/reddit.js" +import searchHelper from "../../assets/javascripts/search.js" +import translateHelper from "../../assets/javascripts/translate/translate.js" +import mapsHelper from "../../assets/javascripts/maps.js" +import wikipediaHelper from "../../assets/javascripts/wikipedia.js" +import mediumHelper from "../../assets/javascripts/medium.js" +import quoraHelper from "../../assets/javascripts/quora.js" +import libremdbHelper from "../../assets/javascripts/imdb.js" +import reutersHelper from "../../assets/javascripts/reuters.js" +import imgurHelper from "../../assets/javascripts/imgur.js" +import tiktokHelper from "../../assets/javascripts/tiktok.js" +import sendTargetsHelper from "../../assets/javascripts/sendTargets.js" +import peertubeHelper from "../../assets/javascripts/peertube.js" +import lbryHelper from "../../assets/javascripts/lbry.js" + +import servicesHelper from "../../assets/javascripts/services.js" + +window.browser = window.browser || window.chrome + +browser.runtime.onInstalled.addListener(details => { + function initDefaults() { + fetch("/instances/blacklist.json") + .then(response => response.text()) + .then(async data => { + browser.storage.local.clear(() => { + browser.storage.local.set({ cloudflareBlackList: JSON.parse(data).cloudflare }, () => { + browser.storage.local.set({ authenticateBlackList: JSON.parse(data).authenticate }, () => { + browser.storage.local.set({ offlineBlackList: JSON.parse(data).offline }, () => { + generalHelper.initDefaults() + /* + youtubeHelper.initDefaults() + youtubeMusicHelper.initDefaults() + twitterHelper.initDefaults() + instagramHelper.initDefaults() + mapsHelper.initDefaults() + searchHelper.initDefaults() + translateHelper.initDefaults() + mediumHelper.initDefaults() + quoraHelper.initDefaults() + libremdbHelper.initDefaults() + reutersHelper.initDefaults() + redditHelper.initDefaults() + wikipediaHelper.initDefaults() + imgurHelper.initDefaults() + tiktokHelper.initDefaults() + sendTargetsHelper.initDefaults() + peertubeHelper.initDefaults() + lbryHelper.initDefaults() + */ + servicesHelper.initDefaults() + }) + }) + }) + }) + }) + } + if (details.reason == "install") initDefaults() + + // if (details.reason == 'install' || (details.reason == "update" && details.previousVersion != browser.runtime.getManifest().version)) { + // if (details.reason == "update") + // browser.storage.local.get(null, r => { + // if (r.theme) { + // const old = encodeURIComponent(JSON.stringify(r)) + // browser.tabs.create({ url: browser.runtime.getURL(`/pages/background/reset_warning.html?data=${old}`) }); + // } + // initDefaults(); + // }) + // else initDefaults(); + // } +}) + +let BYPASSTABs = [] +browser.webRequest.onBeforeRequest.addListener( + details => { + const url = new URL(details.url) + if (new RegExp(/^chrome-extension:\/{2}.*\/instances\/.*.json$/).test(url.href) && details.type == "xmlhttprequest") return + let initiator + try { + if (details.originUrl) initiator = new URL(details.originUrl) + else if (details.initiator) initiator = new URL(details.initiator) + } catch { + return null + } + + /* + let newUrl = youtubeMusicHelper.redirect(url, details.type) + if (!newUrl) newUrl = youtubeHelper.redirect(url, details.type, initiator) + if (!newUrl) newUrl = twitterHelper.redirect(url, details.type, initiator) + if (!newUrl) newUrl = instagramHelper.redirect(url, details.type, initiator) + if (!newUrl) newUrl = mapsHelper.redirect(url, initiator) + if (!newUrl) newUrl = redditHelper.redirect(url, details.type, initiator) + if (!newUrl) newUrl = mediumHelper.redirect(url, details.type, initiator) + if (!newUrl) newUrl = quoraHelper.redirect(url, details.type, initiator) + if (!newUrl) newUrl = libremdbHelper.redirect(url, details.type, initiator) + if (!newUrl) newUrl = reutersHelper.redirect(url, details.type, initiator) + if (!newUrl) newUrl = imgurHelper.redirect(url, details.type, initiator) + if (!newUrl) newUrl = tiktokHelper.redirect(url, details.type, initiator) + if (!newUrl) newUrl = sendTargetsHelper.redirect(url, details.type, initiator) + if (!newUrl) newUrl = peertubeHelper.redirect(url, details.type, initiator) + if (!newUrl) newUrl = lbryHelper.redirect(url, details.type, initiator) + if (!newUrl) newUrl = translateHelper.redirect(url) + if (!newUrl) newUrl = searchHelper.redirect(url) + if (!newUrl) newUrl = wikipediaHelper.redirect(url) + */ + let newUrl = servicesHelper.redirect(url, details.type, initiator) + + if (details.frameAncestors && details.frameAncestors.length > 0 && generalHelper.isException(new URL(details.frameAncestors[0].url))) newUrl = null + + if (generalHelper.isException(url)) newUrl = "BYPASSTAB" + if (BYPASSTABs.includes(details.tabId)) newUrl = null + + if (newUrl) { + if (newUrl === "CANCEL") { + console.log(`Canceled ${url}`) + return { cancel: true } + } + if (newUrl === "BYPASSTAB") { + console.log(`Bypassed ${details.tabId} ${url}`) + if (!BYPASSTABs.includes(details.tabId)) BYPASSTABs.push(details.tabId) + return null + } + console.info("Redirecting", url.href, "=>", newUrl) + return { redirectUrl: newUrl } + } + return null + }, + { urls: [""] }, + ["blocking"] +) + +browser.tabs.onRemoved.addListener(tabId => { + const i = BYPASSTABs.indexOf(tabId) + if (i > -1) { + BYPASSTABs.splice(i, 1) + console.log("Removed BYPASSTABs", tabId) + } +}) + +browser.webRequest.onHeadersReceived.addListener( + e => { + let response = youtubeHelper.removeXFrameOptions(e) + if (!response) response = twitterHelper.removeXFrameOptions(e) + return response + }, + { urls: [""] }, + ["blocking", "responseHeaders"] +) + +async function redirectOfflineInstance(url, tabId) { + let newUrl = await youtubeHelper.switchInstance(url, true) + if (!newUrl) newUrl = await twitterHelper.switchInstance(url, true) + if (!newUrl) newUrl = await instagramHelper.switchInstance(url, true) + if (!newUrl) newUrl = await redditHelper.switchInstance(url, true) + if (!newUrl) newUrl = await searchHelper.switchInstance(url, true) + if (!newUrl) newUrl = await translateHelper.switchInstance(url, true) + if (!newUrl) newUrl = await mediumHelper.switchInstance(url, true) + if (!newUrl) newUrl = await quoraHelper.switchInstance(url, true) + if (!newUrl) newUrl = await libremdbHelper.switchInstance(url, true) + if (!newUrl) newUrl = await tiktokHelper.switchInstance(url, true) + if (!newUrl) newUrl = await imgurHelper.switchInstance(url, true) + if (!newUrl) newUrl = await wikipediaHelper.switchInstance(url, true) + if (!newUrl) newUrl = await peertubeHelper.switchInstance(url, true) + if (!newUrl) newUrl = await lbryHelper.switchInstance(url, true) + if (!newUrl) newUrl = await youtubeMusicHelper.switchInstance(url, true) + + if (newUrl) { + if (counter >= 5) { + browser.tabs.update(tabId, { + url: `/pages/errors/instance_offline.html?url=${encodeURIComponent(newUrl)}`, + }) + counter = 0 + } else { + browser.tabs.update(tabId, { url: newUrl }) + counter++ + } + } +} +let counter = 0 + +function isAutoRedirect() { + return new Promise(resolve => browser.storage.local.get("autoRedirect", r => resolve(r.autoRedirect == true))) +} + +browser.webRequest.onResponseStarted.addListener( + async details => { + if (!(await isAutoRedirect())) return null + if (details.type == "main_frame" && details.statusCode >= 500) redirectOfflineInstance(new URL(details.url), details.tabId) + }, + { urls: [""] } +) + +browser.webRequest.onErrorOccurred.addListener( + async details => { + if (!(await isAutoRedirect())) return + if (details.type == "main_frame") redirectOfflineInstance(new URL(details.url), details.tabId) + }, + { urls: [""] } +) + +browser.commands.onCommand.addListener(command => { + if (command === "switchInstance") utils.switchInstance() + else if (command == "copyRaw") utils.copyRaw() + else if (command == "unify") utils.unify() +}) + +browser.contextMenus.create({ + id: "settings", + title: browser.i18n.getMessage("Settings"), + contexts: ["browser_action"], +}) + +browser.contextMenus.create({ + id: "switchInstance", + title: browser.i18n.getMessage("switchInstance"), + contexts: ["browser_action"], +}) + +browser.contextMenus.create({ + id: "copyRaw", + title: browser.i18n.getMessage("copyRaw"), + contexts: ["browser_action"], +}) + +browser.contextMenus.create({ + id: "unify", + title: browser.i18n.getMessage("unifySettings"), + contexts: ["browser_action"], +}) + +browser.contextMenus.onClicked.addListener(info => { + if (info.menuItemId == "switchInstance") utils.switchInstance() + else if (info.menuItemId == "settings") browser.runtime.openOptionsPage() + else if (info.menuItemId == "copyRaw") utils.copyRaw() + else if (info.menuItemId == "unify") utils.unify() +}) + +browser.runtime.onMessage.addListener((message, sender, sendResponse) => { + if (message.function === "unify") utils.unify(false).then(r => sendResponse({ response: r })) + return true +}) + +browser.storage.local.set({ version: browser.runtime.getManifest().version }) From c005983a0fa6b99186aad02045af29d9466f0ae8 Mon Sep 17 00:00:00 2001 From: Hygna Date: Fri, 9 Sep 2022 22:08:40 +0100 Subject: [PATCH 11/67] Make config.json fetching work --- src/assets/javascripts/services.js | 46 ++++++++++++++++-------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 9c88043..1781c4e 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -2,23 +2,25 @@ window.browser = window.browser || window.chrome import utils from "./utils.js" -let config +let config = {}, + redirects = {}, + options = {} +let disabled, curNetwork, networkFallback, redirectType -function getConfig() { - return new Promise(async resolve => { - let data +async function getConfig() { + return new Promise(resolve => { fetch("/config/config.json") .then(response => response.text()) .then(data => { - data = JSON.parse(data) + config = JSON.parse(data) + resolve() }) - config = data - resolve() }) } -let redirects = {} -let disabled, curNetwork, networkFallback, redirectType +function camelCase(str) { + return str.charAt(0).toUpperCase() + str.slice(1) +} function init() { return new Promise(async resolve => { @@ -27,16 +29,16 @@ function init() { networkFallback = r.networkFallback }) //cur = current - for (service in config.services) { - redirects = {} + for (const service in config.services) { + options[service] = {} browser.storage.local.get([`disable${camelCase(service)}`, `${service}Redirects`, `${service}RedirectType,`, `${service}Frontend`], r => { - disabled = r["disable" + camelCase(service)] - redirects = r[service + "Redirects"] - frontend = r[service + "Frontend"] + options[service].disabled = r["disable" + camelCase(service)] + options[service].redirects = r[service + "Redirects"] + options[service].frontend = r[service + "Frontend"] }) - for (frontend in config[service].frontends) { + for (const frontend in config.services[service].frontends) { redirects[frontend] = {} - for (network in config.networks) { + for (const network in config.networks) { browser.storage.local.get([`${frontend}${camelCase(network)}RedirectsChecks`, `${frontend}${camelCase(network)}CustomRedirects`], r => { redirects[frontend][network] = [...r[frontend + camelCase(network) + "RedirectsChecks"], ...r[frontend + camelCase(network) + "CustomRedirects"]] }) @@ -47,7 +49,7 @@ function init() { }) } -getConfig() +await getConfig() console.log(config) init() browser.storage.onChanged.addListener(init) @@ -55,7 +57,7 @@ browser.storage.onChanged.addListener(init) function redirect(url, type, initiator) { let randomInstance, frontend if (url.pathname == "/") return - for (service in config.services) { + for (const service in config.services) { if (disabled && !disableOverride) continue let targets = service.targets if (targets == "datajson") { @@ -368,18 +370,18 @@ function initDefaults() { let dataJson = JSON.parse(data) redirects = dataJson browser.storage.local.get(["cloudflareBlackList", "authenticateBlackList", "offlineBlackList"], async r => { - for (service in config.services) { - for (defaultOption in service.defaults) { + for (const service in config.services) { + for (const defaultOption in service.defaults) { browser.storage.local.set({ [defaultOption]: service.defaults[defaultOption], }) } - for (frontend in service.frontends) { + for (const frontend in service.frontends) { for (const instance of [...r.cloudflareBlackList, ...r.authenticateBlackList, ...r.offlineBlackList]) { let i = redirects[frontend]["clearnet"].indexOf(instance) if (i > -1) redirects[frontend]["clearnet"].splice(i, 1) } - for (network in config.networks) { + for (const network in config.networks) { browser.storage.local.set({ [frontend + camelCase(network) + "RedirectsChecks"]: [...redirects[frontend][network]], [frontend + camelCase(network) + "CustomRedirects"]: [], From 25de09a9359eda0c038640b2a792cd3c753f5511 Mon Sep 17 00:00:00 2001 From: Hygna Date: Sat, 10 Sep 2022 20:48:57 +0100 Subject: [PATCH 12/67] Further progress --- src/assets/javascripts/general.js | 4 +- src/assets/javascripts/services.js | 31 ++++++--- src/instances/beatbump.json | 4 +- src/instances/bibliogram.json | 6 ++ src/instances/cloudtube.json | 2 +- src/instances/facil.json | 2 +- src/instances/get_instances.py | 101 ++++++++++++++--------------- src/instances/neuters.json | 2 +- 8 files changed, 82 insertions(+), 70 deletions(-) create mode 100644 src/instances/bibliogram.json diff --git a/src/assets/javascripts/general.js b/src/assets/javascripts/general.js index a8360bd..072ff3c 100644 --- a/src/assets/javascripts/general.js +++ b/src/assets/javascripts/general.js @@ -30,8 +30,8 @@ async function initDefaults() { popupFrontends: ["youtube", "twitter", "instagram", "tiktok", "imgur", "reddit", "quora", "translate", "maps"], autoRedirect: false, firstPartyIsolate: false, - protocol: "normal", - protocolFallback: true, + network: "clearnet", + networkFallback: true, latencyThreshold: 1000, }, () => resolve() diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 1781c4e..7dc9347 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -35,11 +35,14 @@ function init() { options[service].disabled = r["disable" + camelCase(service)] options[service].redirects = r[service + "Redirects"] options[service].frontend = r[service + "Frontend"] + // console.log(r) }) for (const frontend in config.services[service].frontends) { redirects[frontend] = {} for (const network in config.networks) { browser.storage.local.get([`${frontend}${camelCase(network)}RedirectsChecks`, `${frontend}${camelCase(network)}CustomRedirects`], r => { + console.log(r) + // console.log(`${frontend}${camelCase(network)}RedirectsChecks`) redirects[frontend][network] = [...r[frontend + camelCase(network) + "RedirectsChecks"], ...r[frontend + camelCase(network) + "CustomRedirects"]] }) } @@ -49,9 +52,15 @@ function init() { }) } +function all(service) { + let tmp = [] + for (frontend in config.services[service].frontends) { + for (network in config.networks) tmp.push([...redirects[frontend][network]]) + } +} + await getConfig() -console.log(config) -init() +await init() browser.storage.onChanged.addListener(init) function redirect(url, type, initiator) { @@ -64,7 +73,7 @@ function redirect(url, type, initiator) { browser.storage.local.get(`${service}Targets`, (targets = r[service + "Targets"])) } - if (initiator && (all().includes(initiator.origin) || targets.includes(initiator.host))) continue + if (initiator && (all(service).includes(initiator.origin) || targets.includes(initiator.host))) continue if (!targets.some(rx => rx.test(url.href))) continue if (type != redirectType && type != "both") continue browser.storage.local.get(`${service}Frontend`, (frontend = r[service + "Frontend"])) @@ -363,20 +372,24 @@ function redirect(url, type, initiator) { } function initDefaults() { - return new Promise(resolve => { + return new Promise(async resolve => { fetch("/instances/data.json") .then(response => response.text()) - .then(data => { + .then(async data => { let dataJson = JSON.parse(data) redirects = dataJson + console.log(redirects) + console.log(config) browser.storage.local.get(["cloudflareBlackList", "authenticateBlackList", "offlineBlackList"], async r => { for (const service in config.services) { for (const defaultOption in service.defaults) { - browser.storage.local.set({ - [defaultOption]: service.defaults[defaultOption], - }) + browser.storage.local.set({ [defaultOption]: service.defaults[defaultOption] }) } - for (const frontend in service.frontends) { + for (const frontend in config.services[service].frontends) { + if ((config.services[service].targets = "datajson")) { + browser.storage.local.set({ [service + "Targets"]: redirects[service] }) + continue + } for (const instance of [...r.cloudflareBlackList, ...r.authenticateBlackList, ...r.offlineBlackList]) { let i = redirects[frontend]["clearnet"].indexOf(instance) if (i > -1) redirects[frontend]["clearnet"].splice(i, 1) diff --git a/src/instances/beatbump.json b/src/instances/beatbump.json index 4c7f65a..c5c7812 100644 --- a/src/instances/beatbump.json +++ b/src/instances/beatbump.json @@ -1,6 +1,6 @@ { - "normal": ["https://beatbump.ml"], - "tor": [], + "clearnet": ["https://beatbump.ml", "https://beatbump.esmailelbob.xyz"], + "tor": ["http://beatbump.lqs5fjmajyp7rvp4qvyubwofzi6d4imua7vs237rkc4m5qogitqwrgyd.onion"], "i2p": [], "loki": [] } diff --git a/src/instances/bibliogram.json b/src/instances/bibliogram.json new file mode 100644 index 0000000..b08aa7a --- /dev/null +++ b/src/instances/bibliogram.json @@ -0,0 +1,6 @@ +{ + "clearnet": ["https://bibliogram.1d4.us", "https://bibliogram.froth.zone", "https://ig.tokhmi.xyz", "https://ig.beparanoid.de", "https://bibliogram.priv.pw"], + "tor": [], + "i2p": [], + "loki": [] +} diff --git a/src/instances/cloudtube.json b/src/instances/cloudtube.json index 402adc3..caba9d9 100644 --- a/src/instances/cloudtube.json +++ b/src/instances/cloudtube.json @@ -1,5 +1,5 @@ { - "normal": ["https://tube.cadence.moe", "https://yt.beparanoid.de"], + "clearnet": ["https://tube.cadence.moe", "https://yt.beparanoid.de"], "tor": ["http://yt.prnoid54e44a4bduq5due64jkk7wcnkxcp5kv3juncm7veptjcqudgyd.onion"], "i2p": [], "loki": [] diff --git a/src/instances/facil.json b/src/instances/facil.json index 798a9cf..6c89eb1 100644 --- a/src/instances/facil.json +++ b/src/instances/facil.json @@ -1,5 +1,5 @@ { - "normal": ["https://facilmap.org"], + "clearnet": ["https://facilmap.org"], "tor": [], "i2p": [], "loki": [] diff --git a/src/instances/get_instances.py b/src/instances/get_instances.py index eab4a92..a95eb46 100644 --- a/src/instances/get_instances.py +++ b/src/instances/get_instances.py @@ -107,13 +107,13 @@ def invidious(): r = requests.get('https://api.invidious.io/instances.json') rJson = json.loads(r.text) invidiousList = {} - invidiousList['normal'] = [] + invidiousList['clearnet'] = [] invidiousList['tor'] = [] invidiousList['i2p'] = [] invidiousList['loki'] = [] for instance in rJson: if instance[1]['type'] == 'https': - invidiousList['normal'].append(instance[1]['uri']) + invidiousList['clearnet'].append(instance[1]['uri']) elif instance[1]['type'] == 'onion': invidiousList['tor'].append(instance[1]['uri']) mightyList['invidious'] = invidiousList @@ -127,7 +127,7 @@ def piped(): tmp = re.findall( '(?:[^\s\/]+\.)+[a-zA-Z]+ (?:\(Official\) )?\| (https:\/{2}(?:[^\s\/]+\.)+[a-zA-Z]+) \| ', r.text) _list = {} - _list['normal'] = [] + _list['clearnet'] = [] _list['tor'] = [] _list['i2p'] = [] _list['loki'] = [] @@ -137,7 +137,7 @@ def piped(): if url.strip("/") == item: continue else: - _list['normal'].append(url) + _list['clearnet'].append(url) except: continue mightyList['piped'] = _list @@ -151,12 +151,12 @@ def pipedMaterial(): tmp = re.findall( r"\| (https?:\/{2}(?:\S+\.)+[a-zA-Z0-9]*) +\|", r.text) pipedMaterialList = {} - pipedMaterialList['normal'] = [] + pipedMaterialList['clearnet'] = [] pipedMaterialList['tor'] = [] pipedMaterialList['i2p'] = [] pipedMaterialList['loki'] = [] for item in tmp: - pipedMaterialList['normal'].append(item) + pipedMaterialList['clearnet'].append(item) mightyList['pipedMaterial'] = pipedMaterialList print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'pipedMaterial') @@ -175,12 +175,12 @@ def proxitok(): tmp = re.findall( r"\| \[.*\]\(([-a-zA-Z0-9@:%_\+.~#?&//=]{2,}\.[a-z]{2,}\b(?:\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?)\)*\|*[A-Z]{0,}.*\|.*\|", r.text) proxiTokList = {} - proxiTokList['normal'] = [] + proxiTokList['clearnet'] = [] proxiTokList['tor'] = [] proxiTokList['i2p'] = [] proxiTokList['loki'] = [] for item in tmp: - proxiTokList['normal'].append(re.sub(r'/$', '', item)) + proxiTokList['clearnet'].append(re.sub(r'/$', '', item)) mightyList['proxiTok'] = proxiTokList print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'ProxiTok') @@ -191,12 +191,12 @@ def send(): tmp = re.findall( r"- ([-a-zA-Z0-9@:%_\+.~#?&//=]{2,}\.[a-z0-9]{2,}\b(?:\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?)\)*\|*[A-Z]{0,}", r.text) sendList = {} - sendList['normal'] = [] + sendList['clearnet'] = [] sendList['tor'] = [] sendList['i2p'] = [] sendList['loki'] = [] for item in tmp: - sendList['normal'].append(item) + sendList['clearnet'].append(item) mightyList['send'] = sendList print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Send') @@ -207,7 +207,7 @@ def nitter(): r"(?:(?:\| \[(?:\S+\.)+[a-zA-Z]+\]\((https?:\/{2}(?:\S+\.)+[a-zA-Z]+)\/?\) (?:\((?:\S+ ?\S*)\) )? *\| [^❌]{1,3} +\|(?:(?:\n)|(?: (?:❌)|(?: ✅)|(?: ❓)|(?: \[))))|(?:- \[(?:\S+\.)+(?:(?:i2p)|(?:loki))\]\((https?:\/{2}(?:\S+\.)(?:(?:i2p)|(?:loki)))\/?\)))", r.text) nitterList = {} - nitterList['normal'] = [] + nitterList['clearnet'] = [] nitterList['tor'] = [] nitterList['i2p'] = [] nitterList['loki'] = [] @@ -224,22 +224,15 @@ def nitter(): elif re.search(lokiRegex, item): nitterList['loki'].append(item) else: - nitterList['normal'].append(item) + nitterList['clearnet'].append(item) mightyList['nitter'] = nitterList print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Nitter') def bibliogram(): - r = requests.get('https://bibliogram.art/api/instances') - rJson = json.loads(r.text) - bibliogramList = {} - bibliogramList['normal'] = [] - bibliogramList['tor'] = [] - bibliogramList['i2p'] = [] - bibliogramList['loki'] = [] - for item in rJson['data']: - bibliogramList['normal'].append(item['address']) - mightyList['bibliogram'] = bibliogramList + json_object = json.dumps(mightyList, ensure_ascii=False, indent=2) + with open('./src/instances/bibliogram.json') as file: + mightyList['bibliogram'] = json.load(file) print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Bibliogram') @@ -247,7 +240,7 @@ def libreddit(): r = requests.get( 'https://raw.githubusercontent.com/spikecodes/libreddit/master/README.md') libredditList = {} - libredditList['normal'] = [] + libredditList['clearnet'] = [] libredditList['tor'] = [] libredditList['i2p'] = [] libredditList['loki'] = [] @@ -259,7 +252,7 @@ def libreddit(): if re.search(torRegex, item): libredditList['tor'].append(item) else: - libredditList['normal'].append(item) + libredditList['clearnet'].append(item) mightyList['libreddit'] = libredditList print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'LibReddit') @@ -269,14 +262,14 @@ def teddit(): 'https://codeberg.org/teddit/teddit/raw/branch/main/instances.json') rJson = json.loads(r.text) tedditList = {} - tedditList['normal'] = [] + tedditList['clearnet'] = [] tedditList['tor'] = [] tedditList['i2p'] = [] tedditList['loki'] = [] for item in rJson: url = item['url'] if url != '': - tedditList['normal'].append(url) + tedditList['clearnet'].append(url) if 'onion' in item: onion = item['onion'] if onion != '': @@ -290,14 +283,14 @@ def wikiless(): r = requests.get('https://wikiless.org/instances.json') rJson = json.loads(r.text) wikilessList = {} - wikilessList['normal'] = [] + wikilessList['clearnet'] = [] wikilessList['tor'] = [] wikilessList['i2p'] = [] wikilessList['loki'] = [] for item in rJson: if 'url' in item: if item['url'].strip() != "": - wikilessList['normal'].append(item['url']) + wikilessList['clearnet'].append(item['url']) if 'onion' in item: if item['onion'].strip() != "": wikilessList['tor'].append(item['onion']) @@ -313,12 +306,12 @@ def scribe(): 'https://git.sr.ht/~edwardloveall/scribe/blob/main/docs/instances.json') rJson = json.loads(r.text) scribeList = {} - scribeList['normal'] = [] + scribeList['clearnet'] = [] scribeList['tor'] = [] scribeList['i2p'] = [] scribeList['loki'] = [] for item in rJson: - scribeList['normal'].append(item) + scribeList['clearnet'].append(item) mightyList['scribe'] = scribeList print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Scribe') @@ -327,7 +320,7 @@ def quetre(): r = requests.get( 'https://raw.githubusercontent.com/zyachel/quetre/main/README.md') _list = {} - _list['normal'] = [] + _list['clearnet'] = [] _list['tor'] = [] _list['i2p'] = [] _list['loki'] = [] @@ -340,7 +333,7 @@ def quetre(): if re.search(torRegex, item): _list['tor'].append(item) else: - _list['normal'].append(item) + _list['clearnet'].append(item) mightyList['quetre'] = _list print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Quetre') @@ -349,7 +342,7 @@ def libremdb(): r = requests.get( 'https://raw.githubusercontent.com/zyachel/libremdb/main/README.md') _list = {} - _list['normal'] = [] + _list['clearnet'] = [] _list['tor'] = [] _list['i2p'] = [] _list['loki'] = [] @@ -364,7 +357,7 @@ def libremdb(): if re.search(torRegex, item): _list['tor'].append(item) else: - _list['normal'].append(item) + _list['clearnet'].append(item) mightyList['libremdb'] = _list print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Libremdb') @@ -372,12 +365,12 @@ def libremdb(): def simpleertube(): r = requests.get('https://simple-web.org/instances/simpleertube') _list = {} - _list['normal'] = [] + _list['clearnet'] = [] _list['tor'] = [] _list['i2p'] = [] _list['loki'] = [] for item in r.text.strip().split('\n'): - _list['normal'].append('https://' + item) + _list['clearnet'].append('https://' + item) mightyList['simpleertube'] = _list print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'SimpleerTube') @@ -386,9 +379,9 @@ def simpleertube(): def simplytranslate(): r = requests.get('https://simple-web.org/instances/simplytranslate') simplyTranslateList = {} - simplyTranslateList['normal'] = [] + simplyTranslateList['clearnet'] = [] for item in r.text.strip().split('\n'): - simplyTranslateList['normal'].append('https://' + item) + simplyTranslateList['clearnet'].append('https://' + item) r = requests.get('https://simple-web.org/instances/simplytranslate_onion') simplyTranslateList['tor'] = [] @@ -414,12 +407,12 @@ def linvgatranslate(): 'https://raw.githubusercontent.com/TheDavidDelta/lingva-translate/main/instances.json') rJson = json.loads(r.text) lingvaList = {} - lingvaList['normal'] = [] + lingvaList['clearnet'] = [] lingvaList['tor'] = [] lingvaList['i2p'] = [] lingvaList['loki'] = [] for item in rJson: - lingvaList['normal'].append(item) + lingvaList['clearnet'].append(item) mightyList['lingva'] = lingvaList print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'LinvgaTranslate') @@ -429,12 +422,12 @@ def searx_searxng(): r = requests.get('https://searx.space/data/instances.json') rJson = json.loads(r.text) searxList = {} - searxList['normal'] = [] + searxList['clearnet'] = [] searxList['tor'] = [] searxList['i2p'] = [] searxList['loki'] = [] searxngList = {} - searxngList['normal'] = [] + searxngList['clearnet'] = [] searxngList['tor'] = [] searxngList['i2p'] = [] searxngList['loki'] = [] @@ -451,9 +444,9 @@ def searx_searxng(): searxList['i2p'].append(item[:-1]) else: if (rJson['instances'][item].get('generator') == 'searxng'): - searxngList['normal'].append(item[:-1]) + searxngList['clearnet'].append(item[:-1]) else: - searxList['normal'].append(item[:-1]) + searxList['clearnet'].append(item[:-1]) mightyList['searx'] = searxList mightyList['searxng'] = searxngList @@ -465,7 +458,7 @@ def whoogle(): 'https://raw.githubusercontent.com/benbusby/whoogle-search/main/misc/instances.txt') tmpList = r.text.strip().split('\n') whoogleList = {} - whoogleList['normal'] = [] + whoogleList['clearnet'] = [] whoogleList['tor'] = [] whoogleList['i2p'] = [] whoogleList['loki'] = [] @@ -475,7 +468,7 @@ def whoogle(): elif re.search(torRegex, item): whoogleList['i2p'].append(item) else: - whoogleList['normal'].append(item) + whoogleList['clearnet'].append(item) mightyList['whoogle'] = whoogleList print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Whoogle') @@ -484,7 +477,7 @@ def librex(): r = requests.get( 'https://raw.githubusercontent.com/hnhx/librex/main/README.md') _list = {} - _list['normal'] = [] + _list['clearnet'] = [] _list['tor'] = [] _list['i2p'] = [] _list['loki'] = [] @@ -500,7 +493,7 @@ def librex(): elif re.search(i2pRegex, item): _list['i2p'].append(item) else: - _list['normal'].append(item) + _list['clearnet'].append(item) mightyList['librex'] = _list print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Librex') @@ -510,13 +503,13 @@ def rimgo(): 'https://codeberg.org/video-prize-ranch/rimgo/raw/branch/main/instances.json') rJson = json.loads(r.text) rimgoList = {} - rimgoList['normal'] = [] + rimgoList['clearnet'] = [] rimgoList['tor'] = [] rimgoList['i2p'] = [] rimgoList['loki'] = [] for item in rJson: if 'url' in item: - rimgoList['normal'].append(item['url']) + rimgoList['clearnet'].append(item['url']) if 'onion' in item: rimgoList['tor'].append(item['onion']) if 'i2p' in item: @@ -530,7 +523,7 @@ def librarian(): 'https://codeberg.org/librarian/librarian/raw/branch/main/instances.json') rJson = json.loads(r.text) librarianList = {} - librarianList['normal'] = [] + librarianList['clearnet'] = [] librarianList['tor'] = [] librarianList['i2p'] = [] librarianList['loki'] = [] @@ -546,7 +539,7 @@ def librarian(): elif re.search(lokiRegex, url): librarianList['loki'].append(url) else: - librarianList['normal'].append(url) + librarianList['clearnet'].append(url) mightyList['librarian'] = librarianList print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Librarian') @@ -570,7 +563,7 @@ def hyperpipe(): 'https://codeberg.org/Hyperpipe/pages/raw/branch/main/api/frontend.json') rJson = json.loads(r.text) hyperpipeList = {} - hyperpipeList['normal'] = [] + hyperpipeList['clearnet'] = [] hyperpipeList['tor'] = [] hyperpipeList['i2p'] = [] hyperpipeList['loki'] = [] @@ -585,7 +578,7 @@ def hyperpipe(): elif re.search(lokiRegex, url): hyperpipeList['loki'].append(url) else: - hyperpipeList['normal'].append(url) + hyperpipeList['clearnet'].append(url) mightyList['hyperpipe'] = hyperpipeList print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Hyperpipe') diff --git a/src/instances/neuters.json b/src/instances/neuters.json index 9e224a5..8023079 100644 --- a/src/instances/neuters.json +++ b/src/instances/neuters.json @@ -1,5 +1,5 @@ { - "normal": ["https://neuters.de"], + "clearnet": ["https://neuters.de"], "tor": [], "i2p": [], "loki": [] From e04c79d4ae7b66e6bac2b16f80f89f98040212c3 Mon Sep 17 00:00:00 2001 From: Hygna Date: Sun, 11 Sep 2022 14:41:06 +0100 Subject: [PATCH 13/67] Embrace object usage for user-set options --- src/assets/javascripts/services.js | 81 +++++++++++++++++++----------- src/config/config.json | 6 +-- 2 files changed, 54 insertions(+), 33 deletions(-) diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 7dc9347..4dba8a7 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -5,7 +5,6 @@ import utils from "./utils.js" let config = {}, redirects = {}, options = {} -let disabled, curNetwork, networkFallback, redirectType async function getConfig() { return new Promise(resolve => { @@ -25,25 +24,29 @@ function camelCase(str) { function init() { return new Promise(async resolve => { browser.storage.local.get(["network", "networkFallback"], r => { - curNetwork = r.network - networkFallback = r.networkFallback + options.network = r.network + options.networkFallback = r.networkFallback + options.redirects = r.redirects }) //cur = current for (const service in config.services) { options[service] = {} - browser.storage.local.get([`disable${camelCase(service)}`, `${service}Redirects`, `${service}RedirectType,`, `${service}Frontend`], r => { + browser.storage.local.get([`disable${camelCase(service)}`, `${service}RedirectType`, `${service}Frontend`], r => { options[service].disabled = r["disable" + camelCase(service)] - options[service].redirects = r[service + "Redirects"] options[service].frontend = r[service + "Frontend"] + options[service].redirectType = r[service + "RedirectType"] // console.log(r) }) for (const frontend in config.services[service].frontends) { - redirects[frontend] = {} + options[frontend] = {} + 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 => { - console.log(r) + // console.log(r) // console.log(`${frontend}${camelCase(network)}RedirectsChecks`) - redirects[frontend][network] = [...r[frontend + camelCase(network) + "RedirectsChecks"], ...r[frontend + camelCase(network) + "CustomRedirects"]] + options[frontend].checks = r[frontend + camelCase(network) + "RedirectsChecks"] + options[frontend].custom = r[frontend + camelCase(network) + "CustomRedirects"] }) } } @@ -57,17 +60,21 @@ function all(service) { for (frontend in config.services[service].frontends) { for (network in config.networks) tmp.push([...redirects[frontend][network]]) } + return tmp } -await getConfig() -await init() +getConfig() +init() browser.storage.onChanged.addListener(init) function redirect(url, type, initiator) { - let randomInstance, frontend + let randomInstance + let frontend = options[service].frontend + let network = options.network + let networkFallback = options.networkFallback if (url.pathname == "/") return for (const service in config.services) { - if (disabled && !disableOverride) continue + if (options[service].disabled && !disableOverride) continue let targets = service.targets if (targets == "datajson") { browser.storage.local.get(`${service}Targets`, (targets = r[service + "Targets"])) @@ -75,10 +82,10 @@ 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 != redirectType && type != "both") continue - browser.storage.local.get(`${service}Frontend`, (frontend = r[service + "Frontend"])) - let instanceList = redirects[frontend][curNetwork] - if (instanceList.length === 0 && networkFallback) instanceList = redirects[frontend].clearnet + if (type != options[service].redirectType && type != "both") continue + // browser.storage.local.get(`${service}Frontend`, (frontend = r[service + "Frontend"])) + let instanceList = [...[service + camelCase(network) + "RedirectsChecks"], ...[service + 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) } @@ -378,27 +385,41 @@ function initDefaults() { .then(async data => { let dataJson = JSON.parse(data) redirects = dataJson - console.log(redirects) - console.log(config) + // console.log(redirects) + // console.log(config) + browser.storage.local.set({ + redirects, + }) browser.storage.local.get(["cloudflareBlackList", "authenticateBlackList", "offlineBlackList"], async r => { + // console.log(r) for (const service in config.services) { - for (const defaultOption in service.defaults) { - browser.storage.local.set({ [defaultOption]: service.defaults[defaultOption] }) + if (config.services[service].targets == "datajson") { + browser.storage.local.set({ [service + "Targets"]: redirects[service] }) + } + for (const defaultOption in config.services[service].defaults) { + browser.storage.local.set({ [defaultOption]: config.services[service].defaults[defaultOption] }) } for (const frontend in config.services[service].frontends) { - if ((config.services[service].targets = "datajson")) { - browser.storage.local.set({ [service + "Targets"]: redirects[service] }) - continue - } + let clearnetChecks = redirects[frontend][clearnet] for (const instance of [...r.cloudflareBlackList, ...r.authenticateBlackList, ...r.offlineBlackList]) { - let i = redirects[frontend]["clearnet"].indexOf(instance) - if (i > -1) redirects[frontend]["clearnet"].splice(i, 1) + let i = clearnetChecks.indexOf(instance) + if (i > -1) clearnetChecks.splice(i, 1) } for (const network in config.networks) { - browser.storage.local.set({ - [frontend + camelCase(network) + "RedirectsChecks"]: [...redirects[frontend][network]], - [frontend + camelCase(network) + "CustomRedirects"]: [], - }) + console.log(redirects[frontend][network]) + switch (network) { + case "clearnet": + browser.storage.local.set({ + [frontend + "ClearnetRedirectsChecks"]: [clearnetChecks], + [frontend + "ClearnetCustomRedirects"]: [], + }) + break + default: + browser.storage.local.set({ + [frontend + camelCase(network) + "RedirectsChecks"]: [...redirects[frontend][network]], + [frontend + camelCase(network) + "CustomRedirects"]: [], + }) + } } } } diff --git a/src/config/config.json b/src/config/config.json index 3d4d3f8..6c4d802 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -293,7 +293,7 @@ "targets": "datajson", "name": "PeerTube", "defaults": { - "disablePeertubeTargets": true + "disablePeertube": true }, "imageType": "svg" }, @@ -310,7 +310,7 @@ "targets": ["^https?:\\/{2}odysee\\.com", "^https?:\\/{2}lbry\\.tv"], "name": "LBRY", "defaults": { - "disableLbryTargets": true, + "disableLbry": true, "lbryFrontend": "librarian", "lbryRedirectType": "both" }, @@ -429,7 +429,7 @@ "targets": ["^https?:\\/{2}send\\.libredirect\\.invalid\\/$", "^https?:\\/{2}send\\.firefox\\.com\\/$", "^https?:\\/{2}sendfiles\\.online\\/$"], "name": "Send Files", "defaults": { - "disableSendTarget": false + "disableSendTargets": false }, "imageType": "svg" } From d6cad17a15e76635d3e51e03b52414e66ef83ac3 Mon Sep 17 00:00:00 2001 From: Hygna Date: Mon, 12 Sep 2022 18:17:25 +0100 Subject: [PATCH 14/67] Begin work with ejs, created widgets/services.js --- src/assets/javascripts/services.js | 29 ++-- src/assets/javascripts/utils.js | 16 +-- src/config/config.json | 152 +++++++++++---------- src/pages/options/index.html | 58 ++++---- src/pages/options/widgets/about.ejs | 24 ++++ src/pages/options/widgets/general.js | 60 ++------ src/pages/options/widgets/general.pug | 2 +- src/pages/options/widgets/imdb.js | 4 +- src/pages/options/widgets/imdb.pug | 2 +- src/pages/options/widgets/imgur.js | 4 +- src/pages/options/widgets/imgur.pug | 2 +- src/pages/options/widgets/instagram.js | 4 +- src/pages/options/widgets/instagram.pug | 2 +- src/pages/options/widgets/lbry.js | 4 +- src/pages/options/widgets/lbry.pug | 2 +- src/pages/options/widgets/maps.js | 4 +- src/pages/options/widgets/maps.pug | 2 +- src/pages/options/widgets/medium.js | 4 +- src/pages/options/widgets/medium.pug | 2 +- src/pages/options/widgets/peertube.js | 4 +- src/pages/options/widgets/peertube.pug | 2 +- src/pages/options/widgets/quora.js | 4 +- src/pages/options/widgets/quora.pug | 2 +- src/pages/options/widgets/reddit.js | 4 +- src/pages/options/widgets/reddit.pug | 4 +- src/pages/options/widgets/reuters.js | 4 +- src/pages/options/widgets/reuters.pug | 2 +- src/pages/options/widgets/search.js | 117 +--------------- src/pages/options/widgets/search.pug | 8 +- src/pages/options/widgets/sendTargets.js | 4 +- src/pages/options/widgets/sendTargets.pug | 2 +- src/pages/options/widgets/services.ejs | 84 ++++++++++++ src/pages/options/widgets/services.js | 81 +++++++++++ src/pages/options/widgets/tiktok.js | 4 +- src/pages/options/widgets/tiktok.pug | 2 +- src/pages/options/widgets/translate.js | 4 +- src/pages/options/widgets/translate.pug | 4 +- src/pages/options/widgets/twitter.js | 4 +- src/pages/options/widgets/twitter.pug | 2 +- src/pages/options/widgets/wikipedia.js | 4 +- src/pages/options/widgets/wikipedia.pug | 2 +- src/pages/options/widgets/youtube.js | 4 +- src/pages/options/widgets/youtube.pug | 8 +- src/pages/options/widgets/youtubeMusic.js | 4 +- src/pages/options/widgets/youtubeMusic.pug | 4 +- 45 files changed, 392 insertions(+), 353 deletions(-) create mode 100644 src/pages/options/widgets/about.ejs create mode 100644 src/pages/options/widgets/services.ejs create mode 100644 src/pages/options/widgets/services.js 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 From 09b2b961164051314813fdf9984881b3a3124874 Mon Sep 17 00:00:00 2001 From: Hygna Date: Tue, 13 Sep 2022 21:15:52 +0100 Subject: [PATCH 15/67] add files --- src/assets/images/medium-icon.svg | 5 +++++ src/pages/widgets/head.ejs | 8 ++++++++ 2 files changed, 13 insertions(+) create mode 100644 src/assets/images/medium-icon.svg create mode 100644 src/pages/widgets/head.ejs diff --git a/src/assets/images/medium-icon.svg b/src/assets/images/medium-icon.svg new file mode 100644 index 0000000..2939a18 --- /dev/null +++ b/src/assets/images/medium-icon.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/src/pages/widgets/head.ejs b/src/pages/widgets/head.ejs new file mode 100644 index 0000000..d9e3802 --- /dev/null +++ b/src/pages/widgets/head.ejs @@ -0,0 +1,8 @@ + + + + + + General + + From e867e2e0a50c76e407117136443bd1ddd9f10ac9 Mon Sep 17 00:00:00 2001 From: Hygna Date: Wed, 14 Sep 2022 21:04:27 +0100 Subject: [PATCH 16/67] Fixed ejs ending tags --- src/pages/options/widgets/services.ejs | 28 +++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/pages/options/widgets/services.ejs b/src/pages/options/widgets/services.ejs index 1436587..a1b0a53 100644 --- a/src/pages/options/widgets/services.ejs +++ b/src/pages/options/widgets/services.ejs @@ -1,30 +1,30 @@ <% config.services.forEach(service=>{ %> -
+
-

<%= config.services[service].name =%>

+

<%= config.services[service].name %>


Enable

- +

Frontend

- <% config.services[service].frontends.forEach(frontend=>{ %> - + <% }); %> <% config.services[service].singleInstanceFrontends.forEach(frontend=>{ %> - + <% }); %>
<% if (config.services[service].embeddable) { %> <% if (config.services[service].singleInstanceFrontends) { %> -
+

Embedded Videos Frontend

- <% config.services[service].frontends.forEach(frontend=>{ %> <% }); %> @@ -43,9 +43,9 @@ <% } %>
<% config.services[service].frontends.forEach(frontend=>{ %> -
+
<% config.networks.forEach(network=>{ %> -
+

Default Instances

@@ -56,7 +56,7 @@
- +
@@ -81,4 +81,4 @@ <% }); %>
<% }); %> - \ No newline at end of file + From 4c1099771caba798573f147fc08e5a474fc7a81b Mon Sep 17 00:00:00 2001 From: Hygna Date: Fri, 16 Sep 2022 19:33:39 +0100 Subject: [PATCH 17/67] More ejs progress --- src/assets/images/about-icon.svg | 3 +++ src/assets/images/general-icon.svg | 0 src/assets/images/maps-icon.svg | 3 +++ src/assets/images/search-icon.svg | 3 +++ src/assets/images/translate-icon.svg | 3 +++ src/pages/options/index.ejs | 13 +++++++++++++ src/pages/widgets/links.ejs | 7 +++++++ 7 files changed, 32 insertions(+) create mode 100644 src/assets/images/about-icon.svg create mode 100644 src/assets/images/general-icon.svg create mode 100644 src/assets/images/maps-icon.svg create mode 100644 src/assets/images/search-icon.svg create mode 100644 src/assets/images/translate-icon.svg create mode 100644 src/pages/options/index.ejs create mode 100644 src/pages/widgets/links.ejs diff --git a/src/assets/images/about-icon.svg b/src/assets/images/about-icon.svg new file mode 100644 index 0000000..551255e --- /dev/null +++ b/src/assets/images/about-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/images/general-icon.svg b/src/assets/images/general-icon.svg new file mode 100644 index 0000000..e69de29 diff --git a/src/assets/images/maps-icon.svg b/src/assets/images/maps-icon.svg new file mode 100644 index 0000000..c66a89d --- /dev/null +++ b/src/assets/images/maps-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/images/search-icon.svg b/src/assets/images/search-icon.svg new file mode 100644 index 0000000..cb73ff1 --- /dev/null +++ b/src/assets/images/search-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/images/translate-icon.svg b/src/assets/images/translate-icon.svg new file mode 100644 index 0000000..30f9c1b --- /dev/null +++ b/src/assets/images/translate-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/pages/options/index.ejs b/src/pages/options/index.ejs new file mode 100644 index 0000000..c17d1f0 --- /dev/null +++ b/src/pages/options/index.ejs @@ -0,0 +1,13 @@ + + + <%- include('../widgets/head') %> + +
+ <%- include('../widgets/links', {config: config}) %> + <%- include('widgets/general', {config: config}) %> + <%- include('widgets/services', {config: config}) %> + <%- include('widgets/about') %> +
+ + + diff --git a/src/pages/widgets/links.ejs b/src/pages/widgets/links.ejs new file mode 100644 index 0000000..eacfe91 --- /dev/null +++ b/src/pages/widgets/links.ejs @@ -0,0 +1,7 @@ + From 978e07930705e87b04d0eafe86233bb62fb36c03 Mon Sep 17 00:00:00 2001 From: Hygna Date: Sun, 18 Sep 2022 17:03:54 +0100 Subject: [PATCH 18/67] Converted index.html to ejs --- package.json | 3 +- src/assets/images/general-icon.svg | 3 + src/assets/images/{imdb.svg => imdb-icon.svg} | 0 .../images/{imgur.png => imgur-icon.png} | Bin src/assets/images/medium-icon.svg | 10 +- .../images/{quora.png => quora-icon.png} | Bin .../images/{reuters.svg => reuters-icon.svg} | 0 .../{send-icon.svg => sendTargets-icon.svg} | 0 ...e-music-icon.png => youtubeMusic-icon.png} | Bin src/assets/javascripts/services.js | 3 +- src/assets/javascripts/utils.js | 7 +- src/config/config.json | 840 ++- src/pages/options/index.ejs | 10 +- src/pages/options/index.html | 6571 +++++++++-------- src/pages/options/index.pug | 36 - src/pages/options/widgets/about.pug | 17 - src/pages/options/widgets/general.ejs | 97 + src/pages/options/widgets/general.pug | 210 - src/pages/options/widgets/imdb.pug | 26 - src/pages/options/widgets/imgur.pug | 27 - src/pages/options/widgets/instagram.pug | 27 - src/pages/options/widgets/lbry.pug | 39 - src/pages/options/widgets/maps.pug | 32 - src/pages/options/widgets/medium.pug | 26 - src/pages/options/widgets/peertube.pug | 26 - src/pages/options/widgets/quora.pug | 26 - src/pages/options/widgets/reddit.pug | 48 - src/pages/options/widgets/reuters.pug | 26 - src/pages/options/widgets/search.pug | 85 - src/pages/options/widgets/sendTargets.pug | 26 - src/pages/options/widgets/services.ejs | 43 +- src/pages/options/widgets/services.js | 3 +- src/pages/options/widgets/tiktok.pug | 26 - src/pages/options/widgets/translate.pug | 48 - src/pages/options/widgets/twitter.pug | 33 - src/pages/options/widgets/wikipedia.pug | 26 - src/pages/options/widgets/youtube.pug | 103 - src/pages/options/widgets/youtubeMusic.pug | 49 - src/pages/widgets/links.ejs | 4 +- 39 files changed, 4066 insertions(+), 4490 deletions(-) rename src/assets/images/{imdb.svg => imdb-icon.svg} (100%) rename src/assets/images/{imgur.png => imgur-icon.png} (100%) rename src/assets/images/{quora.png => quora-icon.png} (100%) rename src/assets/images/{reuters.svg => reuters-icon.svg} (100%) rename src/assets/images/{send-icon.svg => sendTargets-icon.svg} (100%) rename src/assets/images/{youtube-music-icon.png => youtubeMusic-icon.png} (100%) delete mode 100644 src/pages/options/index.pug delete mode 100644 src/pages/options/widgets/about.pug create mode 100644 src/pages/options/widgets/general.ejs delete mode 100644 src/pages/options/widgets/general.pug delete mode 100644 src/pages/options/widgets/imdb.pug delete mode 100644 src/pages/options/widgets/imgur.pug delete mode 100644 src/pages/options/widgets/instagram.pug delete mode 100644 src/pages/options/widgets/lbry.pug delete mode 100644 src/pages/options/widgets/maps.pug delete mode 100644 src/pages/options/widgets/medium.pug delete mode 100644 src/pages/options/widgets/peertube.pug delete mode 100644 src/pages/options/widgets/quora.pug delete mode 100644 src/pages/options/widgets/reddit.pug delete mode 100644 src/pages/options/widgets/reuters.pug delete mode 100644 src/pages/options/widgets/search.pug delete mode 100644 src/pages/options/widgets/sendTargets.pug delete mode 100644 src/pages/options/widgets/tiktok.pug delete mode 100644 src/pages/options/widgets/translate.pug delete mode 100644 src/pages/options/widgets/twitter.pug delete mode 100644 src/pages/options/widgets/wikipedia.pug delete mode 100644 src/pages/options/widgets/youtube.pug delete mode 100644 src/pages/options/widgets/youtubeMusic.pug diff --git a/package.json b/package.json index 50872aa..ee0d908 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "test": "web-ext lint --source-dir ./src/ || true", "pug": "pug ./src/pages/options/*.pug ./src/pages/popup/ -P -w", "prettier": "npx prettier --write .", - "instances": "python3 src/instances/get_instances.py; git update-index --assume-unchanged src/instances/blacklist.json src/instances/data.json" + "instances": "python3 src/instances/get_instances.py; git update-index --assume-unchanged src/instances/blacklist.json src/instances/data.json", + "ejs": "npx ejs src/pages/options/index.ejs -f src/config/config.json -o src/pages/options/index.html" }, "repository": { "type": "git", diff --git a/src/assets/images/general-icon.svg b/src/assets/images/general-icon.svg index e69de29..55c5f8b 100644 --- a/src/assets/images/general-icon.svg +++ b/src/assets/images/general-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/images/imdb.svg b/src/assets/images/imdb-icon.svg similarity index 100% rename from src/assets/images/imdb.svg rename to src/assets/images/imdb-icon.svg diff --git a/src/assets/images/imgur.png b/src/assets/images/imgur-icon.png similarity index 100% rename from src/assets/images/imgur.png rename to src/assets/images/imgur-icon.png diff --git a/src/assets/images/medium-icon.svg b/src/assets/images/medium-icon.svg index 2939a18..7261248 100644 --- a/src/assets/images/medium-icon.svg +++ b/src/assets/images/medium-icon.svg @@ -1,5 +1,5 @@ - - - - - \ No newline at end of file + + + + + diff --git a/src/assets/images/quora.png b/src/assets/images/quora-icon.png similarity index 100% rename from src/assets/images/quora.png rename to src/assets/images/quora-icon.png diff --git a/src/assets/images/reuters.svg b/src/assets/images/reuters-icon.svg similarity index 100% rename from src/assets/images/reuters.svg rename to src/assets/images/reuters-icon.svg diff --git a/src/assets/images/send-icon.svg b/src/assets/images/sendTargets-icon.svg similarity index 100% rename from src/assets/images/send-icon.svg rename to src/assets/images/sendTargets-icon.svg diff --git a/src/assets/images/youtube-music-icon.png b/src/assets/images/youtubeMusic-icon.png similarity index 100% rename from src/assets/images/youtube-music-icon.png rename to src/assets/images/youtubeMusic-icon.png diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index b7ee220..7092878 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -11,7 +11,8 @@ async function getConfig() { fetch("/config/config.json") .then(response => response.text()) .then(data => { - config = JSON.parse(data) + const tmp = JSON.parse(data) + config = tmp.config resolve() }) }) diff --git a/src/assets/javascripts/utils.js b/src/assets/javascripts/utils.js index 9c5947a..7337a13 100644 --- a/src/assets/javascripts/utils.js +++ b/src/assets/javascripts/utils.js @@ -23,6 +23,10 @@ function getRandomInstance(instances) { return instances[~~(instances.length * Math.random())] } +function camelCase(str) { + return str.charAt(0).toUpperCase() + str.slice(1) +} + let cloudflareBlackList = [] let authenticateBlackList = [] let offlineBlackList = [] @@ -107,9 +111,6 @@ function protocolHost(url) { } async function processDefaultCustomInstances(target, name, protocol, document) { - function camelCase(str) { - return str.charAt(0).toUpperCase() + str.slice(1) - } let latencyKey = `${name}Latency` let instancesLatency let nameProtocolElement = document.getElementById(name).getElementsByClassName(protocol)[0] diff --git a/src/config/config.json b/src/config/config.json index 97fd838..7c39155 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -1,439 +1,459 @@ { - "networks": { - "clearnet": { - "tld": "org", - "name": "Clearnet" + "config": { + "networks": { + "clearnet": { + "tld": "org", + "name": "Clearnet" + }, + "tor": { + "tld": "onion", + "name": "Tor" + }, + "i2p": { + "tld": "i2p", + "name": "I2P" + }, + "loki": { + "tld": "loki", + "name": "Lokinet" + } }, - "tor": { - "tld": "onion", - "name": "Tor" - }, - "i2p": { - "tld": "i2p", - "name": "I2P" - }, - "loki": { - "tld": "loki", - "name": "Lokinet" - } - }, - "services": { - "youtube": { - "frontends": { - "invidious": { - "preferences": { - "cookies": ["PREFS"] + "services": { + "youtube": { + "frontends": { + "invidious": { + "preferences": { + "cookies": ["PREFS"] + } + }, + "piped": { + "preferences": { + "localstorage": [ + "bufferGoal", + "comments", + "disableLBRY", + "enabledCodecs", + "hl", + "homepage", + "instance", + "listen", + "minimizeDescription", + "playerAutoPlay", + "proxyLBRY", + "quality", + "region", + "selectedSkip", + "sponsorblock", + "theme", + "volume", + "watchHistory" + ] + } + }, + "pipedMaterial": { + "preferences": { + "localstorage": ["PREFERENCES"] + } + }, + "cloudtube": { + "preferences": { + "token": "token", + "fetchEndpoint": "/api/settings", + "setEndpoint": "/settings" + } } }, - "piped": { - "preferences": { - "localstorage": [ - "bufferGoal", - "comments", - "disableLBRY", - "enabledCodecs", - "hl", - "homepage", - "instance", - "listen", - "minimizeDescription", - "playerAutoPlay", - "proxyLBRY", - "quality", - "region", - "selectedSkip", - "sponsorblock", - "theme", - "volume", - "watchHistory" - ] + "singleInstanceFrontends": ["freetube", "yatte"], + "targets": [ + "^https?:\\/{2}(www\\.|music\\.|m\\.|)youtube.com(\\(?!iframe_api)/.*|$)", + "^https?:\\/{2}img\\.youtube.com\\/vi\\/.*\\/..*", + "^https?:\\/{2}(i|s)\\.ytimg.com\\/vi\\/.*\\/..*", + "^https?:\\/{2}(www\\.|music\\.|)youtube.com\\/watch?v=..*", + "^https?:\\/{2}youtu\\.be\\/..*", + "^https?:\\/{2}(www\\.|)(youtube|youtube-nocookie)\\.com\\/embed\\/..*" + ], + "name": "Youtube", + "options": { + "disabled": false, + "redirectType": "both", + "frontend": "invidious", + "embedFrontend": "invidious" + }, + "imageType": "png", + "embeddable": true + }, + "youtubeMusic": { + "frontends": { + "beatbump": { + "preferences": { + "localstorage": ["settings"], + "indexeddb": "beatbump" + } + }, + "hyperpipe": { + "preferences": { + "localstorage": ["api", "authapi", "codec", "locale", "next", "pipedapi", "quality", "theme", "vol"], + "indexeddb": ["hyperpipedb"] + } } }, - "pipedMaterial": { - "preferences": { - "localstorage": ["PREFERENCES"] + "targets": ["^https?:\\/{2}music\\.youtube\\.com(\\/.*|$)"], + "name": "YT Music", + "options": { + "disabled": false, + "frontend": "beatbump" + }, + "imageType": "png", + "embeddable": false + }, + "twitter": { + "frontends": { + "nitter": { + "preferences": { + "cookies": [ + "theme", + "infiniteScroll", + "stickyProfile", + "bidiSupport", + "hideTweetStats", + "hideBanner", + "hidePins", + "hideReplies", + "squareAvatars", + "mp4Playback", + "hlsPlayback", + "proxyVideos", + "muteVideos", + "autoplayGifs", + "replaceInstagram", + "replaceReddit", + "replaceTwitter", + "replaceYouTube" + ] + } } }, - "cloudtube": { - "preferences": { - "token": "token", - "fetchEndpoint": "/api/settings", - "setEndpoint": "/settings" - } - } + "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", + "options": { + "disabled": false, + "redirectType": "both" + }, + "imageType": "png", + "embeddable": true }, - "singleInstanceFrontends": ["freetube", "yatte"], - "targets": [ - "^https?:\\/{2}(www\\.|music\\.|m\\.|)youtube.com(\\(?!iframe_api)/.*|$)", - "^https?:\\/{2}img\\.youtube.com\\/vi\\/.*\\/..*", - "^https?:\\/{2}(i|s)\\.ytimg.com\\/vi\\/.*\\/..*", - "^https?:\\/{2}(www\\.|music\\.|)youtube.com\\/watch?v=..*", - "^https?:\\/{2}youtu\\.be\\/..*", - "^https?:\\/{2}(www\\.|)(youtube|youtube-nocookie)\\.com\\/embed\\/..*" - ], - "name": "Youtube", - "options": { - "disabled": false, - "redirectType": "both", - "frontend": "invidious", - "embedFrontend": "invidious" - }, - "imageType": "png", - "embeddable": true - }, - "youtubeMusic": { - "frontends": { - "beatbump": {}, - "hyperpipe": {} - }, - "targets": ["^https?:\\/{2}music\\.youtube\\.com(\\/.*|$)"], - "name": "YT Music", - "options": { - "disabled": false, - "frontend": "beatbump" - }, - "imageType": "png", - "embeddable": false - }, - "twitter": { - "frontends": { - "nitter": { - "preferences": { - "cookies": [ - "theme", - "infiniteScroll", - "stickyProfile", - "bidiSupport", - "hideTweetStats", - "hideBanner", - "hidePins", - "hideReplies", - "squareAvatars", - "mp4Playback", - "hlsPlayback", - "proxyVideos", - "muteVideos", - "autoplayGifs", - "replaceInstagram", - "replaceReddit", - "replaceTwitter", - "replaceYouTube" - ] - } - } - }, - "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", - "options": { - "disabled": false, - "redirectType": "both" - }, - "imageType": "png", - "embeddable": true - }, - "instagram": { - "frontends": { - "bibliogram": { - "preferences": { - "token": "token", - "fetchEndpoint": "/settings.json", - "setEndpoint": "/applysettings" - } - } - }, - "targets": ["^https?:\\/{2}(www\\.)?instagram\\.com"], - "name": "Instagram", - "options": { "disabled": false }, - "imageType": "png", - "embeddable": false - }, - "tiktok": { - "frontends": { - "proxiTok": {} - }, - "targets": ["^https?:\\/{2}(www\\.|)tiktok\\.com.*"], - "name": "TikTok", - "options": { "disabled": false }, - "imageType": "png", - "embeddable": false - }, - "reddit": { - "frontends": { - "libreddit": { - "preferences": { - "cookies": ["theme", "front_page", "layout", "wide", "post_sort", "comment_sort", "show_nsfw", "autoplay_videos", "use_hls", "hide_hls_notification", "subscriptions", "filters"] + "instagram": { + "frontends": { + "bibliogram": { + "preferences": { + "token": "token", + "fetchEndpoint": "/settings.json", + "setEndpoint": "/applysettings" + } } }, - "teddit": { - "preferences": { - "cookies": [ - "collapse_child_comments", - "domain_instagram", - "domain_twitter", - "domain_youtube", - "flairs", - "highlight_controversial", - "nsfw_enabled", - "post_media_max_height", - "show_upvoted_percentage", - "show_upvotes", - "theme", - "videos_muted" - ] - } - } + "targets": ["^https?:\\/{2}(www\\.)?instagram\\.com"], + "name": "Instagram", + "options": { "disabled": false }, + "imageType": "png", + "embeddable": false }, - "targets": ["^https?:\\/{2}(www\\.|old\\.|np\\.|new\\.|amp\\.|)reddit\\.com", "^https?:\\/{2}(i\\.|preview\\.)redd\\.it"], - "name": "Reddit", - "options": { - "disabled": false, - "frontend": "libreddit" - }, - "imageType": "png", - "embeddable": false - }, - "imgur": { - "frontends": { - "rimgo": { - "preferences": {} - } - }, - "targets": ["^https?:\\/{2}([im]\\.)?imgur\\.(com|io)(\\/|$)"], - "name": "Imgur", - "options": { "disabled": false }, - "imageType": "png", - "embeddable": false - }, - "wikipedia": { - "frontends": { - "wikiless": { - "preferences": { - "cookies": ["theme", "default_lang"] - } - } - }, - "targets": ["^https?:\\/{2}([a-z]+\\.)*wikipedia\\.org"], - "name": "Wikipedia", - "options": { "disabled": true }, - "imageType": "svg", - "embeddable": false - }, - "medium": { - "frontends": { - "scribe": { - "preferences": {} - } - }, - "targets": [ - "(?:.*\\.)*(? - <%- include('../widgets/head') %> + <%- include('src/pages/widgets/head') %> + <%- include('src/pages/widgets/links', {config: config}) %>
- <%- include('../widgets/links', {config: config}) %> - <%- include('widgets/general', {config: config}) %> - <%- include('widgets/services', {config: config}) %> - <%- include('widgets/about') %> + <%- include('src/pages/options/widgets/general', {config: config}) %> + <%- include('src/pages/options/widgets/services', {config: config}) %> + <%- include('src/pages/options/widgets/about') %>
diff --git a/src/pages/options/index.html b/src/pages/options/index.html index 5c0aedd..8908c9b 100644 --- a/src/pages/options/index.html +++ b/src/pages/options/index.html @@ -1,3189 +1,3600 @@ - - - - - General - - + + + + + General + + + - + +
+
+

General

+
+
+
+

Theme

+ +
+
+

+ +
+
+
+

Fallback to normal if no instances are available for the current protocol

+ +
+
+
+

+ +
+ +
+

Latency Threshold

+ + +
+ +
+

+
+
+
+
+   +   +
+ +
+
+
+ +
+ +     + + +   + Export Settings    + + + + + Reset Settings +
+
+
+

Customize Popup

+
+ + +
+ + +
+
+

Youtube

+
+
+
+

Enable

+ +
+ +
+

Frontend

+ +
+ + +
+
+

Embed Frontend

+ +
+
+ + +
+

Redirect Type

+ +
+ +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

General

-
-
-
-

Theme

- -
-
-

- -
-
-
-

Fallback to normal if no instances are available for the current protocol

- -
-
-
-

- -
- -
-

Latency Threshold

- - -
-
-
-

-
-
-
-
-   -   -
- -
-
-
- -
- -     - - -   - Export Settings    - - - + +
+ +
+ +
+ + +
+ +
+ + + +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Customize Popup

+ +
- - -
-
+ +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

YouTube

+ +
-
+
+
+ +
+ +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Enable

- + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Frontend

- -
-
-
-

Embedded Videos Frontend

- -
+ +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Redirect Type

- + +
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
- -
- - -
- -
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- - -
+ +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

YouTube Music

+ +
-
+
+
+ +
+ +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Enable

- + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Frontend

- + +
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
- -
- - -
- -
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- - -
+ +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Twitter

+ +
-
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Enable

- + +
+
+
+ +
+ +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Redirect Type

- + +
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
- -
- - -
- -
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- - -
+ +
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Instagram

+ +
-
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Enable

- + +
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
- -
- - -
- -
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- - -
+ +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

TikTok

+ +
-
+
+
+ +
+ +
+ + + +
+
+

YT Music

+
+
+
+

Enable

+ +
+ +
+

Frontend

+ +
+ + + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Enable

- + +
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
- -
- - -
- -
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- -
-
+ +
+ +
+ + +
+ + + +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Reddit

+ +
-
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Enable

- + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Frontend

- + +
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
- -
- - -
- -
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- -
-
+ +
+ + + + + +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Imgur

+ +
-
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Enable

- + +
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
- -
- - -
- -
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- -
-
+ +
+ + + +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Wikipedia

+ +
-
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Enable

- + +
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
- -
- - -
- -
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- -
-
+ +
+ + + + + +
+ +
+
+

Twitter

+
+
+
+

Enable

+ +
+ + + +
+

Redirect Type

+ +
+ +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Medium

+ +
-
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Enable

- + +
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
- -
- - -
- -
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- -
-
+ +
+ + + +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Quora

+ +
-
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Enable

- + +
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
- -
- - -
- -
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- -
-
+ +
+ + + + + +
+ +
+
+

Instagram

+
+
+
+

Enable

+ +
+ + + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

IMDb

+ +
-
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Enable

- + +
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
- -
- - -
- -
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- -
-
+ +
+ + + +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Reuters

+ +
-
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Enable

- + +
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
- -
- - -
- -
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- -
-
+ +
+ + + + + +
+ +
+
+

TikTok

+
+
+
+

Enable

+ +
+ + + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

PeerTube

+ +
-
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Enable

- + +
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
- -
- - -
- -
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- -
-
+ +
+ + + +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

LBRY

+ +
-
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Enable

- + +
+
+
+ +
+ + + +
+ +
+
+

Reddit

+
+
+
+

Enable

+ +
+ +
+

Frontend

+ +
+ + + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Frontend

- + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Redirect Type

- + +
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
- -
- - -
- -
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- -
-
+ +
+ + + +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Search

+ +
-
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Enable

- + +
+
+
+ +
+ + + +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Frontend

- + +
-
-

Note: To use Search, make LibRedirect the Default Search Engine

-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
- -
- - -
- -
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- -
-
+ +
+ +
+ + +
+ + + +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Translate

+ +
-
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Enable

- + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Frontend

- + +
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
- -
- - -
- -
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- -
-
+ +
+ + + + + +
+ +
+
+

Imgur

+
+
+
+

Enable

+ +
+ + + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Maps

+ +
-
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Enable

- + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Frontend

- + +
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
- -
- - -
- -
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
- -
-
+ +
+ + + +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Send Files

+ +
-
+
+
+ +
+ + + +
+ +
+
+

Wikipedia

+
+
+
+

Enable

+ +
+ + + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
-

Enable

- + +
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
- -
- - -
- -
-
- - -
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
-
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
-
+ +
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ +
- -
+ +
+ + + +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + + + + +
+
+

Medium

+
+
+
+

Enable

+ +
+ + + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

Quora

+
+
+
+

Enable

+ +
+ + + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

IMDb

+
+
+
+

Enable

+ +
+ + + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

Reuters

+
+
+
+

Enable

+ +
+ + + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

PeerTube

+
+
+
+

Enable

+ +
+ + + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

LBRY

+
+
+
+

Enable

+ +
+ +
+

Frontend

+ +
+ + + +
+

Redirect Type

+ +
+ +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

Search

+
+
+
+

Enable

+ +
+ +
+

Frontend

+ +
+ + + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

Translate

+
+
+
+

Enable

+ +
+ +
+

Frontend

+ +
+ + + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

Maps

+
+
+
+

Enable

+ +
+ +
+

Frontend

+ +
+ + + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+

Send Files

+
+
+
+

Enable

+ +
+ + + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ + +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ +
+ +
+ +
+ + +
-
-

About

-
-
- -
+
+

About

+
+
+ + + - \ No newline at end of file + diff --git a/src/pages/options/index.pug b/src/pages/options/index.pug deleted file mode 100644 index 3711fda..0000000 --- a/src/pages/options/index.pug +++ /dev/null @@ -1,36 +0,0 @@ -doctype html -html#elementToShowWithJavaScript(lang="en") - head - meta(charset='utf-8') - meta(name="viewport" content="width=device-width, initial-scale=1") - link(rel="icon" type="image/x-icon" href="../../../assets/images/libredirect.svg") - link(href="../stylesheets/styles.css" rel="stylesheet") - title General - - script(type="module" src="./init.js") - body.option(dir="auto") - include ../widgets/links.pug - +links('general') - div#pages - include ./widgets/general.pug - include ./widgets/youtube.pug - include ./widgets/youtubeMusic.pug - include ./widgets/twitter.pug - include ./widgets/instagram.pug - include ./widgets/tiktok.pug - include ./widgets/reddit.pug - include ./widgets/imgur.pug - include ./widgets/wikipedia.pug - include ./widgets/medium.pug - include ./widgets/quora.pug - include ./widgets/imdb.pug - include ./widgets/reuters.pug - include ./widgets/peertube.pug - include ./widgets/lbry.pug - include ./widgets/search.pug - include ./widgets/translate.pug - include ./widgets/maps.pug - include ./widgets/sendTargets.pug - include ./widgets/about.pug - - script(type="module" src="./index.js") diff --git a/src/pages/options/widgets/about.pug b/src/pages/options/widgets/about.pug deleted file mode 100644 index 954522b..0000000 --- a/src/pages/options/widgets/about.pug +++ /dev/null @@ -1,17 +0,0 @@ -section#about_page.option-block - .some-block.option-block - h1(data-localise="__MSG_about__") About - hr - .about - .some-block.option-block - h4 Donate: ♥️ - h4 https://libredirect.github.io/donate - .some-block.option-block - h4 FAQ: - h4 https://libredirect.github.io/faq - .some-block.option-block - h4 Docs: - h4 https://libredirect.github.io/docs - .some-block.option-block - h4 Source Code: - h4 https://libredirect.github.io/source_code \ No newline at end of file diff --git a/src/pages/options/widgets/general.ejs b/src/pages/options/widgets/general.ejs new file mode 100644 index 0000000..05ef095 --- /dev/null +++ b/src/pages/options/widgets/general.ejs @@ -0,0 +1,97 @@ +
+
+

General

+
+
+
+

Theme

+ +
+
+

+ +
+
+
+

Fallback to normal if no instances are available for the current protocol

+ +
+
+
+

+ +
+
+
+

Latency Threshold

+ + +
+
+
+

+
+
+
+
+   +   +
+ +
+
+
+ +
+ +     + + +   + Export Settings    + + + + + Reset Settings +
+
+
+

Customize Popup

+
+ + +
diff --git a/src/pages/options/widgets/general.pug b/src/pages/options/widgets/general.pug deleted file mode 100644 index be3d495..0000000 --- a/src/pages/options/widgets/general.pug +++ /dev/null @@ -1,210 +0,0 @@ -section#general_page.option-block - .some-block.option-block - h1(data-localise="__MSG_general__") General - hr - - .some-block.option-block - h4(data-localise="__MSG_theme__") Theme - select#theme - option(value="DEFAULT" data-localise="__MSG_system__") System - option(value="light" data-localise="__MSG_light__") Light - option(value="dark" data-localise="__MSG_dark__") Dark - - //- .some-block.option-block - h4 Tor Browser - input#firstPartyIsolate(type="checkbox") - - .some-block.option-block - h4(data-localise="__MSG_protocol__") - select#protocol - option(value="clearnet" data-localise="__MSG_normal__") Clearnet - option(value="tor") Tor - option(value="i2p") I2P - option(value="loki") Lokinet - - #protocol-fallback - .some-block.option-block - h4(data-localise="__MSG_protocolFallback__") Fallback to normal if no instances are available for the current protocol - input#protocol-fallback-checkbox(type="checkbox") - - .some-block.option-block - h4(data-localise="__MSG_autoRedirect__") - input#auto-redirect(type="checkbox") - - form - .some-block.option-block - h4(data-localise="__MSG_latencyThreshold") Latency Threshold - output#latency-output(for="latencyInput" name="latencyOutput") - input#latency-input(type="range" min="50" max="5000" value="1000" name="latencyInput" step="50") - - .some-block.option-block - h4(data-localise="__MSG_exceptions__") - - form#custom-exceptions-instance-form - .some-block.option-block - .some-block(style="padding:0;") - input#exceptions-custom-instance(placeholder="https://www.google.com" type="url") - |  - select#exceptions-custom-instance-type - option(value="url") URL - option(value="regex") Regex - |  - button#exceptions-add-instance.add(type="submit") - svg(xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor") - path(d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z") - - #exceptions-custom-checklist.checklist - - .buttons.buttons-inline - a#update-instances.button.button-inline - svg(xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor") - path(d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z") - x(data-localise="__MSG_updateInstances__") Update Instances - - |    - - .buttons.buttons-inline - - label#import_settings_text.button.button-inline(for="import-settings") - svg(xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor") - path(d="M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z") - |  - x(data-localise="__MSG_importSettings__") Import Settings - input#import-settings.button.button-inline(type="file" style="display:none;") - - |    - - a#export-settings.button.button-inline - svg(xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor") - path(d="M10.09 15.59L11.5 17l5-5-5-5-1.41 1.41L12.67 11H3v2h9.67l-2.58 2.59zM19 3H5c-1.11 0-2 .9-2 2v4h2V5h14v14H5v-4H3v4c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z") - |  - x(data-localise="__MSG_exportSettings__") Export Settings - - |    - - a#reset-settings.button.button-inline - svg(xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor") - path(d="M12,5V2L8,6l4,4V7c3.31,0,6,2.69,6,6c0,2.97-2.17,5.43-5,5.91v2.02c3.95-0.49,7-3.85,7-7.93C20,8.58,16.42,5,12,5z") - path(d="M6,13c0-1.65,0.67-3.15,1.76-4.24L6.34,7.34C4.9,8.79,4,10.79,4,13c0,4.08,3.05,7.44,7,7.93v-2.02 C8.17,18.43,6,15.97,6,13z") - x(data-localise="__MSG_resetSettings__") Reset Settings - hr - - .some-block.option-block - h4(data-localise="__MSG_customPopup__") Customize Popup - - #popup-frontends-checklist.checklist-popup - div - div - img(src="../../../assets/images/youtube-icon.png") - x(data-localise="__MSG_youtube__") YouTube - input#youtube(type="checkbox") - div - div - img(src="../../../assets/images/youtube-music-icon.png") - x(data-localise="__MSG_ytmusic__") YoutubeMusic - input#youtubeMusic(type="checkbox") - div - div - img(src="../../../assets/images/twitter-icon.png") - x(data-localise="__MSG_twitter__") Twitter - input#twitter(type="checkbox") - - div - div - img(src="../../../assets/images/instagram-icon.png") - x(data-localise="__MSG_instagram__") Instagram - input#instagram(type="checkbox") - - div - div - img(src="../../../assets/images/tiktok-icon.png") - x(data-localise="__MSG_tiktok__") TikTok - input#tiktok(type="checkbox") - - div - div - img(src="../../../assets/images/imgur.png") - x(data-localise="__MSG_imgur__") Imgur - input#imgur(type="checkbox") - - div - div - img(src="../../../assets/images/reddit-icon.png") - x(data-localise="__MSG_reddit__") Reddit - input#reddit(type="checkbox") - - div - div - svg(xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor") - path(d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z") - x(data-localise="__MSG_search__") Search - input#search(type="checkbox") - - div - div - svg(xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor") - path(d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z") - x(data-localise="__MSG_translate__") Translate - input#translate(type="checkbox") - - div - div - svg(xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor") - path(d="M20.5 3l-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5zM10 5.47l4 1.4v11.66l-4-1.4V5.47zm-5 .99l3-1.01v11.7l-3 1.16V6.46zm14 11.08l-3 1.01V6.86l3-1.16v11.84z") - x(data-localise="__MSG_maps__") Maps - input#maps(type="checkbox") - - div - div - img(src="../../../assets/images/wikipedia-icon.svg") - x(data-localise="__MSG_wikipedia__") Wikipedia - input#wikipedia(type="checkbox") - - div - div - svg(xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1770 1000" fill="currentColor") - circle(cx="500" cy="500" r="500") - ellipse(ry="475" rx="250" cy="501" cx="1296") - ellipse(cx="1682" cy="502" rx="88" ry="424") - x(data-localise="__MSG_medium__") Medium - input#medium(type="checkbox") - - div - div - img(src="../../../assets/images/quora.png") - x(data-localise="__MSG_quora__") Quora - input#quora(type="checkbox") - - div - div - img(src="../../../assets/images/imdb.svg") - x(data-localise="__MSG_imdb__") IMDb - input#imdb(type="checkbox") - - div - div - img(src="../../../assets/images/reuters.svg") - x(data-localise="__MSG_reuters__") Reuters - input#reuters(type="checkbox") - - div - div - img(src="../../../assets/images/peertube-icon.svg") - x(data-localise="__MSG_peertube__") PeerTube - input#peertube(type="checkbox") - - div - div - img(src="../../../assets/images/lbry-icon.png") - x(data-localise="__MSG_lbry__") LBRY - input#lbry(type="checkbox") - - div - div - svg(xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor") - path(d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z") - x(data-localise="__MSG_sendFiles__") Send Files - input#sendTargets(type="checkbox") - - - script(type="module" src="./widgets/general.js") diff --git a/src/pages/options/widgets/imdb.pug b/src/pages/options/widgets/imdb.pug deleted file mode 100644 index 67eb8ec..0000000 --- a/src/pages/options/widgets/imdb.pug +++ /dev/null @@ -1,26 +0,0 @@ -section#imdb_page.option-block - .some-block.option-block - h1(data-localise="__MSG_imdb__") IMDb - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#imdb-enable(type="checkbox") - - #libremdb - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://libremdb.com') - include ../../widgets/latency.pug - +latency('libremdb') - .tor - include ../../widgets/instances.pug - +instances('http://libremdb.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://libremdb.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://libremdb.loki') - - script(type="module" src="./widgets/imdb.js") diff --git a/src/pages/options/widgets/imgur.pug b/src/pages/options/widgets/imgur.pug deleted file mode 100644 index 46c497e..0000000 --- a/src/pages/options/widgets/imgur.pug +++ /dev/null @@ -1,27 +0,0 @@ -section#imgur_page.option-block - .some-block.option-block - h1(data-localise="__MSG_imgur__") Imgur - hr - - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#imgur-enable(type="checkbox") - - #rimgo - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://rimgo.com') - include ../../widgets/latency.pug - +latency('rimgo') - .tor - include ../../widgets/instances.pug - +instances('http://rimgo.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://rimgo.onion') - .loki - include ../../widgets/instances.pug - +instances('http://rimgo.loki') - - script(type="module" src="./widgets/imgur.js") diff --git a/src/pages/options/widgets/instagram.pug b/src/pages/options/widgets/instagram.pug deleted file mode 100644 index 702aa65..0000000 --- a/src/pages/options/widgets/instagram.pug +++ /dev/null @@ -1,27 +0,0 @@ -section#instagram_page.option-block - .some-block.option-block - h1(data-localise="__MSG_instagram__") Instagram - hr - - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#instagram-enable(type="checkbox") - - #bibliogram - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://bibliogram.com') - include ../../widgets/latency.pug - +latency('bibliogram') - .tor - include ../../widgets/instances.pug - +instances('https://bibliogram.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://bibliogram.onion') - .loki - include ../../widgets/instances.pug - +instances('http://bibliogram.loki') - - script(type="module" src="./widgets/instagram.js") diff --git a/src/pages/options/widgets/lbry.pug b/src/pages/options/widgets/lbry.pug deleted file mode 100644 index 9f01ebc..0000000 --- a/src/pages/options/widgets/lbry.pug +++ /dev/null @@ -1,39 +0,0 @@ -section#lbry_page.option-block - .some-block.option-block - h1(data-localise="__MSG_lbry__") LBRY - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#lbry-enable(type="checkbox") - - .some-block.option-block - h4(data-localise="__MSG_frontend__") Frontend - select#lbry-frontend - option(value="librarian") Librarian - option(value="lbryDesktop" data-localise="__MSG_lbryDesktop__") LBRY Desktop - - .some-block.option-block - h4(data-localise="__MSG_redirectType__") Redirect Type - select#lbry-redirect_type - option(value="both" data-localise="__MSG_both__") both - option(value="sub_frame" data-localise="__MSG_onlyEmbedded__") Only Embedded - option(value="main_frame" data-localise="__MSG_onlyNotEmbedded__") Only Not Embedded - - #librarian - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://librarian.com') - include ../../widgets/latency.pug - +latency('librarian') - .tor - include ../../widgets/instances.pug - +instances('https://librarian.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://librarian.onion') - .loki - include ../../widgets/instances.pug - +instances('http://librarian.loki') - - script(type="module" src="./widgets/lbry.js") diff --git a/src/pages/options/widgets/maps.pug b/src/pages/options/widgets/maps.pug deleted file mode 100644 index 66d0d41..0000000 --- a/src/pages/options/widgets/maps.pug +++ /dev/null @@ -1,32 +0,0 @@ -section#maps_page.option-block - .some-block.option-block - h1(data-localise="__MSG_maps__") Maps - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#maps-enable(type="checkbox") - - .some-block.option-block - h4(data-localise="__MSG_frontend__") Frontend - select#maps-frontend - option(value="osm") OpenStreetMap - option(value="facil") Facil Map - - #facil - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://facilmap.com') - include ../../widgets/latency.pug - +latency('facil') - .tor - +instances('http://facilmap.onion') - include ../../widgets/instances.pug - .i2p - include ../../widgets/instances.pug - +instances('http://facilmap.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://facilmap.loki') - - script(type="module" src="./widgets/maps.js") diff --git a/src/pages/options/widgets/medium.pug b/src/pages/options/widgets/medium.pug deleted file mode 100644 index 60223fd..0000000 --- a/src/pages/options/widgets/medium.pug +++ /dev/null @@ -1,26 +0,0 @@ -section#medium_page.option-block - .some-block.option-block - h1(data-localise="__MSG_medium__") Medium - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#medium-enable(type="checkbox") - - #scribe - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://scribe.com') - include ../../widgets/latency.pug - +latency('scribe') - .tor - include ../../widgets/instances.pug - +instances('http://scribe.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://scribe.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://scribe.loki') - - script(type="module" src="./widgets/medium.js") diff --git a/src/pages/options/widgets/peertube.pug b/src/pages/options/widgets/peertube.pug deleted file mode 100644 index 2b818df..0000000 --- a/src/pages/options/widgets/peertube.pug +++ /dev/null @@ -1,26 +0,0 @@ -section#peertube_page.option-block - .some-block.option-block - h1(data-localise="__MSG_peertube__") PeerTube - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#peertube-enable(type="checkbox") - - #simpleertube - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://simpleertube.com') - include ../../widgets/latency.pug - +latency('simpleertube') - .tor - include ../../widgets/instances.pug - +instances('http://simpleertube.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://simpleertube.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://simpleertube.loki') - - script(type="module" src="./widgets/peertube.js") diff --git a/src/pages/options/widgets/quora.pug b/src/pages/options/widgets/quora.pug deleted file mode 100644 index 7c3c52a..0000000 --- a/src/pages/options/widgets/quora.pug +++ /dev/null @@ -1,26 +0,0 @@ -section#quora_page.option-block - .some-block.option-block - h1(data-localise="__MSG_quora__") Quora - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#quora-enable(type="checkbox") - - #quetre - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://quetre.com') - include ../../widgets/latency.pug - +latency('quetre') - .tor - include ../../widgets/instances.pug - +instances('http://quetre.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://quetre.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://quetre.loki') - - script(type="module" src="./widgets/quora.js") diff --git a/src/pages/options/widgets/reddit.pug b/src/pages/options/widgets/reddit.pug deleted file mode 100644 index 24c437f..0000000 --- a/src/pages/options/widgets/reddit.pug +++ /dev/null @@ -1,48 +0,0 @@ -section#reddit_page.option-block - .some-block.option-block - h1(data-localise="__MSG_reddit__") Reddit - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#reddit-enable(type="checkbox") - - .some-block.option-block - h4#frontend(data-localise="__MSG_frontend__") Frontend - select#reddit-frontend - option(value="libreddit") Libreddit - option(value="teddit") Teddit - - #libreddit - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://libreddit.com') - include ../../widgets/latency.pug - +latency('libreddit') - .tor - include ../../widgets/instances.pug - +instances('http://libreddit.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://libreddit.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://libreddit.loki') - - #teddit - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://teddit.com') - +latency('teddit') - .tor - include ../../widgets/instances.pug - +instances('http://teddit.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://teddit.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://teddit.loki') - - script(type="module" src="./widgets/reddit.js") diff --git a/src/pages/options/widgets/reuters.pug b/src/pages/options/widgets/reuters.pug deleted file mode 100644 index 985965a..0000000 --- a/src/pages/options/widgets/reuters.pug +++ /dev/null @@ -1,26 +0,0 @@ -section#reuters_page.option-block - .some-block.option-block - h1(data-localise="__MSG_reuters__") Reuters - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#reuters-enable(type="checkbox") - - #neuters - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://neuters.com') - include ../../widgets/latency.pug - +latency('neuters') - .tor - include ../../widgets/instances.pug - +instances('http://neuters.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://neuters.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://neuters.loki') - - script(type="module" src="./widgets/reuters.js") diff --git a/src/pages/options/widgets/search.pug b/src/pages/options/widgets/search.pug deleted file mode 100644 index f449e0d..0000000 --- a/src/pages/options/widgets/search.pug +++ /dev/null @@ -1,85 +0,0 @@ -section#search_page.option-block - .some-block.option-block - h1(data-localise="__MSG_search__") Search - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#search-enable(type="checkbox") - - .some-block.option-block - h4(data-localise="__MSG_frontend__") Frontend - select#search-frontend - option(value="searxng") SearXNG - option(value="searx") SearX - option(value="whoogle") Whoogle - option(value="librex") LibreX - - .some-block - h4(data-localise="__MSG_searchNote__") Note: To use Search, make LibRedirect the Default Search Engine - - #searx - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://searx.com') - include ../../widgets/latency.pug - +latency('searx') - .tor - include ../../widgets/instances.pug - +instances('http://searx.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://searx.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://searx.loki') - - #searxng - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://searxng.com') - +latency('searxng') - .tor - include ../../widgets/instances.pug - +instances('http://searxng.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://searxng.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://searxng.loki') - - #whoogle - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://whoogle.com') - +latency('whoogle') - .tor - include ../../widgets/instances.pug - +instances('http://whoogle.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://whoogle.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://whoogle.loki') - - #librex - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://librex.com') - +latency('librex') - .tor - include ../../widgets/instances.pug - +instances('http://librex.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://librex.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://librex.loki') - - script(type="module" src="./widgets/search.js") diff --git a/src/pages/options/widgets/sendTargets.pug b/src/pages/options/widgets/sendTargets.pug deleted file mode 100644 index e7676b3..0000000 --- a/src/pages/options/widgets/sendTargets.pug +++ /dev/null @@ -1,26 +0,0 @@ -section#sendTargets_page.option-block - .some-block.option-block - h1(data-localise="__MSG_sendFiles__") Send Files - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#sendTargets-enable(type="checkbox") - - #send - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://send.com') - include ../../widgets/latency.pug - +latency('send') - .tor - include ../../widgets/instances.pug - +instances('http://send.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://send.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://send.loki') - - script(type="module" src="./widgets/sendTargets.js") diff --git a/src/pages/options/widgets/services.ejs b/src/pages/options/widgets/services.ejs index a1b0a53..aed5872 100644 --- a/src/pages/options/widgets/services.ejs +++ b/src/pages/options/widgets/services.ejs @@ -1,5 +1,5 @@ -<% config.services.forEach(service=>{ %> -
+<% for (const service in config.services) { %> +

<%= config.services[service].name %>

@@ -8,33 +8,35 @@

Enable

+ <% if ((Object.keys(config.services[service].frontends).length > 1) || config.services[service].singleInstanceFrontends) { %>

Frontend

- <% if (config.services[service].embeddable) { %> - <% if (config.services[service].singleInstanceFrontends) { %> + <% } %> + <% if ((config.services[service].singleInstanceFrontends) && (Object.keys(config.services[service].frontends).length > 1)) { %>
-

Embedded Videos Frontend

+

Embed Frontend

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

Redirect Type

- @@ -42,9 +44,9 @@
<% } %>
- <% config.services[service].frontends.forEach(frontend=>{ %> + <% for (const frontend in config.services[service].frontends) { %>
- <% config.networks.forEach(network=>{ %> + <% for (const network in config.networks) { %>

Default Instances

@@ -56,7 +58,7 @@
- +
<% } %>
- <% }); %> - <% }); %> + <% }; %> +
+ <% }; %>
-<% }); %> +<% }; %> diff --git a/src/pages/options/widgets/services.js b/src/pages/options/widgets/services.js index 5f370a1..c7955b4 100644 --- a/src/pages/options/widgets/services.js +++ b/src/pages/options/widgets/services.js @@ -12,7 +12,8 @@ async function getConfig() { fetch("/config/config.json") .then(response => response.text()) .then(data => { - config = JSON.parse(data) + const tmp = JSON.parse(data) + config = tmp.config resolve() }) }) diff --git a/src/pages/options/widgets/tiktok.pug b/src/pages/options/widgets/tiktok.pug deleted file mode 100644 index 986bd27..0000000 --- a/src/pages/options/widgets/tiktok.pug +++ /dev/null @@ -1,26 +0,0 @@ -section#tiktok_page.option-block - .some-block.option-block - h1(data-localise="__MSG_tiktok__") TikTok - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#tiktok-enable(type="checkbox") - - #proxiTok - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://proxitok.com') - include ../../widgets/latency.pug - +latency('proxiTok') - .tor - include ../../widgets/instances.pug - +instances('http://proxitok.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://proxitok.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://proxitok.loki') - - script(type="module" src="./widgets/tiktok.js") diff --git a/src/pages/options/widgets/translate.pug b/src/pages/options/widgets/translate.pug deleted file mode 100644 index 40d42bc..0000000 --- a/src/pages/options/widgets/translate.pug +++ /dev/null @@ -1,48 +0,0 @@ -section#translate_page.option-block - .some-block.option-block - h1(data-localise="__MSG_translate__") Translate - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#translate-enable(type="checkbox") - - .some-block.option-block - h4(data-localise="__MSG_frontend__") Frontend - select#translate-frontend - option(value="simplyTranslate") SimplyTranslate - option(value="lingva") Lingva - - hr - #simplyTranslate - .clearnet - include ../../widgets/instances.pug - +instances('https://simplytranslate.org') - include ../../widgets/latency.pug - +latency('simplyTranslate') - .tor - include ../../widgets/instances.pug - +instances('http://hxecvvetgrznmprg.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://simplytranslate.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://simplytranslate.loki') - - #lingva - .clearnet - include ../../widgets/instances.pug - +instances('https://lingvatranslate.com') - +latency('lingva') - .tor - include ../../widgets/instances.pug - +instances('http://lingvatranslate.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://lingvatranslate.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://lingvatranslate.loki') - - - script(type="module" src="./widgets/translate.js") diff --git a/src/pages/options/widgets/twitter.pug b/src/pages/options/widgets/twitter.pug deleted file mode 100644 index fa7f132..0000000 --- a/src/pages/options/widgets/twitter.pug +++ /dev/null @@ -1,33 +0,0 @@ -section#twitter_page.option-block - .some-block.option-block - h1(data-localise="__MSG_twitter__") Twitter - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#twitter-enable(type="checkbox") - - .some-block.option-block - h4(data-localise="__MSG_redirectType__") Redirect Type - select#twitter-redirect_type - option(value="both" data-localise="__MSG_both__") both - option(value="sub_frame" data-localise="__MSG_onlyEmbedded__") Only Embedded - option(value="main_frame" data-localise="__MSG_onlyNotEmbedded__") Only Not Embedded - - #nitter - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://nitter.com') - include ../../widgets/latency.pug - +latency('nitter') - .tor - include ../../widgets/instances.pug - +instances('http://nitter.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://nitter.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://nitter.loki') - - script(type="module" src="./widgets/twitter.js") diff --git a/src/pages/options/widgets/wikipedia.pug b/src/pages/options/widgets/wikipedia.pug deleted file mode 100644 index a0ad37c..0000000 --- a/src/pages/options/widgets/wikipedia.pug +++ /dev/null @@ -1,26 +0,0 @@ -section#wikipedia_page.option-block - .some-block.option-block - h1(data-localise="__MSG_wikipedia__") Wikipedia - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#wikipedia-enable(type="checkbox") - - #wikiless - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://wikiless.com') - include ../../widgets/latency.pug - +latency('wikiless') - .tor - include ../../widgets/instances.pug - +instances('http://wikiless.onion') - .i2p - include ../../widgets/instances.pug - +instances('https://wikiless.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://wikiless.loki') - - script(type="module" src="./widgets/wikipedia.js") diff --git a/src/pages/options/widgets/youtube.pug b/src/pages/options/widgets/youtube.pug deleted file mode 100644 index cf48d9b..0000000 --- a/src/pages/options/widgets/youtube.pug +++ /dev/null @@ -1,103 +0,0 @@ -section#youtube_page.option-block - .some-block.option-block - h1(data-localise="__MSG_youtube__") YouTube - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#youtube-enable(type="checkbox") - - .some-block.option-block - h4(data-localise="__MSG_frontend__") Frontend - select#youtube-frontend - option(value="invidious") Invidious - option(value="piped") Piped - option(value="pipedMaterial") Piped-Material - option(value="cloudtube") CloudTube - option(value="freetube") FreeTube - option(value="yatte") Yattee - - #youtube-embedded_frontend - .some-block.option-block - h4(data-localise="__MSG_embeddedVids__") Embedded Videos Frontend - select#youtube-embed_frontend - option(value="invidious") Invidious - option(value="piped") Piped - option(value="pipedMaterial") Piped-Material - option(value="cloudtube") CloudTube - - .some-block.option-block - h4(data-localise="__MSG_redirectType__") Redirect Type - select#youtube-redirect_type - option(value="both" data-localise="__MSG_both__") both - option(value="onlyEmbedded" data-localise="__MSG_onlyEmbedded__") Only Embedded - option(value="onlyNotEmbedded" data-localise="__MSG_onlyNotEmbedded__") Only Not Embedded - - #invidious - hr - .clearnet - include ../../widgets/instances.pug - +instances('http://invidious.com') - include ../../widgets/latency.pug - +latency('invidious') - .tor - include ../../widgets/instances.pug - +instances('http://invidious.onion') - .i2p - include ../../widgets/instances.pug - +instances('http://invidious.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://invidious.loki') - - #piped - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://piped.com') - include ../../widgets/latency.pug - +latency('piped') - .tor - +instances('http://piped.onion') - include ../../widgets/instances.pug - .i2p - include ../../widgets/instances.pug - +instances('http://piped.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://piped.loki') - - #pipedMaterial - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://piped-material.com') - include ../../widgets/latency.pug - +latency('pipedMaterial') - .tor - +instances('http://piped-material.onion') - include ../../widgets/instances.pug - .i2p - include ../../widgets/instances.pug - +instances('http://piped-material.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://piped-material.loki') - - #cloudtube - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://cloudtube.com') - include ../../widgets/latency.pug - +latency('cloudtube') - .tor - +instances('http://cloudtube.onion') - include ../../widgets/instances.pug - .i2p - include ../../widgets/instances.pug - +instances('http://cloudtube.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://cloudtube.loki') - - script(type="module" src="./widgets/youtube.js") diff --git a/src/pages/options/widgets/youtubeMusic.pug b/src/pages/options/widgets/youtubeMusic.pug deleted file mode 100644 index 9c2c08c..0000000 --- a/src/pages/options/widgets/youtubeMusic.pug +++ /dev/null @@ -1,49 +0,0 @@ -section#youtubeMusic_page.option-block - .some-block.option-block - h1(data-localise="__MSG_ytmusic__") YouTube Music - hr - .some-block.option-block - h4(data-localise="__MSG_enable__") Enable - input#youtubeMusic-enable(type="checkbox") - - .some-block.option-block - h4(data-localise="__MSG_frontend__") Frontend - select#youtubeMusic-frontend - option(value="beatbump") Beatbump - option(value="hyperpipe") Hyperpipe - - #beatbump - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://beatbump.org') - include ../../widgets/latency.pug - +latency('beatbump') - .tor - +instances('http://beatbump.onion') - include ../../widgets/instances.pug - .i2p - include ../../widgets/instances.pug - +instances('http://beatbump.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://beatbump.loki') - - #hyperpipe - hr - .clearnet - include ../../widgets/instances.pug - +instances('https://hyperpipe.org') - include ../../widgets/latency.pug - +latency('hyperpipe') - .tor - +instances('http://hyperpipe.onion') - include ../../widgets/instances.pug - .i2p - include ../../widgets/instances.pug - +instances('http://hyperpipe.i2p') - .loki - include ../../widgets/instances.pug - +instances('http://hyperpipe.loki') - - script(type="module" src="./widgets/youtubeMusic.js") diff --git a/src/pages/widgets/links.ejs b/src/pages/widgets/links.ejs index eacfe91..fe0cd37 100644 --- a/src/pages/widgets/links.ejs +++ b/src/pages/widgets/links.ejs @@ -1,7 +1,7 @@ From 0c1595ec3a0f8f38f322f2e70598dbe208151554 Mon Sep 17 00:00:00 2001 From: Hygna Date: Mon, 19 Sep 2022 17:30:39 +0100 Subject: [PATCH 19/67] Changes Made get_instances.py more efficient Further work to get widgets/services.js to work properly --- src/assets/javascripts/services.js | 33 +- src/config/config.json | 171 ++- src/instances/get_instances.py | 484 +++------ src/pages/options/index.ejs | 10 +- src/pages/options/index.html | 1332 ++++++++---------------- src/pages/options/widgets/general.ejs | 12 +- src/pages/options/widgets/services.ejs | 61 +- src/pages/options/widgets/services.js | 58 +- src/pages/widgets/links.ejs | 4 +- 9 files changed, 796 insertions(+), 1369 deletions(-) diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 7092878..affe0d1 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -28,8 +28,8 @@ function init() { //cur = current for (const service in config.services) { options[service] = {} - browser.storage.local.get([`disable${utils.camelCase(service)}`, `${service}RedirectType`, `${service}Frontend`], r => { - options[service].disabled = r["disable" + utils.camelCase(service)] + browser.storage.local.get([`${utils.camelCase(service)}Enable`, `${service}RedirectType`, `${service}Frontend`], r => { + options[service].enabled = r[utils.camelCase(service) + "Enable"] options[service].frontend = r[service + "Frontend"] options[service].redirectType = r[service + "RedirectType"] // console.log(r) @@ -60,19 +60,19 @@ function all(service) { return tmp } -getConfig() +await getConfig() init() browser.storage.onChanged.addListener(init) function redirect(url, type, initiator) { let randomInstance - let frontend = options[service].frontend + let frontend let network = options.network let networkFallback = options.networkFallback - let redirectType = options[service].redirectType + let redirectType if (url.pathname == "/") return for (const service in config.services) { - if (options[service].disabled && !disableOverride) continue + if (!options[service].enabled && !disableOverride) continue let targets = service.targets if (targets == "datajson") { browser.storage.local.get(`${service}Targets`, (targets = r[service + "Targets"])) @@ -81,11 +81,18 @@ 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 != redirectType && type != "both") continue + + frontend = options[service].frontend + redirectType = options[service].redirectType + // browser.storage.local.get(`${service}Frontend`, (frontend = r[service + "Frontend"])) - 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) + + if (config.services[service].frontends[frontend].instanceList) { + let instanceList = [...[frontend + utils.camelCase(network) + "RedirectsChecks"], ...[frontend + utils.camelCase(network) + "CustomRedirects"]] + if (instanceList.length === 0 && networkFallback) instanceList = [...[frontend + "ClearnetRedirectsChecks"], ...[frontend + "ClearnetCustomRedirects"]] + if (instanceList.length === 0 && redirects.indexOf(frontend) != -1) return + randomInstance = utils.getRandomInstance(instanceList) + } } // Here is a (temperory) space for defining constants required in 2 or more switch cases. @@ -114,7 +121,7 @@ function redirect(url, type, initiator) { .replace("/watch?v=", "/listen?id=") .replace("/channel/", "/artist/") .replace("/playlist?list=", "/playlist/VL") - .replace(/\/search\?q=.*/, searchQuery => searchQuery.replace("?q=", "/") + "?filter=song") + .replace(/\/search\?q=.*/, searchQuery => searchQuery.replace("?q=", "/") + "?filter=all") case "hyperpipe": return `${randomInstance}${url.pathname}${url.search}`.replace(/\/search\?q=.*/, searchQuery => searchQuery.replace("?q=", "/")) case "bibliogram": @@ -386,7 +393,7 @@ function initDefaults() { // console.log(redirects) // console.log(config) browser.storage.local.set({ - redirects, + redirects: redirects.invidious, }) browser.storage.local.get(["cloudflareBlackList", "authenticateBlackList", "offlineBlackList"], async r => { // console.log(r) @@ -395,7 +402,7 @@ function initDefaults() { browser.storage.local.set({ [service + "Targets"]: redirects[service] }) } for (const defaultOption in config.services[service].defaults) { - browser.storage.local.set({ [defaultOption]: config.services[service].defaults[defaultOption] }) + browser.storage.local.set({ [service + camelCase(defaultOption)]: config.services[service].defaults[defaultOption] }) } for (const frontend in config.services[service].frontends) { let clearnetChecks = redirects[frontend].clearnet diff --git a/src/config/config.json b/src/config/config.json index 7c39155..d0bf7ed 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -24,7 +24,10 @@ "invidious": { "preferences": { "cookies": ["PREFS"] - } + }, + "name": "Invidious", + "embeddable": true, + "instanceList": true }, "piped": { "preferences": { @@ -48,19 +51,38 @@ "volume", "watchHistory" ] - } + }, + "name": "Piped", + "embeddable": true, + "instanceList": true }, "pipedMaterial": { "preferences": { "localstorage": ["PREFERENCES"] - } + }, + "name": "Piped-Material", + "embeddable": false, + "instanceList": true }, "cloudtube": { "preferences": { "token": "token", "fetchEndpoint": "/api/settings", "setEndpoint": "/settings" - } + }, + "name": "CloudTube", + "embeddable": false, + "instanceList": true + }, + "freetube": { + "name": "FreeTube", + "embeddable": false, + "instanceList": false + }, + "yattee": { + "name": "Yattee", + "embeddable": false, + "instanceList": false } }, "singleInstanceFrontends": ["freetube", "yatte"], @@ -74,7 +96,7 @@ ], "name": "Youtube", "options": { - "disabled": false, + "enabled": true, "redirectType": "both", "frontend": "invidious", "embedFrontend": "invidious" @@ -88,19 +110,23 @@ "preferences": { "localstorage": ["settings"], "indexeddb": "beatbump" - } + }, + "name": "Beatbump", + "instanceList": true }, "hyperpipe": { "preferences": { "localstorage": ["api", "authapi", "codec", "locale", "next", "pipedapi", "quality", "theme", "vol"], "indexeddb": ["hyperpipedb"] - } + }, + "name": "HyperPipe", + "instanceList": true } }, "targets": ["^https?:\\/{2}music\\.youtube\\.com(\\/.*|$)"], "name": "YT Music", "options": { - "disabled": false, + "enabled": true, "frontend": "beatbump" }, "imageType": "png", @@ -130,13 +156,16 @@ "replaceTwitter", "replaceYouTube" ] - } + }, + "name": "Nitter", + "embeddable": true, + "instanceList": true } }, "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", "options": { - "disabled": false, + "enabled": true, "redirectType": "both" }, "imageType": "png", @@ -149,12 +178,14 @@ "token": "token", "fetchEndpoint": "/settings.json", "setEndpoint": "/applysettings" - } + }, + "name": "Bibliogram", + "instanceList": false } }, "targets": ["^https?:\\/{2}(www\\.)?instagram\\.com"], "name": "Instagram", - "options": { "disabled": false }, + "options": { "enabled": true }, "imageType": "png", "embeddable": false }, @@ -163,12 +194,14 @@ "proxiTok": { "preferences": { "cookies": ["api-test_endpoints", "theme"] - } + }, + "name": "ProxiTok", + "instanceList": true } }, "targets": ["^https?:\\/{2}(www\\.|)tiktok\\.com.*"], "name": "TikTok", - "options": { "disabled": false }, + "options": { "enabled": true }, "imageType": "png", "embeddable": false }, @@ -177,7 +210,9 @@ "libreddit": { "preferences": { "cookies": ["theme", "front_page", "layout", "wide", "post_sort", "comment_sort", "show_nsfw", "autoplay_videos", "use_hls", "hide_hls_notification", "subscriptions", "filters"] - } + }, + "name": "Libreddit", + "instanceList": true }, "teddit": { "preferences": { @@ -195,13 +230,15 @@ "theme", "videos_muted" ] - } + }, + "name": "Teddit", + "instanceList": true } }, "targets": ["^https?:\\/{2}(www\\.|old\\.|np\\.|new\\.|amp\\.|)reddit\\.com", "^https?:\\/{2}(i\\.|preview\\.)redd\\.it"], "name": "Reddit", "options": { - "disabled": false, + "enabled": true, "frontend": "libreddit" }, "imageType": "png", @@ -210,12 +247,14 @@ "imgur": { "frontends": { "rimgo": { - "preferences": {} + "preferences": {}, + "name": "rimgo", + "instanceList": true } }, "targets": ["^https?:\\/{2}([im]\\.)?imgur\\.(com|io)(\\/|$)"], "name": "Imgur", - "options": { "disabled": false }, + "options": { "enabled": true }, "imageType": "png", "embeddable": false }, @@ -224,19 +263,23 @@ "wikiless": { "preferences": { "cookies": ["theme", "default_lang"] - } + }, + "name": "Wikiless", + "instanceList": true } }, "targets": ["^https?:\\/{2}([a-z]+\\.)*wikipedia\\.org"], "name": "Wikipedia", - "options": { "disabled": true }, + "options": { "enabled": false }, "imageType": "svg", "embeddable": false }, "medium": { "frontends": { "scribe": { - "preferences": {} + "preferences": {}, + "name": "Scribe", + "instanceList": true } }, "targets": [ @@ -260,7 +303,7 @@ "^writingcooperative\\.com " ], "name": "Medium", - "options": { "disabled": false }, + "options": { "enabled": true }, "imageType": "svg", "embeddable": false }, @@ -269,12 +312,14 @@ "quetre": { "preferences": { "localstorage": ["theme"] - } + }, + "name": "Quetre", + "instanceList": true } }, "targets": ["^https?:\\/{2}([a-z]+\\.)*quora\\.com.*"], "name": "Quora", - "options": { "disabled": false }, + "options": { "enabled": true }, "imageType": "png", "embeddable": false }, @@ -283,36 +328,42 @@ "libremdb": { "preferences": { "localstorage": ["theme"] - } + }, + "name": "libremdb", + "instanceList": true } }, "targets": ["^https?:\\/{2}(?:www\\.|)imdb\\.com.*"], "name": "IMDb", - "options": { "disabled": true }, + "options": { "enabled": false }, "imageType": "svg", "embeddable": false }, "reuters": { "frontends": { "neuters": { - "preferences": {} + "preferences": {}, + "name": "Neuters", + "instanceList": true } }, "targets": ["^https?:\\/{2}(www\\.|)reuters\\.com.*"], "name": "Reuters", - "options": { "disabled": true }, + "options": { "enabled": false }, "imageType": "svg", "embeddable": false }, "peertube": { "frontends": { "simpleertube": { - "preferences": {} + "preferences": {}, + "name": "SimpleerTube", + "instanceList": true } }, "targets": "datajson", "name": "PeerTube", - "options": { "disabled": true }, + "options": { "enabled": false }, "imageType": "svg", "embeddable": false }, @@ -322,14 +373,21 @@ "preferences": { "cookies": ["nsfw", "theme"], "localstorage": ["autoplay", "autoplayNextVid", "collapseComments", "plyr", "sb_categories", "showRelated"] - } + }, + "name": "Librarian", + "embeddable": true, + "instanceList": true + }, + "lbryDesktop": { + "name": "LBRY Desktop", + "embeddable": false, + "instanceList": false } }, - "singleInstanceFrontends": ["lbryDesktop"], "targets": ["^https?:\\/{2}odysee\\.com", "^https?:\\/{2}lbry\\.tv"], "name": "LBRY", "options": { - "disabled": true, + "enabled": false, "frontend": "librarian", "redirectType": "both" }, @@ -359,7 +417,9 @@ "theme", "tokens" ] - } + }, + "name": "SearX", + "instanceList": true }, "searxng": { "preferences": { @@ -384,21 +444,27 @@ "theme", "tokens" ] - } + }, + "name": "SearXNG", + "instanceList": true }, "whoogle": { - "preferences": {} + "preferences": {}, + "name": "Whoogle", + "instanceList": true }, "librex": { "preferences": { "cookies": ["bibliogram", "disable_special", "invidious", "libreddit", "nitter", "proxitok", "theme", "wikiless"] - } + }, + "name": "LibreX", + "instanceList": true } }, "targets": ["^https?:\\/{2}search\\.libredirect\\.invalid"], "name": "Search", "options": { - "disabled": false, + "enabled": true, "frontend": "searxng" }, "imageType": "svg", @@ -409,18 +475,22 @@ "simplyTranslate": { "preferences": { "cookies": ["from_lang", "to_lang", "tts_enabled", "use_text_fields"] - } + }, + "name": "SimplyTranslate", + "instanceList": true }, "lingva": { "preferences": { "localstorage": ["isauto", "source", "target"] - } + }, + "name": "Lingva", + "instanceList": true } }, "targets": ["^https?:\\/{2}translate\\.google(\\.[a-z]{2,3}){1,2}\\/"], "name": "Translate", "options": { - "disabled": false, + "enabled": true, "frontend": "simplyTranslate" }, "imageType": "svg", @@ -429,14 +499,19 @@ "maps": { "frontends": { "facil": { - "preferences": {} + "preferences": {}, + "name": "FacilMap", + "instanceList": true + }, + "osm": { + "name": "OpenStreetMap", + "instanceList": false } }, - "singleInstanceFrontends": ["osm"], "targets": ["^https?:\\/{2}(((www|maps)\\.)?(google\\.).*(\\/maps)|maps\\.(google\\.).*)"], "name": "Maps", "options": { - "disabled": false, + "enabled": true, "frontend": "osm" }, "imageType": "svg", @@ -445,12 +520,14 @@ "sendTargets": { "frontends": { "send": { - "preferences": {} + "preferences": {}, + "name": "Send", + "instanceList": "true" } }, "targets": ["^https?:\\/{2}send\\.libredirect\\.invalid\\/$", "^https?:\\/{2}send\\.firefox\\.com\\/$", "^https?:\\/{2}sendfiles\\.online\\/$"], "name": "Send Files", - "options": { "disabled": false }, + "options": { "enabled": true }, "imageType": "svg", "embeddable": false } diff --git a/src/instances/get_instances.py b/src/instances/get_instances.py index a95eb46..770f258 100644 --- a/src/instances/get_instances.py +++ b/src/instances/get_instances.py @@ -3,12 +3,10 @@ import requests import json from urllib.parse import urlparse -from bs4 import BeautifulSoup import re from colorama import Fore, Back, Style from urllib.parse import urlparse import socket -import subprocess mightyList = {} @@ -18,6 +16,11 @@ torRegex = startRegex + "onion" + endRegex i2pRegex = startRegex + "i2p" + endRegex lokiRegex = startRegex + "loki" + endRegex authRegex = "https?:\/{2}\S+:\S+@(?:[^\s\/]+\.)+[a-zA-Z0-9]+" + endRegex +config = {} + +with open('./config/config.json') as file: + config = file + def filterLastSlash(urlList): tmp = {} @@ -102,70 +105,162 @@ def is_offline(url): except: return False +def fetchCache(frontend, name) : + # json_object = json.dumps(mightyList, ensure_ascii=False, indent=2) + with open('./src/instances/data.json') as file: + mightyList[frontend] = json.load(file).frontend + print(Fore.ORANGE + 'Failed' + Style.RESET_ALL + ' to fetch ' + name) + +def fetchFromFile(frontend, name): + #json_object = json.dumps(mightyList, ensure_ascii=False, indent=2) + with open('./src/instances/' + frontend + '.json') as file: + mightyList[frontend] = json.load(file) + print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + name) + +def fetchJsonList(frontend, name, url, urlItem): + try: + r = requests.get(url) + rJson = json.loads(r.text) + _list = {} + for network in config.networks: + _list[network] = [] + if type(urlItem) is 'str': + for item in rJson: + if urlItem is not None: + tmpUrl = item[urlItem] + else: + tmpUrl = item + if tmpUrl.strip() == "": + continue + elif re.search(torRegex, tmpUrl): + _list['tor'].append(tmpUrl) + elif re.search(i2pRegex, tmpUrl): + _list['i2p'].append(tmpUrl) + elif re.search(lokiRegex, tmpUrl): + _list['loki'].append(tmpUrl) + else: + _list['clearnet'].append(tmpUrl) + else: + for i in range(config.networks.length): + # The expected order is the same as in config.json. If the frontend doesn't have any instances for a specified network, use None + if urlItem != None: + for item in rJson: + if network in item: + if item[network].strip() != "": + _list[config.networks[i]].append(item[urlItem[i]]) + + mightyList[frontend] = _list + print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + name) + except: + fetchCache(frontend, name) + +def fetchRegexList(frontend, name, url, regex): + try: + r = requests.get(url) + _list = {} + for network in config.networks: + _list[network] = [] + + tmp = re.findall(regex, r.text) + + for item in tmp: + if item.strip() == "": + continue + elif re.search(torRegex, item): + _list['tor'].append(item) + elif re.search(i2pRegex, item): + _list['i2p'].append(item) + elif re.search(lokiRegex, item): + _list['loki'].append(item) + else: + _list['clearnet'].append(item) + mightyList[frontend] = _list + print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + name) + except: + fetchCache(frontend, name) + +def fetchTextList(frontend, name, url, prepend): + try: + r = requests.get(url) + tmp = r.text.strip().split('\n') + + _list = {} + for network in config.networks: + _list[network] = [] + + for item in tmp: + item = prepend + item + if re.search(torRegex, item): + _list['tor'].append(item) + elif re.search(i2pRegex, item): + _list['i2p'].append(item) + elif re.search(lokiRegex, item): + _list['loki'].append(item) + else: + _list['clearnet'].append(item) + mightyList[frontend] = _list + print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + name) + except: + fetchCache(frontend, name) + def invidious(): - r = requests.get('https://api.invidious.io/instances.json') - rJson = json.loads(r.text) - invidiousList = {} - invidiousList['clearnet'] = [] - invidiousList['tor'] = [] - invidiousList['i2p'] = [] - invidiousList['loki'] = [] - for instance in rJson: - if instance[1]['type'] == 'https': - invidiousList['clearnet'].append(instance[1]['uri']) - elif instance[1]['type'] == 'onion': - invidiousList['tor'].append(instance[1]['uri']) - mightyList['invidious'] = invidiousList - print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Invidious') + name = 'Invidious' + frontend = 'invidious' + try: + _list = {} + _list['clearnet'] = [] + _list['tor'] = [] + _list['i2p'] = [] + _list['loki'] = [] + r = requests.get('https://api.invidious.io/instances.json') + rJson = json.loads(r.text) + for instance in rJson: + if instance[1]['type'] == 'https': + _list['clearnet'].append(instance[1]['uri']) + elif instance[1]['type'] == 'onion': + _list['tor'].append(instance[1]['uri']) + mightyList[frontend] = _list + print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + name) + except: + fetchCache(frontend, name) def piped(): - r = requests.get( - 'https://raw.githubusercontent.com/wiki/TeamPiped/Piped/Instances.md') - - tmp = re.findall( - '(?:[^\s\/]+\.)+[a-zA-Z]+ (?:\(Official\) )?\| (https:\/{2}(?:[^\s\/]+\.)+[a-zA-Z]+) \| ', r.text) - _list = {} - _list['clearnet'] = [] - _list['tor'] = [] - _list['i2p'] = [] - _list['loki'] = [] - for item in tmp: - try: - url = requests.get(item, timeout=5).url - if url.strip("/") == item: + frontend = 'piped' + name = 'Piped' + try: + _list = {} + _list['clearnet'] = [] + _list['tor'] = [] + _list['i2p'] = [] + _list['loki'] = [] + r = requests.get( + 'https://raw.githubusercontent.com/wiki/TeamPiped/Piped/Instances.md') + + tmp = re.findall( + '(?:[^\s\/]+\.)+[a-zA-Z]+ (?:\(Official\) )?\| (https:\/{2}(?:[^\s\/]+\.)+[a-zA-Z]+) \| ', r.text) + for item in tmp: + try: + url = requests.get(item, timeout=5).url + if url.strip("/") == item: + continue + else: + _list['clearnet'].append(url) + except: continue - else: - _list['clearnet'].append(url) - except: - continue - mightyList['piped'] = _list - print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Piped') + mightyList[frontend] = _list + print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + name) + except: + fetchCache(frontend, name) def pipedMaterial(): - r = requests.get( - 'https://raw.githubusercontent.com/mmjee/Piped-Material/master/README.md') - - tmp = re.findall( - r"\| (https?:\/{2}(?:\S+\.)+[a-zA-Z0-9]*) +\|", r.text) - pipedMaterialList = {} - pipedMaterialList['clearnet'] = [] - pipedMaterialList['tor'] = [] - pipedMaterialList['i2p'] = [] - pipedMaterialList['loki'] = [] - for item in tmp: - pipedMaterialList['clearnet'].append(item) - mightyList['pipedMaterial'] = pipedMaterialList - print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'pipedMaterial') + fetchRegexList('pipedMaterial', 'Piped-Material', 'https://raw.githubusercontent.com/mmjee/Piped-Material/master/README.md', r"\| (https?:\/{2}(?:\S+\.)+[a-zA-Z0-9]*) +\|") def cloudtube(): - json_object = json.dumps(mightyList, ensure_ascii=False, indent=2) - with open('./src/instances/cloudtube.json') as file: - mightyList['cloudtube'] = json.load(file) - print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'CloudTube') + fetchCache('cloudtube', 'Cloudtube') def proxitok(): @@ -186,19 +281,7 @@ def proxitok(): def send(): - r = requests.get( - 'https://gitlab.com/timvisee/send-instances/-/raw/master/README.md') - tmp = re.findall( - r"- ([-a-zA-Z0-9@:%_\+.~#?&//=]{2,}\.[a-z0-9]{2,}\b(?:\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?)\)*\|*[A-Z]{0,}", r.text) - sendList = {} - sendList['clearnet'] = [] - sendList['tor'] = [] - sendList['i2p'] = [] - sendList['loki'] = [] - for item in tmp: - sendList['clearnet'].append(item) - mightyList['send'] = sendList - print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Send') + fetchRegexList('send', 'Send', 'https://gitlab.com/timvisee/send-instances/-/raw/master/README.md', r"- ([-a-zA-Z0-9@:%_\+.~#?&//=]{2,}\.[a-z0-9]{2,}\b(?:\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?)\)*\|*[A-Z]{0,}") def nitter(): @@ -230,150 +313,35 @@ def nitter(): def bibliogram(): - json_object = json.dumps(mightyList, ensure_ascii=False, indent=2) - with open('./src/instances/bibliogram.json') as file: - mightyList['bibliogram'] = json.load(file) - print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Bibliogram') + fetchFromFile('bibliogram', 'Bibliogram') def libreddit(): - r = requests.get( - 'https://raw.githubusercontent.com/spikecodes/libreddit/master/README.md') - libredditList = {} - libredditList['clearnet'] = [] - libredditList['tor'] = [] - libredditList['i2p'] = [] - libredditList['loki'] = [] - - tmp = re.findall( - r"\| \[.*\]\(([-a-zA-Z0-9@:%_\+.~#?&//=]{2,}\.[a-z]{2,}\b(?:\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?)\)*\|*[A-Z]{0,}.*\|.*\|", r.text) - - for item in tmp: - if re.search(torRegex, item): - libredditList['tor'].append(item) - else: - libredditList['clearnet'].append(item) - mightyList['libreddit'] = libredditList - print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'LibReddit') + fetchRegexList('libreddit', 'Libreddit', 'https://raw.githubusercontent.com/spikecodes/libreddit/master/README.md', r"\| \[.*\]\(([-a-zA-Z0-9@:%_\+.~#?&//=]{2,}\.[a-z]{2,}\b(?:\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?)\)*\|*[A-Z]{0,}.*\|.*\|") def teddit(): - r = requests.get( - 'https://codeberg.org/teddit/teddit/raw/branch/main/instances.json') - rJson = json.loads(r.text) - tedditList = {} - tedditList['clearnet'] = [] - tedditList['tor'] = [] - tedditList['i2p'] = [] - tedditList['loki'] = [] - for item in rJson: - url = item['url'] - if url != '': - tedditList['clearnet'].append(url) - if 'onion' in item: - onion = item['onion'] - if onion != '': - tedditList['tor'].append(onion) - - mightyList['teddit'] = tedditList - print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Teddit') + fetchJsonList('teddit', 'Teddit', 'https://codeberg.org/teddit/teddit/raw/branch/main/instances.json', ['url', 'onion', 'i2p', None]) def wikiless(): - r = requests.get('https://wikiless.org/instances.json') - rJson = json.loads(r.text) - wikilessList = {} - wikilessList['clearnet'] = [] - wikilessList['tor'] = [] - wikilessList['i2p'] = [] - wikilessList['loki'] = [] - for item in rJson: - if 'url' in item: - if item['url'].strip() != "": - wikilessList['clearnet'].append(item['url']) - if 'onion' in item: - if item['onion'].strip() != "": - wikilessList['tor'].append(item['onion']) - if 'i2p' in item: - if item['i2p'].strip() != "": - wikilessList['i2p'].append(item['i2p']) - mightyList['wikiless'] = wikilessList - print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Wikiless') + fetchJsonList('wikiless', 'Wikiless', 'https://wikiless.org/instances.json', ['url', 'onion', 'i2p', None]) def scribe(): - r = requests.get( - 'https://git.sr.ht/~edwardloveall/scribe/blob/main/docs/instances.json') - rJson = json.loads(r.text) - scribeList = {} - scribeList['clearnet'] = [] - scribeList['tor'] = [] - scribeList['i2p'] = [] - scribeList['loki'] = [] - for item in rJson: - scribeList['clearnet'].append(item) - mightyList['scribe'] = scribeList - print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Scribe') + fetchJsonList('scribe', 'Scribe', 'https://git.sr.ht/~edwardloveall/scribe/blob/main/docs/instances.json', None) def quetre(): - r = requests.get( - 'https://raw.githubusercontent.com/zyachel/quetre/main/README.md') - _list = {} - _list['clearnet'] = [] - _list['tor'] = [] - _list['i2p'] = [] - _list['loki'] = [] - - tmp = re.findall( - r"\| \[.*\]\(([-a-zA-Z0-9@:%_\+.~#?&//=]{2,}\.[a-z]{2,}\b(?:\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?)\)*\|*[A-Z]{0,}.*\|.*\|", r.text) - - - for item in tmp: - if re.search(torRegex, item): - _list['tor'].append(item) - else: - _list['clearnet'].append(item) - mightyList['quetre'] = _list - print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Quetre') + fetchRegexList('quetre', 'Quetre', 'https://raw.githubusercontent.com/zyachel/quetre/main/README.md', r"\| \[.*\]\(([-a-zA-Z0-9@:%_\+.~#?&//=]{2,}\.[a-z]{2,}\b(?:\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?)\)*\|*[A-Z]{0,}.*\|.*\|") def libremdb(): - r = requests.get( - 'https://raw.githubusercontent.com/zyachel/libremdb/main/README.md') - _list = {} - _list['clearnet'] = [] - _list['tor'] = [] - _list['i2p'] = [] - _list['loki'] = [] + fetchRegexList('libremdb', 'libremdb', 'https://raw.githubusercontent.com/zyachel/libremdb/main/README.md', r"\| ([-a-zA-Z0-9@:%_\+.~#?&//=]{2,}\.[a-z]{2,}\b(?:\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?)*\|*[A-Z]{0,}.*\|.*\|") - tmp = re.findall( - r"\| ([-a-zA-Z0-9@:%_\+.~#?&//=]{2,}\.[a-z]{2,}\b(?:\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?)*\|*[A-Z]{0,}.*\|.*\|", r.text) - - - for item in tmp: - if item.strip() == "": - continue - if re.search(torRegex, item): - _list['tor'].append(item) - else: - _list['clearnet'].append(item) - - mightyList['libremdb'] = _list - print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Libremdb') def simpleertube(): - r = requests.get('https://simple-web.org/instances/simpleertube') - _list = {} - _list['clearnet'] = [] - _list['tor'] = [] - _list['i2p'] = [] - _list['loki'] = [] - for item in r.text.strip().split('\n'): - _list['clearnet'].append('https://' + item) - - mightyList['simpleertube'] = _list - print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'SimpleerTube') + fetchTextList('simpleertube', 'SimpleerTube', 'https://simple-web.org/instances/simpleertube', 'https://') def simplytranslate(): @@ -403,19 +371,7 @@ def simplytranslate(): def linvgatranslate(): - r = requests.get( - 'https://raw.githubusercontent.com/TheDavidDelta/lingva-translate/main/instances.json') - rJson = json.loads(r.text) - lingvaList = {} - lingvaList['clearnet'] = [] - lingvaList['tor'] = [] - lingvaList['i2p'] = [] - lingvaList['loki'] = [] - for item in rJson: - lingvaList['clearnet'].append(item) - - mightyList['lingva'] = lingvaList - print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'LinvgaTranslate') + fetchJsonList('lingva', 'LingvaTranslate', 'https://raw.githubusercontent.com/TheDavidDelta/lingva-translate/main/instances.json', None) def searx_searxng(): @@ -454,140 +410,34 @@ def searx_searxng(): def whoogle(): - r = requests.get( - 'https://raw.githubusercontent.com/benbusby/whoogle-search/main/misc/instances.txt') - tmpList = r.text.strip().split('\n') - whoogleList = {} - whoogleList['clearnet'] = [] - whoogleList['tor'] = [] - whoogleList['i2p'] = [] - whoogleList['loki'] = [] - for item in tmpList: - if re.search(torRegex, item): - whoogleList['tor'].append(item) - elif re.search(torRegex, item): - whoogleList['i2p'].append(item) - else: - whoogleList['clearnet'].append(item) - mightyList['whoogle'] = whoogleList - print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Whoogle') + fetchTextList('whoogle', 'Whoogle', 'https://raw.githubusercontent.com/benbusby/whoogle-search/main/misc/instances.txt', '') def librex(): - r = requests.get( - 'https://raw.githubusercontent.com/hnhx/librex/main/README.md') - _list = {} - _list['clearnet'] = [] - _list['tor'] = [] - _list['i2p'] = [] - _list['loki'] = [] - - tmp = re.findall( - r"\| {1,2}\[(?:(?:[a-zA-Z0-9]+\.)+[a-zA-Z]{2,}|✅)\]\((https?:\/{2}(?:[a-zA-Z0-9]+\.)+[a-zA-Z0-9]{2,})", r.text) - - for item in tmp: - if item.strip() == "": - continue - elif re.search(torRegex, item): - _list['tor'].append(item) - elif re.search(i2pRegex, item): - _list['i2p'].append(item) - else: - _list['clearnet'].append(item) - mightyList['librex'] = _list - print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Librex') + fetchRegexList('librex', 'LibreX', 'https://raw.githubusercontent.com/hnhx/librex/main/README.md', r"\| {1,2}\[(?:(?:[a-zA-Z0-9]+\.)+[a-zA-Z]{2,}|✅)\]\((https?:\/{2}(?:[a-zA-Z0-9]+\.)+[a-zA-Z0-9]{2,})") def rimgo(): - r = requests.get( - 'https://codeberg.org/video-prize-ranch/rimgo/raw/branch/main/instances.json') - rJson = json.loads(r.text) - rimgoList = {} - rimgoList['clearnet'] = [] - rimgoList['tor'] = [] - rimgoList['i2p'] = [] - rimgoList['loki'] = [] - for item in rJson: - if 'url' in item: - rimgoList['clearnet'].append(item['url']) - if 'onion' in item: - rimgoList['tor'].append(item['onion']) - if 'i2p' in item: - rimgoList['i2p'].append(item['i2p']) - mightyList['rimgo'] = rimgoList - print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Rimgo') + fetchJsonList('rimgo', 'rimgo', 'https://codeberg.org/video-prize-ranch/rimgo/raw/branch/main/instances.json', ['url', 'onion', 'i2p', None]) def librarian(): - r = requests.get( - 'https://codeberg.org/librarian/librarian/raw/branch/main/instances.json') - rJson = json.loads(r.text) - librarianList = {} - librarianList['clearnet'] = [] - librarianList['tor'] = [] - librarianList['i2p'] = [] - librarianList['loki'] = [] - instances = rJson['instances'] - for item in instances: - url = item['url'] - if url.strip() == "": - continue - elif re.search(torRegex, url): - librarianList['tor'].append(url) - elif re.search(i2pRegex, url): - librarianList['i2p'].append(url) - elif re.search(lokiRegex, url): - librarianList['loki'].append(url) - else: - librarianList['clearnet'].append(url) - mightyList['librarian'] = librarianList - print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Librarian') - + fetchJsonList('librarian', 'Librarian', 'https://codeberg.org/librarian/librarian/raw/branch/main/instances.json', 'url') def neuters(): - json_object = json.dumps(mightyList, ensure_ascii=False, indent=2) - with open('./src/instances/neuters.json') as file: - mightyList['neuters'] = json.load(file) - print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Neuters') + fetchFromFile('neuters', 'Neuters') def beatbump(): - json_object = json.dumps(mightyList, ensure_ascii=False, indent=2) - with open('./src/instances/beatbump.json') as file: - mightyList['beatbump'] = json.load(file) - print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Beatbump') + fetchFromFile('beatbump', 'Beatbump') def hyperpipe(): - r = requests.get( - 'https://codeberg.org/Hyperpipe/pages/raw/branch/main/api/frontend.json') - rJson = json.loads(r.text) - hyperpipeList = {} - hyperpipeList['clearnet'] = [] - hyperpipeList['tor'] = [] - hyperpipeList['i2p'] = [] - hyperpipeList['loki'] = [] - for item in rJson: - url = item['url'] - if url.strip() == "": - continue - elif re.search(torRegex, url): - hyperpipeList['tor'].append(url) - elif re.search(i2pRegex, url): - hyperpipeList['i2p'].append(url) - elif re.search(lokiRegex, url): - hyperpipeList['loki'].append(url) - else: - hyperpipeList['clearnet'].append(url) - mightyList['hyperpipe'] = hyperpipeList - print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Hyperpipe') + fetchJsonList('hyperpipe', 'Hyperpipe', 'https://codeberg.org/Hyperpipe/pages/raw/branch/main/api/frontend.json', 'url') def facil(): - json_object = json.dumps(mightyList, ensure_ascii=False, indent=2) - with open('./src/instances/facil.json') as file: - mightyList['facil'] = json.load(file) - print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'FacilMap') + fetchFromFile('facil', 'FacilMap') def peertube(): diff --git a/src/pages/options/index.ejs b/src/pages/options/index.ejs index 0240f99..e0ce3c3 100644 --- a/src/pages/options/index.ejs +++ b/src/pages/options/index.ejs @@ -1,12 +1,12 @@ - <%- include('src/pages/widgets/head') %> + <%- include('src/pages/widgets/head') -%> - <%- include('src/pages/widgets/links', {config: config}) %> + <%- include('src/pages/widgets/links', {config: config}) -%>
- <%- include('src/pages/options/widgets/general', {config: config}) %> - <%- include('src/pages/options/widgets/services', {config: config}) %> - <%- include('src/pages/options/widgets/about') %> + <%- include('src/pages/options/widgets/general', {config: config}) -%> + <%- include('src/pages/options/widgets/services', {config: config}) -%> + <%- include('src/pages/options/widgets/about') -%>
diff --git a/src/pages/options/index.html b/src/pages/options/index.html index 8908c9b..df6bec2 100644 --- a/src/pages/options/index.html +++ b/src/pages/options/index.html @@ -8,50 +8,29 @@ General - -
@@ -69,16 +48,12 @@

+
@@ -145,126 +120,108 @@

Customize Popup

- - -
+

Youtube


Enable

- +
-

Frontend

- +

Frontend

+
- - -
+

Embed Frontend

- - -
+

Redirect Type

- - - + +
- -
- -
- -
+
+
+

Default Instances

@@ -359,8 +294,7 @@
- -
+
- -
- -
+
+

Default Instances

@@ -392,10 +324,8 @@
- -
- -
+
+

Default Instances

@@ -415,10 +345,8 @@
- -
- -
+
+

Default Instances

@@ -438,14 +366,11 @@
- -
+
- -
- -
+
+

Default Instances

@@ -465,8 +390,7 @@
- -
+
- -
- -
+
+

Default Instances

@@ -498,10 +420,8 @@
- -
- -
+
+

Default Instances

@@ -521,10 +441,8 @@
- -
- -
+
+

Default Instances

@@ -544,14 +462,11 @@
- -
+
- -
- -
+
+

Default Instances

@@ -571,8 +486,7 @@
- -
+
- -
- -
+
+

Default Instances

@@ -604,10 +516,8 @@
- -
- -
+
+

Default Instances

@@ -627,10 +537,8 @@
- -
- -
+
+

Default Instances

@@ -650,14 +558,11 @@
- -
+ - -
- -
+
+

Default Instances

@@ -677,8 +582,7 @@
- -
+
- -
- -
+
+

Default Instances

@@ -710,10 +612,8 @@
- -
- -
+
+

Default Instances

@@ -733,10 +633,8 @@
- -
- -
+
+

Default Instances

@@ -756,13 +654,11 @@
- -
+ - +
-

YT Music

@@ -770,28 +666,20 @@

Enable

- +
-

Frontend

- +

Frontend

+
- - - -
- -
- -
+
+
+

Default Instances

@@ -811,8 +699,7 @@
- -
+
- -
- -
+
+

Default Instances

@@ -844,10 +729,8 @@
- -
- -
+
+

Default Instances

@@ -867,10 +750,8 @@
- -
- -
+
+

Default Instances

@@ -890,14 +771,11 @@
- -
+
- -
- -
+
+

Default Instances

@@ -917,8 +795,7 @@
- -
+
- -
- -
+
+

Default Instances

@@ -950,10 +825,8 @@
- -
- -
+
+

Default Instances

@@ -973,10 +846,8 @@
- -
- -
+
+

Default Instances

@@ -996,13 +867,11 @@
- -
+ - +
-

Twitter

@@ -1010,25 +879,19 @@

Enable

- +
- - - -
+

Redirect Type

- - - + +
- -
- -
- -
+
+
+

Default Instances

@@ -1048,8 +911,7 @@
- -
+
- -
- -
+
+

Default Instances

@@ -1081,10 +941,8 @@
- -
- -
+
+

Default Instances

@@ -1104,10 +962,8 @@
- -
- -
+
+

Default Instances

@@ -1127,13 +983,11 @@
- -
+
- +
-

Instagram

@@ -1141,121 +995,11 @@

Enable

- +
- - - -
- -
- -
-
-

Default Instances

-
-

-
-

Custom Instances

-
-
-
- - -
-
-
-
- - -
- -
- -
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
- -
- -
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
- -
- -
-
-

Default Instances

-
-
-
-
-

Custom Instances

-
-
-
- - -
-
-
- -
- -
-
-

TikTok

@@ -1263,16 +1007,11 @@

Enable

- +
- - - -
- -
- -
+
+
+

Default Instances

@@ -1292,8 +1031,7 @@
- -
+
- -
- -
+
+

Default Instances

@@ -1325,10 +1061,8 @@
- -
- -
+
+

Default Instances

@@ -1348,10 +1082,8 @@
- -
- -
+
+

Default Instances

@@ -1371,13 +1103,11 @@
- -
+
- +
-

Reddit

@@ -1385,28 +1115,20 @@

Enable

- +
-

Frontend

- +

Frontend

+
- - - -
- -
- -
+
+
+

Default Instances

@@ -1426,8 +1148,7 @@
- -
+
- -
- -
+
+

Default Instances

@@ -1459,10 +1178,8 @@
- -
- -
+
+

Default Instances

@@ -1482,10 +1199,8 @@
- -
- -
+
+

Default Instances

@@ -1505,14 +1220,11 @@
- -
+
- -
- -
+
+

Default Instances

@@ -1532,8 +1244,7 @@
- -
+
- -
- -
+
+

Default Instances

@@ -1565,10 +1274,8 @@
- -
- -
+
+

Default Instances

@@ -1588,10 +1295,8 @@
- -
- -
+
+

Default Instances

@@ -1611,13 +1316,11 @@
- -
+ - +
-

Imgur

@@ -1625,16 +1328,11 @@

Enable

- +
- - - -
- -
- -
+
+
+

Default Instances

@@ -1654,8 +1352,7 @@
- -
+
- -
- -
+
+

Default Instances

@@ -1687,10 +1382,8 @@
- -
- -
+
+

Default Instances

@@ -1710,10 +1403,8 @@
- -
- -
+
+

Default Instances

@@ -1733,13 +1424,11 @@
- -
+
- +
-

Wikipedia

@@ -1747,16 +1436,11 @@

Enable

- +
- - - -
- -
- -
+
+
+

Default Instances

@@ -1776,8 +1460,7 @@
- -
+
- -
- -
+
+

Default Instances

@@ -1809,10 +1490,8 @@
- -
- -
+
+

Default Instances

@@ -1832,10 +1511,8 @@
- -
- -
+
+

Default Instances

@@ -1855,13 +1532,11 @@
- -
+
- +
-

Medium

@@ -1869,16 +1544,11 @@

Enable

- +
- - - -
- -
- -
+
+
+

Default Instances

@@ -1898,8 +1568,7 @@
- -
+
- -
- -
+
+

Default Instances

@@ -1931,10 +1598,8 @@
- -
- -
+
+

Default Instances

@@ -1954,10 +1619,8 @@
- -
- -
+
+

Default Instances

@@ -1977,13 +1640,11 @@
- -
+
- +
-

Quora

@@ -1991,16 +1652,11 @@

Enable

- +
- - - -
- -
- -
+
+
+

Default Instances

@@ -2020,8 +1676,7 @@
- -
+
- -
- -
+
+

Default Instances

@@ -2053,10 +1706,8 @@
- -
- -
+
+

Default Instances

@@ -2076,10 +1727,8 @@
- -
- -
+
+

Default Instances

@@ -2099,13 +1748,11 @@
- -
+
- +
-

IMDb

@@ -2113,16 +1760,11 @@

Enable

- +
- - - -
- -
- -
+
+
+

Default Instances

@@ -2142,8 +1784,7 @@
- -
+
- -
- -
+
+

Default Instances

@@ -2175,10 +1814,8 @@
- -
- -
+
+

Default Instances

@@ -2198,10 +1835,8 @@
- -
- -
+
+

Default Instances

@@ -2221,13 +1856,11 @@
- -
+
- +
-

Reuters

@@ -2235,16 +1868,11 @@

Enable

- +
- - - -
- -
- -
+
+
+

Default Instances

@@ -2264,8 +1892,7 @@
- -
+
- -
- -
+
+

Default Instances

@@ -2297,10 +1922,8 @@
- -
- -
+
+

Default Instances

@@ -2320,10 +1943,8 @@
- -
- -
+
+

Default Instances

@@ -2343,13 +1964,11 @@
- -
+
- +
-

PeerTube

@@ -2357,16 +1976,11 @@

Enable

- +
- - - -
- -
- -
+
+
+

Default Instances

@@ -2386,8 +2000,7 @@
- -
+
- -
- -
+
+

Default Instances

@@ -2419,10 +2030,8 @@
- -
- -
+
+

Default Instances

@@ -2442,10 +2051,8 @@
- -
- -
+
+

Default Instances

@@ -2465,13 +2072,11 @@
- -
+
- +
-

LBRY

@@ -2479,37 +2084,37 @@

Enable

- +
-

Frontend

- -
- - - -
-

Redirect Type

- + + +
- -
- -
- -
+
+
+

Embed Frontend

+ +
+
+
+

Redirect Type

+ +
+
+
+

Default Instances

@@ -2529,8 +2134,7 @@
- -
+
- -
- -
+
+

Default Instances

@@ -2562,10 +2164,8 @@
- -
- -
+
+

Default Instances

@@ -2585,10 +2185,8 @@
- -
- -
+
+

Default Instances

@@ -2608,13 +2206,11 @@
- -
+
- +
-

Search

@@ -2622,32 +2218,22 @@

Enable

- +
-

Frontend

- +

Frontend

+
- - - -
- -
- -
+
+
+

Default Instances

@@ -2667,8 +2253,7 @@
- -
+
- -
- -
+
+

Default Instances

@@ -2700,10 +2283,8 @@
- -
- -
+
+

Default Instances

@@ -2723,10 +2304,8 @@
- -
- -
+
+

Default Instances

@@ -2746,14 +2325,11 @@
- -
+
- -
- -
+
+

Default Instances

@@ -2773,8 +2349,7 @@
- -
+
- -
- -
+
+

Default Instances

@@ -2806,10 +2379,8 @@
- -
- -
+
+

Default Instances

@@ -2829,10 +2400,8 @@
- -
- -
+
+

Default Instances

@@ -2852,14 +2421,11 @@
- -
+ - -
- -
+
+

Default Instances

@@ -2879,8 +2445,7 @@
- -
+
- -
- -
+
+

Default Instances

@@ -2912,10 +2475,8 @@
- -
- -
+
+

Default Instances

@@ -2935,10 +2496,8 @@
- -
- -
+
+

Default Instances

@@ -2958,14 +2517,11 @@
- -
+ - -
- -
+
+

Default Instances

@@ -2985,8 +2541,7 @@
- -
+
- -
- -
+
+

Default Instances

@@ -3018,10 +2571,8 @@
- -
- -
+
+

Default Instances

@@ -3041,10 +2592,8 @@
- -
- -
+
+

Default Instances

@@ -3064,13 +2613,11 @@
- -
+ - +
-

Translate

@@ -3078,28 +2625,20 @@

Enable

- +
-

Frontend

- +

Frontend

+
- - - -
- -
- -
+
+
+

Default Instances

@@ -3119,8 +2658,7 @@
- -
+
- -
- -
+
+

Default Instances

@@ -3152,10 +2688,8 @@
- -
- -
+
+

Default Instances

@@ -3175,10 +2709,8 @@
- -
- -
+
+

Default Instances

@@ -3198,14 +2730,11 @@
- -
+
- -
- -
+
+

Default Instances

@@ -3225,8 +2754,7 @@
- -
+
- -
- -
+
+

Default Instances

@@ -3258,10 +2784,8 @@
- -
- -
+
+

Default Instances

@@ -3281,10 +2805,8 @@
- -
- -
+
+

Default Instances

@@ -3304,13 +2826,11 @@
- -
+ - +
-

Maps

@@ -3318,28 +2838,20 @@

Enable

- +
-

Frontend

- +

Frontend

+
- - - -
- -
- -
+
+
+

Default Instances

@@ -3359,8 +2871,7 @@
- -
+
- -
- -
+
+

Default Instances

@@ -3392,10 +2901,8 @@
- -
- -
+
+

Default Instances

@@ -3415,10 +2922,8 @@
- -
- -
+
+

Default Instances

@@ -3438,13 +2943,11 @@
- -
+
- +
-

Send Files

@@ -3452,16 +2955,11 @@

Enable

- +
- - - -
- -
- -
+
+
+

Default Instances

@@ -3481,8 +2979,7 @@
- -
+
- -
- -
+
+

Default Instances

@@ -3514,10 +3009,8 @@
- -
- -
+
+

Default Instances

@@ -3537,10 +3030,8 @@
- -
- -
+
+

Default Instances

@@ -3560,15 +3051,13 @@
- -
+
- +
-

About

@@ -3593,7 +3082,6 @@
- diff --git a/src/pages/options/widgets/general.ejs b/src/pages/options/widgets/general.ejs index 05ef095..d68a228 100644 --- a/src/pages/options/widgets/general.ejs +++ b/src/pages/options/widgets/general.ejs @@ -14,10 +14,10 @@

+
@@ -84,14 +84,14 @@

Customize Popup

diff --git a/src/pages/options/widgets/services.ejs b/src/pages/options/widgets/services.ejs index aed5872..bc75f28 100644 --- a/src/pages/options/widgets/services.ejs +++ b/src/pages/options/widgets/services.ejs @@ -1,4 +1,4 @@ -<% for (const service in config.services) { %> +<% for (const service in config.services) { -%>

<%= config.services[service].name %>

@@ -6,47 +6,47 @@

Enable

- +
- <% if ((Object.keys(config.services[service].frontends).length > 1) || config.services[service].singleInstanceFrontends) { %> + <% if (Object.keys(config.services[service].frontends).length > 1) { %>
-

Frontend

- +

Frontend

+
- <% } %> - <% if ((config.services[service].singleInstanceFrontends) && (Object.keys(config.services[service].frontends).length > 1)) { %> -
+ <% if (config.services[service].embeddable) { _%> +

Embed Frontend

- <% } %> - <% if (config.services[service].embeddable) { %> + <% } _%> + <% } _%> + <% if (config.services[service].embeddable) { _%>

Redirect Type

- - - + +
- <% } %> + <% } _%>
- <% for (const frontend in config.services[service].frontends) { %> + <% for (const frontend in config.services[service].frontends) { -%> + <% if (config.services[service].frontends[frontend].instanceList) { _%>
- <% for (const network in config.networks) { %> + <% for (const network in config.networks) { -%>

Default Instances

@@ -67,7 +67,7 @@
- <% if (network == "clearnet") { %> + <% if (network == "clearnet") { _%>
- <% } %> + <% } _%>
- <% }; %> + <% } %>
- <% }; %> + <% } _%> + <% } %>
-<% }; %> +<% } %> diff --git a/src/pages/options/widgets/services.js b/src/pages/options/widgets/services.js index c7955b4..4a53a74 100644 --- a/src/pages/options/widgets/services.js +++ b/src/pages/options/widgets/services.js @@ -1,13 +1,10 @@ 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() { +function getConfig() { return new Promise(resolve => { fetch("/config/config.json") .then(response => response.text()) @@ -19,7 +16,7 @@ async function getConfig() { }) } -getConfig() +await getConfig() browser.storage.local.get("network", r => { network = r.network @@ -27,45 +24,50 @@ browser.storage.local.get("network", r => { 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" + if (config.services[service].frontends[frontend].instanceList && config.services[service].frontends.length > 1) { + const frontendDiv = document.getElementById(frontend) + if (divs[service].frontend == null) { + console.log(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" + if (config.services[service].frontends[frontend].instanceList) { + 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) { +for (const service in config.services) { + divs[service] = {} 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)] + 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 }) - } + 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() }) } @@ -74,9 +76,11 @@ for (service in config.services) { changeNetworkSettings(network) for (const frontend in config.services[service].frontends) { - for (const network in config.networks) { - utils.processDefaultCustomInstances(service, frontend, network, document) + if (config.services[service].frontends[frontend].instanceList) { + for (const network in config.networks) { + utils.processDefaultCustomInstances(service, frontend, network, document) + } + utils.latency(service, frontend, document, location) } - utils.latency(service, frontend, document, location) } } diff --git a/src/pages/widgets/links.ejs b/src/pages/widgets/links.ejs index fe0cd37..c28d366 100644 --- a/src/pages/widgets/links.ejs +++ b/src/pages/widgets/links.ejs @@ -1,7 +1,7 @@ From 098e7368a743b61f36e920e2e01df764441786b6 Mon Sep 17 00:00:00 2001 From: Hygna Date: Mon, 19 Sep 2022 19:52:26 +0100 Subject: [PATCH 20/67] Fixed bugs introduced in the previous commit --- src/instances/get_instances.py | 53 +++++++++++++++++----------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/src/instances/get_instances.py b/src/instances/get_instances.py index 770f258..3dcb42b 100644 --- a/src/instances/get_instances.py +++ b/src/instances/get_instances.py @@ -9,6 +9,7 @@ from urllib.parse import urlparse import socket mightyList = {} +config = {} startRegex = "https?:\/{2}(?:[^\s\/]+\.)+" endRegex = "(?:\/[^\s\/]+)*\/?" @@ -16,10 +17,10 @@ torRegex = startRegex + "onion" + endRegex i2pRegex = startRegex + "i2p" + endRegex lokiRegex = startRegex + "loki" + endRegex authRegex = "https?:\/{2}\S+:\S+@(?:[^\s\/]+\.)+[a-zA-Z0-9]+" + endRegex -config = {} -with open('./config/config.json') as file: - config = file +with open('./src/config/config.json', 'rt') as tmp: + config['networks'] = json.load(tmp)['config']['networks'] + def filterLastSlash(urlList): @@ -108,8 +109,8 @@ def is_offline(url): def fetchCache(frontend, name) : # json_object = json.dumps(mightyList, ensure_ascii=False, indent=2) with open('./src/instances/data.json') as file: - mightyList[frontend] = json.load(file).frontend - print(Fore.ORANGE + 'Failed' + Style.RESET_ALL + ' to fetch ' + name) + mightyList[frontend] = json.load(file)[frontend] + print(Fore.YELLOW + 'Failed' + Style.RESET_ALL + ' to fetch ' + name) def fetchFromFile(frontend, name): #json_object = json.dumps(mightyList, ensure_ascii=False, indent=2) @@ -122,32 +123,31 @@ def fetchJsonList(frontend, name, url, urlItem): r = requests.get(url) rJson = json.loads(r.text) _list = {} - for network in config.networks: + for network in config['networks']: _list[network] = [] - if type(urlItem) is 'str': + if type(urlItem) == 'str': for item in rJson: + tmpItem = item if urlItem is not None: - tmpUrl = item[urlItem] - else: - tmpUrl = item - if tmpUrl.strip() == "": + tmpItem = item[urlItem] + if tmpItem.strip() == '': continue - elif re.search(torRegex, tmpUrl): - _list['tor'].append(tmpUrl) - elif re.search(i2pRegex, tmpUrl): - _list['i2p'].append(tmpUrl) - elif re.search(lokiRegex, tmpUrl): - _list['loki'].append(tmpUrl) + elif re.search(torRegex, tmpItem): + _list['tor'].append(tmpItem) + elif re.search(i2pRegex, tmpItem): + _list['i2p'].append(tmpItem) + elif re.search(lokiRegex, tmpItem): + _list['loki'].append(tmpItem) else: - _list['clearnet'].append(tmpUrl) + _list['clearnet'].append(tmpItem) else: - for i in range(config.networks.length): + for i in range(len(config['networks']) - 1): # The expected order is the same as in config.json. If the frontend doesn't have any instances for a specified network, use None if urlItem != None: for item in rJson: if network in item: - if item[network].strip() != "": - _list[config.networks[i]].append(item[urlItem[i]]) + if item[network].strip() != '': + _list[config['networks'][i]].append(item[urlItem[i]]) mightyList[frontend] = _list print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + name) @@ -158,7 +158,7 @@ def fetchRegexList(frontend, name, url, regex): try: r = requests.get(url) _list = {} - for network in config.networks: + for network in config['networks']: _list[network] = [] tmp = re.findall(regex, r.text) @@ -185,7 +185,7 @@ def fetchTextList(frontend, name, url, prepend): tmp = r.text.strip().split('\n') _list = {} - for network in config.networks: + for network in config['networks']: _list[network] = [] for item in tmp: @@ -207,13 +207,14 @@ def fetchTextList(frontend, name, url, prepend): def invidious(): name = 'Invidious' frontend = 'invidious' + url = 'https://api.invidious.io/instances.json' try: _list = {} _list['clearnet'] = [] _list['tor'] = [] _list['i2p'] = [] _list['loki'] = [] - r = requests.get('https://api.invidious.io/instances.json') + r = requests.get(url) rJson = json.loads(r.text) for instance in rJson: if instance[1]['type'] == 'https': @@ -256,11 +257,11 @@ def piped(): def pipedMaterial(): - fetchRegexList('pipedMaterial', 'Piped-Material', 'https://raw.githubusercontent.com/mmjee/Piped-Material/master/README.md', r"\| (https?:\/{2}(?:\S+\.)+[a-zA-Z0-9]*) +\|") + fetchRegexList('pipedMaterial', 'Piped-Material', 'https://raw.githubusercontent.com/mmjee/Piped-Material/master/README.md', r"\| (https?:\/{2}(?:\S+\.)+[a-zA-Z0-9]*) +\| Production") def cloudtube(): - fetchCache('cloudtube', 'Cloudtube') + fetchFromFile('cloudtube', 'Cloudtube') def proxitok(): From 8f05957ffad01824448397574851719f4f562e58 Mon Sep 17 00:00:00 2001 From: Hygna Date: Tue, 20 Sep 2022 22:24:19 +0100 Subject: [PATCH 21/67] Fixed more bugs --- src/assets/javascripts/services.js | 61 ++++++++++++--------------- src/instances/get_instances.py | 28 ++++++------ src/pages/options/widgets/services.js | 6 +-- 3 files changed, 45 insertions(+), 50 deletions(-) diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index affe0d1..fff3227 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -25,14 +25,12 @@ function init() { options.networkFallback = r.networkFallback options.redirects = r.redirects }) - //cur = current for (const service in config.services) { options[service] = {} browser.storage.local.get([`${utils.camelCase(service)}Enable`, `${service}RedirectType`, `${service}Frontend`], r => { options[service].enabled = r[utils.camelCase(service) + "Enable"] options[service].frontend = r[service + "Frontend"] options[service].redirectType = r[service + "RedirectType"] - // console.log(r) }) for (const frontend in config.services[service].frontends) { options[frontend] = {} @@ -40,8 +38,6 @@ function init() { options[frontend].custom = [] for (const network in config.networks) { browser.storage.local.get([`${frontend}${utils.camelCase(network)}RedirectsChecks`, `${frontend}${utils.camelCase(network)}CustomRedirects`], r => { - // console.log(r) - // 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"] }) @@ -390,46 +386,45 @@ function initDefaults() { .then(async data => { let dataJson = JSON.parse(data) redirects = dataJson - // console.log(redirects) - // console.log(config) - browser.storage.local.set({ - redirects: redirects.invidious, - }) browser.storage.local.get(["cloudflareBlackList", "authenticateBlackList", "offlineBlackList"], async r => { - // console.log(r) for (const service in config.services) { if (config.services[service].targets == "datajson") { - browser.storage.local.set({ [service + "Targets"]: redirects[service] }) + browser.storage.local.set({ [service + "Targets"]: [...dataJson[service]] }) + delete redirects[service] } - for (const defaultOption in config.services[service].defaults) { - browser.storage.local.set({ [service + camelCase(defaultOption)]: config.services[service].defaults[defaultOption] }) + for (const defaultOption in config.services[service].options) { + browser.storage.local.set({ [service + utils.camelCase(defaultOption)]: config.services[service].options[defaultOption] }) } for (const frontend in config.services[service].frontends) { - 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]) - switch (network) { - case "clearnet": - browser.storage.local.set({ - [frontend + "ClearnetRedirectsChecks"]: [clearnetChecks], - [frontend + "ClearnetCustomRedirects"]: [], - }) - break - default: - browser.storage.local.set({ - [frontend + utils.camelCase(network) + "RedirectsChecks"]: [...redirects[frontend][network]], - [frontend + utils.camelCase(network) + "CustomRedirects"]: [], - }) + if (config.services[service].frontends[frontend].instanceList) { + 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) { + switch (network) { + case "clearnet": + browser.storage.local.set({ + [frontend + "ClearnetRedirectsChecks"]: [...clearnetChecks], + [frontend + "ClearnetCustomRedirects"]: [], + }) + break + default: + browser.storage.local.set({ + [frontend + utils.camelCase(network) + "RedirectsChecks"]: [...redirects[frontend][network]], + [frontend + utils.camelCase(network) + "CustomRedirects"]: [], + }) + } } } } } - ;() => resolve() }) + browser.storage.local.set({ + redirects, + }) + ;() => resolve() }) }) } diff --git a/src/instances/get_instances.py b/src/instances/get_instances.py index 3dcb42b..2547917 100644 --- a/src/instances/get_instances.py +++ b/src/instances/get_instances.py @@ -22,7 +22,6 @@ with open('./src/config/config.json', 'rt') as tmp: config['networks'] = json.load(tmp)['config']['networks'] - def filterLastSlash(urlList): tmp = {} for x in urlList: @@ -106,7 +105,7 @@ def is_offline(url): except: return False -def fetchCache(frontend, name) : +def fetchCache(frontend, name): # json_object = json.dumps(mightyList, ensure_ascii=False, indent=2) with open('./src/instances/data.json') as file: mightyList[frontend] = json.load(file)[frontend] @@ -125,7 +124,16 @@ def fetchJsonList(frontend, name, url, urlItem): _list = {} for network in config['networks']: _list[network] = [] - if type(urlItem) == 'str': + if type(urlItem) == dict: + for item in rJson: + for network in config['networks']: + if urlItem[network] != None: + if urlItem[network] in item: + if item[urlItem[network]].strip() != '': + _list[network].append(item[urlItem[network]]) + else: + if frontend == 'librarian': + rJson = rJson['instances'] # I got lazy :p Might fix this at some point... for item in rJson: tmpItem = item if urlItem is not None: @@ -140,14 +148,6 @@ def fetchJsonList(frontend, name, url, urlItem): _list['loki'].append(tmpItem) else: _list['clearnet'].append(tmpItem) - else: - for i in range(len(config['networks']) - 1): - # The expected order is the same as in config.json. If the frontend doesn't have any instances for a specified network, use None - if urlItem != None: - for item in rJson: - if network in item: - if item[network].strip() != '': - _list[config['networks'][i]].append(item[urlItem[i]]) mightyList[frontend] = _list print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + name) @@ -322,11 +322,11 @@ def libreddit(): def teddit(): - fetchJsonList('teddit', 'Teddit', 'https://codeberg.org/teddit/teddit/raw/branch/main/instances.json', ['url', 'onion', 'i2p', None]) + fetchJsonList('teddit', 'Teddit', 'https://codeberg.org/teddit/teddit/raw/branch/main/instances.json', { 'clearnet': 'url', 'tor': 'onion', 'i2p': 'i2p', 'loki': None }) def wikiless(): - fetchJsonList('wikiless', 'Wikiless', 'https://wikiless.org/instances.json', ['url', 'onion', 'i2p', None]) + fetchJsonList('wikiless', 'Wikiless', 'https://wikiless.org/instances.json', { 'clearnet': 'url', 'tor': 'onion', 'i2p': 'i2p', 'loki': None}) def scribe(): @@ -419,7 +419,7 @@ def librex(): def rimgo(): - fetchJsonList('rimgo', 'rimgo', 'https://codeberg.org/video-prize-ranch/rimgo/raw/branch/main/instances.json', ['url', 'onion', 'i2p', None]) + fetchJsonList('rimgo', 'rimgo', 'https://codeberg.org/video-prize-ranch/rimgo/raw/branch/main/instances.json', {'clearnet': 'url', 'tor': 'onion', 'i2p': 'i2p', 'loki': None}) def librarian(): diff --git a/src/pages/options/widgets/services.js b/src/pages/options/widgets/services.js index 4a53a74..33c174f 100644 --- a/src/pages/options/widgets/services.js +++ b/src/pages/options/widgets/services.js @@ -1,7 +1,7 @@ import utils from "../../../assets/javascripts/utils.js" let config, - network, + selectedNetwork, divs = {} function getConfig() { @@ -19,7 +19,7 @@ function getConfig() { await getConfig() browser.storage.local.get("network", r => { - network = r.network + selectedNetwork = r.network }) function changeFrontendsSettings(service) { @@ -54,6 +54,7 @@ function changeNetworkSettings(selectedNetwork) { } } +changeNetworkSettings(selectedNetwork) for (const service in config.services) { divs[service] = {} divs[service][service] = document.getElementById(`${service}_page`) @@ -73,7 +74,6 @@ for (const service in config.services) { } changeFrontendsSettings(service) - changeNetworkSettings(network) for (const frontend in config.services[service].frontends) { if (config.services[service].frontends[frontend].instanceList) { From b2b9adfa97adc2d3784f5d76f670b919bb6a64fe Mon Sep 17 00:00:00 2001 From: Hygna Date: Tue, 20 Sep 2022 22:27:56 +0100 Subject: [PATCH 22/67] Update instances to match new structure --- src/instances/blacklist.json | 58 +++-- src/instances/data.json | 430 +++++++++++++++++------------------ 2 files changed, 252 insertions(+), 236 deletions(-) diff --git a/src/instances/blacklist.json b/src/instances/blacklist.json index e7756f8..fe941df 100644 --- a/src/instances/blacklist.json +++ b/src/instances/blacklist.json @@ -1,29 +1,36 @@ { "cloudflare": [ "https://invidious.kavin.rocks", + "https://invidious.rhyshl.live", "https://piped.kavin.rocks", "https://piped.tokhmi.xyz", "https://piped.moomoo.me", "https://piped.mha.fi", "https://de-piped.shimul.me", "https://pipedus.palash.dev", - "https://piped.waffle.wiki", "https://watch.whatever.social", + "https://piped.garudalinux.org", + "https://y.rivo.lol", + "https://cringe.whatever.social", "https://nitter.domain.glass", "https://birdsite.xanny.family", + "https://nitter.it", "https://notabird.site", "https://fuckthesacklers.network", "https://nitter.winscloud.net", "https://twtr.bch.bar", "https://twitter.dr460nf1r3.org", "https://nitter.garudalinux.org", - "https://nitter.wef.lol", "https://nitter.catalyst.sx", "https://nitter.fprivacy.com", - "https://bib.actionsack.com", + "https://read.whatever.social", + "https://nitter.rawbit.ninja", + "https://nitter.privacytools.io", + "https://nitter.sneed.network", + "https://n.sneed.network", + "https://nitter.twei.space", "https://libreddit.domain.glass", "https://r.nf", - "https://lr.oversold.host", "https://libreddit.hu", "https://lr.stilic.ml", "https://reddi.tk", @@ -32,6 +39,7 @@ "https://libreddit.winscloud.net", "https://r.ahwx.org", "https://reddit.dr460nf1r3.org", + "https://libreddit.mha.fi", "https://libreddit.encrypted-data.xyz", "https://libreddit.eu.org", "https://teddit.domain.glass", @@ -39,44 +47,54 @@ "https://teddit.encrypted-data.xyz", "https://teddit.garudalinux.org", "https://tedd.it", + "https://wiki.privacytools.io", + "https://teddit.rawbit.ninja", "https://wiki.604kph.xyz", + "https://wiki.privacytools.io", + "https://wikiless.rawbit.ninja", + "https://scribe.rawbit.ninja", "https://lingva.garudalinux.org", "https://translate.dr460nf1r3.org", - "https://searx.org", "https://searx.run", - "https://search.albony.xyz", + "https://searx.org", "https://search.garudalinux.org", "https://search.dr460nf1r3.org", "https://search.wef.lol", "https://i.actionsack.com", "https://rimgo.encrypted-data.xyz", - "https://beatbump.ml" + "https://beatbump.ml", + "https://listen.whatever.social" ], "authenticate": [ "https://nitter:nitter@nitter.nixnet.services" ], "offline": [ - "https://invidious.snopyta.org", - "https://tok.habedieeh.re", - "https://n.hyperborea.cloud", - "https://nitter.spaceint.fr", - "https://bibliogram.snopyta.org", - "https://libreddit.autarkic.org", + "https://invidious.rhyshl.live", + "https://proxitok.odyssey346.dev", + "https://nhanh.cloud", + "https://nitter.nl", + "https://ntr.odyssey346.dev", + "https://libreddit.nl", "https://libreddit.notyourcomputer.net", - "https://anon.sx", + "https://teddit.ggc-project.de", + "https://teddit.nautolan.racing", + "https://tedd.it", + "https://teddit.artemislena.eu", + "https://wiki.froth.zone", + "https://quetre.odyssey346.dev", + "https://st.odyssey346.dev", "https://jsearch.pw", "https://searx.gnu.style", "https://searx.semipvt.com", "https://etsi.me", - "https://s.zhaocloud.net", - "https://search.vidhukant.xyz", + "https://search.zzls.xyz", "https://searx.ericaftereric.top", "https://searx.fmac.xyz", - "https://searxng.au/searx", "https://www.webrats.xyz", - "https://search.albony.xyz", "https://whoogle.esmailelbob.xyz", - "https://beatbump.ml", - "https://stube.tokhmi.xyz" + "https://search.wef.lol", + "https://i.bcow.xyz", + "https://lbry.bcow.xyz", + "https://beatbump.ml" ] } \ No newline at end of file diff --git a/src/instances/data.json b/src/instances/data.json index 3e82842..e2e5d9f 100644 --- a/src/instances/data.json +++ b/src/instances/data.json @@ -1,75 +1,82 @@ { "invidious": { - "normal": [ + "clearnet": [ "https://yewtu.be", "https://vid.puffyan.us", + "https://invidious.snopyta.org", "https://invidious.kavin.rocks", "https://inv.riverside.rocks", - "https://invidious.osi.kr", + "https://invidio.xamh.de", "https://y.com.sb", "https://yt.artemislena.eu", - "https://invidious.flokinet.to", "https://invidious.sethforprivacy.com", + "https://invidious.flokinet.to", "https://invidious.tiekoetter.com", "https://inv.bp.projectsegfau.lt", - "https://invidious.projectsegfau.lt", "https://inv.vern.cc", + "https://invidious.projectsegfau.lt", "https://invidious.nerdvpn.de", + "https://invidious.rhyshl.live", "https://inv.privacy.com.de", "https://invidious.slipfox.xyz", - "https://youtube.076.ne.jp", "https://invidious.weblibre.org", - "https://invidious.snopyta.org", "https://invidious.esmailelbob.xyz", + "https://youtube.076.ne.jp", "https://invidious.namazso.eu" ], "tor": [ - "http://c7hqkpkpemu6e7emz5b4vyz7idjgdvgaaa3dyimmeojqbgpea3xqjoid.onion", - "http://w6ijuptxiku4xpnnaetxvnkc5vqcdu7mgns2u77qefoixi63vbvnpnqd.onion", - "http://kbjggqkzv65ivcqj6bumvp337z6264huv5kpkwuv6gu5yjiskvan7fad.onion", - "http://grwp24hodrefzvjjuccrkw3mjq4tzhaaq32amf33dzpmuxe7ilepcmad.onion", - "http://osbivz6guyeahrwp2lnwyjk2xos342h4ocsxyqrlaopqjuhwn2djiiyd.onion", - "http://u2cvlit75owumwpy4dj2hsmvkq7nvrclkpht7xgyye2pyoxhpmclkrad.onion", - "http://euxxcnhsynwmfidvhjf6uzptsmh4dipkmgdmcmxxuo7tunp3ad2jrwyd.onion", + "http://inv.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion", "http://invidious.lqs5fjmajyp7rvp4qvyubwofzi6d4imua7vs237rkc4m5qogitqwrgyd.onion", - "http://inv.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion" + "http://euxxcnhsynwmfidvhjf6uzptsmh4dipkmgdmcmxxuo7tunp3ad2jrwyd.onion", + "http://u2cvlit75owumwpy4dj2hsmvkq7nvrclkpht7xgyye2pyoxhpmclkrad.onion", + "http://osbivz6guyeahrwp2lnwyjk2xos342h4ocsxyqrlaopqjuhwn2djiiyd.onion", + "http://grwp24hodrefzvjjuccrkw3mjq4tzhaaq32amf33dzpmuxe7ilepcmad.onion", + "http://kbjggqkzv65ivcqj6bumvp337z6264huv5kpkwuv6gu5yjiskvan7fad.onion", + "http://w6ijuptxiku4xpnnaetxvnkc5vqcdu7mgns2u77qefoixi63vbvnpnqd.onion", + "http://c7hqkpkpemu6e7emz5b4vyz7idjgdvgaaa3dyimmeojqbgpea3xqjoid.onion", + "http://am74vkcrjp2d5v36lcdqgsj2m6x36tbrkhsruoegwfcizzabnfgf5zyd.onion" ], "i2p": [], "loki": [] }, "piped": { - "normal": [ + "clearnet": [ "https://piped.kavin.rocks", "https://piped.tokhmi.xyz", "https://piped.moomoo.me", - "https://il.ax", "https://piped.mha.fi", "https://de-piped.shimul.me", "https://pipedus.palash.dev", - "https://piped.waffle.wiki", "https://watch.whatever.social", + "https://piped.garudalinux.org", + "https://y.rivo.lol", "https://yt.jae.fi", "https://piped.mint.lgbt", + "https://il.ax", + "https://piped.privacy.com.de", "https://piped.esmailelbob.xyz", - "https://piped.projectsegfau.lt" + "https://piped.projectsegfau.lt", + "https://piped.privacydev.net", + "https://piped.palveluntarjoaja.eu", + "https://piped.smnz.de", + "https://piped.adminforge.de", + "https://watch.whatevertinfoil.de" ], "tor": [], "i2p": [], "loki": [] }, "pipedMaterial": { - "normal": [ + "clearnet": [ "https://piped-material.১.net", - "https://piped-material.ftp.sh", - "https://piped-staging.ftp.sh", - "https://ui.piped.১.net" + "https://piped-material.ftp.sh" ], "tor": [], "i2p": [], "loki": [] }, "cloudtube": { - "normal": [ + "clearnet": [ "https://tube.cadence.moe", "https://yt.beparanoid.de" ], @@ -80,18 +87,25 @@ "loki": [] }, "proxiTok": { - "normal": [ - "https://proxitok.herokuapp.com", + "clearnet": [ + "https://proxitok.pabloferreiro.es", "https://proxitok.pussthecat.org", + "https://tok.habedieeh.re", + "https://proxitok.esmailelbob.xyz", + "https://cringe.whatever.social", + "https://proxitok.dhusch.de", "https://proxitok.privacydev.net", - "https://tok.habedieeh.re" + "https://proxitok.odyssey346.dev", + "https://tok.artemislena.eu", + "https://tok.adminforge.de", + "https://proxitok.manasiwibi.com" ], "tor": [], "i2p": [], "loki": [] }, "send": { - "normal": [ + "clearnet": [ "https://send.vis.ee", "https://send.zcyph.cc", "https://send.turingpoint.de", @@ -115,7 +129,7 @@ "loki": [] }, "nitter": { - "normal": [ + "clearnet": [ "https://nitter.net", "https://nitter.42l.fr", "https://nitter.pussthecat.org", @@ -133,7 +147,6 @@ "https://nitter.it", "https://twitter.censors.us", "https://nitter.grimneko.de", - "https://n.hyperborea.cloud", "https://nitter.ca", "https://twitter.076.ne.jp", "https://nitter.fly.dev", @@ -148,14 +161,11 @@ "https://fuckthesacklers.network", "https://nitter.esmailelbob.xyz", "https://tw.artemislena.eu", - "https://de.nttr.stream", "https://nitter.winscloud.net", "https://nitter.tiekoetter.com", "https://nitter.spaceint.fr", "https://twtr.bch.bar", "https://nitter.privacy.com.de", - "https://nitter.mastodon.pro", - "https://nitter.notraxx.ch", "https://nitter.poast.org", "https://nitter.bird.froth.zone", "https://nitter.dcs0.hu", @@ -165,13 +175,11 @@ "https://n.ramle.be", "https://nitter.cz", "https://nitter.privacydev.net", + "https://nitter.evil.site", "https://tweet.lambda.dance", - "https://nitter.ebnar.xyz", "https://nitter.kylrth.com", "https://nitter.foss.wtf", "https://nitter.priv.pw", - "https://nt.vern.cc", - "https://nitter.wef.lol", "https://nitter.tokhmi.xyz", "https://nitter.catalyst.sx", "https://unofficialbird.com", @@ -184,7 +192,21 @@ "https://nederland.unofficialbird.com", "https://uk.unofficialbird.com", "https://n.l5.ca", - "https://nitter.slipfox.xyz" + "https://nitter.slipfox.xyz", + "https://nitter.soopy.moe", + "https://nitter.qwik.space", + "https://read.whatever.social", + "https://nitter.rawbit.ninja", + "https://nt.vern.cc", + "https://ntr.odyssey346.dev", + "https://nitter.ir", + "https://nitter.privacytools.io", + "https://nitter.sneed.network", + "https://n.sneed.network", + "https://nitter.manasiwibi.com", + "https://nitter.smnz.de", + "https://nitter.twei.space", + "https://nitter.inpt.fr" ], "tor": [ "http://nitter7bryz3jv7e3uekphigvmoyoem4al3fynerxkj22dmoxoq553qd.onion", @@ -197,7 +219,7 @@ "http://jebqj47jgxleaiosfcxfibx2xdahjettuydlxbg64azd4khsxv6kawid.onion", "http://nttr2iupbb6fazdpr2rgbooon2tzbbsvvkagkgkwohhodjzj43stxhad.onion", "http://nitraeju2mipeziu2wtcrqsxg7h62v5y4eqgwi75uprynkj74gevvuqd.onion", - "http://nitter.lqs5fjmajyp7rvp4qvyubwofzi6d4imua7vs237rkc4m5qogitqwrgyd.onion", + "http://nitter.esmail5pdn24shtvieloeedh7ehz3nrwcdivnfhfcedl7gf4kwddhkqd.onion", "http://ibsboeui2im5o7dxnik3s5yghufumgy5abevtij5nbizequfpu4qi4ad.onion", "http://ec5nvbycpfa5k6ro77blxgkyrzbkv7uy6r5cngcbkadtjj2733nm3uyd.onion", "http://twitter.ap3jtgssd7qn4vfoa62gi2ijddoblslbeuw5dan3xt7myvqpura5i4qd.onion", @@ -207,39 +229,36 @@ "http://nitterqdyumlovt7tjqpdjrluitgmtpa53qq3idlpgoe4kxo7gs3xvad.onion", "http://nitter.privpw3tndpkw6pnp3g727zfgfdzbu3k6a7chv226s3xymv2p4eiuqyd.onion", "http://aaaaaxx74hbzeibageieowryhsqvimbdiitfkfe47tvgawkwkjh3coqd.onion", - "http://wiio4sgs4247brk7hj6qck2jxnvldwfdbguigc5ivpxrsegnliyfvuqd.onion" + "http://wiio4sgs4247brk7hj6qck2jxnvldwfdbguigc5ivpxrsegnliyfvuqd.onion", + "http://qwikxx2erhx6qrymued6ox2qkf2yeogjwypqvzoif4fqkljixasr6oid.onion", + "http://4g47cxugkohbweao2x66nnxxfoe3k7gdfzxej537nhdbwr522sbjxeqd.onion", + "http://tw.lpoaj7z2zkajuhgnlltpeqh3zyq7wk2iyeggqaduhgxhyajtdt2j7wad.onion" ], "i2p": [ "http://axd6uavsstsrvstva4mzlzh4ct76rc6zdug3nxdgeitrzczhzf4q.b32.i2p", "http://u6ikd6zndl3c4dsdq4mmujpntgeevdk5qzkfb57r4tnfeccrn2qa.b32.i2p", - "http://gseczlzmiv23p5vhsktyd7whquq2uy3c5fgkmdohh453qp3daoua.b32.i2p" + "http://gseczlzmiv23p5vhsktyd7whquq2uy3c5fgkmdohh453qp3daoua.b32.i2p", + "http://tm4rwkeysv3zz3q5yacyr4rlmca2c4etkdobfvuqzt6vsfsu4weq.b32.i2p", + "http://vernzdedoxuflrrxc4vbatbkpjh4k22ecgiqgimdiif62onhagva.b32.i2p" ], "loki": [ "http://nitter.priv.loki" ] }, "bibliogram": { - "normal": [ - "https://bibliogram.art", - "https://bibliogram.snopyta.org", - "https://bibliogram.pussthecat.org", + "clearnet": [ "https://bibliogram.1d4.us", "https://bibliogram.froth.zone", - "https://insta.trom.tf", - "https://insta.tromdienste.de", "https://ig.tokhmi.xyz", "https://ig.beparanoid.de", - "https://bibliogram.privacydev.net", - "https://bibliogram.priv.pw", - "https://ig.funami.tech", - "https://bib.actionsack.com" + "https://bibliogram.priv.pw" ], "tor": [], "i2p": [], "loki": [] }, "libreddit": { - "normal": [ + "clearnet": [ "https://libredd.it", "https://libreddit.spike.codes", "https://libreddit.dothq.co", @@ -324,7 +343,7 @@ "loki": [] }, "teddit": { - "normal": [ + "clearnet": [ "https://teddit.net", "https://teddit.ggc-project.de", "https://teddit.zaggy.nl", @@ -347,20 +366,35 @@ "https://i.opnxng.com", "https://teddit.tokhmi.xyz", "https://teddit.garudalinux.org", - "https://tedd.it" + "https://tedd.it", + "https://wiki.privacytools.io", + "https://td.vern.cc", + "https://teddit.rawbit.ninja", + "https://teddit.artemislena.eu", + "https://teddit.manasiwibi.com" ], "tor": [ "http://snoo.ioensistjs7wd746zluwixvojbbkxhr37lepdvwtdfeav673o64iflqd.onion", "http://ibarajztopxnuhabfu7fg6gbudynxofbnmvis3ltj6lfx47b6fhrd5qd.onion", "http://tedditfyn6idalzso5wam5qd3kdtxoljjhbrbbx34q2xkcisvshuytad.onion", "http://dawtyi5e2cfyfmoht4izmczi42aa2zwh6wi34zwvc6rzf2acpxhrcrad.onion", - "http://qtpvyiaqhmwccxwzsqubd23xhmmrt75tdyw35kp43w4hvamsgl3x27ad.onion" + "http://qtpvyiaqhmwccxwzsqubd23xhmmrt75tdyw35kp43w4hvamsgl3x27ad.onion", + "http://jnuonmf2n36sfdmyksqqqyab3w63cq4kx24olyjleh5z6zzfvyt7uqqd.onion", + "http://td.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion", + "http://yqu4yj5lju7bmlwpzpmltb5gsu6cw7nnbcxxx4iqemwa56nxjiggf4qd.onion", + "http://teddit.lpoaj7z2zkajuhgnlltpeqh3zyq7wk2iyeggqaduhgxhyajtdt2j7wad.onion", + "http://24fympskbrdgbf4afuvhqwwl2tv3y2vwxg5t2ktozd4j5b3fob5ntzyd.onion" + ], + "i2p": [ + "http://xugoqcf2pftm76vbznx4xuhrzyb5b6zwpizpnw2hysexjdn5l2tq.b32.i2p", + "http://teddit.i2p", + "https://codeberg.org/teddit/teddit/src/branch/main/vzeiwzi7ogwl3ijrfek4fbtwhvamxcpyqoc3s4vcgnhlp54s5clq.b32.i2p", + "http://verncco2oaxjikammz4pi7umzp673cme6zuemx7yeeewspwrw3va.b32.i2p" ], - "i2p": [], "loki": [] }, "wikiless": { - "normal": [ + "clearnet": [ "https://wikiless.org", "https://wikiless.sethforprivacy.com", "https://wiki.604kph.xyz", @@ -370,69 +404,85 @@ "https://wikiless.tiekoetter.com", "https://wikiless.esmailelbob.xyz", "https://wiki.slipfox.xyz", - "https://wikiless.funami.tech" + "https://wikiless.funami.tech", + "https://wl.vern.cc", + "https://wiki.privacytools.io", + "https://wikiless.rawbit.ninja", + "https://wiki.adminforge.de" ], "tor": [ "http://dj2tbh2nqfxyfmvq33cjmhuw7nb6am7thzd3zsjvizeqf374fixbrxyd.onion", "http://ybgg2evrcdz37y2qes23ff3wjqjdn33tthgoagi76vhxytu4mpxiz5qd.onion", - "http://wikiless.lqs5fjmajyp7rvp4qvyubwofzi6d4imua7vs237rkc4m5qogitqwrgyd.onion", - "http://c2pesewpalbi6lbfc5hf53q4g3ovnxe4s7tfa6k2aqkf7jd7a7dlz5ad.onion" + "http://wikiless.esmail5pdn24shtvieloeedh7ehz3nrwcdivnfhfcedl7gf4kwddhkqd.onion", + "http://c2pesewpalbi6lbfc5hf53q4g3ovnxe4s7tfa6k2aqkf7jd7a7dlz5ad.onion", + "http://wl.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion", + "http://tdx37ew3oke5rxn3yi5r5665ka7ozvehnd4xmnjxxdvqorias2nyl4qd.onion" ], "i2p": [ "http://wikiless.i2p", "http://hflqp2ejxygpj6cdwo3ogfieqmxw3b56w7dblt7bor2ltwk6kcfa.b32.i2p", - "http://x33lx4h6d7h6xs4eiqwhvaxn3ea5gn2ifmu3jobnvuvn4k4aej7a.b32.i2p" + "http://x33lx4h6d7h6xs4eiqwhvaxn3ea5gn2ifmu3jobnvuvn4k4aej7a.b32.i2p", + "http://vernesciy2defjsputrjrv6pa5ll6qzrckfffi5lgkumstdojyga.b32.i2p" ], "loki": [] }, "scribe": { - "normal": [ + "clearnet": [ "https://scribe.rip", "https://scribe.nixnet.services", "https://scribe.citizen4.eu", "https://scribe.bus-hit.me", "https://scribe.froth.zone", - "https://scribe.esmailelbob.xyz" + "https://scribe.esmailelbob.xyz", + "https://scribe.privacydev.net", + "https://scribe.rawbit.ninja", + "https://sc.vern.cc" ], "tor": [], "i2p": [], "loki": [] }, "quetre": { - "normal": [ - "https://quetre.herokuapp.com", - "https://quora.vern.cc", + "clearnet": [ + "https://quetre.iket.me", + "https://qr.vern.cc", "https://quetre.pussthecat.org", "https://wuetre.herokuapp.com", "https://quetreus.herokuapp.com", "https://quetre.tokhmi.xyz", "https://quetre.projectsegfau.lt", - "https://quetre.esmailelbob.xyz" + "https://quetre.esmailelbob.xyz", + "https://quetre.odyssey346.dev" + ], + "tor": [ + "http://quetre.esmail5pdn24shtvieloeedh7ehz3nrwcdivnfhfcedl7gf4kwddhkqd.onion", + "http://qr.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion" ], - "tor": [], "i2p": [], "loki": [] }, "libremdb": { - "normal": [ + "clearnet": [ "https://libremdb.herokuapp.com", "https://libremdb.pussthecat.org", "https://libremdbeu.herokuapp.com", "https://lmdb.tokhmi.xyz", "https://libremdb.esmailelbob.xyz" ], - "tor": [], + "tor": [ + "http://libremdb.lqs5fjmajyp7rvp4qvyubwofzi6d4imua7vs237rkc4m5qogitqwrgyd.onion" + ], "i2p": [], "loki": [] }, "simplyTranslate": { - "normal": [ + "clearnet": [ "https://simplytranslate.org", "https://st.tokhmi.xyz", "https://translate.josias.dev", "https://translate.namazso.eu", "https://translate.riverside.rocks", - "https://st.manerakai.com", + "https://simplytranslate.manerakai.com", "https://translate.bus-hit.me", "https://simplytranslate.pussthecat.org", "https://translate.northboot.xyz", @@ -442,22 +492,26 @@ "https://translate.slipfox.xyz", "https://st.privacydev.net", "https://translate.beparanoid.de", - "https://translate.priv.pw" + "https://translate.priv.pw", + "https://st.odyssey346.dev" ], "tor": [ "http://fyng2tsmzmvxmojzbbwmfnsn2lrcyftf4cw6rk5j2v2huliazud3fjid.onion", "http://xxtbwyb5z5bdvy2f6l2yquu5qilgkjeewno4qfknvb3lkg3nmoklitid.onion", - "http://translate.prnoid54e44a4bduq5due64jkk7wcnkxcp5kv3juncm7veptjcqudgyd.onion" + "http://translate.prnoid54e44a4bduq5due64jkk7wcnkxcp5kv3juncm7veptjcqudgyd.onion", + "http://simplytranslate.esmail5pdn24shtvieloeedh7ehz3nrwcdivnfhfcedl7gf4kwddhkqd.onion", + "http://tl.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion" ], "i2p": [ - "http://kmnkkp4v4ublygtnyq46oacy3qw75nrxxniriuaersumw7bfsm2a.b32.i2p" + "http://kmnkkp4v4ublygtnyq46oacy3qw75nrxxniriuaersumw7bfsm2a.b32.i2p", + "http://verna7avzgd4qqal7k2onjzwxcceqby2gwvya2a2frdswb7z2k4q.b32.i2p" ], "loki": [ "http://translate.priv.loki" ] }, "lingva": { - "normal": [ + "clearnet": [ "https://lingva.ml", "https://translate.igna.ooo", "https://lingva.pussthecat.org", @@ -473,8 +527,7 @@ "loki": [] }, "searx": { - "normal": [ - "https://anon.sx", + "clearnet": [ "https://dynabyte.ca", "https://jsearch.pw", "https://search.ethibox.fr", @@ -491,8 +544,6 @@ "https://searx.nakhan.net", "https://searx.netzspielplatz.de", "https://searx.nixnet.services", - "https://searx.org", - "https://searx.rasp.fr", "https://searx.ru", "https://searx.run", "https://searx.semipvt.com", @@ -515,10 +566,12 @@ ], "tor": [ "http://3afisqjw2rxm6z7mmstyt5rx75qfqrgxnkzftknbp2vhipr2nrmrjdyd.onion", + "http://4n53nafyi77iplnbrpmxnp3x4exbswwxigujaxy3b37fvr7bvlopxeyd.onion", "http://yra4tke2pwcnatxjkufpw6kvebu3h3ti2jca2lcdpgx3mpwol326lzid.onion", "http://z5vawdol25vrmorm4yydmohsd4u6rdoj2sylvoi3e3nqvxkvpqul7bqd.onion", "http://zbuc3bbzbfdqqo2x46repx2ddajbha6fpsjeeptjhhhhzji3zopxdqyd.onion", - "http://f4qfqajszpx5b7itzxt6mb7kj4ktpgbdq7lq6xaiqyqx6a7de3epptad.onion" + "http://f4qfqajszpx5b7itzxt6mb7kj4ktpgbdq7lq6xaiqyqx6a7de3epptad.onion", + "http://searxfilowxokbogygrigir4wqxfxqzuxofxgdon7dg6rsii4yxzytyd.onion" ], "i2p": [ "http://ransack.i2p", @@ -527,12 +580,15 @@ "loki": [] }, "searxng": { - "normal": [ + "clearnet": [ "https://darmarit.org/searx", "https://de.xcxc.ml", "https://etsi.me", + "https://icanfindit.online", "https://jackgoss.xyz", + "https://metasearch.nl", "https://northboot.xyz", + "https://notsearch.uk", "https://opnxng.com", "https://paulgo.io", "https://priv.au", @@ -542,24 +598,30 @@ "https://saber.tk", "https://search.0relay.com", "https://search.affusio.com", - "https://search.ashs.club", - "https://search.bingowaves.xyz", "https://search.bus-hit.me", "https://search.chemicals-in-the-water.eu", + "https://search.cronobox.one", "https://search.disroot.org", "https://search.gcomm.ch", "https://search.kiwitalk.de", "https://search.mdosch.de", + "https://search.mpx.wtf", "https://search.neet.works", "https://search.ononoki.org", "https://search.privacyguides.net", "https://search.projectsegfau.lt", "https://search.rabbit-company.com", + "https://search.rhscze.cf", + "https://search.rowie.at", "https://search.sapti.me", + "https://search.serginho.dev", + "https://search.smnz.de", "https://search.teamriverbubbles.com", "https://search.unlocked.link", + "https://search.uspersec.com", "https://search.vidhukant.xyz", "https://search.zzls.xyz", + "https://searx.baczek.me", "https://searx.be", "https://searx.becomesovran.com", "https://searx.chocoflan.net", @@ -569,9 +631,11 @@ "https://searx.fi", "https://searx.fmac.xyz", "https://searx.gnous.eu", + "https://searx.kujonello.cf", "https://searx.mha.fi", "https://searx.mistli.net", "https://searx.namejeff.xyz", + "https://searx.org", "https://searx.orion-hub.fr", "https://searx.priv.pw", "https://searx.prvcy.eu", @@ -580,40 +644,41 @@ "https://searx.sev.monster", "https://searx.slipfox.xyz/searx", "https://searx.tiekoetter.com", - "https://searx.vimproved.me", "https://searx.zcyph.cc", - "https://searxng.au/searx", - "https://searxng.tordenskjold.de", + "https://searxng.nicfab.it", "https://searxng.zackptg5.com", "https://serx.ml", "https://sh0.it", + "https://soek.allesbeste.com", "https://srx.cosmohub.io", "https://swag.pw", + "https://trydex.tk/searxng", "https://www.gruble.de", "https://www.webrats.xyz", - "https://xcxc.ml", "https://xo.wtf" ], "tor": [ "http://w5rl6wsd7mzj4bdkbuqvzidet5osdsm5jhg2f7nvfidakfq5exda5wid.onion", - "http://4n53nafyi77iplnbrpmxnp3x4exbswwxigujaxy3b37fvr7bvlopxeyd.onion", + "http://privateoz3u5utrimal2edr56j3r5caakektxxgixigdkycuxigvquid.onion", "http://b6sxmon57qza6dt36li7huabie5ntrvjr4q5rc2vvbn4hqvzd4phrvyd.onion", - "http://search3q76rqpektbrchlf2rjq4fnbxzeov6rljdywg3nwbunpgd7bid.onion", - "http://searchoorwalty5a2ailrboa2asqyts2u7bdoqwnjefpgjobpvtzn4qd.onion", + "http://searxngg6zleq6ceboe5ltkyo4hyrb3aaycrgzmrljv3jjlb5vcytead.onion", "http://gbat2pbpg7ys3fi3pbp64667tt5x66mg45xok35bxdw7v55brm7a27yd.onion", + "http://b2c7fvbhnfvwnl6oh2tydhzfx4i37kmmrycq42heqbbe7wovq3uzenid.onion", "http://searxdr3pqz4nydgnqocsia2xbywptxbkympa2emn7zlgggrir4bkfad.onion", + "http://searx.esmail5pdn24shtvieloeedh7ehz3nrwcdivnfhfcedl7gf4kwddhkqd.onion", "http://searx.micohauwkjbyw5meacrb4ipicwvwg4xtzl7y7viv53kig2mdcsvwkyyd.onion", "http://searx.privpw3tndpkw6pnp3g727zfgfdzbu3k6a7chv226s3xymv2p4eiuqyd.onion", "http://rq2w52kyrif3xpfihkgjnhqm3a5aqhoikpv72z3drpjglfzc2wr5z4yd.onion", "http://fub6vgedgeadlu3ctskrpkcqjruh76tckwtj5swfhyblgml2tzgzckqd.onion/searx", "http://searx3aolosaf3urwnhpynlhuokqsgz47si4pzz5hvb7uuzyjncl2tid.onion", - "http://4tz2vlnwk2apf2rpinkqv6uxvfgo5xjx6vl5vp7lxgaiooumetjpstqd.onion" + "http://4tz2vlnwk2apf2rpinkqv6uxvfgo5xjx6vl5vp7lxgaiooumetjpstqd.onion", + "https://lgmekfnpealdqhnctyg3p5fuelpdwnbqbwnl2ickpdoodzatzgz27ryd.onion" ], "i2p": [], "loki": [] }, "whoogle": { - "normal": [ + "clearnet": [ "https://gowogle.voring.me", "https://s.tokhmi.xyz", "https://search.albony.xyz", @@ -633,29 +698,32 @@ "loki": [] }, "librex": { - "normal": [ + "clearnet": [ "https://librex.beparanoid.de", + "https://librex.extravi.dev", "https://search.davidovski.xyz", "https://search.funami.tech", - "https://librex.catalyst.sx" + "https://librex.catalyst.sx", + "https://search.madreyk.xyz", + "https://search.pabloferreiro.es" ], "tor": [ - "http://librex.prnoid54e44a4bduq5due64jkk7wcnkxcp5kv3juncm7veptjcqudgyd.onion", + "http://librex.2356uhnbpv5nk3bni5bv6jg2cd6lgj664kwx3lhyelstpttpyv4kk2qd.onion", + "http://ncblhz7q4sfbf755bdbhebfzxcpypz7ewafgi4agatecojz7pln4i3id.onion", "http://librex.so2mpiyfo4cje7bof5v52y3cvjyo2haxpqfvut4sr6gj2ul4mddx2jid.onion" ], "i2p": [ - "http://fboseyskrqpi6yjiifvz4ryuoiswjezkqsfxfkm2vmbuhehbpr7q.b32.i2p" + "http://rra33hiaf6nmby7jfpqe2gqmng3jnzkvbu2n7jgce7vbhoyuhzya.b32.i2p" ], "loki": [] }, "rimgo": { - "normal": [ + "clearnet": [ "https://i.bcow.xyz", "https://rimgo.pussthecat.org", "https://rimgo.totaldarkness.net", "https://rimgo.bus-hit.me", "https://rimgo.esmailelbob.xyz", - "https://rimgo.lunar.icu", "https://i.actionsack.com", "https://rimgo.privacydev.net", "https://imgur.artemislena.eu", @@ -664,7 +732,7 @@ "https://rimgo.mha.fi" ], "tor": [ - "http://rimgo.lqs5fjmajyp7rvp4qvyubwofzi6d4imua7vs237rkc4m5qogitqwrgyd.onion", + "http://rimgo.esmail5pdn24shtvieloeedh7ehz3nrwcdivnfhfcedl7gf4kwddhkqd.onion", "http://rimgo.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion", "http://rimgo.micohauwkjbyw5meacrb4ipicwvwg4xtzl7y7viv53kig2mdcsvwkyyd.onion" ], @@ -672,25 +740,30 @@ "loki": [] }, "librarian": { - "normal": [ + "clearnet": [ "https://lbry.bcow.xyz", "https://odysee.076.ne.jp", "https://librarian.pussthecat.org", - "https://lbry.mutahar.rocks", + "https://lbry.projectsegfau.lt", "https://librarian.esmailelbob.xyz", "https://lbry.vern.cc", - "https://lbry.slipfox.xyz" + "https://lbry.slipfox.xyz", + "https://lbry.sytes.net", + "https://lbry.webhop.me", + "https://lbry.mywire.org" ], "tor": [ - "http://librarian.lqs5fjmajyp7rvp4qvyubwofzi6d4imua7vs237rkc4m5qogitqwrgyd.onion", + "http://librarian.esmail5pdn24shtvieloeedh7ehz3nrwcdivnfhfcedl7gf4kwddhkqd.onion", "http://lbry.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion", - "http://5znbzx2xcymhddzekfjib3isgqq4ilcyxa2bsq6vqmnvbtgu4f776lqd.onion" + "http://5znbzx2xcymhddzekfjib3isgqq4ilcyxa2bsq6vqmnvbtgu4f776lqd.onion", + "http://zjmls4urccc5wxc64ilbv4oqarjab6pbanvmhd2qqt6p7fgqrjjnryqd.onion", + "http://bxewpsswttslepw27w2hhxhlizwm7l7y54x3jw5cfrb64hb6lgc557ad.onion" ], "i2p": [], "loki": [] }, "neuters": { - "normal": [ + "clearnet": [ "https://neuters.de" ], "tor": [], @@ -698,24 +771,31 @@ "loki": [] }, "beatbump": { - "normal": [ - "https://beatbump.ml" + "clearnet": [ + "https://beatbump.ml", + "https://beatbump.esmailelbob.xyz" + ], + "tor": [ + "http://beatbump.lqs5fjmajyp7rvp4qvyubwofzi6d4imua7vs237rkc4m5qogitqwrgyd.onion" ], - "tor": [], "i2p": [], "loki": [] }, "hyperpipe": { - "normal": [ + "clearnet": [ "https://hyperpipe.surge.sh", - "https://hyperpipe.esmailelbob.xyz" + "https://hyperpipe.esmailelbob.xyz", + "https://listen.whatever.social", + "https://music.adminforge.de" + ], + "tor": [ + "http://hyperpipe.esmail5pdn24shtvieloeedh7ehz3nrwcdivnfhfcedl7gf4kwddhkqd.onion" ], - "tor": [], "i2p": [], "loki": [] }, "facil": { - "normal": [ + "clearnet": [ "https://facilmap.org" ], "tor": [], @@ -723,42 +803,51 @@ "loki": [] }, "simpleertube": { - "normal": [ + "clearnet": [ "https://tube.simple-web.org", "https://simpleertube.esmailelbob.xyz", - "https://stube.tokhmi.xyz" + "https://stube.tokhmi.xyz", + "https://st.vern.cc" ], "tor": [], "i2p": [], "loki": [] }, "peertube": [ + "https://pt.freedomwolf.cc", + "https://vr360tube.online", + "https://bodavr.com", + "https://peertube.tni-hosted.nl", + "https://videos.parleur.net", + "https://tube.azadehafzar.ir", + "https://pewflix.com", + "https://video.electronicping.net", + "https://videos.im.allmendenetz.de", + "https://tube.cyberia.club", + "https://casstream.nohost.me", + "https://peertube.as62430.net", + "https://peertube.askan.info", + "https://apertatube.net", + "https://beetoons.tv", + "https://rankett.net", + "https://tube.xsoftware.it", + "https://video.ut0pia.org", + "https://kinotu.be", "https://tube.nogafa.org", "https://www.neptube.io", "https://tube.ghk-academy.info", "https://pcbu.nl", - "https://soberania.tv", "https://pire.artisanlogiciel.net", - "https://trutube.xyz", "https://tube-test.apps.education.fr", "https://tube-sciences-technologies.apps.education.fr", - "https://stream.conesphere.cloud", "https://tube-institutionnel.apps.education.fr", "https://trutube.online", "https://tube-cycle-3.apps.education.fr", "https://video.manicphase.me", - "https://tube.emy.plus", - "https://v.bearvideo.win", "https://tubulus.openlatin.org", - "https://peertube.securetown.top", - "https://tv.datamol.org", "https://video.graine-pdl.org", - "https://tube.zee.li", "https://tube-cycle-2.apps.education.fr", - "https://mikeclips.net", - "https://tube.s1gm4.eu", "https://videos.keyedlimepie.org", - "https://video.cpn.so", "https://video.davduf.net", "https://tube.oldkid.digital", "https://tube.fofoca.eu", @@ -769,9 +858,6 @@ "https://media.theplattform.net", "https://peertube.offerman.com", "https://v.lastorder.xyz", - "https://video.eradicatinglove.xyz", - "https://peertube.thele.me", - "https://video.schnitzler.one", "https://tube.cybershock.life", "https://tube.reseau-canope.fr", "https://frentube.myyouniverse.observer", @@ -781,17 +867,12 @@ "https://video.trankil.info", "https://video.uriopss-pdl.fr", "https://pt.bolapara.mywire.org", - "https://ptube.ranranhome.info", - "https://vidid.pl", "https://video.3cmr.fr", - "https://tube.die-rote-front.de", "https://peertube.miguelcr.me", "https://video.thinkof.name", "https://nekofans.tv", "https://video.comun.al", - "https://peertube.nrsk.no", "https://video.occm.cc", - "https://peertube.viviers-fibre.net", "https://tube-action-educative.apps.education.fr", "https://jahve.pl", "https://videos.yesil.club", @@ -800,93 +881,68 @@ "https://tube.hunterjozwiak.com", "https://tube-numerique-educatif.apps.education.fr", "https://tube.itsg.host", - "https://tube.valinor.fr", "https://lucarne.balsamine.be", "https://peertube.suranyami.com", "https://video.ados.accoord.fr", "https://t.0x0.st", "https://tube-education-physique-et-sportive.apps.education.fr", "https://videos.lemouvementassociatif-pdl.org", - "https://videos.casually.cat", "https://playroom.kitsunes.world", "https://tube2.nous.media", - "https://peertube.freenet.ru", "https://peertube.0x5e.eu", "https://tube.darknight-coffee.org", "https://play.mittdata.se", - "https://peertube.lhc.net.br", - "https://see.vtopia.live", "https://peertube.letoine.fr", "https://tube-enseignement-professionnel.apps.education.fr", - "https://socpeertube.ru", "https://videos.laliguepaysdelaloire.org", "https://quantube.win", "https://twctube.twc-zone.eu", "https://vhs.absturztau.be", - "https://video.espr.moe", "https://peertube.social.my-wan.de", "https://phijkchu.com", "https://video.lycee-experimental.org", - "https://galileo.news", - "https://peertube.otakufarms.com", "https://tube.motuhake.xyz", "https://pt.m0r016.net", "https://hitchtube.fr", "https://video.fox-romka.ru", "https://peertube.ctrl-c.liu.se", - "https://peertube.live", "https://video.slipfox.xyz", - "https://pt.vern.cc", "https://vnop.org", "https://videos.cassidypunchmachine.com", - "https://tv1.gomntu.space", "https://dalek.zone", "https://seka.pona.la", "https://syop.tv", "https://watch.thelema.social", "https://tube.miegl.cz", "https://mov.clov.fr", - "https://videomensoif.ynh.fr", - "https://videos.neongarden.life", "https://video.vaku.org.ua", "https://videos.trom.lt", "https://vid.mkp.ca", "https://jupiter.tube", - "https://tuvideo.encanarias.info", "https://videos.squat.net", "https://peertube.chaunchy.com", "https://tube.vrpnet.org", "https://video.tii.space", - "https://peertube.inubo.ch", "https://nightshift.minnix.dev", "https://tube.friloux.me", "https://peertube.virtual-assembly.org", - "https://video.olos311.org", "https://peertube.atilla.org", - "https://video.lapineige.fr", - "https://zapping.no-ip.info", "https://tube.azkware.net", "https://video.lunasqu.ee", "https://v.mkp.ca", "https://peertube.eus", "https://infothema.net", "https://tube.nilsu.org", - "https://podlibre.video", - "https://videos.tankernn.eu", "https://watch.autonomous-zone.earth", "https://pirtube.calut.fr", "https://y.melonia.se", - "https://peertube.cirkau.art", - "https://peertube.2i2l.net", "https://videos.martyn.berlin", "https://turkum.me", "https://video.colibris-outilslibres.org", - "https://invoice.peertube.biz", "https://peertube.chantierlibre.org", "https://video.9wd.eu", "https://video.niboe.info", "https://peertuibe.fedsinfo.nohost.me", - "https://s9.gegenstimme.tv", "https://videos.alamaisondulibre.org", "https://videos.tormentasolar.win", "https://tube.nestor.coop", @@ -903,13 +959,9 @@ "https://peertube.bgzashtita.es", "https://tube.genb.de", "https://cliptube.org", - "https://tube.tr4sk.me", "https://videos.campdarling.com", - "https://video.mikka.md", - "https://www.aktion-nordost.tv", "https://tube.rooty.fr", "https://tube.dnet.one", - "https://peertube.io", "https://www.kotikoff.net", "https://peertube.nz", "https://videos.grafo.zone", @@ -921,7 +973,6 @@ "https://peertube.narrativerry.xyz", "https://tube.9minuti.it", "https://krdtube.org", - "https://peertube.elforcer.ru", "https://tubocatodico.bida.im", "https://torstenwitte.peertube-host.de", "https://peertube.hackerfraternity.org", @@ -940,14 +991,9 @@ "https://free-streams.com", "https://tube.pawelko.net", "https://video.livecchi.cloud", - "https://anarchy.video", "https://peertube.gsugambit.com", - "https://media.zat.im", - "https://videos.sadx.moe", "https://pt.nospy.net", "https://yhwh.tube", - "https://peerlook.ru", - "https://monero.wf", "https://tube.kicou.info", "https://video.aqr.af", "https://videos-passages.huma-num.fr", @@ -956,8 +1002,6 @@ "https://peertube.dsmouse.net", "https://ptube.horsentiers.fr", "https://video.cnt.social", - "https://peertube.okko.io", - "https://video.mentality.rip", "https://tube.03281.fspfc.org", "https://tube.linc.systems", "https://peertube.ketchup.noho.st", @@ -970,31 +1014,23 @@ "https://truvitv.com", "https://pt.ilyamikcoder.com", "https://peertube.sensin.eu", - "https://watch.riverside.rocks", - "https://sharetube.us", "https://video.sadmin.io", "https://stream.jurnalfm.md", - "https://video.asgardius.company", "https://video.publicspaces.net", "https://video.eientei.org", "https://tv.suwerenni.org", "https://tube.revertron.com", "https://tube.erzbistum-hamburg.de", - "https://video.germanische-heilkunde.at", "https://views.southfox.me", - "https://vide.oxel.me", "https://video.mttv.it", "https://peertube.cloud.nerdraum.de", "https://vid.pretok.tv", "https://videos.slownewsdayshow.com", "https://videos.sarcasmstardust.com", "https://videos.factsonthegroundshow.com", - "https://video.pe6.eu", "https://tv.santic-zombie.ru", "https://tube.sleeping.town", - "https://tube.globalfrens.com", "https://peertube.hacknews.pmdcollab.org", - "https://freetubes.nohost.me", "https://video.snug.moe", "https://video.avant-le-strike.buzz", "https://videos.ritimo.org", @@ -1017,17 +1053,14 @@ "https://peertube.beardedtek.com", "https://creemoseducacioninclusiva.uma.es", "https://videos.yeswiki.net", - "https://tube.lrk.sh", "https://peertube.autogestioncitoyenne.org", "https://video.r3s.nrw", "https://peertube.semweb.pro", "https://poast.tv", "https://testube.distrilab.fr", "https://peertube.rse43.com", - "https://libremedia.video", "https://vid.lelux.fi", "https://v.wolfskaempf.de", - "https://peertube.chevro.fr", "https://media.econoalchemist.com", "https://video.qoto.org", "https://peertube.maxweiss.io", @@ -1036,34 +1069,27 @@ "https://peertube.swarm.solvingmaz.es", "https://film.node9.org", "https://peertube.mi-site.net", - "https://tube.nowtech.io", "https://raptube.antipub.org", "https://video.cm-en-transition.fr", "https://tube.koweb.fr", "https://peertube.genma.fr", "https://tv.generallyrubbish.net.au", - "https://video.travisshears.xyz", "https://videos.codingotaku.com", "https://foss.tube", "https://peertube.satoshishop.de", "https://ua.peertube.red", "https://peertube.zwindler.fr", "https://videos.fsci.in", - "https://swebbtube.se", "https://video.dnfi.no", "https://peertube.revelin.fr", - "https://armstube.com", "https://peertube.ti-fr.com", "https://video.turbo.chat", - "https://tube.toldi.eu", - "https://review.peertube.biz", "https://peertube.am-networks.fr", "https://video.chbmeyer.de", "https://video.rs-einrich.de", "https://p2ptv.ru", "https://peertube.librenet.co.za", "https://h3h3.club", - "https://watch.snoot.tube", "https://tube.freepeople.fr", "https://watch.rt4mn.org", "https://video.lrose.de", @@ -1080,7 +1106,6 @@ "https://video.anartist.org", "https://peertube.home.x0r.fr", "https://peertube.marud.fr", - "https://freetubehub.live", "https://mtube.mooo.com", "https://skeptube.fr", "https://tube.villejuif.fr", @@ -1125,9 +1150,7 @@ "https://live.solari.com", "https://live.codinglab.ch", "https://dud-video.inf.tu-dresden.de", - "https://media-test.interior.edu.uy", "https://media.interior.edu.uy", - "https://phoenixproject.group", "https://peertube.sebu77.com", "https://www.orion-hub.fr", "https://tv.orion-serv.fr", @@ -1168,7 +1191,6 @@ "https://tube.nuxnik.com", "https://tube.froth.zone", "https://peertube.ethibox.fr", - "https://www.freetubehub.live", "https://tube.communia.org", "https://peertube.dragonborn.app", "https://ai-tube.ch", @@ -1180,14 +1202,12 @@ "https://pocketnetpeertube10.nohost.me", "https://tube.io18.top", "https://peertube.remerge.net", - "https://video.wuatek.is", "https://tube.geekyboo.net", "https://notretube.asselma.eu", "https://canal.facil.services", "https://pt.gordons.gen.nz", "https://tube.misterbanal.net", "https://peertube.fomin.site", - "https://peertube.kenjiyon.xyz", "https://tube.g1zm0.de", "https://video.ellijaymakerspace.org", "https://videos.benpro.fr", @@ -1223,14 +1243,12 @@ "https://bideoak.argia.eus", "https://video.hainry.fr", "https://video.gresille.org", - "https://peertube.tangentfox.com", "https://puffy.tube", "https://tube.kher.nl", "https://watch.ocaml.org", "https://peertube.kleph.eu", "https://tube.missbanal.net", "https://pityu.flaki.hu", - "https://tv.catalpafestival.fr", "https://pony.tube", "https://peertube.umeahackerspace.se", "https://tube.okcinfo.news", @@ -1250,7 +1268,6 @@ "https://peertube.scyldings.com", "https://gade.o-k-i.net", "https://peertube.mobilsicher.de", - "https://video.jigmedatse.com", "https://video.amiga-ng.org", "https://peertube.espace.si", "https://videos.supertuxkart.net", @@ -1264,7 +1281,6 @@ "https://peertube.w.utnw.de", "https://tube.sp-codes.de", "https://tube.apolut.net", - "https://tube.mfraters.net", "https://tube.pyngu.com", "https://peertube.troback.com", "https://peertube.ucy.de", @@ -1300,7 +1316,6 @@ "https://video.gyt.is", "https://peertube.jensdiemer.de", "https://tube.futuretic.fr", - "https://libra.syntazia.org", "https://peertube.beeldengeluid.nl", "https://tv.lumbung.space", "https://peertube.cuatrolibertades.org", @@ -1318,7 +1333,6 @@ "https://peertube.radres.xyz", "https://darkvapor.nohost.me", "https://tube.chaoszone.tv", - "https://media.over-world.org", "https://tube.avensio.de", "https://peertube.klaewyss.fr", "https://sender-fm.veezee.tube", @@ -1332,7 +1346,6 @@ "https://peertube.iriseden.eu", "https://video.shitposter.club", "https://tv.mattchristiansenmedia.com", - "https://tube.hackerscop.org", "https://peertube.kx.studio", "https://videos.3d-wolf.com", "https://tube.octaplex.net", @@ -1355,7 +1368,6 @@ "https://tube.frischesicht.de", "https://peertube1.zeteo.me", "https://conspiracydistillery.com", - "https://peertube.chemnitz.freifunk.net", "https://hpstube.fr", "https://video.blast-info.fr", "https://peertube.bubuit.net", @@ -1380,7 +1392,6 @@ "https://peertube.inapurna.org", "https://watch.libertaria.space", "https://video.triplea.fr", - "https://video.catgirl.biz", "https://vulgarisation-informatique.fr", "https://tube.kotur.org", "https://peertube.euskarabildua.eus", @@ -1430,7 +1441,6 @@ "https://evangelisch.video", "https://tube.anufrij.de", "https://videos.mastodont.cat", - "https://video.taboulisme.com", "https://media.undeadnetwork.de", "https://tube.dragonpsi.xyz", "https://peertube.nicolastissot.fr", @@ -1504,11 +1514,9 @@ "https://video.csc49.fr", "https://tube.wolfe.casa", "https://video.dresden.network", - "https://peertube.zapashcanon.fr", "https://40two.tube", "https://tube.amic37.fr", "https://video.comptoir.net", - "https://kino.schuerz.at", "https://peertube.tiennot.net", "https://tututu.tube", "https://tube.picasoft.net", @@ -1521,14 +1529,12 @@ "https://videos.testimonia.org", "https://video.mass-trespass.uk", "https://peertube.cipherbliss.com", - "https://peertube.stemy.me", "https://daschauher.aksel.rocks", "https://tube.cyano.at", "https://tube.nox-rhea.org", "https://peertube.securitymadein.lu", "https://tube.rita.moe", "https://tuktube.com", - "https://v.basspistol.org", "https://mytube.kn-cloud.de", "https://tube.nuagelibre.fr", "https://video.nogafam.es", @@ -1547,9 +1553,7 @@ "https://cinema.yunohost.support", "https://peertube.s2s.video", "https://peertube.travelpandas.eu", - "https://video.sdm-tools.net", "https://peertube.anzui.dev", - "https://video.up.edu.ph", "https://video.igem.org", "https://worldofvids.com", "https://peertube.underworld.fr", @@ -1576,8 +1580,6 @@ "https://video.violoncello.ch", "https://peertube.gidikroon.eu", "https://tubedu.org", - "https://watch.breadtube.tv", - "https://video.exodus-privacy.eu.org", "https://tilvids.com", "https://peertube.devloprog.org", "https://peertube.designersethiques.org", @@ -1614,11 +1616,9 @@ "https://peertube.netzbegruenung.de", "https://plextube.nl", "https://tube.opportunis.me", - "https://nanawel-peertube.dyndns.org", "https://tube-strasbourg.beta.education.fr", "https://tube.graz.social", "https://tube-besancon.beta.education.fr", - "https://vid.garwood.io", "https://kolektiva.media", "https://peertube.ichigo.everydayimshuflin.com", "https://video.lundi.am", @@ -1643,7 +1643,6 @@ "https://mplayer.demouliere.eu", "https://video.liberta.vip", "https://peertube.gcfamily.fr", - "https://video.ploud.fr", "https://tube.plaf.fr", "https://tube.nah.re", "https://dreiecksnebel.alex-detsch.de", @@ -1731,7 +1730,6 @@ "https://peertube.makotoworkshop.org", "https://peertube.serveur.slv-valbonne.fr", "https://video.netsyms.com", - "https://video.writeas.org", "https://videos.adhocmusic.com", "https://vid.y-y.li", "https://diode.zone", @@ -1775,4 +1773,4 @@ "https://peertube2.cpy.re", "https://peertube.cpy.re" ] -} \ No newline at end of file +} From d86fecab3f3e98a87d6e8af8879c036f9da44779 Mon Sep 17 00:00:00 2001 From: Hygna Date: Wed, 21 Sep 2022 20:38:30 +0100 Subject: [PATCH 23/67] 100% compat with widgets/.js --- src/assets/javascripts/services.js | 2 +- src/config/config.json | 2 +- src/pages/options/index.html | 134 +++++++++++++++++++++---- src/pages/options/widgets/general.ejs | 10 +- src/pages/options/widgets/general.js | 24 ++--- src/pages/options/widgets/services.ejs | 20 ++-- src/pages/options/widgets/services.js | 71 ++++++++----- 7 files changed, 188 insertions(+), 75 deletions(-) diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index fff3227..7944444 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -385,7 +385,7 @@ function initDefaults() { .then(response => response.text()) .then(async data => { let dataJson = JSON.parse(data) - redirects = dataJson + redirects = dataJson.slice() browser.storage.local.get(["cloudflareBlackList", "authenticateBlackList", "offlineBlackList"], async r => { for (const service in config.services) { if (config.services[service].targets == "datajson") { diff --git a/src/config/config.json b/src/config/config.json index d0bf7ed..ac393f1 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -180,7 +180,7 @@ "setEndpoint": "/applysettings" }, "name": "Bibliogram", - "instanceList": false + "instanceList": true } }, "targets": ["^https?:\\/{2}(www\\.)?instagram\\.com"], diff --git a/src/pages/options/index.html b/src/pages/options/index.html index df6bec2..e1163e9 100644 --- a/src/pages/options/index.html +++ b/src/pages/options/index.html @@ -46,8 +46,8 @@
-

- @@ -55,10 +55,10 @@
-
+
-

Fallback to normal if no instances are available for the current protocol

- +

Fallback to normal if no instances are available for the current network

+
@@ -254,15 +254,13 @@
-
-

Embed Frontend

- -
+

Embed Frontend

+

Redirect Type

@@ -998,7 +996,103 @@

- +
+
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+
+ + +
+
+
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+
+
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+
+
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+
+ +
+
@@ -2095,14 +2189,12 @@
-
-

Embed Frontend

- -
+

Embed Frontend

+

Redirect Type

diff --git a/src/pages/options/widgets/general.ejs b/src/pages/options/widgets/general.ejs index d68a228..e306ba4 100644 --- a/src/pages/options/widgets/general.ejs +++ b/src/pages/options/widgets/general.ejs @@ -12,17 +12,17 @@
-

- <% for (const network in config.networks) { -%> <% }; %>
-
+
-

Fallback to normal if no instances are available for the current protocol

- +

Fallback to normal if no instances are available for the current network

+
diff --git a/src/pages/options/widgets/general.js b/src/pages/options/widgets/general.js index e573b4e..9dac9bf 100644 --- a/src/pages/options/widgets/general.js +++ b/src/pages/options/widgets/general.js @@ -86,15 +86,15 @@ themeElement.addEventListener("change", event => { location.reload() }) -let protocolElement = document.getElementById("protocol") -protocolElement.addEventListener("change", event => { - const value = event.target.options[protocol.selectedIndex].value +let networkElement = document.getElementById("network") +networkElement.addEventListener("change", event => { + const value = event.target.options[network.selectedIndex].value browser.storage.local.set({ network: value }) location.reload() }) -let protocolFallbackCheckbox = document.getElementById("protocol-fallback-checkbox") -protocolFallbackCheckbox.addEventListener("change", event => { +let networkFallbackCheckbox = document.getElementById("network-fallback-checkbox") +networkFallbackCheckbox.addEventListener("change", event => { browser.storage.local.set({ networkFallback: event.target.checked }) }) @@ -138,16 +138,16 @@ browser.storage.local.get( r => { autoRedirectElement.checked = r.autoRedirect themeElement.value = r.theme - protocolElement.value = r.network - protocolFallbackCheckbox.checked = r.networkFallback + networkElement.value = r.network + networkFallbackCheckbox.checked = r.networkFallback latencyOutput.value = r.latencyThreshold // firstPartyIsolate.checked = r.firstPartyIsolate; - let protocolFallbackElement = document.getElementById("protocol-fallback") - if (protocolElement.value == "clearnet") { - protocolFallbackElement.style.display = "none" + let networkFallbackElement = document.getElementById("network-fallback") + if (networkElement.value == "clearnet") { + networkFallbackElement.style.display = "none" } else { - protocolFallbackElement.style.display = "block" + networkFallbackElement.style.display = "block" } instanceTypeElement.addEventListener("change", event => { @@ -200,7 +200,7 @@ browser.storage.local.get( if (instanceType == "url") { if (nameCustomInstanceInput.validity.valid) { let url = new URL(nameCustomInstanceInput.value) - val = `${url.protocol}//${url.host}` + val = `${url.network}//${url.host}` if (!exceptionsCustomInstances.url.includes(val)) exceptionsCustomInstances.url.push(val) } } else if (instanceType == "regex") { diff --git a/src/pages/options/widgets/services.ejs b/src/pages/options/widgets/services.ejs index bc75f28..44c6a9f 100644 --- a/src/pages/options/widgets/services.ejs +++ b/src/pages/options/widgets/services.ejs @@ -18,17 +18,15 @@
<% if (config.services[service].embeddable) { _%> -
-
-

Embed Frontend

- -
+
+

Embed Frontend

+
<% } _%> <% } _%> diff --git a/src/pages/options/widgets/services.js b/src/pages/options/widgets/services.js index 33c174f..69840de 100644 --- a/src/pages/options/widgets/services.js +++ b/src/pages/options/widgets/services.js @@ -16,19 +16,22 @@ function getConfig() { }) } -await getConfig() +function getNetwork() { + return new Promise(resolve => { + browser.storage.local.get("network", r => { + selectedNetwork = r.network + resolve() + }) + }) +} -browser.storage.local.get("network", r => { - selectedNetwork = r.network -}) +await getConfig() +await getNetwork() function changeFrontendsSettings(service) { for (const frontend in config.services[service].frontends) { - if (config.services[service].frontends[frontend].instanceList && config.services[service].frontends.length > 1) { + if (config.services[service].frontends[frontend].instanceList) { const frontendDiv = document.getElementById(frontend) - if (divs[service].frontend == null) { - console.log(frontend) - } if (frontend == divs[service].frontend.value) { frontendDiv.style.display = "block" } else { @@ -36,25 +39,43 @@ function changeFrontendsSettings(service) { } } } + + if (config.services[service].embeddable) { + if (!config.services[service].frontends[divs[service].frontend.value].instanceList) { + divs[service].embedFrontend.disabled = false + for (const frontend in config.services[service].frontends) { + if (config.services[service].frontends[frontend].embeddable) { + const frontendDiv = document.getElementById(frontend) + if (frontend == divs[service].embedFrontend.value) { + frontendDiv.style.display = "block" + } else { + frontendDiv.style.display = "none" + } + } + } + } else if (Object.keys(config.services[service].frontends) > 1) divs[service].embedFrontend.disabled = true + } } -function changeNetworkSettings(selectedNetwork) { - for (const frontend in config.frontends) { - if (config.services[service].frontends[frontend].instanceList) { - 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" +function changeNetworkSettings() { + for (const service in config.services) { + for (const frontend in config.services[service].frontends) { + if (config.services[service].frontends[frontend].instanceList) { + 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" + } } } } } } -changeNetworkSettings(selectedNetwork) +changeNetworkSettings() for (const service in config.services) { divs[service] = {} divs[service][service] = document.getElementById(`${service}_page`) @@ -62,18 +83,20 @@ for (const service in config.services) { 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)] + if (typeof config.services[service].options[option] == "boolean") 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 }) + if (typeof config.services[service].options[option] == "boolean") 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) }) } - changeFrontendsSettings(service) + if (Object.keys(config.services[service].frontends).length > 1) { + changeFrontendsSettings(service) + } for (const frontend in config.services[service].frontends) { if (config.services[service].frontends[frontend].instanceList) { From 320d0175a8e1223618eb3b8d740b420ef674fc8d Mon Sep 17 00:00:00 2001 From: Hygna Date: Thu, 22 Sep 2022 19:58:07 +0100 Subject: [PATCH 24/67] Completed Migration to ejs --- package.json | 2 +- src/assets/images/sendTargets-icon.svg | 52 +--- src/assets/javascripts/services.js | 8 +- src/config/config.json | 67 +++-- src/instances/get_instances.py | 2 +- src/pages/options/index.html | 109 +++++-- src/pages/options/widgets/services.js | 2 +- src/pages/popup/popup.ejs | 49 +++ src/pages/popup/popup.html | 396 ++++++++++++++----------- src/pages/popup/popup.pug | 155 ---------- src/pages/widgets/head.pug | 5 - src/pages/widgets/icons.pug | 46 --- src/pages/widgets/instances.pug | 15 - src/pages/widgets/latency.pug | 14 - src/pages/widgets/links.ejs | 12 +- src/pages/widgets/links.pug | 83 ------ src/pages/widgets/switches.ejs | 11 + 17 files changed, 422 insertions(+), 606 deletions(-) create mode 100644 src/pages/popup/popup.ejs delete mode 100644 src/pages/popup/popup.pug delete mode 100644 src/pages/widgets/head.pug delete mode 100644 src/pages/widgets/icons.pug delete mode 100644 src/pages/widgets/instances.pug delete mode 100644 src/pages/widgets/latency.pug delete mode 100644 src/pages/widgets/links.pug create mode 100644 src/pages/widgets/switches.ejs diff --git a/package.json b/package.json index ee0d908..76f5747 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "pug": "pug ./src/pages/options/*.pug ./src/pages/popup/ -P -w", "prettier": "npx prettier --write .", "instances": "python3 src/instances/get_instances.py; git update-index --assume-unchanged src/instances/blacklist.json src/instances/data.json", - "ejs": "npx ejs src/pages/options/index.ejs -f src/config/config.json -o src/pages/options/index.html" + "ejs": "npx ejs src/pages/options/index.ejs -f src/config/config.json -o src/pages/options/index.html; npx ejs src/pages/popup/popup.ejs -f src/config/config.json -o src/pages/popup/popup.html" }, "repository": { "type": "git", diff --git a/src/assets/images/sendTargets-icon.svg b/src/assets/images/sendTargets-icon.svg index 2ed80a0..5557664 100644 --- a/src/assets/images/sendTargets-icon.svg +++ b/src/assets/images/sendTargets-icon.svg @@ -1,51 +1,3 @@ - - - - - - - - + + diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 7944444..f4c3087 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -68,7 +68,7 @@ function redirect(url, type, initiator) { let redirectType if (url.pathname == "/") return for (const service in config.services) { - if (!options[service].enabled && !disableOverride) continue + if (!options[service].enabled) continue let targets = service.targets if (targets == "datajson") { browser.storage.local.get(`${service}Targets`, (targets = r[service + "Targets"])) @@ -385,12 +385,12 @@ function initDefaults() { .then(response => response.text()) .then(async data => { let dataJson = JSON.parse(data) - redirects = dataJson.slice() + redirects = JSON.parse(data) browser.storage.local.get(["cloudflareBlackList", "authenticateBlackList", "offlineBlackList"], async r => { for (const service in config.services) { if (config.services[service].targets == "datajson") { browser.storage.local.set({ [service + "Targets"]: [...dataJson[service]] }) - delete redirects[service] + delete dataJson[service] } for (const defaultOption in config.services[service].options) { browser.storage.local.set({ [service + utils.camelCase(defaultOption)]: config.services[service].options[defaultOption] }) @@ -422,7 +422,7 @@ function initDefaults() { } }) browser.storage.local.set({ - redirects, + redirects: dataJson, }) ;() => resolve() }) diff --git a/src/config/config.json b/src/config/config.json index ac393f1..1c8f5f9 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -102,7 +102,8 @@ "embedFrontend": "invidious" }, "imageType": "png", - "embeddable": true + "embeddable": true, + "url": "https://youtube.com" }, "youtubeMusic": { "frontends": { @@ -130,7 +131,8 @@ "frontend": "beatbump" }, "imageType": "png", - "embeddable": false + "embeddable": false, + "url": "https://music.youtube.com" }, "twitter": { "frontends": { @@ -169,7 +171,8 @@ "redirectType": "both" }, "imageType": "png", - "embeddable": true + "embeddable": true, + "url": "https://twitter.com" }, "instagram": { "frontends": { @@ -187,7 +190,8 @@ "name": "Instagram", "options": { "enabled": true }, "imageType": "png", - "embeddable": false + "embeddable": false, + "url": "https://instagram.com" }, "tiktok": { "frontends": { @@ -203,7 +207,8 @@ "name": "TikTok", "options": { "enabled": true }, "imageType": "png", - "embeddable": false + "embeddable": false, + "url": "https://tiktok.com" }, "reddit": { "frontends": { @@ -242,7 +247,8 @@ "frontend": "libreddit" }, "imageType": "png", - "embeddable": false + "embeddable": false, + "url": "https://reddit.com" }, "imgur": { "frontends": { @@ -256,7 +262,8 @@ "name": "Imgur", "options": { "enabled": true }, "imageType": "png", - "embeddable": false + "embeddable": false, + "url": "https://imgur.com" }, "wikipedia": { "frontends": { @@ -272,7 +279,8 @@ "name": "Wikipedia", "options": { "enabled": false }, "imageType": "svg", - "embeddable": false + "embeddable": false, + "url": "https://wikipedia.com" }, "medium": { "frontends": { @@ -304,8 +312,9 @@ ], "name": "Medium", "options": { "enabled": true }, - "imageType": "svg", - "embeddable": false + "imageType": "svgMono", + "embeddable": false, + "url": "https://medium.com" }, "quora": { "frontends": { @@ -321,7 +330,8 @@ "name": "Quora", "options": { "enabled": true }, "imageType": "png", - "embeddable": false + "embeddable": false, + "url": "https://quora.com" }, "imdb": { "frontends": { @@ -337,7 +347,8 @@ "name": "IMDb", "options": { "enabled": false }, "imageType": "svg", - "embeddable": false + "embeddable": false, + "url": "https://imdb.com" }, "reuters": { "frontends": { @@ -351,7 +362,8 @@ "name": "Reuters", "options": { "enabled": false }, "imageType": "svg", - "embeddable": false + "embeddable": false, + "url": "https://reuters.com" }, "peertube": { "frontends": { @@ -365,7 +377,8 @@ "name": "PeerTube", "options": { "enabled": false }, "imageType": "svg", - "embeddable": false + "embeddable": false, + "url": "https://search.joinpeertube.org" }, "lbry": { "frontends": { @@ -389,10 +402,12 @@ "options": { "enabled": false, "frontend": "librarian", - "redirectType": "both" + "redirectType": "both", + "embedFrontend": "librarian" }, "imageType": "png", - "embeddable": true + "embeddable": true, + "url": "https://odysee.com" }, "search": { "frontends": { @@ -467,8 +482,9 @@ "enabled": true, "frontend": "searxng" }, - "imageType": "svg", - "embeddable": false + "imageType": "svgMono", + "embeddable": false, + "url": "https://search.libredirect.invalid" }, "translate": { "frontends": { @@ -493,8 +509,9 @@ "enabled": true, "frontend": "simplyTranslate" }, - "imageType": "svg", - "embeddable": false + "imageType": "svgMono", + "embeddable": false, + "url": "https://translate.google.com" }, "maps": { "frontends": { @@ -514,8 +531,9 @@ "enabled": true, "frontend": "osm" }, - "imageType": "svg", - "embeddable": false + "imageType": "svgMono", + "embeddable": false, + "url": "https://maps.google.com" }, "sendTargets": { "frontends": { @@ -528,8 +546,9 @@ "targets": ["^https?:\\/{2}send\\.libredirect\\.invalid\\/$", "^https?:\\/{2}send\\.firefox\\.com\\/$", "^https?:\\/{2}sendfiles\\.online\\/$"], "name": "Send Files", "options": { "enabled": true }, - "imageType": "svg", - "embeddable": false + "imageType": "svgMono", + "embeddable": false, + "url": "https://send.libredirect.invalid" } } } diff --git a/src/instances/get_instances.py b/src/instances/get_instances.py index 2547917..85bdf1c 100644 --- a/src/instances/get_instances.py +++ b/src/instances/get_instances.py @@ -446,7 +446,7 @@ def peertube(): 'https://instances.joinpeertube.org/api/v1/instances?start=0&count=1045&sort=-createdAt') rJson = json.loads(r.text) - myList = [] + myList = ['https://search.joinpeertube.org'] for k in rJson['data']: myList.append('https://'+k['host']) diff --git a/src/pages/options/index.html b/src/pages/options/index.html index e1163e9..a23ff24 100644 --- a/src/pages/options/index.html +++ b/src/pages/options/index.html @@ -10,26 +10,85 @@
@@ -169,7 +228,7 @@
-
+
medium
@@ -205,25 +264,25 @@
-
+
search
-
+
translate
-
+
maps
-
+
sendTargets
diff --git a/src/pages/options/widgets/services.js b/src/pages/options/widgets/services.js index 69840de..b595943 100644 --- a/src/pages/options/widgets/services.js +++ b/src/pages/options/widgets/services.js @@ -53,7 +53,7 @@ function changeFrontendsSettings(service) { } } } - } else if (Object.keys(config.services[service].frontends) > 1) divs[service].embedFrontend.disabled = true + } else if (Object.keys(config.services[service].frontends).length > 1) divs[service].embedFrontend.disabled = true } } diff --git a/src/pages/popup/popup.ejs b/src/pages/popup/popup.ejs new file mode 100644 index 0000000..efb73e5 --- /dev/null +++ b/src/pages/popup/popup.ejs @@ -0,0 +1,49 @@ + + + + + + + + + +
+ <%- include('src/pages/widgets/switches', {config: config}) -%> +
+
+
+
+
+ <%- include('src/pages/widgets/switches', {config: config}) -%> +
+
+ + + + + +
+ + + + diff --git a/src/pages/popup/popup.html b/src/pages/popup/popup.html index 25f70f4..e21a63a 100644 --- a/src/pages/popup/popup.html +++ b/src/pages/popup/popup.html @@ -8,189 +8,227 @@
@@ -222,4 +260,4 @@ - \ No newline at end of file + diff --git a/src/pages/popup/popup.pug b/src/pages/popup/popup.pug deleted file mode 100644 index 7da687c..0000000 --- a/src/pages/popup/popup.pug +++ /dev/null @@ -1,155 +0,0 @@ -include ../widgets/icons.pug - -mixin services - .youtube.some-block - a.title(href="https://youtube.com") - img(src="../../assets/images/youtube-icon.png") - h4(data-localise="__MSG_youtube__") YouTube - input.disable-youtube(type="checkbox") - - .youtubeMusic.some-block - a.title(href="https://music.youtube.com") - img(src="../../assets/images/youtube-music-icon.png") - h4(data-localise="__MSG_ytmusic__") YT Music - input.disable-youtubeMusic(type="checkbox") - - .twitter.some-block - a.title(href="https://twitter.com") - img(src="../../assets/images/twitter-icon.png") - h4(data-localise="__MSG_twitter__") Twitter - input.disable-nitter(type="checkbox") - - .instagram.some-block - a.title(href="https://instagram.com") - img(src="../../assets/images/instagram-icon.png") - h4(data-localise="__MSG_instagram__") Instagram - input.disable-bibliogram(type="checkbox") - - .tiktok.some-block - a.title(href="https://tiktok.com") - img(src="../../assets/images/tiktok-icon.png") - h4(data-localise="__MSG_tiktok__") TikTok - input.disable-tiktok(type="checkbox") - - .imgur.some-block - a.title(href="https://imgur.com") - img(src="../../assets/images/imgur.png") - h4(data-localise="__MSG_imgur__") Imgur - input.disable-imgur(type="checkbox") - - .reddit.some-block - a.title(href="https://reddit.com") - img(src="../../assets/images/reddit-icon.png") - h4(data-localise="__MSG_reddit__") Reddit - input.disable-reddit(type="checkbox") - - .wikipedia.some-block - a.title(href="https://wikipedia.com") - img(src="../../assets/images/wikipedia-icon.svg") - h4(data-localise="__MSG_wikipedia__") Wikipedia - input.disable-wikipedia(type="checkbox") - - .medium.some-block - a.title(href="https://medium.com") - +medium - h4(data-localise="__MSG_medium__") Medium - input.disable-medium(type="checkbox") - - .quora.some-block - a.title(href="https://quora.com") - img(src="../../assets/images/quora.png") - h4(data-localise="__MSG_quora__") Quora - input.disable-quora(type="checkbox") - - .imdb.some-block - a.title(href="https://imdb.com") - img(src="../../assets/images/imdb.svg") - h4(data-localise="__MSG_imdb__") IMDb - input.disable-imdb(type="checkbox") - - .reuters.some-block - a.title(href="https://reuters.com") - img(src="../../assets/images/reuters.svg") - h4(data-localise="__MSG_reuters__") Reuters - input.disable-reuters(type="checkbox") - - .peertube.some-block - a.title(href="https://search.joinpeertube.org") - img(src="../../assets/images/peertube-icon.svg") - h4(data-localise="__MSG_peertube__") PeerTube - input.disable-peertube(type="checkbox") - - .lbry.some-block - a.title(href="https://odysee.com/") - img(src="../../assets/images/lbry-icon.png") - h4(data-localise="__MSG_lbry__") LBRY - input.disable-lbry(type="checkbox") - - .search.some-block - a.title(href="https://search.libredirect.invalid") - +search - h4(data-localise="__MSG_search__") Search - input.disable-search(type="checkbox") - - .translate.some-block - a.title(href="https://translate.google.com") - +translate - h4(data-localise="__MSG_translate__") Translate - input.disable-translate(type="checkbox") - - .maps.some-block - a.title(href="https://www.openstreetmap.org") - +maps - h4(data-localise="__MSG_maps__") Maps - input.disable-osm(type="checkbox") - - .sendTargets.some-block - a.title(href="https://send.libredirect.invalid") - +send - h4(data-localise="__MSG_sendFiles__") Send Files - input.disable-sendTargets(type="checkbox") - -doctype html -html(lang="en") - head - meta(charset="utf-8") - meta(name="viewport" content="width=device-width, initial-scale=1") - link(href="../stylesheets/styles.css" rel="stylesheet") - link(href="./style.css" rel="stylesheet") - body(dir="auto") - .current_site - +services - #current_site_divider - hr - .all_sites - +services - hr - #change_instance_div.some-block - a#change_instance.title.button.prevent - h4(data-localise="__MSG_switchInstance__") Change Instance - +change_instance - - #copy_raw_div.some-block(title="Copy the original redirected link") - a#copy_raw.title.button.prevent - h4(data-localise="__MSG_copyRaw__") Copy Raw - +copy_raw - - #unify_div.some-block(title="Unify cookies across all selected instances") - a#unify.title.button.prevent - h4(data-localise="__MSG_unifySettings__") Unify Settings - +unify - - .some-block - a#more-options.title.button.prevent - h4(data-localise="__MSG_settings__") Settings - +settings - - .some-block - a#about.title.button(href="/pages/options/index.html#about") - h4(data-localise="__MSG_about__") About - +about - - .space - - script(type="module" src="../options/init.js") - script(type="module" src="./popup.js") diff --git a/src/pages/widgets/head.pug b/src/pages/widgets/head.pug deleted file mode 100644 index 53de42d..0000000 --- a/src/pages/widgets/head.pug +++ /dev/null @@ -1,5 +0,0 @@ -head - meta(charset='utf-8') - meta(name="viewport" content="width=device-width, initial-scale=1") - link(rel="icon" type="image/x-icon" href="../../../assets/images/libredirect.svg") - link(href="../../stylesheets/styles.css" rel="stylesheet") \ No newline at end of file diff --git a/src/pages/widgets/icons.pug b/src/pages/widgets/icons.pug deleted file mode 100644 index cc77ad1..0000000 --- a/src/pages/widgets/icons.pug +++ /dev/null @@ -1,46 +0,0 @@ -mixin medium - svg(xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1770 1000" fill="currentColor") - circle(cx="500" cy="500" r="500") - ellipse(ry="475" rx="250" cy="501" cx="1296") - ellipse(cx="1682" cy="502" rx="88" ry="424") - -mixin search - svg(xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor") - path(d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z") - -mixin translate - svg(xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor") - path(d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z") - -mixin maps - svg(xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor") - path( d="M20.5 3l-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5zM10 5.47l4 1.4v11.66l-4-1.4V5.47zm-5 .99l3-1.01v11.7l-3 1.16V6.46zm14 11.08l-3 1.01V6.86l3-1.16v11.84z") - -mixin send - svg(xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor") - path(d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z") - -mixin change_instance - svg(xmlns="http://www.w3.org/2000/svg" height="26px" viewBox="0 0 24 24" width="26px" fill="currentColor") - path(d="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z") - -mixin settings - svg(xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="26px" viewBox="0 0 24 24" - width="26px" fill="currentColor") - path(d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z") - -mixin copy_raw - svg(xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor") - path(d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z") - -mixin general - svg(xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="26px" viewBox="0 0 24 24" width="26px" fill="currentColor") - path(d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z") - -mixin unify - svg(xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor") - path(d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z") - -mixin about - svg( xmlns="http://www.w3.org/2000/svg" height="24" width="24" fill="currentColor") - path( d="M11 17h2v-6h-2Zm1-8q.425 0 .713-.288Q13 8.425 13 8t-.287-.713Q12.425 7 12 7t-.712.287Q11 7.575 11 8t.288.712Q11.575 9 12 9Zm0 13q-2.075 0-3.9-.788-1.825-.787-3.175-2.137-1.35-1.35-2.137-3.175Q2 14.075 2 12t.788-3.9q.787-1.825 2.137-3.175 1.35-1.35 3.175-2.138Q9.925 2 12 2t3.9.787q1.825.788 3.175 2.138 1.35 1.35 2.137 3.175Q22 9.925 22 12t-.788 3.9q-.787 1.825-2.137 3.175-1.35 1.35-3.175 2.137Q14.075 22 12 22Zm0-2q3.35 0 5.675-2.325Q20 15.35 20 12q0-3.35-2.325-5.675Q15.35 4 12 4 8.65 4 6.325 6.325 4 8.65 4 12q0 3a.35 2.325 5.675Q8.65 20 12 20Zm0-8Z") \ No newline at end of file diff --git a/src/pages/widgets/instances.pug b/src/pages/widgets/instances.pug deleted file mode 100644 index 950bd46..0000000 --- a/src/pages/widgets/instances.pug +++ /dev/null @@ -1,15 +0,0 @@ -mixin instances(myPlaceholder) - .some-block.option-block - h4(data-localise="__MSG_defaultInstances__") Default Instances - - .checklist - hr - .some-block.option-block - h4(data-localise="__MSG_customInstances__") Custom Instances - form.custom-instance-form - .some-block.option-block - input.custom-instance(placeholder=myPlaceholder type="url") - button.add.add-instance(type="submit") - svg(xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor") - path(d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z") - .checklist.custom-checklist \ No newline at end of file diff --git a/src/pages/widgets/latency.pug b/src/pages/widgets/latency.pug deleted file mode 100644 index e5bf53b..0000000 --- a/src/pages/widgets/latency.pug +++ /dev/null @@ -1,14 +0,0 @@ -mixin latency(service) - - var latencyVal - if (service) - - latencyVal = `latency-${service}` - else - - latencyVal = `latency` - - .buttons.buttons-inline - label.button.button-inline(id=`${latencyVal}-label` for=latencyVal) - svg(xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor") - path(d="M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z") - |  - x(data-localise="__MSG_testInstancesLatency__") Test Instances Latency - input.button.button-inline(id=latencyVal style="display:none;") \ No newline at end of file diff --git a/src/pages/widgets/links.ejs b/src/pages/widgets/links.ejs index c28d366..86b9f26 100644 --- a/src/pages/widgets/links.ejs +++ b/src/pages/widgets/links.ejs @@ -1,7 +1,13 @@ diff --git a/src/pages/widgets/links.pug b/src/pages/widgets/links.pug deleted file mode 100644 index c7f8e0a..0000000 --- a/src/pages/widgets/links.pug +++ /dev/null @@ -1,83 +0,0 @@ -include ./icons.pug - -mixin links(service) - section#links.links - .title - +general - a(href="#general" data-localise="__MSG_general__") General - - .title - img(src="../../../assets/images/youtube-icon.png") - a(href="#youtube" data-localise="__MSG_youtube__") YouTube - - .title - img(src="../../../assets/images/youtube-music-icon.png") - a(href="#youtubeMusic" data-localise="__MSG_ytmusic__") YT Music - - .title - img(src="../../../assets/images/twitter-icon.png") - a(href="#twitter" data-localise="__MSG_twitter__") Twitter - - .title - img(src="../../../assets/images/instagram-icon.png") - a(href="#instagram" data-localise="__MSG_instagram__") Instagram - - .title - img(src="../../../assets/images/tiktok-icon.png") - a(href="#tiktok" data-localise="__MSG_tiktok__") TikTok - - .title - img(src="../../../assets/images/reddit-icon.png") - a(href="#reddit" data-localise="__MSG_reddit__") Reddit - - .title - img(src="../../../assets/images/imgur.png") - a(href="#imgur" data-localise="__MSG_imgur__") Imgur - - .title - img(src="../../../assets/images/wikipedia-icon.svg") - a(href="#wikipedia" data-localise="__MSG_wikipedia__") Wikipedia - - .title - +medium - a(href="#medium" data-localise="__MSG_medium__") Medium - - .title - img(src="../../../assets/images/quora.png") - a(href="#quora" data-localise="__MSG_quora__") Quora - - .title - img(src="../../../assets/images/imdb.svg") - a(href="#imdb" data-localise="__MSG_imdb__") IMDb - - .title - img(src="../../../assets/images/reuters.svg") - a(href="#reuters" data-localise="__MSG_reuters__") Reuters - - .title - img(src="../../../assets/images/peertube-icon.svg") - a(href="#peertube" data-localise="__MSG_peertube__") PeerTube - - .title - img(src="../../../assets/images/lbry-icon.png") - a(href="#lbry" data-localise="__MSG_lbry__") LBRY - - .title - +search - a(href="#search" data-localise="__MSG_search__") Search - - .title - +translate - a(href="#translate" data-localise="__MSG_translate__") Translate - - .title - +maps - a(href="#maps" data-localise="__MSG_maps__") Maps - - .title - +send - a(href="#sendTargets" data-localise="__MSG_sendFiles__") Send Files - - .title - +about - a(href="#about" data-localise="__MSG_about") About diff --git a/src/pages/widgets/switches.ejs b/src/pages/widgets/switches.ejs new file mode 100644 index 0000000..45bcd79 --- /dev/null +++ b/src/pages/widgets/switches.ejs @@ -0,0 +1,11 @@ +<% for (const service in config.services) { -%> + +<% } %> From f87eb20ceed147362f4d446aa10e15f865c0bc16 Mon Sep 17 00:00:00 2001 From: Hygna Date: Fri, 23 Sep 2022 20:57:25 +0100 Subject: [PATCH 25/67] Started optimizing popup.js --- src/assets/javascripts/services.js | 43 ++- src/config/config.json | 10 +- src/pages/background/background.js | 2 + src/pages/options/index.html | 36 +-- src/pages/popup/popup.js | 504 ++++++----------------------- src/pages/widgets/links.ejs | 2 +- 6 files changed, 159 insertions(+), 438 deletions(-) diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index f4c3087..d3b7290 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -20,10 +20,10 @@ async function getConfig() { function init() { return new Promise(async resolve => { - browser.storage.local.get(["network", "networkFallback"], r => { + browser.storage.local.get(["network", "networkFallback", "redirects"], r => { options.network = r.network options.networkFallback = r.networkFallback - options.redirects = r.redirects + redirects = r.redirects }) for (const service in config.services) { options[service] = {} @@ -50,14 +50,26 @@ function init() { function all(service) { let tmp = [] - for (frontend in config.services[service].frontends) { - for (network in config.networks) tmp.push([...redirects[frontend][network]]) + for (const frontend in config.services[service].frontends) { + if (config.services[service].frontends[frontend].instanceList) { + for (const network in config.networks) { + tmp.push(...redirects[frontend][network]) + } + } } return tmp } +function regexArray(service, url) { + for (const targetString in config.services[service].targets) { + const target = new RegExp(config.services[service].targets[targetString]) + if (target.test(url.href)) return true + } + return false +} + await getConfig() -init() +await init() browser.storage.onChanged.addListener(init) function redirect(url, type, initiator) { @@ -69,7 +81,7 @@ function redirect(url, type, initiator) { if (url.pathname == "/") return for (const service in config.services) { if (!options[service].enabled) continue - let targets = service.targets + let targets = config.services[service].targets if (targets == "datajson") { browser.storage.local.get(`${service}Targets`, (targets = r[service + "Targets"])) } @@ -424,12 +436,29 @@ function initDefaults() { browser.storage.local.set({ redirects: dataJson, }) - ;() => resolve() + resolve() }) }) } +function computeService(url) { + for (const service in config.services) { + const regex = config.services[service].targets + console.log(regex) + if (regexArray(service, url)) { + console.log(service + "gi") + return service + } else if (all(service).includes(utils.protocolHost(url))) { + console.log(service) + return service + } + } + console.log("moment") + return null +} + export default { redirect, initDefaults, + computeService, } diff --git a/src/config/config.json b/src/config/config.json index 1c8f5f9..a4bcf12 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -87,12 +87,12 @@ }, "singleInstanceFrontends": ["freetube", "yatte"], "targets": [ - "^https?:\\/{2}(www\\.|music\\.|m\\.|)youtube.com(\\(?!iframe_api)/.*|$)", + "^https?:\\/{2}(?:www\\.|music\\.|m\\.|)youtube.com(\\(?!iframe_api/.*|$)", "^https?:\\/{2}img\\.youtube.com\\/vi\\/.*\\/..*", - "^https?:\\/{2}(i|s)\\.ytimg.com\\/vi\\/.*\\/..*", - "^https?:\\/{2}(www\\.|music\\.|)youtube.com\\/watch?v=..*", + "^https?:\\/{2}(?:i|s)\\.ytimg.com\\/vi\\/.*\\/..*", + "^https?:\\/{2}(?:www\\.|music\\.|)youtube.com\\/watch?v=..*", "^https?:\\/{2}youtu\\.be\\/..*", - "^https?:\\/{2}(www\\.|)(youtube|youtube-nocookie)\\.com\\/embed\\/..*" + "^https?:\\/{2}(?:www\\.|)(youtube|youtube-nocookie)\\.com\\/embed\\/..*" ], "name": "Youtube", "options": { @@ -275,7 +275,7 @@ "instanceList": true } }, - "targets": ["^https?:\\/{2}([a-z]+\\.)*wikipedia\\.org"], + "targets": ["^https?:\\/{2}(?:[a-z]+\\.)*wikipedia\\.org"], "name": "Wikipedia", "options": { "enabled": false }, "imageType": "svg", diff --git a/src/pages/background/background.js b/src/pages/background/background.js index e93e3d0..e0228df 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -145,6 +145,7 @@ browser.tabs.onRemoved.addListener(tabId => { } }) +/* browser.webRequest.onHeadersReceived.addListener( e => { let response = youtubeHelper.removeXFrameOptions(e) @@ -154,6 +155,7 @@ browser.webRequest.onHeadersReceived.addListener( { urls: [""] }, ["blocking", "responseHeaders"] ) +*/ async function redirectOfflineInstance(url, tabId) { let newUrl = await youtubeHelper.switchInstance(url, true) diff --git a/src/pages/options/index.html b/src/pages/options/index.html index a23ff24..b6ea153 100644 --- a/src/pages/options/index.html +++ b/src/pages/options/index.html @@ -16,28 +16,28 @@ General
+ Youtube
+ YT Music
+ Twitter
+ Instagram
+ TikTok
+ Reddit
+ Imgur
+ Wikipedia
@@ -45,46 +45,46 @@ - medium
+ Medium
+ Quora
- imdb
+ IMDb + Reuters + PeerTube
- lbry
+ LBRY + Search + Translate
- maps
+ Maps + Send Files
diff --git a/src/pages/popup/popup.js b/src/pages/popup/popup.js index 465080c..fa269e6 100644 --- a/src/pages/popup/popup.js +++ b/src/pages/popup/popup.js @@ -3,40 +3,7 @@ window.browser = window.browser || window.chrome import utils from "../../assets/javascripts/utils.js" import generalHelper from "../../assets/javascripts/general.js" - -import youtubeHelper from "../../assets/javascripts/youtube/youtube.js" -import youtubeMusicHelper from "../../assets/javascripts/youtubeMusic.js" -import twitterHelper from "../../assets/javascripts/twitter.js" -import instagramHelper from "../../assets/javascripts/instagram.js" -import redditHelper from "../../assets/javascripts/reddit.js" -import searchHelper from "../../assets/javascripts/search.js" -import translateHelper from "../../assets/javascripts/translate/translate.js" -import mapsHelper from "../../assets/javascripts/maps.js" -import wikipediaHelper from "../../assets/javascripts/wikipedia.js" -import mediumHelper from "../../assets/javascripts/medium.js" -import quoraHelper from "../../assets/javascripts/quora.js" -import libremdbHelper from "../../assets/javascripts/imdb.js" -import reutersHelper from "../../assets/javascripts/reuters.js" -import imgurHelper from "../../assets/javascripts/imgur.js" -import tiktokHelper from "../../assets/javascripts/tiktok.js" -import sendTargetsHelper from "../../assets/javascripts/sendTargets.js" -import peertubeHelper from "../../assets/javascripts/peertube.js" -import lbryHelper from "../../assets/javascripts/lbry.js" - -utils.unify(true).then(r => { - if (!r) document.getElementById("unify_div").style.display = "none" - else { - const unify = document.getElementById("unify") - const textElement = document.getElementById("unify").getElementsByTagName("h4")[0] - unify.addEventListener("click", () => { - const oldHtml = textElement.innerHTML - textElement.innerHTML = "..." - browser.runtime.sendMessage({ function: "unify" }, response => { - if (response && response.response) textElement.innerHTML = oldHtml - }) - }) - } -}) +import serviceHelper from "../../assets/javascripts/services.js" utils.switchInstance(true).then(r => { if (!r) document.getElementById("change_instance_div").style.display = "none" @@ -52,389 +19,112 @@ utils.copyRaw(true).then(r => { }) document.getElementById("more-options").addEventListener("click", () => browser.runtime.openOptionsPage()) +let config +let divs = {} + +async function getConfig() { + return new Promise(resolve => { + fetch("/config/config.json") + .then(response => response.text()) + .then(data => { + const tmp = JSON.parse(data) + config = tmp.config + resolve() + }) + }) +} + +await getConfig() + const allSites = document.getElementsByClassName("all_sites")[0] const currSite = document.getElementsByClassName("current_site")[0] -const disableTwitterCurrentSite = currSite.getElementsByClassName("disable-nitter")[0] -const disableTwitterAllSites = allSites.getElementsByClassName("disable-nitter")[0] +function setDivs() { + return new Promise(resolve => { + for (const service in config.services) { + divs[service] = {} + divs[service].toggle = {} + divs[service].current = currSite.getElementsByClassName(service)[0] + divs[service].all = allSites.getElementsByClassName(service)[0] + divs[service].toggle.current = currSite.getElementsByClassName(service + "-enabled")[0] + divs[service].toggle.all = allSites.getElementsByClassName(service + "-enabled")[0] + } + resolve() + }) +} -const disableYoutubeCurrentSite = currSite.getElementsByClassName("disable-youtube")[0] -const disableYoutubeAllSites = allSites.getElementsByClassName("disable-youtube")[0] - -const disableYoutubeMusicCurrentSite = currSite.getElementsByClassName("disable-youtubeMusic")[0] -const disableYoutubeMusicAllSites = allSites.getElementsByClassName("disable-youtubeMusic")[0] - -const disableInstagramCurrentSite = currSite.getElementsByClassName("disable-bibliogram")[0] -const disableInstagramAllSites = allSites.getElementsByClassName("disable-bibliogram")[0] - -const disableMapsCurrentSite = currSite.getElementsByClassName("disable-osm")[0] -const disableMapsAllSites = allSites.getElementsByClassName("disable-osm")[0] - -const disableRedditCurrentSite = currSite.getElementsByClassName("disable-reddit")[0] -const disableRedditAllSites = allSites.getElementsByClassName("disable-reddit")[0] - -const disableSearchCurrentSite = currSite.getElementsByClassName("disable-search")[0] -const disableSearchAllSites = allSites.getElementsByClassName("disable-search")[0] - -const disableTranslateCurrentSite = currSite.getElementsByClassName("disable-translate")[0] -const disableTranslateAllSites = allSites.getElementsByClassName("disable-translate")[0] - -const disableWikipediaCurrentSite = currSite.getElementsByClassName("disable-wikipedia")[0] -const disableWikipediaAllSites = allSites.getElementsByClassName("disable-wikipedia")[0] - -const disableMediumCurrentSite = currSite.getElementsByClassName("disable-medium")[0] -const disableMediumAllSites = allSites.getElementsByClassName("disable-medium")[0] - -const disableQuoraCurrentSite = currSite.getElementsByClassName("disable-quora")[0] -const disableQuoraAllSites = allSites.getElementsByClassName("disable-quora")[0] - -const disableImdbCurrentSite = currSite.getElementsByClassName("disable-imdb")[0] -const disableImdbAllSites = allSites.getElementsByClassName("disable-imdb")[0] - -const disableReutersCurrentSite = currSite.getElementsByClassName("disable-reuters")[0] -const disableReutersAllSites = allSites.getElementsByClassName("disable-reuters")[0] - -const disablePeertubeTargetsCurrentSite = currSite.getElementsByClassName("disable-peertube")[0] -const disablePeertubeTargetsAllSites = allSites.getElementsByClassName("disable-peertube")[0] - -const disableLbryTargetsCurrentSite = currSite.getElementsByClassName("disable-lbry")[0] -const disableLbryTargetsAllSites = allSites.getElementsByClassName("disable-lbry")[0] - -const disableSendTargetsCurrentSite = currSite.getElementsByClassName("disable-sendTargets")[0] -const disableSendTargetsAllSites = allSites.getElementsByClassName("disable-sendTargets")[0] - -const disableImgurCurrentSite = currSite.getElementsByClassName("disable-imgur")[0] -const disableImgurAllSites = allSites.getElementsByClassName("disable-imgur")[0] - -const disableTiktokCurrentSite = currSite.getElementsByClassName("disable-tiktok")[0] -const disableTiktokAllSites = allSites.getElementsByClassName("disable-tiktok")[0] +await setDivs() const currentSiteIsFrontend = document.getElementById("current_site_divider") -browser.storage.local.get( - [ - "disableTwitter", - "disableYoutube", - "disableYoutubeMusic", - "disableInstagram", - "disableMaps", - "disableReddit", - "disableSearch", - "translateDisable", - "disableWikipedia", - "disableImgur", - "disableTiktok", - "disableMedium", - "disableQuora", - "disableImdb", - "disableReuters", - "disablePeertubeTargets", - "disableLbryTargets", - "disableSendTarget", - "popupFrontends", - ], - r => { - disableTwitterCurrentSite.checked = !r.disableTwitter - disableTwitterAllSites.checked = !r.disableTwitter - disableYoutubeCurrentSite.checked = !r.disableYoutube - disableYoutubeAllSites.checked = !r.disableYoutube - disableYoutubeMusicCurrentSite.checked = !r.disableYoutubeMusic - disableYoutubeMusicAllSites.checked = !r.disableYoutubeMusic - disableInstagramCurrentSite.checked = !r.disableInstagram - disableInstagramAllSites.checked = !r.disableInstagram - disableMapsCurrentSite.checked = !r.disableMaps - disableMapsAllSites.checked = !r.disableMaps - disableRedditCurrentSite.checked = !r.disableReddit - disableRedditAllSites.checked = !r.disableReddit - disableSearchCurrentSite.checked = !r.disableSearch - disableSearchAllSites.checked = !r.disableSearch - disableTranslateCurrentSite.checked = !r.translateDisable - disableTranslateAllSites.checked = !r.translateDisable - disableWikipediaCurrentSite.checked = !r.disableWikipedia - disableWikipediaAllSites.checked = !r.disableWikipedia - disableImgurCurrentSite.checked = !r.disableImgur - disableImgurAllSites.checked = !r.disableImgur - disableTiktokCurrentSite.checked = !r.disableTiktok - disableTiktokAllSites.checked = !r.disableTiktok - disableMediumCurrentSite.checked = !r.disableMedium - disableMediumAllSites.checked = !r.disableMedium - disableQuoraCurrentSite.checked = !r.disableQuora - disableQuoraAllSites.checked = !r.disableQuora - disableImdbCurrentSite.checked = !r.disableImdb - disableImdbAllSites.checked = !r.disableImdb - disableReutersCurrentSite.checked = !r.disableReuters - disableReutersAllSites.checked = !r.disableReuters - disablePeertubeTargetsCurrentSite.checked = !r.disablePeertubeTargets - disablePeertubeTargetsAllSites.checked = !r.disablePeertubeTargets - disableLbryTargetsCurrentSite.checked = !r.disableLbryTargets - disableLbryTargetsAllSites.checked = !r.disableLbryTargets - disableSendTargetsCurrentSite.checked = !r.disableSendTarget - disableSendTargetsAllSites.checked = !r.disableSendTarget - - browser.tabs.query({ active: true, currentWindow: true }, async tabs => { - for (const frontend of generalHelper.allPopupFrontends) { - if (!r.popupFrontends.includes(frontend)) allSites.getElementsByClassName(frontend)[0].classList.add("hide") - else allSites.getElementsByClassName(frontend)[0].classList.remove("hide") - currSite.getElementsByClassName(frontend)[0].classList.add("hide") - } - - let url - try { - url = new URL(tabs[0].url) - } catch { - currentSiteIsFrontend.classList.add("hide") - return - } - - if (youtubeMusicHelper.redirect(url, "main_frame", false, true) || (await youtubeMusicHelper.switchInstance(url, true))) { - currSite.getElementsByClassName("youtubeMusic")[0].classList.remove("hide") - allSites.getElementsByClassName("youtubeMusic")[0].classList.add("hide") - } else if (twitterHelper.redirect(url, "main_frame", false, true) || (await twitterHelper.switchInstance(url, "main_frame", false, true))) { - currSite.getElementsByClassName("twitter")[0].classList.remove("hide") - allSites.getElementsByClassName("twitter")[0].classList.add("hide") - } else if (instagramHelper.redirect(url, "main_frame", false, true) || (await instagramHelper.switchInstance(url, "main_frame", false, true))) { - currSite.getElementsByClassName("instagram")[0].classList.remove("hide") - allSites.getElementsByClassName("instagram")[0].classList.add("hide") - } else if (mapsHelper.redirect(url, false)) { - currSite.getElementsByClassName("maps")[0].classList.remove("hide") - allSites.getElementsByClassName("maps")[0].classList.add("hide") - } else if (redditHelper.redirect(url, "main_frame", false, true) || (await redditHelper.switchInstance(url, "main_frame", false, true))) { - currSite.getElementsByClassName("reddit")[0].classList.remove("hide") - allSites.getElementsByClassName("reddit")[0].classList.add("hide") - } else if (mediumHelper.redirect(url, "main_frame", false, true) || (await mediumHelper.switchInstance(url, "main_frame", false, true))) { - currSite.getElementsByClassName("medium")[0].classList.remove("hide") - allSites.getElementsByClassName("medium")[0].classList.add("hide") - } else if (quoraHelper.redirect(url, "main_frame", false, true) || (await quoraHelper.switchInstance(url, "main_frame", false, true))) { - currSite.getElementsByClassName("quora")[0].classList.remove("hide") - allSites.getElementsByClassName("quora")[0].classList.add("hide") - } else if (libremdbHelper.redirect(url, "main_frame", false, true) || (await libremdbHelper.switchInstance(url, "main_frame", false, true))) { - currSite.getElementsByClassName("imdb")[0].classList.remove("hide") - allSites.getElementsByClassName("imdb")[0].classList.add("hide") - } else if (reutersHelper.redirect(url, "main_frame", false, true)) { - currSite.getElementsByClassName("reuters")[0].classList.remove("hide") - allSites.getElementsByClassName("reuters")[0].classList.add("hide") - } else if (imgurHelper.redirect(url, "main_frame", false, true) || (await imgurHelper.switchInstance(url, "main_frame", false, true))) { - currSite.getElementsByClassName("imgur")[0].classList.remove("hide") - allSites.getElementsByClassName("imgur")[0].classList.add("hide") - } else if (tiktokHelper.redirect(url, "main_frame", false, true) || (await tiktokHelper.switchInstance(url, "main_frame", false, true))) { - currSite.getElementsByClassName("tiktok")[0].classList.remove("hide") - allSites.getElementsByClassName("tiktok")[0].classList.add("hide") - } else if (sendTargetsHelper.redirect(url, "main_frame", false, true) || (await sendTargetsHelper.switchInstance(url, "main_frame", false, true))) { - currSite.getElementsByClassName("sendTargets")[0].classList.remove("hide") - allSites.getElementsByClassName("sendTargets")[0].classList.add("hide") - } else if (peertubeHelper.redirect(url, "main_frame", false, true) || (await peertubeHelper.switchInstance(url, true))) { - currSite.getElementsByClassName("peertube")[0].classList.remove("hide") - allSites.getElementsByClassName("peertube")[0].classList.add("hide") - } else if (lbryHelper.redirect(url, "main_frame", false, true) || (await lbryHelper.switchInstance(url, "main_frame", false, true))) { - currSite.getElementsByClassName("lbry")[0].classList.remove("hide") - allSites.getElementsByClassName("lbry")[0].classList.add("hide") - } else if (translateHelper.redirect(url, true) || (await translateHelper.switchInstance(url, true))) { - currSite.getElementsByClassName("translate")[0].classList.remove("hide") - allSites.getElementsByClassName("translate")[0].classList.add("hide") - } else if (searchHelper.redirect(url, true) || (await searchHelper.switchInstance(url, true))) { - currSite.getElementsByClassName("search")[0].classList.remove("hide") - allSites.getElementsByClassName("search")[0].classList.add("hide") - } else if (wikipediaHelper.redirect(url, true) || (await wikipediaHelper.switchInstance(url, true))) { - currSite.getElementsByClassName("wikipedia")[0].classList.remove("hide") - allSites.getElementsByClassName("wikipedia")[0].classList.add("hide") - } else if (youtubeHelper.redirect(url, "main_frame", false, true) || (await youtubeHelper.switchInstance(url, "main_frame", false, true))) { - currSite.getElementsByClassName("youtube")[0].classList.remove("hide") - allSites.getElementsByClassName("youtube")[0].classList.add("hide") - } else { - currentSiteIsFrontend.classList.add("hide") - } - }) - } -) - -document.addEventListener("change", () => { - browser.storage.local.get( - [ - "disableTwitter", - "disableYoutube", - "disableYoutubeMusic", - "disableInstagram", - "disableMaps", - "disableReddit", - "disableSearch", - "translateDisable", - "disableWikipedia", - "disableImgur", - "disableTiktok", - "disableMedium", - "disableQuora", - "disableImdb", - "disableReuters", - "disablePeertubeTargets", - "disableLbryTargets", - "disableSendTarget", - ], - r => { - if (!r.disableTwitter != disableTwitterCurrentSite.checked) - browser.storage.local.set({ - disableTwitter: !disableTwitterCurrentSite.checked, - }) - else if (!r.disableTwitter != disableTwitterAllSites.checked) - browser.storage.local.set({ - disableTwitter: !disableTwitterAllSites.checked, - }) - - if (!r.disableYoutube != disableYoutubeCurrentSite.checked) - browser.storage.local.set({ - disableYoutube: !disableYoutubeCurrentSite.checked, - }) - else if (!r.disableYoutube != disableYoutubeAllSites.checked) - browser.storage.local.set({ - disableYoutube: !disableYoutubeAllSites.checked, - }) - - if (!r.disableYoutubeMusic != disableYoutubeMusicCurrentSite.checked) - browser.storage.local.set({ - disableYoutubeMusic: !disableYoutubeMusicCurrentSite.checked, - }) - else if (!r.disableYoutubeMusic != disableYoutubeMusicAllSites.checked) - browser.storage.local.set({ - disableYoutubeMusic: !disableYoutubeMusicAllSites.checked, - }) - - if (!r.disableInstagram != disableInstagramCurrentSite.checked) - browser.storage.local.set({ - disableInstagram: !disableInstagramCurrentSite.checked, - }) - else if (!r.disableInstagram != disableInstagramAllSites.checked) - browser.storage.local.set({ - disableInstagram: !disableInstagramAllSites.checked, - }) - - if (!r.disableMaps != disableMapsCurrentSite.checked) - browser.storage.local.set({ - disableMaps: !disableMapsCurrentSite.checked, - }) - else if (!r.disableMaps != disableMapsAllSites.checked) - browser.storage.local.set({ - disableMaps: !disableMapsAllSites.checked, - }) - - if (!r.disableReddit != disableRedditCurrentSite.checked) - browser.storage.local.set({ - disableReddit: !disableRedditCurrentSite.checked, - }) - else if (!r.disableReddit != disableRedditAllSites.checked) - browser.storage.local.set({ - disableReddit: !disableRedditAllSites.checked, - }) - - if (!r.disableSearch != disableSearchCurrentSite.checked) - browser.storage.local.set({ - disableSearch: !disableSearchCurrentSite.checked, - }) - else if (!r.disableSearch != disableSearchAllSites.checked) - browser.storage.local.set({ - disableSearch: !disableSearchAllSites.checked, - }) - - if (!r.translateDisable != disableTranslateCurrentSite.checked) - browser.storage.local.set({ - translateDisable: !disableTranslateCurrentSite.checked, - }) - else if (!r.translateDisable != disableTranslateAllSites.checked) - browser.storage.local.set({ - translateDisable: !disableTranslateAllSites.checked, - }) - - if (!r.disableWikipedia != disableWikipediaCurrentSite.checked) - browser.storage.local.set({ - disableWikipedia: !disableWikipediaCurrentSite.checked, - }) - else if (!r.disableWikipedia != disableWikipediaAllSites.checked) - browser.storage.local.set({ - disableWikipedia: !disableWikipediaAllSites.checked, - }) - - if (!r.disableImgur != disableImgurCurrentSite.checked) - browser.storage.local.set({ - disableImgur: !disableImgurCurrentSite.checked, - }) - else if (!r.disableImgur != disableImgurAllSites.checked) - browser.storage.local.set({ - disableImgur: !disableImgurAllSites.checked, - }) - - if (!r.disableTiktok != disableTiktokCurrentSite.checked) - browser.storage.local.set({ - disableTiktok: !disableTiktokCurrentSite.checked, - }) - else if (!r.disableTiktok != disableTiktokAllSites.checked) - browser.storage.local.set({ - disableTiktok: !disableTiktokAllSites.checked, - }) - - if (!r.disableMedium != disableMediumCurrentSite.checked) - browser.storage.local.set({ - disableMedium: !disableMediumCurrentSite.checked, - }) - else if (!r.disableMedium != disableMediumAllSites.checked) - browser.storage.local.set({ - disableMedium: !disableMediumAllSites.checked, - }) - - if (!r.disableQuora != disableQuoraCurrentSite.checked) - browser.storage.local.set({ - disableQuora: !disableQuoraCurrentSite.checked, - }) - else if (!r.disableQuora != disableQuoraAllSites.checked) - browser.storage.local.set({ - disableQuora: !disableQuoraAllSites.checked, - }) - - if (!r.disableImdb != disableImdbCurrentSite.checked) - browser.storage.local.set({ - disableImdb: !disableImdbCurrentSite.checked, - }) - else if (!r.disableImdb != disableImdbAllSites.checked) - browser.storage.local.set({ - disableImdb: !disableImdbAllSites.checked, - }) - - if (!r.disableReuters != disableReutersCurrentSite.checked) - browser.storage.local.set({ - disableReuters: !disableReutersCurrentSite.checked, - }) - else if (!r.disableReuters != disableReutersAllSites.checked) - browser.storage.local.set({ - disableReuters: !disableReutersAllSites.checked, - }) - - if (!r.disablePeertubeTargets != disablePeertubeTargetsCurrentSite.checked) - browser.storage.local.set({ - disablePeertubeTargets: !disablePeertubeTargetsCurrentSite.checked, - }) - else if (!r.disablePeertubeTargets != disablePeertubeTargetsAllSites.checked) - browser.storage.local.set({ - disablePeertubeTargets: !disablePeertubeTargetsAllSites.checked, - }) - - if (!r.disableLbryTargets != disableLbryTargetsCurrentSite.checked) - browser.storage.local.set({ - disableLbryTargets: !disableLbryTargetsCurrentSite.checked, - }) - else if (!r.disableLbryTargets != disableLbryTargetsAllSites.checked) - browser.storage.local.set({ - disableLbryTargets: !disableLbryTargetsAllSites.checked, - }) - - if (!r.disableSendTarget != disableSendTargetsCurrentSite.checked) - browser.storage.local.set({ - disableSendTarget: !disableSendTargetsCurrentSite.checked, - }) - else if (!r.disableSendTarget != disableSendTargetsAllSites.checked) - browser.storage.local.set({ - disableSendTarget: !disableSendTargetsAllSites.checked, - }) +function getEnabled() { + return new Promise(async resolve => { + for (const service in config.services) { + browser.storage.local.get(`${service}Enabled`, r => { + divs[service].toggle.all.checked = r[service + "Enabled"] + divs[service].toggle.current.checked = r[service + "Enabled"] + }) } - ) + resolve() + }) +} + +browser.storage.local.get("popupFrontends", r => { + browser.tabs.query({ active: true, currentWindow: true }, async tabs => { + for (const frontend of generalHelper.allPopupFrontends) { + if (!r.popupFrontends.includes(frontend)) allSites.getElementsByClassName(frontend)[0].classList.add("hide") + else allSites.getElementsByClassName(frontend)[0].classList.remove("hide") + currSite.getElementsByClassName(frontend)[0].classList.add("hide") + } + + let url + try { + url = new URL(tabs[0].url) + console.log(url.href) + } catch { + currentSiteIsFrontend.classList.add("hide") + return + } + + await getEnabled() + + const currentService = serviceHelper.computeService(url) + if (currentService != null) { + divs[currentService].current.classList.remove("hide") + divs[currentService].all.classList.add("hide") + if (config.services[currentService].preferences != {}) { + const unify = document.getElementById("unify") + const textElement = document.getElementById("unify").getElementsByTagName("h4")[0] + unify.addEventListener("click", () => { + const oldHtml = textElement.innerHTML + textElement.innerHTML = "..." + browser.runtime.sendMessage({ function: "unify" }, response => { + if (response && response.response) textElement.innerHTML = oldHtml + }) + }) + } else { + document.getElementById("unify_div").style.display = "none" + } + } else { + currentSiteIsFrontend.classList.add("hide") + document.getElementById("unify_div").style.display = "none" + } + }) }) +for (const service in config.services) { + divs[service].toggle.all.addEventListener("change", () => { + browser.storage.local.set({ + [service + "Enabled"]: divs[service].toggle.all.checked, + }) + }) + divs[service].toggle.current.addEventListener("change", () => { + browser.storage.local.set({ + [service + "Enabled"]: divs[service].toggle.current.checked, + }) + }) +} + for (const a of document.getElementsByTagName("a")) { a.addEventListener("click", e => { if (!a.classList.contains("prevent")) { diff --git a/src/pages/widgets/links.ejs b/src/pages/widgets/links.ejs index 86b9f26..24a02e9 100644 --- a/src/pages/widgets/links.ejs +++ b/src/pages/widgets/links.ejs @@ -7,7 +7,7 @@ <% } else { _%> <%- include ('src/assets/images/' + service + '-icon.svg') %> <% } _%> - <%= service %>
+ <%= config.services[service].name %> <% }; -%>
<%- include ('src/assets/images/about-icon.svg') %>About
From df5e7f9b070066014b9289b5a01adbc91aaf9087 Mon Sep 17 00:00:00 2001 From: Hygna Date: Sat, 24 Sep 2022 11:44:18 +0100 Subject: [PATCH 26/67] Made most redirects work as expected --- src/assets/javascripts/services.js | 83 ++++++++++---------- src/config/config.json | 31 +++----- src/pages/options/index.html | 107 +++++++++++++++++--------- src/pages/options/widgets/general.ejs | 9 ++- src/pages/popup/popup.js | 8 +- 5 files changed, 135 insertions(+), 103 deletions(-) diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index d3b7290..64bed3b 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -27,19 +27,19 @@ function init() { }) for (const service in config.services) { options[service] = {} - browser.storage.local.get([`${utils.camelCase(service)}Enable`, `${service}RedirectType`, `${service}Frontend`], r => { - options[service].enabled = r[utils.camelCase(service) + "Enable"] + browser.storage.local.get([`${service}Enabled`, `${service}RedirectType`, `${service}Frontend`], r => { + options[service].enabled = r[service + "Enabled"] options[service].frontend = r[service + "Frontend"] options[service].redirectType = r[service + "RedirectType"] }) for (const frontend in config.services[service].frontends) { options[frontend] = {} - options[frontend].checks = [] - options[frontend].custom = [] for (const network in config.networks) { + options[frontend][network] = {} + options[frontend][network] = {} browser.storage.local.get([`${frontend}${utils.camelCase(network)}RedirectsChecks`, `${frontend}${utils.camelCase(network)}CustomRedirects`], r => { - options[frontend].checks = r[frontend + utils.camelCase(network) + "RedirectsChecks"] - options[frontend].custom = r[frontend + utils.camelCase(network) + "CustomRedirects"] + options[frontend][network].checks = r[frontend + utils.camelCase(network) + "RedirectsChecks"] + options[frontend][network].custom = r[frontend + utils.camelCase(network) + "CustomRedirects"] }) } } @@ -55,14 +55,22 @@ function all(service) { for (const network in config.networks) { tmp.push(...redirects[frontend][network]) } - } + } else if (config.services[service].frontends[frontend].singleInstance != undefined) tmp.push(config.services[service].frontends[frontend].singleInstance) } return tmp } function regexArray(service, url) { - for (const targetString in config.services[service].targets) { - const target = new RegExp(config.services[service].targets[targetString]) + let targets + if (config.services[service].targets == "datajson") { + browser.storage.local.get(`${service}Targets`, r => { + targets = r[service + "Targets"] + }) + } else { + targets = config.services[service].targets + } + for (const targetString in targets) { + const target = new RegExp(targets[targetString]) if (target.test(url.href)) return true } return false @@ -76,32 +84,30 @@ function redirect(url, type, initiator) { let randomInstance let frontend let network = options.network - let networkFallback = options.networkFallback - let redirectType - if (url.pathname == "/") return for (const service in config.services) { if (!options[service].enabled) continue - let targets = config.services[service].targets - if (targets == "datajson") { - browser.storage.local.get(`${service}Targets`, (targets = r[service + "Targets"])) + if (config.services[service].embeddable && type != options[service].redirectType && options[service].redirectType != "both") continue + if (!config.services[service].embeddable && type != "main_frame") continue + let targets = new RegExp(config.services[service].targets.join("|"), "i") + + if (initiator && (all(service).includes(initiator.origin) || targets.test(initiator.host))) continue + if (!regexArray(service, url)) continue + + if (Object.keys(config.services[service].frontends).length > 1) { + frontend = options[service].frontend + } else { + frontend = Object.keys(config.services[service].frontends)[0] } - if (initiator && (all(service).includes(initiator.origin) || targets.includes(initiator.host))) continue - if (!targets.some(rx => rx.test(url.href))) continue - if (type != redirectType && type != "both") continue - - frontend = options[service].frontend - redirectType = options[service].redirectType - - // browser.storage.local.get(`${service}Frontend`, (frontend = r[service + "Frontend"])) - if (config.services[service].frontends[frontend].instanceList) { - let instanceList = [...[frontend + utils.camelCase(network) + "RedirectsChecks"], ...[frontend + utils.camelCase(network) + "CustomRedirects"]] - if (instanceList.length === 0 && networkFallback) instanceList = [...[frontend + "ClearnetRedirectsChecks"], ...[frontend + "ClearnetCustomRedirects"]] - if (instanceList.length === 0 && redirects.indexOf(frontend) != -1) return + let instanceList = [...options[frontend][network].checks, ...options[frontend][network].custom] + if (instanceList.length === 0 && options.networkFallback) instanceList = [...options[frontend].clearnet.checks, ...options[frontend].clearnet.custom] + if (instanceList.length === 0) return randomInstance = utils.getRandomInstance(instanceList) - } + } else if (config.services[service].frontends[frontend].singleInstance) randomInstance = config.services[service].frontends[frontend].singleInstance + break } + if (frontend == null) return // Here is a (temperory) space for defining constants required in 2 or more switch cases. // When possible, try have the two switch cases share all their code as done with searx and searxng. @@ -111,10 +117,10 @@ function redirect(url, type, initiator) { const dataLatLngRegex = /!3d(-?[0-9]{1,}.[0-9]{1,})!4d(-?[0-9]{1,}.[0-9]{1,})/ const placeRegex = /\/place\/(.*)\// function convertMapCentre() { - let [, lat, lon, zoom] = 0 + let [lat, lon, zoom] = [null, null, null] if (url.pathname.match(mapCentreRegex)) { // Set map centre if present - ;[, lat, lon, zoom] = url.pathname.match(mapCentreRegex) + ;[lat, lon, zoom] = url.pathname.match(mapCentreRegex) } else if (url.searchParams.has("center")) { ;[lat, lon] = url.searchParams.get("center").split(",") zoom = url.searchParams.get("zoom") ?? "17" @@ -149,7 +155,7 @@ function redirect(url, type, initiator) { case "whoogle": return `${randomInstance}/search${encodeURIComponent(url.searchParams.get("q"))}` case "librex": - return `${randomInstance}/search.php${encodeURIComponent(url.searchParams.get("q"))}` + return `${randomInstance}/search.php?q=${encodeURIComponent(url.searchParams.get("q"))}` case "send": return randomInstance case "nitter": @@ -168,7 +174,7 @@ function redirect(url, type, initiator) { return `${randomInstance}/${url.search}` case "osm": { if (initiator && initiator.host === "earth.google.com") return - travelModes = { + const travelModes = { driving: "fossgis_osrm_car", walking: "fossgis_osrm_foot", bicycling: "fossgis_osrm_bike", @@ -227,10 +233,8 @@ function redirect(url, type, initiator) { let orgVal = url.searchParams.get("origin") let destVal = url.searchParams.get("destination") - let org - addressToLatLng(orgVal, a => (org = a)) - let dest - addressToLatLng(destVal, a => (dest = a)) + let org = addressToLatLng(orgVal) + let dest = addressToLatLng(destVal) prefs.route = `${org};${dest}` let prefsEncoded = new URLSearchParams(prefs).toString() @@ -280,7 +284,7 @@ function redirect(url, type, initiator) { } case "facil": { if (initiator && initiator.host === "earth.google.com") return - let travelModes = { + const travelModes = { driving: "car", walking: "pedestrian", bicycling: "bicycle", @@ -443,17 +447,12 @@ function initDefaults() { function computeService(url) { for (const service in config.services) { - const regex = config.services[service].targets - console.log(regex) if (regexArray(service, url)) { - console.log(service + "gi") return service } else if (all(service).includes(utils.protocolHost(url))) { - console.log(service) return service } } - console.log("moment") return null } diff --git a/src/config/config.json b/src/config/config.json index a4bcf12..84f430f 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -85,9 +85,8 @@ "instanceList": false } }, - "singleInstanceFrontends": ["freetube", "yatte"], "targets": [ - "^https?:\\/{2}(?:www\\.|music\\.|m\\.|)youtube.com(\\(?!iframe_api/.*|$)", + "^https?:\\/{2}(?:www\\.|m\\.|)youtube.com(?!iframe_api\\/.*)", "^https?:\\/{2}img\\.youtube.com\\/vi\\/.*\\/..*", "^https?:\\/{2}(?:i|s)\\.ytimg.com\\/vi\\/.*\\/..*", "^https?:\\/{2}(?:www\\.|music\\.|)youtube.com\\/watch?v=..*", @@ -253,7 +252,6 @@ "imgur": { "frontends": { "rimgo": { - "preferences": {}, "name": "rimgo", "instanceList": true } @@ -285,7 +283,6 @@ "medium": { "frontends": { "scribe": { - "preferences": {}, "name": "Scribe", "instanceList": true } @@ -301,14 +298,14 @@ "^psiloveyou\\.xyz", "^entrepreneurshandbook\\.co", "^blog\\.coinbase\\.com", - "^levelup\\.gitconnected\\.com ", - "^javascript\\.plainenglish\\.io ", - "^blog\\.bitsrc\\.io ", - "^itnext\\.io ", - "^codeburst\\.io ", - "^infosecwriteups\\.com ", - "^blog\\.devgenius\\.io ", - "^writingcooperative\\.com " + "^levelup\\.gitconnected\\.com", + "^javascript\\.plainenglish\\.io", + "^blog\\.bitsrc\\.io", + "^itnext\\.io", + "^codeburst\\.io", + "^infosecwriteups\\.com", + "^blog\\.devgenius\\.io", + "^writingcooperative\\.com" ], "name": "Medium", "options": { "enabled": true }, @@ -353,7 +350,6 @@ "reuters": { "frontends": { "neuters": { - "preferences": {}, "name": "Neuters", "instanceList": true } @@ -368,7 +364,6 @@ "peertube": { "frontends": { "simpleertube": { - "preferences": {}, "name": "SimpleerTube", "instanceList": true } @@ -464,13 +459,12 @@ "instanceList": true }, "whoogle": { - "preferences": {}, "name": "Whoogle", "instanceList": true }, "librex": { "preferences": { - "cookies": ["bibliogram", "disable_special", "invidious", "libreddit", "nitter", "proxitok", "theme", "wikiless"] + "cookies": ["bibliogram", "disable_frontends", " disable_special", "invidious", "libreddit", "nitter", "proxitok", "save", "theme", "wikiless"] }, "name": "LibreX", "instanceList": true @@ -516,13 +510,13 @@ "maps": { "frontends": { "facil": { - "preferences": {}, "name": "FacilMap", "instanceList": true }, "osm": { "name": "OpenStreetMap", - "instanceList": false + "instanceList": false, + "singleInstance": "https://www.openstreetmap.org" } }, "targets": ["^https?:\\/{2}(((www|maps)\\.)?(google\\.).*(\\/maps)|maps\\.(google\\.).*)"], @@ -538,7 +532,6 @@ "sendTargets": { "frontends": { "send": { - "preferences": {}, "name": "Send", "instanceList": "true" } diff --git a/src/pages/options/index.html b/src/pages/options/index.html index b6ea153..2059263 100644 --- a/src/pages/options/index.html +++ b/src/pages/options/index.html @@ -180,110 +180,145 @@ @@ -318,7 +318,7 @@ - Send Files + diff --git a/src/pages/options/widgets/general.ejs b/src/pages/options/widgets/general.ejs index 77028ac..e24046d 100644 --- a/src/pages/options/widgets/general.ejs +++ b/src/pages/options/widgets/general.ejs @@ -92,7 +92,7 @@ <% } else { _%> <%- include ('src/assets/images/' + service + '-icon.svg') %> <% } _%> - <%= config.services[service].name %> + From d980c4c70e835488721666996e2408801eea4970 Mon Sep 17 00:00:00 2001 From: Woodpecker CI Date: Tue, 4 Oct 2022 00:09:57 +0000 Subject: [PATCH 45/67] updated instances --- src/instances/blacklist.json | 4 ++++ src/instances/data.json | 42 +++++++++++++++++------------------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/instances/blacklist.json b/src/instances/blacklist.json index 79cdc94..cbbb3b2 100644 --- a/src/instances/blacklist.json +++ b/src/instances/blacklist.json @@ -71,13 +71,16 @@ "offline": [ "https://invidious.rhyshl.live", "https://invidious.esmailelbob.xyz", + "https://cringe.whatever.social", "https://proxitok.odyssey346.dev", "https://nhanh.cloud", "https://nitter.winscloud.net", "https://ntr.odyssey346.dev", "https://libreddit.winscloud.net", "https://teddit.ggc-project.de", + "https://teddit.tokhmi.xyz", "https://quetre.odyssey346.dev", + "https://translate.northboot.xyz", "https://st.odyssey346.dev", "https://jsearch.pw", "https://searx.gnu.style", @@ -91,6 +94,7 @@ "https://search.wef.lol", "https://i.bcow.xyz", "https://i.actionsack.com", + "https://rimgo.mha.fi", "https://lbry.bcow.xyz", "https://beatbump.ml" ] diff --git a/src/instances/data.json b/src/instances/data.json index 41a43bc..3a8e721 100644 --- a/src/instances/data.json +++ b/src/instances/data.json @@ -10,7 +10,6 @@ "https://y.com.sb", "https://yt.artemislena.eu", "https://invidious.sethforprivacy.com", - "https://invidious.tiekoetter.com", "https://invidious.flokinet.to", "https://inv.bp.projectsegfau.lt", "https://inv.vern.cc", @@ -21,6 +20,7 @@ "https://invidious.slipfox.xyz", "https://invidious.esmailelbob.xyz", "https://youtube.076.ne.jp", + "https://invidious.tiekoetter.com", "https://invidious.namazso.eu" ], "tor": [ @@ -210,7 +210,8 @@ "https://nitter.d420.de", "https://nitter.caioalonso.com", "https://nitter.at", - "https://nitter.drivet.xyz" + "https://nitter.drivet.xyz", + "https://nitter.pw" ], "tor": [ "http://nitter7bryz3jv7e3uekphigvmoyoem4al3fynerxkj22dmoxoq553qd.onion", @@ -509,11 +510,13 @@ "https://search.stinpriza.org", "https://search.trom.tf", "https://searx.bissisoft.com", + "https://searx.chocoflan.net", "https://searx.divided-by-zero.eu", "https://searx.dresden.network", "https://searx.fossencdi.org", "https://searx.gnu.style", "https://searx.mastodontech.de", + "https://searx.mistli.net", "https://searx.mxchange.org", "https://searx.nakhan.net", "https://searx.netzspielplatz.de", @@ -540,11 +543,15 @@ ], "tor": [ "http://3afisqjw2rxm6z7mmstyt5rx75qfqrgxnkzftknbp2vhipr2nrmrjdyd.onion", + "http://b2c7fvbhnfvwnl6oh2tydhzfx4i37kmmrycq42heqbbe7wovq3uzenid.onion", "http://yra4tke2pwcnatxjkufpw6kvebu3h3ti2jca2lcdpgx3mpwol326lzid.onion", "http://z5vawdol25vrmorm4yydmohsd4u6rdoj2sylvoi3e3nqvxkvpqul7bqd.onion", "http://zbuc3bbzbfdqqo2x46repx2ddajbha6fpsjeeptjhhhhzji3zopxdqyd.onion", "http://f4qfqajszpx5b7itzxt6mb7kj4ktpgbdq7lq6xaiqyqx6a7de3epptad.onion", - "http://searx.micohauwkjbyw5meacrb4ipicwvwg4xtzl7y7viv53kig2mdcsvwkyyd.onion" + "http://searxfilowxokbogygrigir4wqxfxqzuxofxgdon7dg6rsii4yxzytyd.onion", + "http://searx.micohauwkjbyw5meacrb4ipicwvwg4xtzl7y7viv53kig2mdcsvwkyyd.onion", + "http://4tz2vlnwk2apf2rpinkqv6uxvfgo5xjx6vl5vp7lxgaiooumetjpstqd.onion", + "http://lgmekfnpealdqhnctyg3p5fuelpdwnbqbwnl2ickpdoodzatzgz27ryd.onion" ], "i2p": [ "http://ransack.i2p", @@ -567,6 +574,7 @@ "https://priv.au", "https://privatus.live", "https://s.frlt.one", + "https://s.trung.fun", "https://s.zhaocloud.net", "https://saber.tk", "https://search.0relay.com", @@ -597,7 +605,6 @@ "https://searx.baczek.me", "https://searx.be", "https://searx.becomesovran.com", - "https://searx.chocoflan.net", "https://searx.ebnar.xyz", "https://searx.ericaftereric.top", "https://searx.esmailelbob.xyz", @@ -606,7 +613,6 @@ "https://searx.gnous.eu", "https://searx.kujonello.cf", "https://searx.mha.fi", - "https://searx.mistli.net", "https://searx.namejeff.xyz", "https://searx.org", "https://searx.orion-hub.fr", @@ -639,16 +645,12 @@ "http://b6sxmon57qza6dt36li7huabie5ntrvjr4q5rc2vvbn4hqvzd4phrvyd.onion", "http://searxngg6zleq6ceboe5ltkyo4hyrb3aaycrgzmrljv3jjlb5vcytead.onion", "http://gbat2pbpg7ys3fi3pbp64667tt5x66mg45xok35bxdw7v55brm7a27yd.onion", - "http://b2c7fvbhnfvwnl6oh2tydhzfx4i37kmmrycq42heqbbe7wovq3uzenid.onion", "http://searxdr3pqz4nydgnqocsia2xbywptxbkympa2emn7zlgggrir4bkfad.onion", "http://searx.esmail5pdn24shtvieloeedh7ehz3nrwcdivnfhfcedl7gf4kwddhkqd.onion", - "http://searxfilowxokbogygrigir4wqxfxqzuxofxgdon7dg6rsii4yxzytyd.onion", "http://searx.privpw3tndpkw6pnp3g727zfgfdzbu3k6a7chv226s3xymv2p4eiuqyd.onion", "http://rq2w52kyrif3xpfihkgjnhqm3a5aqhoikpv72z3drpjglfzc2wr5z4yd.onion", "http://fub6vgedgeadlu3ctskrpkcqjruh76tckwtj5swfhyblgml2tzgzckqd.onion/searx", - "http://searx3aolosaf3urwnhpynlhuokqsgz47si4pzz5hvb7uuzyjncl2tid.onion", - "http://4tz2vlnwk2apf2rpinkqv6uxvfgo5xjx6vl5vp7lxgaiooumetjpstqd.onion", - "https://lgmekfnpealdqhnctyg3p5fuelpdwnbqbwnl2ickpdoodzatzgz27ryd.onion" + "http://searx3aolosaf3urwnhpynlhuokqsgz47si4pzz5hvb7uuzyjncl2tid.onion" ], "i2p": [], "loki": [] @@ -677,19 +679,23 @@ "normal": [ "https://librex.beparanoid.de", "https://librex.extravi.dev", + "https://lx.vern.cc", "https://search.davidovski.xyz", "https://librex.kitscomputer.tk", "https://search.funami.tech", "https://librex.catalyst.sx", "https://search.madreyk.xyz", - "https://search.pabloferreiro.es" + "https://search.pabloferreiro.es", + "https://buscar.weblibre.org" ], "tor": [ "http://librex.2356uhnbpv5nk3bni5bv6jg2cd6lgj664kwx3lhyelstpttpyv4kk2qd.onion", - "http://ncblhz7q4sfbf755bdbhebfzxcpypz7ewafgi4agatecojz7pln4i3id.onion" + "http://ncblhz7q4sfbf755bdbhebfzxcpypz7ewafgi4agatecojz7pln4i3id.onion", + "http://lx.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion" ], "i2p": [ - "http://rra33hiaf6nmby7jfpqe2gqmng3jnzkvbu2n7jgce7vbhoyuhzya.b32.i2p" + "http://rra33hiaf6nmby7jfpqe2gqmng3jnzkvbu2n7jgce7vbhoyuhzya.b32.i2p", + "http://vernziqfqvweijfaacmwazohgpdo2bt2ib2jlupt2pwwu27bhgxq.b32.i2p" ], "loki": [] }, @@ -790,6 +796,7 @@ "loki": [] }, "peertube": [ + "https://tbh.co-shaoghal.net", "https://tube.kansanvalta.org", "https://duanrra.cf", "https://ytube.retronerd.at", @@ -928,13 +935,11 @@ "https://videos.tormentasolar.win", "https://tube.nestor.coop", "https://live.oldskool.fi", - "https://dytube.com", "https://tube.thierrytalbert.fr", "https://peertube.informaction.info", "https://tube.ac-amiens.fr", "https://tube.alado.space", "https://tube.network.europa.eu", - "https://vnchich.com", "https://pt.maciej.website", "https://peertube.frontmediatique.fr", "https://peertube.bgzashtita.es", @@ -966,7 +971,6 @@ "https://pierre.tube", "https://mirametube.fr", "https://vidz.dou.bet", - "https://videos.redeyes.site", "https://video.hostpath.de", "https://free-streams.com", "https://tube.pawelko.net", @@ -1127,7 +1131,6 @@ "https://www.orion-hub.fr", "https://tv.orion-serv.fr", "https://video.interru.io", - "https://tube.cnr.it", "https://peertube.dtmf.ca", "https://tube.ponsonaille.fr", "https://tube.int5.net", @@ -1146,7 +1149,6 @@ "https://vtr.chikichiki.tube", "https://fedimovie.com", "https://tube.doctors4covidethics.org", - "https://yoba.tv", "https://tube.mediainformationcenter.de", "https://peertube.communecter.org", "https://queermotion.org", @@ -1408,7 +1410,6 @@ "https://videos.john-livingston.fr", "https://melsungen.peertube-host.de", "https://evangelisch.video", - "https://tube.anufrij.de", "https://videos.mastodont.cat", "https://media.undeadnetwork.de", "https://tube.dragonpsi.xyz", @@ -1460,7 +1461,6 @@ "https://kodcast.com", "https://video.altertek.org", "https://ruraletv.ovh", - "https://videos.weblib.re", "https://tube.oisux.org", "https://peertube.louisematic.site", "https://clap.nerv-project.eu", @@ -1501,14 +1501,12 @@ "https://tube.nox-rhea.org", "https://peertube.securitymadein.lu", "https://tube.rita.moe", - "https://tuktube.com", "https://mytube.kn-cloud.de", "https://tube.nuagelibre.fr", "https://video.nogafam.es", "https://peertube.stream", "https://videos.leslionsfloorball.fr", "https://player.ojamajo.moe", - "https://ftsi.ru", "https://video.cigliola.com", "https://xxx.noho.st", "https://peertube.stefofficiel.me", From e4954d197fee859112381040b1d8f3ba8009df56 Mon Sep 17 00:00:00 2001 From: Hygna Date: Tue, 4 Oct 2022 17:36:38 +0100 Subject: [PATCH 46/67] Display if server is not found, made images in settings clickable --- src/assets/javascripts/utils.js | 4 +- src/pages/options/index.html | 88 ++++++++++++++++++++++++--------- src/pages/widgets/links.ejs | 16 ++++-- 3 files changed, 82 insertions(+), 26 deletions(-) diff --git a/src/assets/javascripts/utils.js b/src/assets/javascripts/utils.js index 056bbc0..9ae9123 100644 --- a/src/assets/javascripts/utils.js +++ b/src/assets/javascripts/utils.js @@ -112,10 +112,11 @@ async function processDefaultCustomInstances(service, frontend, network, documen const offline = offlineBlackList.includes(x) ? ' offline' : "" let ms = instancesLatency[x] - let latencyColor = ms <= 1000 ? "green" : ms <= 2000 ? "orange" : "red" + let latencyColor = ms == -1 ? "red" : ms <= 1000 ? "green" : ms <= 2000 ? "orange" : "red" let latencyLimit if (ms == 5000) latencyLimit = "5000ms+" else if (ms > 5000) latencyLimit = `ERROR: ${ms - 5000}` + else if (ms == -1) latencyLimit = "Server not found" else latencyLimit = ms + "ms" const latency = x in instancesLatency ? '' + latencyLimit + "" : "" @@ -267,6 +268,7 @@ async function testLatency(element, instances, frontend) { else text = `${time}ms` element.innerHTML = `${href}: ${text}` } else { + myList[href] = -1 color = "red" element.innerHTML = `${href}: Server not found` if (options[frontend].clearnet.enabled.includes(href)) options[frontend].clearnet.enabled.splice(options[frontend].clearnet.enabled.indexOf(href), 1) diff --git a/src/pages/options/index.html b/src/pages/options/index.html index a3afec5..53ee562 100644 --- a/src/pages/options/index.html +++ b/src/pages/options/index.html @@ -10,85 +10,129 @@
diff --git a/src/pages/widgets/links.ejs b/src/pages/widgets/links.ejs index 6fa9514..2373a10 100644 --- a/src/pages/widgets/links.ejs +++ b/src/pages/widgets/links.ejs @@ -1,13 +1,23 @@
<% }; -%> -
<%- include ('src/assets/images/about-icon.svg') %>About
+ From c87bbba349ced5cbc5d9559fbf8af88f9557ad24 Mon Sep 17 00:00:00 2001 From: Hygna Date: Tue, 4 Oct 2022 19:10:07 +0100 Subject: [PATCH 47/67] Ported 87d68cb662 --- .woodpecker/instances.yml | 9 +- README.md | 4 +- src/assets/javascripts/frontend.js | 143 ------------- src/assets/javascripts/services.js | 18 +- src/pages/background/background.js | 314 +++-------------------------- 5 files changed, 54 insertions(+), 434 deletions(-) delete mode 100644 src/assets/javascripts/frontend.js diff --git a/.woodpecker/instances.yml b/.woodpecker/instances.yml index 72fdd6e..43df0cd 100644 --- a/.woodpecker/instances.yml +++ b/.woodpecker/instances.yml @@ -8,13 +8,14 @@ pipeline: - python -m pip install --upgrade pip - pip install requests colorama - python src/instances/get_instances.py + # SSH configuration + - mkdir ~/.ssh + - ssh-keyscan -t ed25519 codeberg.org >> ~/.ssh/known_hosts + - eval `ssh-agent` + - echo "$TOKEN" | tr -d '\r' | ssh-add - # Git configuration - git config --global user.email $MAIL - git config --global user.name "Woodpecker CI" - git commit -am "updated instances" - - mkdir ~/.ssh - - ssh-keyscan -t ed25519 codeberg.org >> ~/.ssh/known_hosts - git remote set-url origin git@codeberg.org:libredirect/libredirect.git - - eval `ssh-agent` - - echo "$TOKEN" | tr -d '\r' | ssh-add - - git push --set-upstream origin master diff --git a/README.md b/README.md index d55dd37..8c5d608 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Send Files => [Send](https://gitlab.com/timvisee/send) **Note**: The Extension will be using random instances by default. You can modify this and add custom instances too. -# Please read the [FAQ](https://libredirect.github.io/faq.html) if you have any questions! +# Please read the [FAQ](https://libredirect.codeberg.page/faq.html) if you have any questions! ## Donate @@ -69,7 +69,7 @@ npm update npm install ``` -If you are modifying any files ending with .ejs, you need to run the following command to render html: +If you are modifying `config.json` or any files ending with .ejs, you need to run the following command to render html: ``` npm run ejs diff --git a/src/assets/javascripts/frontend.js b/src/assets/javascripts/frontend.js deleted file mode 100644 index ab71cc0..0000000 --- a/src/assets/javascripts/frontend.js +++ /dev/null @@ -1,143 +0,0 @@ -class FrontEnd { - constructor({ enable, frontends, frontend, redirect }) { - this.redirects = {} - this.enable = enable - this.frontend = frontend - this.protocol = "normal" - this.protocolFallback = true - fetch("/instances/data.json") - .then(response => response.text()) - .then(async data => { - data = JSON.parse(data) - fetch("/instances/blacklist.json") - .then(response => response.text()) - .then(async blackList => { - blackList = JSON.parse(blackList) - for (const frontend in frontends) { - this.redirects[frontend] = {} - - this.redirects[frontend].cookies = [...frontends[frontend].cookies] - - for (const protocol in data[frontend]) { - this.redirects[frontend][protocol] = {} - - this.redirects[frontend][protocol].all = [...data[frontend][protocol]] - - this.redirects[frontend][protocol].custom = [] - - this.redirects[frontend][protocol].checked = [...data[frontend][protocol]] - for (const instance of blackList.cloudflare) { - const a = this.redirects[frontend][protocol].checked.indexOf(instance) - if (a > -1) this.redirects[frontend][protocol].checked.splice(a, 1) - } - for (const instance of blackList.offline) { - const a = this.redirects[frontend][protocol].checked.indexOf(instance) - if (a > -1) this.redirects[frontend][protocol].checked.splice(a, 1) - } - } - } - }) - }) - this.unifyCookies = from => - new Promise(async resolve => { - await init() - const protocolHost = utils.protocolHost(from) - const list = [...this.redirects[this.frontend][this.protocol]] - if (![...list.checked, ...list.custom].includes(protocolHost)) { - resolve() - return - } - for (const cookie of this.redirects[this.frontend].cookies) { - await utils.copyCookie(frontend, protocolHost, [...list.checked, list.custom], cookie) - } - resolve(true) - }) - - this.switchInstance = (url, disableOverride) => { - if (!this.enable && !disableOverride) return - - const protocolHost = utils.protocolHost(url) - - const list = [...this.redirects[this.frontend][this.protocol]] - if (!list.all.includes(protocolHost)) return - - let userList = [...list.checked, ...list.custom] - if (userList.length === 0 && this.protocolFallback) userList = [...list.normal.all] - - const i = userList.indexOf(protocolHost) - if (i > -1) userList.splice(i, 1) - if (userList.length === 0) return - - const randomInstance = utils.getRandomInstance(userList) - return `${randomInstance}${url.pathname}${url.search}` - } - - this.redirect = (url, type, initiator, disableOverride) => { - const result = redirect(url, type, initiator, disableOverride) - if (result == "BYPASSTAB") return "BYPASSTAB" - if (result) { - const list = [...this.redirects[this.frontend][this.protocol]] - let userList = [...list.checked, ...list.custom] - const randomInstance = utils.getRandomInstance(userList) - return `${randomInstance}${result.pathname}${result.search}` - } - } - - let init = () => new Promise(async resolve => {}) - } -} - -let Reddit = new FrontEnd({ - enable: true, - frontends: { - libreddit: { cookies: ["theme", "front_page", "layout", "wide", "post_sort", "comment_sort", "show_nsfw", "autoplay_videos", "use_hls", "hide_hls_notification", "subscriptions", "filters"] }, - teddit: { - cookies: [ - "collapse_child_comments", - "domain_instagram", - "domain_twitter", - "domain_youtube", - "flairs", - "highlight_controversial", - "nsfw_enabled", - "post_media_max_height", - "show_upvoted_percentage", - "show_upvotes", - "theme", - "videos_muted", - ], - }, - }, - frontend: "libreddit", - redirect: (url, type, initiator, disableOverride) => { - if (this.enable && !disableOverride) return - - const targets = [/^https?:\/{2}(www\.|old\.|np\.|new\.|amp\.|)reddit\.com/, /^https?:\/{2}(i\.|preview\.)redd\.it/] - if (!targets.some(rx => rx.test(url.href))) return - - if (initiator && all().includes(initiator.origin)) return "BYPASSTAB" - if (!["main_frame", "xmlhttprequest", "other", "image", "media"].includes(type)) return - - const bypassPaths = /\/(gallery\/poll\/rpan\/settings\/topics)/ - if (url.pathname.match(bypassPaths)) return - - const protocolHost = utils.protocolHost(url) - - if (url.host === "i.redd.it") { - if (this.frontend == "libreddit") return `${protocolHost}/img${url.pathname}${url.search}` - if (this.frontend == "teddit") return `${protocolHost}/pics/w:null_${url.pathname.substring(1)}${url.search}` - } else if (url.host === "redd.it") { - // https://redd.it/foo => https://libredd.it/comments/foo - if (this.frontend == "libreddit" && !url.pathname.match(/^\/+[^\/]+\/+[^\/]/)) return `${protocolHost}/comments${url.pathname}${url.search}` - // https://redd.it/foo => https://teddit.net/comments/foo - if (this.frontend == "teddit" && !url.pathname.match(/^\/+[^\/]+\/+[^\/]/)) return `${protocolHost}/comments${url.pathname}${url.search}` - } else if (url.host === "preview.redd.it") { - if (this.frontend == "libreddit") return `${protocolHost}/preview/pre${url.pathname}${url.search}` - if (this.frontend == "teddit") return - } else { - return `${url.href}` - } - }, -}) - -export default {} diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index afd7906..eed1e6c 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -140,13 +140,23 @@ function redirect(url, type, initiator) { case "send": return randomInstance case "nitter": + let search = new URLSearchParams(url.search) + + search.delete("ref_src") + search.delete("ref_url") + + search = search.toString() + if (search !== "") search = `?${search}` + if (url.host.split(".")[0] === "pbs" || url.host.split(".")[0] === "video") { const [, id, format, extra] = url.search.match(/(.*)\?format=(.*)&(.*)/) const query = encodeURIComponent(`${id}.${format}?${extra}`) - return `${randomInstance}/pic${url.pathname}${query}` - } else if (url.pathname.split("/").includes("tweets")) return `${randomInstance}${url.pathname.replace("/tweets", "")}${url.search}` - else if (url.host == "t.co") return `${randomInstance}/t.co${url.pathname}` - else return `${randomInstance}${url.pathname}${url.search}` + return `${randomInstance}/pic${search}${query}` + } + + if (url.pathname.split("/").includes("tweets")) return `${randomInstance}${url.pathname.replace("/tweets", "")}${search}` + if (url.host == "t.co") return `${randomInstance}/t.co${url.pathname}` + return `${randomInstance}${url.pathname}${search}` case "yattee": return url.href.replace(/^https?:\/{2}/, "yattee://") case "freetube": diff --git a/src/pages/background/background.js b/src/pages/background/background.js index 7186144..cad0858 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -1,68 +1,25 @@ -<<<<<<< HEAD "use strict" import generalHelper from "../../assets/javascripts/general.js" import utils from "../../assets/javascripts/utils.js" - -import youtubeHelper from "../../assets/javascripts/youtube/youtube.js" -import youtubeMusicHelper from "../../assets/javascripts/youtubeMusic.js" -import twitterHelper from "../../assets/javascripts/twitter.js" -import instagramHelper from "../../assets/javascripts/instagram.js" -import redditHelper from "../../assets/javascripts/reddit.js" -import searchHelper from "../../assets/javascripts/search.js" -import translateHelper from "../../assets/javascripts/translate/translate.js" -import mapsHelper from "../../assets/javascripts/maps.js" -import wikipediaHelper from "../../assets/javascripts/wikipedia.js" -import mediumHelper from "../../assets/javascripts/medium.js" -import quoraHelper from "../../assets/javascripts/quora.js" -import libremdbHelper from "../../assets/javascripts/imdb.js" -import reutersHelper from "../../assets/javascripts/reuters.js" -import imgurHelper from "../../assets/javascripts/imgur.js" -import tiktokHelper from "../../assets/javascripts/tiktok.js" -import sendTargetsHelper from "../../assets/javascripts/sendTargets.js" -import peertubeHelper from "../../assets/javascripts/peertube.js" -import lbryHelper from "../../assets/javascripts/lbry.js" - -import frontend from "../../assets/javascripts/frontend.js" +import servicesHelper from "../../assets/javascripts/services.js" window.browser = window.browser || window.chrome -browser.runtime.onInstalled.addListener(details => { - function initDefaults() { +function initDefaults() { + browser.storage.local.clear(() => { fetch("/instances/blacklist.json") .then(response => response.text()) .then(async data => { - browser.storage.local.clear(() => { - browser.storage.local.set({ cloudflareBlackList: JSON.parse(data).cloudflare }, () => { - browser.storage.local.set({ authenticateBlackList: JSON.parse(data).authenticate }, () => { - browser.storage.local.set({ offlineBlackList: JSON.parse(data).offline }, () => { - generalHelper.initDefaults() - youtubeHelper.initDefaults() - youtubeMusicHelper.initDefaults() - twitterHelper.initDefaults() - instagramHelper.initDefaults() - mapsHelper.initDefaults() - searchHelper.initDefaults() - translateHelper.initDefaults() - mediumHelper.initDefaults() - quoraHelper.initDefaults() - libremdbHelper.initDefaults() - reutersHelper.initDefaults() - redditHelper.initDefaults() - wikipediaHelper.initDefaults() - imgurHelper.initDefaults() - tiktokHelper.initDefaults() - sendTargetsHelper.initDefaults() - peertubeHelper.initDefaults() - lbryHelper.initDefaults() - }) - }) - }) + browser.storage.local.set({ blacklists: JSON.parse(data) }, async () => { + await generalHelper.initDefaults() + await servicesHelper.initDefaults() }) }) - } - if (details.reason == "install") initDefaults() + }) +} +browser.runtime.onInstalled.addListener(details => { // if (details.reason == 'install' || (details.reason == "update" && details.previousVersion != browser.runtime.getManifest().version)) { // if (details.reason == "update") // browser.storage.local.get(null, r => { @@ -74,6 +31,25 @@ browser.runtime.onInstalled.addListener(details => { // }) // else initDefaults(); // } + switch (details.reason) { + case "install": + initDefaults() + break + case "update": + fetch("/instances/blacklist.json") + .then(response => response.text()) + .then(async data => { + browser.storage.local.set({ blacklists: JSON.parse(data) }, async () => { + switch (details.previousVersion) { + case "2.2.1": + await generalHelper.initDefaults() + await servicesHelper.initDefaults() + await servicesHelper.upgradeOptions() + break + } + }) + }) + } }) let BYPASSTABs = [] @@ -89,24 +65,7 @@ browser.webRequest.onBeforeRequest.addListener( return null } - let newUrl = youtubeMusicHelper.redirect(url, details.type) - if (!newUrl) newUrl = youtubeHelper.redirect(url, details.type, details.tabId, initiator) - if (!newUrl) newUrl = twitterHelper.redirect(url, details.type, initiator) - if (!newUrl) newUrl = instagramHelper.redirect(url, details.type, initiator) - if (!newUrl) newUrl = mapsHelper.redirect(url, initiator) - if (!newUrl) newUrl = redditHelper.redirect(url, details.type, initiator) - if (!newUrl) newUrl = mediumHelper.redirect(url, details.type, initiator) - if (!newUrl) newUrl = quoraHelper.redirect(url, details.type, initiator) - if (!newUrl) newUrl = libremdbHelper.redirect(url, details.type, initiator) - if (!newUrl) newUrl = reutersHelper.redirect(url, details.type, initiator) - if (!newUrl) newUrl = imgurHelper.redirect(url, details.type, initiator) - if (!newUrl) newUrl = tiktokHelper.redirect(url, details.type, initiator) - if (!newUrl) newUrl = sendTargetsHelper.redirect(url, details.type, initiator) - if (!newUrl) newUrl = peertubeHelper.redirect(url, details.type, initiator) - if (!newUrl) newUrl = lbryHelper.redirect(url, details.type, initiator) - if (!newUrl) newUrl = translateHelper.redirect(url) - if (!newUrl) newUrl = searchHelper.redirect(url) - if (!newUrl) newUrl = wikipediaHelper.redirect(url) + let newUrl = servicesHelper.redirect(url, details.type, initiator) if (details.frameAncestors && details.frameAncestors.length > 0 && generalHelper.isException(new URL(details.frameAncestors[0].url))) newUrl = null @@ -140,6 +99,7 @@ browser.tabs.onRemoved.addListener(tabId => { } }) +/* browser.webRequest.onHeadersReceived.addListener( e => { let response = youtubeHelper.removeXFrameOptions(e) @@ -149,23 +109,10 @@ browser.webRequest.onHeadersReceived.addListener( { urls: [""] }, ["blocking", "responseHeaders"] ) +*/ async function redirectOfflineInstance(url, tabId) { - let newUrl = await youtubeHelper.switchInstance(url, true) - if (!newUrl) newUrl = await twitterHelper.switchInstance(url, true) - if (!newUrl) newUrl = await instagramHelper.switchInstance(url, true) - if (!newUrl) newUrl = await redditHelper.switchInstance(url, true) - if (!newUrl) newUrl = await searchHelper.switchInstance(url, true) - if (!newUrl) newUrl = await translateHelper.switchInstance(url, true) - if (!newUrl) newUrl = await mediumHelper.switchInstance(url, true) - if (!newUrl) newUrl = await quoraHelper.switchInstance(url, true) - if (!newUrl) newUrl = await libremdbHelper.switchInstance(url, true) - if (!newUrl) newUrl = await tiktokHelper.switchInstance(url, true) - if (!newUrl) newUrl = await imgurHelper.switchInstance(url, true) - if (!newUrl) newUrl = await wikipediaHelper.switchInstance(url, true) - if (!newUrl) newUrl = await peertubeHelper.switchInstance(url, true) - if (!newUrl) newUrl = await lbryHelper.switchInstance(url, true) - if (!newUrl) newUrl = await youtubeMusicHelper.switchInstance(url, true) + let newUrl = await servicesHelper.switchInstance(url, true) if (newUrl) { if (counter >= 5) { @@ -182,7 +129,7 @@ async function redirectOfflineInstance(url, tabId) { let counter = 0 function isAutoRedirect() { - return new Promise(resolve => browser.storage.local.get("autoRedirect", r => resolve(r.autoRedirect == true))) + return new Promise(resolve => browser.storage.local.get("options", r => resolve(r.options.autoRedirect == true))) } browser.webRequest.onResponseStarted.addListener( @@ -242,198 +189,3 @@ browser.runtime.onMessage.addListener((message, sender, sendResponse) => { if (message.function === "unify") utils.unify(false).then(r => sendResponse({ response: r })) return true }) - -browser.storage.local.set({ version: browser.runtime.getManifest().version }) -======= -"use strict" - -import generalHelper from "../../assets/javascripts/general.js" -import utils from "../../assets/javascripts/utils.js" -import servicesHelper from "../../assets/javascripts/services.js" - -window.browser = window.browser || window.chrome - -function initDefaults() { - browser.storage.local.clear(() => { - fetch("/instances/blacklist.json") - .then(response => response.text()) - .then(async data => { - browser.storage.local.set({ blacklists: JSON.parse(data) }, async () => { - await generalHelper.initDefaults() - await servicesHelper.initDefaults() - }) - }) - }) -} - -browser.runtime.onInstalled.addListener(details => { - // if (details.reason == 'install' || (details.reason == "update" && details.previousVersion != browser.runtime.getManifest().version)) { - // if (details.reason == "update") - // browser.storage.local.get(null, r => { - // if (r.theme) { - // const old = encodeURIComponent(JSON.stringify(r)) - // browser.tabs.create({ url: browser.runtime.getURL(`/pages/background/reset_warning.html?data=${old}`) }); - // } - // initDefaults(); - // }) - // else initDefaults(); - // } - switch (details.reason) { - case "install": - initDefaults() - break - case "update": - fetch("/instances/blacklist.json") - .then(response => response.text()) - .then(async data => { - browser.storage.local.set({ blacklists: JSON.parse(data) }, async () => { - switch (details.previousVersion) { - case "2.2.1": - await generalHelper.initDefaults() - await servicesHelper.initDefaults() - await servicesHelper.upgradeOptions() - break - } - }) - }) - } -}) - -let BYPASSTABs = [] -browser.webRequest.onBeforeRequest.addListener( - details => { - const url = new URL(details.url) - if (new RegExp(/^chrome-extension:\/{2}.*\/instances\/.*.json$/).test(url.href) && details.type == "xmlhttprequest") return - let initiator - try { - if (details.originUrl) initiator = new URL(details.originUrl) - else if (details.initiator) initiator = new URL(details.initiator) - } catch { - return null - } - - let newUrl = servicesHelper.redirect(url, details.type, initiator) - - if (details.frameAncestors && details.frameAncestors.length > 0 && generalHelper.isException(new URL(details.frameAncestors[0].url))) newUrl = null - - if (generalHelper.isException(url)) newUrl = "BYPASSTAB" - if (BYPASSTABs.includes(details.tabId)) newUrl = null - - if (newUrl) { - if (newUrl === "CANCEL") { - console.log(`Canceled ${url}`) - return { cancel: true } - } - if (newUrl === "BYPASSTAB") { - console.log(`Bypassed ${details.tabId} ${url}`) - if (!BYPASSTABs.includes(details.tabId)) BYPASSTABs.push(details.tabId) - return null - } - console.info("Redirecting", url.href, "=>", newUrl) - return { redirectUrl: newUrl } - } - return null - }, - { urls: [""] }, - ["blocking"] -) - -browser.tabs.onRemoved.addListener(tabId => { - const i = BYPASSTABs.indexOf(tabId) - if (i > -1) { - BYPASSTABs.splice(i, 1) - console.log("Removed BYPASSTABs", tabId) - } -}) - -/* -browser.webRequest.onHeadersReceived.addListener( - e => { - let response = youtubeHelper.removeXFrameOptions(e) - if (!response) response = twitterHelper.removeXFrameOptions(e) - return response - }, - { urls: [""] }, - ["blocking", "responseHeaders"] -) -*/ - -async function redirectOfflineInstance(url, tabId) { - let newUrl = await servicesHelper.switchInstance(url, true) - - if (newUrl) { - if (counter >= 5) { - browser.tabs.update(tabId, { - url: `/pages/errors/instance_offline.html?url=${encodeURIComponent(newUrl)}`, - }) - counter = 0 - } else { - browser.tabs.update(tabId, { url: newUrl }) - counter++ - } - } -} -let counter = 0 - -function isAutoRedirect() { - return new Promise(resolve => browser.storage.local.get("options", r => resolve(r.options.autoRedirect == true))) -} - -browser.webRequest.onResponseStarted.addListener( - async details => { - if (!(await isAutoRedirect())) return null - if (details.type == "main_frame" && details.statusCode >= 500) redirectOfflineInstance(new URL(details.url), details.tabId) - }, - { urls: [""] } -) - -browser.webRequest.onErrorOccurred.addListener( - async details => { - if (!(await isAutoRedirect())) return - if (details.type == "main_frame") redirectOfflineInstance(new URL(details.url), details.tabId) - }, - { urls: [""] } -) - -browser.commands.onCommand.addListener(command => { - if (command === "switchInstance") utils.switchInstance() - else if (command == "copyRaw") utils.copyRaw() - else if (command == "unify") utils.unify() -}) - -browser.contextMenus.create({ - id: "settings", - title: browser.i18n.getMessage("Settings"), - contexts: ["browser_action"], -}) - -browser.contextMenus.create({ - id: "switchInstance", - title: browser.i18n.getMessage("switchInstance"), - contexts: ["browser_action"], -}) - -browser.contextMenus.create({ - id: "copyRaw", - title: browser.i18n.getMessage("copyRaw"), - contexts: ["browser_action"], -}) - -browser.contextMenus.create({ - id: "unify", - title: browser.i18n.getMessage("unifySettings"), - contexts: ["browser_action"], -}) - -browser.contextMenus.onClicked.addListener(info => { - if (info.menuItemId == "switchInstance") utils.switchInstance() - else if (info.menuItemId == "settings") browser.runtime.openOptionsPage() - else if (info.menuItemId == "copyRaw") utils.copyRaw() - else if (info.menuItemId == "unify") utils.unify() -}) - -browser.runtime.onMessage.addListener((message, sender, sendResponse) => { - if (message.function === "unify") utils.unify(false).then(r => sendResponse({ response: r })) - return true -}) ->>>>>>> optimizations From 1898a17f0468e34c94f10fa829d5f1d04a360fdb Mon Sep 17 00:00:00 2001 From: Hygna Date: Tue, 4 Oct 2022 21:33:53 +0100 Subject: [PATCH 48/67] Restored utils.js --- src/assets/javascripts/utils.js | 455 ++++++++++++++++++++++++++++++++ 1 file changed, 455 insertions(+) create mode 100644 src/assets/javascripts/utils.js diff --git a/src/assets/javascripts/utils.js b/src/assets/javascripts/utils.js new file mode 100644 index 0000000..9ae9123 --- /dev/null +++ b/src/assets/javascripts/utils.js @@ -0,0 +1,455 @@ +window.browser = window.browser || window.chrome + +import localise from "./localise.js" +import servicesHelper from "./services.js" + +function getRandomInstance(instances) { + return instances[~~(instances.length * Math.random())] +} + +function camelCase(str) { + return str.charAt(0).toUpperCase() + str.slice(1) +} + +let cloudflareBlackList = [] +let authenticateBlackList = [] +let offlineBlackList = [] +async function initBlackList() { + return new Promise(resolve => { + fetch("/instances/blacklist.json") + .then(response => response.text()) + .then(data => { + cloudflareBlackList = JSON.parse(data).cloudflare + authenticateBlackList = JSON.parse(data).authenticate + offlineBlackList = JSON.parse(data).offline + resolve() + }) + }) +} + +function updateInstances() { + return new Promise(async resolve => { + let http = new XMLHttpRequest() + let fallback = new XMLHttpRequest() + http.open("GET", "https://codeberg.org/LibRedirect/libredirect/raw/branch/master/src/instances/data.json", false) + http.send(null) + if (http.status != 200) { + fallback.open("GET", "https://raw.githubusercontent.com/libredirect/libredirect/master/src/instances/data.json", false) + fallback.send(null) + if (fallback.status === 200) { + http = fallback + } else { + resolve() + return + } + } + await initBlackList() + const instances = JSON.parse(http.responseText) + + servicesHelper.setRedirects(instances) + + console.info("Successfully updated Instances") + resolve(true) + return + }) +} + +function protocolHost(url) { + if (url.username && url.password) return `${url.protocol}//${url.username}:${url.password}@${url.host}` + return `${url.protocol}//${url.host}` +} + +async function processDefaultCustomInstances(service, frontend, network, document) { + let instancesLatency + let frontendNetworkElement = document.getElementById(frontend).getElementsByClassName(network)[0] + + let frontendCustomInstances = [] + let frontendCheckListElement = frontendNetworkElement.getElementsByClassName("checklist")[0] + + await initBlackList() + + let frontendDefaultRedirects + + let redirects, options + + async function getFromStorage() { + return new Promise(async resolve => + browser.storage.local.get(["options", "redirects", "latency"], r => { + frontendDefaultRedirects = r.options[frontend][network].enabled + frontendCustomInstances = r.options[frontend][network].custom + options = r.options + instancesLatency = r.latency[frontend] ?? [] + redirects = r.redirects + resolve() + }) + ) + } + + await getFromStorage() + + function calcFrontendCheckBoxes() { + let isTrue = true + for (const item of redirects[frontend][network]) { + if (!frontendDefaultRedirects.includes(item)) { + isTrue = false + break + } + } + for (const element of frontendCheckListElement.getElementsByTagName("input")) { + element.checked = frontendDefaultRedirects.includes(element.className) + } + if (frontendDefaultRedirects.length == 0) isTrue = false + frontendNetworkElement.getElementsByClassName("toggle-all")[0].checked = isTrue + } + frontendCheckListElement.innerHTML = [ + `
+ Toggle All + +
`, + ...redirects[frontend][network].map(x => { + const cloudflare = cloudflareBlackList.includes(x) ? ' cloudflare' : "" + const authenticate = authenticateBlackList.includes(x) ? ' authenticate' : "" + const offline = offlineBlackList.includes(x) ? ' offline' : "" + + let ms = instancesLatency[x] + let latencyColor = ms == -1 ? "red" : ms <= 1000 ? "green" : ms <= 2000 ? "orange" : "red" + let latencyLimit + if (ms == 5000) latencyLimit = "5000ms+" + else if (ms > 5000) latencyLimit = `ERROR: ${ms - 5000}` + else if (ms == -1) latencyLimit = "Server not found" + else latencyLimit = ms + "ms" + + const latency = x in instancesLatency ? '' + latencyLimit + "" : "" + + let warnings = [cloudflare, authenticate, offline, latency].join(" ") + return `
+ ${x}${warnings} + +
` + }), + ].join("\n
\n") + + localise.localisePage() + + calcFrontendCheckBoxes() + frontendNetworkElement.getElementsByClassName("toggle-all")[0].addEventListener("change", async event => { + if (event.target.checked) frontendDefaultRedirects = [...redirects[frontend][network]] + else frontendDefaultRedirects = [] + + options[frontend][network].enabled = frontendDefaultRedirects + browser.storage.local.set({ options }) + calcFrontendCheckBoxes() + }) + + for (let element of frontendCheckListElement.getElementsByTagName("input")) { + if (element.className != "toggle-all") + frontendNetworkElement.getElementsByClassName(element.className)[0].addEventListener("change", async event => { + if (event.target.checked) frontendDefaultRedirects.push(element.className) + else { + let index = frontendDefaultRedirects.indexOf(element.className) + if (index > -1) frontendDefaultRedirects.splice(index, 1) + } + + options[frontend][network].enabled = frontendDefaultRedirects + browser.storage.local.set({ options }) + calcFrontendCheckBoxes() + }) + } + + function calcFrontendCustomInstances() { + frontendNetworkElement.getElementsByClassName("custom-checklist")[0].innerHTML = frontendCustomInstances + .map( + x => `
+ ${x} + +
+
` + ) + .join("\n") + + for (const item of frontendCustomInstances) { + frontendNetworkElement.getElementsByClassName(`clear-${item}`)[0].addEventListener("click", async () => { + let index = frontendCustomInstances.indexOf(item) + if (index > -1) frontendCustomInstances.splice(index, 1) + options[frontend][network].custom = frontendCustomInstances + browser.storage.local.set({ options }) + calcFrontendCustomInstances() + }) + } + } + calcFrontendCustomInstances() + frontendNetworkElement.getElementsByClassName("custom-instance-form")[0].addEventListener("submit", async event => { + event.preventDefault() + let frontendCustomInstanceInput = frontendNetworkElement.getElementsByClassName("custom-instance")[0] + let url = new URL(frontendCustomInstanceInput.value) + let protocolHostVar = protocolHost(url) + if (frontendCustomInstanceInput.validity.valid && !redirects[frontend][network].includes(protocolHostVar)) { + if (!frontendCustomInstances.includes(protocolHostVar)) { + frontendCustomInstances.push(protocolHostVar) + options[frontend][network].custom = frontendCustomInstances + browser.storage.local.set({ options }) + frontendCustomInstanceInput.value = "" + } + calcFrontendCustomInstances() + } + }) +} + +function ping(href) { + return new Promise(async resolve => { + let average = 0 + let time + for (let i = 0; i < 3; i++) { + time = await pingOnce(href) + if (i == 0) continue + if (time >= 5000) { + resolve(time) + return + } + average += time + } + average = parseInt(average / 3) + resolve(average) + }) +} + +function pingOnce(href) { + return new Promise(async resolve => { + let started + let http = new XMLHttpRequest() + http.timeout = 5000 + http.ontimeout = () => resolve(5000) + http.onerror = () => resolve() + http.onreadystatechange = () => { + if (http.readyState == 2) { + if (http.status == 200) { + let ended = new Date().getTime() + http.abort() + resolve(ended - started) + } else { + resolve(5000 + http.status) + } + } + } + http.open("GET", `${href}?_=${new Date().getTime()}`, true) + started = new Date().getTime() + http.send(null) + }) +} + +async function testLatency(element, instances, frontend) { + return new Promise(async resolve => { + let myList = {} + let latencyThreshold, options + browser.storage.local.get(["options"], r => { + latencyThreshold = r.options.latencyThreshold + options = r.options + }) + for (const href of instances) { + await ping(href).then(time => { + let color + if (time) { + myList[href] = time + if (time <= 1000) color = "green" + else if (time <= 2000) color = "orange" + else color = "red" + + if (time > latencyThreshold && options[frontend].clearnet.enabled.includes(href)) { + options[frontend].clearnet.enabled.splice(options[frontend].clearnet.enabled.indexOf(href), 1) + } + + let text + if (time == 5000) text = "5000ms+" + else if (time > 5000) text = `ERROR: ${time - 5000}` + else text = `${time}ms` + element.innerHTML = `${href}: ${text}` + } else { + myList[href] = -1 + color = "red" + element.innerHTML = `${href}: Server not found` + if (options[frontend].clearnet.enabled.includes(href)) options[frontend].clearnet.enabled.splice(options[frontend].clearnet.enabled.indexOf(href), 1) + } + }) + } + browser.storage.local.set({ options }) + resolve(myList) + }) +} + +function copyCookie(frontend, targetUrl, urls, name) { + return new Promise(resolve => { + browser.storage.local.get("options", r => { + let query + if (!r.options.firstPartyIsolate) + query = { + url: protocolHost(targetUrl), + name: name, + } + else + query = { + url: protocolHost(targetUrl), + name: name, + firstPartyDomain: null, + } + browser.cookies.getAll(query, async cookies => { + for (const cookie of cookies) + if (cookie.name == name) { + for (const url of urls) { + const setQuery = r.options.firstPartyIsolate + ? { + url: url, + name: name, + value: cookie.value, + secure: true, + firstPartyDomain: new URL(url).hostname, + } + : { + url: url, + name: name, + value: cookie.value, + secure: true, + expirationDate: cookie.expirationDate, + } + browser.cookies.set(setQuery) + } + break + } + resolve() + }) + }) + }) +} + +function getPreferencesFromToken(frontend, targetUrl, urls, name, endpoint) { + return new Promise(resolve => { + const http = new XMLHttpRequest() + const url = `${targetUrl}${endpoint}` + http.open("GET", url, false) + //http.setRequestHeader("Cookie", `${name}=${cookie.value}`) + http.send(null) + const preferences = JSON.parse(http.responseText) + let formdata = new FormData() + for (var key in preferences) formdata.append(key, preferences[key]) + for (const url of urls) { + const http = new XMLHttpRequest() + http.open("POST", `${url}/settings/stay`, false) + http.send(null) + } + resolve() + return + }) +} + +function copyRaw(test, copyRawElement) { + return new Promise(resolve => { + browser.tabs.query({ active: true, currentWindow: true }, async tabs => { + let currTab = tabs[0] + if (currTab) { + let url + try { + url = new URL(currTab.url) + } catch { + resolve() + return + } + + const newUrl = await servicesHelper.reverse(url) + + if (newUrl) { + resolve(newUrl) + if (test) return + navigator.clipboard.writeText(newUrl) + if (copyRawElement) { + const textElement = copyRawElement.getElementsByTagName("h4")[0] + const oldHtml = textElement.innerHTML + textElement.innerHTML = browser.i18n.getMessage("copied") + setTimeout(() => (textElement.innerHTML = oldHtml), 1000) + } + } + } + resolve() + }) + }) +} + +function unify() { + return new Promise(resolve => { + browser.tabs.query({ active: true, currentWindow: true }, async tabs => { + let currTab = tabs[0] + if (currTab) { + let url + try { + url = new URL(currTab.url) + } catch { + resolve() + return + } + + resolve(await servicesHelper.unifyPreferences(url, currTab.id)) + } + }) + }) +} + +function switchInstance(test) { + return new Promise(resolve => { + browser.tabs.query({ active: true, currentWindow: true }, async tabs => { + let currTab = tabs[0] + if (currTab) { + let url + try { + url = new URL(currTab.url) + } catch { + resolve() + return + } + const newUrl = await servicesHelper.switchInstance(url) + + if (newUrl) { + if (!test) browser.tabs.update({ url: newUrl }) + resolve(true) + } else resolve() + } + }) + }) +} + +function latency(service, frontend, document, location) { + 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) + browser.storage.local.get(["redirects", "latency"], r => { + let redirects = r.redirects + let latency = r.latency + const oldHtml = latencyLabel.innerHTML + latencyLabel.innerHTML = "..." + testLatency(latencyLabel, redirects[frontend].clearnet, frontend).then(r => { + latency[frontend] = r + browser.storage.local.set({ latency }) + latencyLabel.innerHTML = oldHtml + processDefaultCustomInstances(service, frontend, "clearnet", document) + latencyElement.removeEventListener("click", reloadWindow) + }) + }) + }) +} + +export default { + getRandomInstance, + updateInstances, + protocolHost, + processDefaultCustomInstances, + latency, + copyCookie, + getPreferencesFromToken, + switchInstance, + copyRaw, + unify, + camelCase, +} From cd01a7083ced7f53c4d87e604f4edadce64ca49e Mon Sep 17 00:00:00 2001 From: Hygna Date: Tue, 4 Oct 2022 21:45:39 +0100 Subject: [PATCH 49/67] Added LibreTranslate --- src/assets/javascripts/services.js | 5 ++ src/config/config.json | 4 ++ src/instances/blacklist.json | 3 + src/instances/data.json | 34 ++++++++--- src/instances/get_instances.py | 7 ++- src/pages/background/background.js | 11 ---- src/pages/options/index.html | 97 ++++++++++++++++++++++++++++++ 7 files changed, 141 insertions(+), 20 deletions(-) diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index eed1e6c..572a6a9 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -163,6 +163,11 @@ function redirect(url, type, initiator) { return `freetube://https://youtu.be${url.pathname}${url.search}`.replace(/watch\?v=/, "") case "simplyTranslate": return `${randomInstance}/${url.search}` + case "libreTranslate": + return `${randomInstance}/${url.search}` + .replace(/(?<=\/?)sl/, "source") + .replace(/(?<=&)tl/, "target") + .replace(/(?<=&)text/, "q") case "osm": { if (initiator && initiator.host === "earth.google.com") return const travelModes = { diff --git a/src/config/config.json b/src/config/config.json index 09c95bb..fde17a0 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -496,6 +496,10 @@ }, "name": "Lingva Translate", "instanceList": true + }, + "libreTranslate": { + "name": "LibreTranslate", + "instanceList": true } }, "targets": ["^https?:\\/{2}translate\\.google(\\.[a-z]{2,3}){1,2}\\/", "^https?:\\/{2}translate\\.libredirect\\.invalid"], diff --git a/src/instances/blacklist.json b/src/instances/blacklist.json index edce195..90febd0 100644 --- a/src/instances/blacklist.json +++ b/src/instances/blacklist.json @@ -53,6 +53,7 @@ "https://scribe.rawbit.ninja", "https://lingva.garudalinux.org", "https://translate.dr460nf1r3.org", + "https://libretranslate.com", "https://searx.run", "https://searx.org", "https://search.garudalinux.org", @@ -77,11 +78,13 @@ "https://libreddit.notyourcomputer.net", "https://teddit.ggc-project.de", "https://teddit.tokhmi.xyz", + "https://wiki.privacytools.io", "https://quetre.odyssey346.dev", "https://st.odyssey346.dev", "https://jsearch.pw", "https://searx.gnu.style", "https://searx.semipvt.com", + "https://searx.tyil.nl", "https://etsi.me", "https://search.zzls.xyz", "https://searx.ericaftereric.top", diff --git a/src/instances/data.json b/src/instances/data.json index 839b155..fac7962 100644 --- a/src/instances/data.json +++ b/src/instances/data.json @@ -6,9 +6,11 @@ "https://invidious.snopyta.org", "https://invidious.kavin.rocks", "https://inv.riverside.rocks", + "https://invidio.xamh.de", "https://y.com.sb", "https://yt.artemislena.eu", "https://invidious.tiekoetter.com", + "https://invidious.sethforprivacy.com", "https://invidious.flokinet.to", "https://inv.bp.projectsegfau.lt", "https://inv.vern.cc", @@ -19,13 +21,11 @@ "https://invidious.slipfox.xyz", "https://invidious.esmailelbob.xyz", "https://youtube.076.ne.jp", - "https://invidious.sethforprivacy.com", - "https://invidious.namazso.eu", - "https://invidio.xamh.de" + "https://invidious.namazso.eu" ], "tor": [ + "http://w6ijuptxiku4xpnnaetxvnkc5vqcdu7mgns2u77qefoixi63vbvnpnqd.onion", "http://c7hqkpkpemu6e7emz5b4vyz7idjgdvgaaa3dyimmeojqbgpea3xqjoid.onion", - "http://kbjggqkzv65ivcqj6bumvp337z6264huv5kpkwuv6gu5yjiskvan7fad.onion", "http://grwp24hodrefzvjjuccrkw3mjq4tzhaaq32amf33dzpmuxe7ilepcmad.onion", "http://osbivz6guyeahrwp2lnwyjk2xos342h4ocsxyqrlaopqjuhwn2djiiyd.onion", "http://u2cvlit75owumwpy4dj2hsmvkq7nvrclkpht7xgyye2pyoxhpmclkrad.onion", @@ -34,7 +34,7 @@ "http://inv.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion", "http://am74vkcrjp2d5v36lcdqgsj2m6x36tbrkhsruoegwfcizzabnfgf5zyd.onion", "http://ng27owmagn5amdm7l5s3rsqxwscl5ynppnis5dqcasogkyxcfqn7psid.onion", - "http://w6ijuptxiku4xpnnaetxvnkc5vqcdu7mgns2u77qefoixi63vbvnpnqd.onion" + "http://kbjggqkzv65ivcqj6bumvp337z6264huv5kpkwuv6gu5yjiskvan7fad.onion" ], "i2p": [], "loki": [] @@ -535,6 +535,24 @@ "i2p": [], "loki": [] }, + "libreTranslate": { + "clearnet": [ + "https://libretranslate.com", + "https://libretranslate.de", + "https://translate.argosopentech.com", + "https://translate.api.skitzen.com", + "https://translate.fortytwo-it.com", + "https://translate.terraprint.co", + "https://lt.vern.cc" + ], + "tor": [ + "http://lt.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion" + ], + "i2p": [ + "http://vernf45n7mxwqnp5riaax7p67pwcl7wcefdcnqqvim7ckdx4264a.b32.i2p" + ], + "loki": [] + }, "searx": { "clearnet": [ "https://dynabyte.ca", @@ -572,12 +590,10 @@ "https://suche.uferwerk.org", "https://sx.catgirl.cloud", "https://timdor.noip.me/searx", - "https://xo.wtf", "https://searx.roflcopter.fr" ], "tor": [ "http://3afisqjw2rxm6z7mmstyt5rx75qfqrgxnkzftknbp2vhipr2nrmrjdyd.onion", - "http://w5rl6wsd7mzj4bdkbuqvzidet5osdsm5jhg2f7nvfidakfq5exda5wid.onion", "http://yra4tke2pwcnatxjkufpw6kvebu3h3ti2jca2lcdpgx3mpwol326lzid.onion", "http://z5vawdol25vrmorm4yydmohsd4u6rdoj2sylvoi3e3nqvxkvpqul7bqd.onion", "http://zbuc3bbzbfdqqo2x46repx2ddajbha6fpsjeeptjhhhhzji3zopxdqyd.onion", @@ -667,9 +683,11 @@ "https://trydex.tk/searxng", "https://www.gruble.de", "https://www.webrats.xyz", - "https://xcxc.ml" + "https://xcxc.ml", + "https://xo.wtf" ], "tor": [ + "http://w5rl6wsd7mzj4bdkbuqvzidet5osdsm5jhg2f7nvfidakfq5exda5wid.onion", "http://4n53nafyi77iplnbrpmxnp3x4exbswwxigujaxy3b37fvr7bvlopxeyd.onion", "http://privateoz3u5utrimal2edr56j3r5caakektxxgixigdkycuxigvquid.onion", "http://b6sxmon57qza6dt36li7huabie5ntrvjr4q5rc2vvbn4hqvzd4phrvyd.onion", diff --git a/src/instances/get_instances.py b/src/instances/get_instances.py index 96902fe..9fc64ad 100644 --- a/src/instances/get_instances.py +++ b/src/instances/get_instances.py @@ -309,7 +309,7 @@ def bibliogram(): def libreddit(): - fetchRegexList('libreddit', 'Libreddit', 'https://raw.githubusercontent.com/spikecodes/libreddit/master/README.md', r"\| \[.*\]\(([-a-zA-Z0-9@:%_\+.~#?&//=]{2,}\.[a-z]{2,}\b(?:\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?)\)*\|*[A-Z]{0,}.*\|.*\|") + fetchJsonList('libreddit', 'Libreddit', 'https://github.com/libbacon/libreddit-instances/raw/master/instances.json', {'clearnet': 'url', 'tor': 'onion', 'i2p': 'i2p', 'loki': None}, True) def teddit(): @@ -433,6 +433,10 @@ def facil(): fetchFromFile('facil', 'FacilMap') +def libreTranslate(): + fetchRegexList('libreTranslate', 'LibreTranslate', 'https://raw.githubusercontent.com/LibreTranslate/LibreTranslate/main/README.md', r"\[(?:[^\s\/]+\.)+[a-zA-Z0-9]+\]\((https?:\/{2}(?:[^\s\/]+\.)+[a-zA-Z0-9]+)\/?\)\|") + + def peertube(): r = requests.get( 'https://instances.joinpeertube.org/api/v1/instances?start=0&count=1045&sort=-createdAt') @@ -470,6 +474,7 @@ quetre() libremdb() simplytranslate() linvgatranslate() +libreTranslate() searx_searxng() whoogle() librex() diff --git a/src/pages/background/background.js b/src/pages/background/background.js index cad0858..e8d0fd7 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -20,17 +20,6 @@ function initDefaults() { } browser.runtime.onInstalled.addListener(details => { - // if (details.reason == 'install' || (details.reason == "update" && details.previousVersion != browser.runtime.getManifest().version)) { - // if (details.reason == "update") - // browser.storage.local.get(null, r => { - // if (r.theme) { - // const old = encodeURIComponent(JSON.stringify(r)) - // browser.tabs.create({ url: browser.runtime.getURL(`/pages/background/reset_warning.html?data=${old}`) }); - // } - // initDefaults(); - // }) - // else initDefaults(); - // } switch (details.reason) { case "install": initDefaults() diff --git a/src/pages/options/index.html b/src/pages/options/index.html index 53ee562..323984e 100644 --- a/src/pages/options/index.html +++ b/src/pages/options/index.html @@ -2863,6 +2863,7 @@ @@ -3058,6 +3059,102 @@
+ +
+
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+
+ + +
+
+
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+
+
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+
+
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+
+
From a96f3188b7eac79f19f2bd438b13a310d3cea90b Mon Sep 17 00:00:00 2001 From: Hygna Date: Wed, 5 Oct 2022 17:29:27 +0100 Subject: [PATCH 50/67] Changes: Added BreezeWiki as a frontend for Fandom Closes https://github.com/libredirect/libredirect/issues/444 Futureproofed bug caused by adding new frontend/service --- src/assets/images/fandom-icon.svg | 1 + src/assets/javascripts/services.js | 56 ++++++++++++++ src/config/config.json | 14 ++++ src/instances/blacklist.json | 23 ++---- src/instances/data.json | 115 ++++++--------------------- src/instances/get_instances.py | 5 ++ src/pages/background/background.js | 3 + src/pages/options/index.html | 120 +++++++++++++++++++++++++++++ src/pages/popup/popup.html | 10 +++ 9 files changed, 238 insertions(+), 109 deletions(-) create mode 100644 src/assets/images/fandom-icon.svg diff --git a/src/assets/images/fandom-icon.svg b/src/assets/images/fandom-icon.svg new file mode 100644 index 0000000..0cd873b --- /dev/null +++ b/src/assets/images/fandom-icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 572a6a9..d7cb520 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -386,6 +386,11 @@ function redirect(url, type, initiator) { return `${randomInstance}/${params.sl}/${params.tl}/${params.text}` } return randomInstance + case "breezeWiki": + let wiki = url.hostname.match(/^[a-zA-Z0-9]+(?=\.fandom\.com)/) + if (wiki == "www" || !wiki) wiki = "" + else wiki = "/" + wiki + return `${randomInstance}${wiki}${url.pathname}${url.search}`.replace(/Special:Search\?query/, "search?q") default: return `${randomInstance}${url.pathname}${url.search}` } @@ -685,6 +690,56 @@ function upgradeOptions() { }) } +function processUpdate() { + return new Promise(resolve => { + fetch("/instances/data.json") + .then(response => response.text()) + .then(data => { + fetch("/config/config.json") + .then(response => response.text()) + .then(configData => { + browser.storage.local.get(["options", "blacklists", "targets"], r => { + let redirects = JSON.parse(data) + let options = r.options + let targets = r.targets + let config = JSON.parse(configData) + for (const service in config.services) { + if (!options[service]) { + options[service] = {} + if (config.services[service].targets == "datajson") { + targets[service] = redirects[service] + } + for (const defaultOption in config.services[service].options) { + options[service][defaultOption] = config.services[service].options[defaultOption] + } + } + for (const frontend in config.services[service].frontends) { + if (!options[service][frontend]) { + if (config.services[service].frontends[frontend].instanceList) { + options[frontend] = {} + for (const network in config.networks) { + options[frontend][network] = {} + options[frontend][network].enabled = JSON.parse(data)[frontend][network] + options[frontend][network].custom = [] + } + for (const blacklist in r.blacklists) { + for (const instance of r.blacklists[blacklist]) { + let i = options[frontend].clearnet.enabled.indexOf(instance) + if (i > -1) options[frontend].clearnet.enabled.splice(i, 1) + } + } + } + } + } + } + browser.storage.local.set({ redirects, options, targets }) + resolve() + }) + }) + }) + }) +} + export default { redirect, computeService, @@ -694,4 +749,5 @@ export default { setRedirects, initDefaults, upgradeOptions, + processUpdate, } diff --git a/src/config/config.json b/src/config/config.json index fde17a0..6119583 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -362,6 +362,20 @@ "embeddable": false, "url": "https://reuters.com" }, + "fandom": { + "frontends": { + "breezeWiki": { + "name": "BreezeWiki", + "instanceList": true + } + }, + "targets": ["^https?:\\/{2}(?:[a-zA-Z0-9]+\\.)?fandom\\.com(?=(?:\\/wiki)|(?:\\/?$))"], + "name": "Fandom", + "options": { "enabled": true }, + "imageType": "svg", + "embeddable": false, + "url": "https://fandom.com" + }, "peertube": { "frontends": { "simpleertube": { diff --git a/src/instances/blacklist.json b/src/instances/blacklist.json index 90febd0..d75c36d 100644 --- a/src/instances/blacklist.json +++ b/src/instances/blacklist.json @@ -28,18 +28,6 @@ "https://n.sneed.network", "https://nitter.twei.space", "https://nitter.d420.de", - "https://libreddit.domain.glass", - "https://r.nf", - "https://libreddit.hu", - "https://lr.stilic.ml", - "https://reddi.tk", - "https://r.walkx.org", - "https://libreddit.yonalee.eu", - "https://libreddit.winscloud.net", - "https://r.ahwx.org", - "https://reddit.dr460nf1r3.org", - "https://libreddit.encrypted-data.xyz", - "https://libreddit.eu.org", "https://teddit.domain.glass", "https://teddit.httpjames.space", "https://teddit.encrypted-data.xyz", @@ -73,18 +61,14 @@ "https://nhanh.cloud", "https://nitter.winscloud.net", "https://ntr.odyssey346.dev", - "https://libreddit.yonalee.eu", - "https://libreddit.winscloud.net", - "https://libreddit.notyourcomputer.net", "https://teddit.ggc-project.de", "https://teddit.tokhmi.xyz", - "https://wiki.privacytools.io", "https://quetre.odyssey346.dev", + "https://simplytranslate.org", "https://st.odyssey346.dev", "https://jsearch.pw", "https://searx.gnu.style", "https://searx.semipvt.com", - "https://searx.tyil.nl", "https://etsi.me", "https://search.zzls.xyz", "https://searx.ericaftereric.top", @@ -93,7 +77,10 @@ "https://whoogle.esmailelbob.xyz", "https://search.wef.lol", "https://i.bcow.xyz", + "https://rimgo.totaldarkness.net", + "https://imgur.artemislena.eu", "https://lbry.bcow.xyz", - "https://beatbump.ml" + "https://beatbump.ml", + "https://bw.odyssey346.dev" ] } \ No newline at end of file diff --git a/src/instances/data.json b/src/instances/data.json index fac7962..eaefc4e 100644 --- a/src/instances/data.json +++ b/src/instances/data.json @@ -13,19 +13,20 @@ "https://invidious.sethforprivacy.com", "https://invidious.flokinet.to", "https://inv.bp.projectsegfau.lt", - "https://inv.vern.cc", "https://invidious.nerdvpn.de", "https://invidious.projectsegfau.lt", "https://invidious.rhyshl.live", "https://inv.privacy.com.de", "https://invidious.slipfox.xyz", - "https://invidious.esmailelbob.xyz", "https://youtube.076.ne.jp", + "https://invidious.esmailelbob.xyz", + "https://inv.vern.cc", "https://invidious.namazso.eu" ], "tor": [ - "http://w6ijuptxiku4xpnnaetxvnkc5vqcdu7mgns2u77qefoixi63vbvnpnqd.onion", "http://c7hqkpkpemu6e7emz5b4vyz7idjgdvgaaa3dyimmeojqbgpea3xqjoid.onion", + "http://w6ijuptxiku4xpnnaetxvnkc5vqcdu7mgns2u77qefoixi63vbvnpnqd.onion", + "http://kbjggqkzv65ivcqj6bumvp337z6264huv5kpkwuv6gu5yjiskvan7fad.onion", "http://grwp24hodrefzvjjuccrkw3mjq4tzhaaq32amf33dzpmuxe7ilepcmad.onion", "http://osbivz6guyeahrwp2lnwyjk2xos342h4ocsxyqrlaopqjuhwn2djiiyd.onion", "http://u2cvlit75owumwpy4dj2hsmvkq7nvrclkpht7xgyye2pyoxhpmclkrad.onion", @@ -33,8 +34,7 @@ "http://invidious.esmail5pdn24shtvieloeedh7ehz3nrwcdivnfhfcedl7gf4kwddhkqd.onion", "http://inv.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion", "http://am74vkcrjp2d5v36lcdqgsj2m6x36tbrkhsruoegwfcizzabnfgf5zyd.onion", - "http://ng27owmagn5amdm7l5s3rsqxwscl5ynppnis5dqcasogkyxcfqn7psid.onion", - "http://kbjggqkzv65ivcqj6bumvp337z6264huv5kpkwuv6gu5yjiskvan7fad.onion" + "http://ng27owmagn5amdm7l5s3rsqxwscl5ynppnis5dqcasogkyxcfqn7psid.onion" ], "i2p": [], "loki": [] @@ -51,9 +51,7 @@ "https://piped.garudalinux.org", "https://y.rivo.lol", "https://yt.jae.fi", - "https://piped.mint.lgbt", "https://il.ax", - "https://piped.esmailelbob.xyz", "https://piped.projectsegfau.lt", "https://piped.privacydev.net", "https://piped.smnz.de", @@ -208,7 +206,8 @@ "https://nitter.caioalonso.com", "https://nitter.at", "https://nitter.drivet.xyz", - "https://nitter.pw" + "https://nitter.pw", + "https://nitter.nicfab.eu" ], "tor": [ "http://nitter7bryz3jv7e3uekphigvmoyoem4al3fynerxkj22dmoxoq553qd.onion", @@ -261,87 +260,8 @@ "loki": [] }, "libreddit": { - "clearnet": [ - "https://libredd.it", - "https://libreddit.spike.codes", - "https://libreddit.dothq.co", - "https://libreddit.kavin.rocks", - "https://reddit.invak.id", - "https://reddit.phii.me", - "https://lr.riverside.rocks", - "https://libreddit.strongthany.cc", - "https://libreddit.database.red", - "https://libreddit.privacy.com.de", - "https://libreddit.domain.glass", - "https://libreddit.sugoma.tk", - "https://libreddit.jamiethalacker.dev", - "https://reddit.artemislena.eu", - "https://r.nf", - "https://libreddit.some-things.org", - "https://reddit.stuehieyr.com", - "https://lr.mint.lgbt", - "https://libreddit.igna.rocks", - "https://libreddit.autarkic.org", - "https://libreddit.flux.industries", - "https://libreddit.drivet.xyz", - "https://lr.oversold.host", - "https://libreddit.de", - "https://libreddit.pussthecat.org", - "https://libreddit.mutahar.rocks", - "https://libreddit.northboot.xyz", - "https://leddit.xyz", - "https://de.leddit.xyz", - "https://lr.cowfee.moe", - "https://libreddit.hu", - "https://libreddit.totaldarkness.net", - "https://libreddit.esmailelbob.xyz", - "https://lr.vern.cc", - "https://libreddit.nl", - "https://lr.stilic.ml", - "https://reddi.tk", - "https://libreddit.bus-hit.me", - "https://libreddit.datatunnel.xyz", - "https://libreddit.crewz.me", - "https://r.walkx.org", - "https://libreddit.kylrth.com", - "https://libreddit.yonalee.eu", - "https://libreddit.winscloud.net", - "https://libreddit.tiekoetter.com", - "https://reddit.rtrace.io", - "https://libreddit.lunar.icu", - "https://libreddit.privacydev.net", - "https://libreddit.notyourcomputer.net", - "https://r.ahwx.org", - "https://bob.fr.to", - "https://reddit.beparanoid.de", - "https://libreddit.dcs0.hu", - "https://reddit.dr460nf1r3.org", - "https://rd.jae.su", - "https://libreddit.mha.fi", - "https://libreddit.foss.wtf", - "https://libreddit.encrypted-data.xyz", - "https://libreddit.eu.org", - "https://l.opnxng.com" - ], - "tor": [ - "http://spjmllawtheisznfs7uryhxumin26ssv2draj7oope3ok3wuhy43eoyd.onion", - "http://fwhhsbrbltmrct5hshrnqlqygqvcgmnek3cnka55zj4y7nuus5muwyyd.onion", - "http://kphht2jcflojtqte4b4kyx7p2ahagv4debjj32nre67dxz7y57seqwyd.onion", - "http://inytumdgnri7xsqtvpntjevaelxtgbjqkuqhtf6txxhwbll2fwqtakqd.onion", - "http://liredejj74h5xjqr2dylnl5howb2bpikfowqoveub55ru27x43357iid.onion", - "http://kzhfp3nvb4qp575vy23ccbrgfocezjtl5dx66uthgrhu7nscu6rcwjyd.onion", - "http://ecue64ybzvn6vjzl37kcsnwt4ycmbsyf74nbttyg7rkc3t3qwnj7mcyd.onion", - "http://ledditqo2mxfvlgobxnlhrkq4dh34jss6evfkdkb2thlvy6dn4f4gpyd.onion", - "http://libredoxhxwnmsb6dvzzd35hmgzmawsq5i764es7witwhddvpc2razid.onion", - "http://libreddit.2syis2nnyytz6jnusnjurva4swlaizlnleiks5mjp46phuwjbdjqwgqd.onion", - "http://ol5begilptoou34emq2sshf3may3hlblvipdjtybbovpb7c7zodxmtqd.onion", - "http://lbrdtjaj7567ptdd4rv74lv27qhxfkraabnyphgcvptl64ijx2tijwid.onion", - "http://libreddit.lqs5fjmajyp7rvp4qvyubwofzi6d4imua7vs237rkc4m5qogitqwrgyd.onion", - "http://reddit.prnoid54e44a4bduq5due64jkk7wcnkxcp5kv3juncm7veptjcqudgyd.onion", - "http://inz6tbezfwzexva6dize4cqraj2tjdhygxabmcgysccesvw2pybzhbyd.onion", - "http://libreddit.micohauwkjbyw5meacrb4ipicwvwg4xtzl7y7viv53kig2mdcsvwkyyd.onion", - "http://lr.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion" - ], + "clearnet": [], + "tor": [], "i2p": [], "loki": [] }, @@ -596,8 +516,10 @@ "http://3afisqjw2rxm6z7mmstyt5rx75qfqrgxnkzftknbp2vhipr2nrmrjdyd.onion", "http://yra4tke2pwcnatxjkufpw6kvebu3h3ti2jca2lcdpgx3mpwol326lzid.onion", "http://z5vawdol25vrmorm4yydmohsd4u6rdoj2sylvoi3e3nqvxkvpqul7bqd.onion", + "http://searxdr3pqz4nydgnqocsia2xbywptxbkympa2emn7zlgggrir4bkfad.onion", "http://zbuc3bbzbfdqqo2x46repx2ddajbha6fpsjeeptjhhhhzji3zopxdqyd.onion", "http://f4qfqajszpx5b7itzxt6mb7kj4ktpgbdq7lq6xaiqyqx6a7de3epptad.onion", + "http://searx.esmail5pdn24shtvieloeedh7ehz3nrwcdivnfhfcedl7gf4kwddhkqd.onion", "http://searx.micohauwkjbyw5meacrb4ipicwvwg4xtzl7y7viv53kig2mdcsvwkyyd.onion" ], "i2p": [ @@ -694,8 +616,6 @@ "http://searxngg6zleq6ceboe5ltkyo4hyrb3aaycrgzmrljv3jjlb5vcytead.onion", "http://gbat2pbpg7ys3fi3pbp64667tt5x66mg45xok35bxdw7v55brm7a27yd.onion", "http://b2c7fvbhnfvwnl6oh2tydhzfx4i37kmmrycq42heqbbe7wovq3uzenid.onion", - "http://searxdr3pqz4nydgnqocsia2xbywptxbkympa2emn7zlgggrir4bkfad.onion", - "http://searx.esmail5pdn24shtvieloeedh7ehz3nrwcdivnfhfcedl7gf4kwddhkqd.onion", "http://searxfilowxokbogygrigir4wqxfxqzuxofxgdon7dg6rsii4yxzytyd.onion", "http://searx.privpw3tndpkw6pnp3g727zfgfdzbu3k6a7chv226s3xymv2p4eiuqyd.onion", "http://rq2w52kyrif3xpfihkgjnhqm3a5aqhoikpv72z3drpjglfzc2wr5z4yd.onion", @@ -829,8 +749,21 @@ "i2p": [], "loki": [] }, + "breezeWiki": { + "clearnet": [ + "https://breezewiki.com", + "https://breezewiki.pussthecat.org", + "https://bw.odyssey346.dev", + "https://bw.vern.cc", + "https://breezewiki.esmailelbob.xyz" + ], + "tor": [], + "i2p": [], + "loki": [] + }, "peertube": [ "https://search.joinpeertube.org", + "https://freedomadultgames.video", "https://tbh.co-shaoghal.net", "https://tube.kansanvalta.org", "https://duanrra.cf", diff --git a/src/instances/get_instances.py b/src/instances/get_instances.py index 9fc64ad..fc730cf 100644 --- a/src/instances/get_instances.py +++ b/src/instances/get_instances.py @@ -437,6 +437,10 @@ def libreTranslate(): fetchRegexList('libreTranslate', 'LibreTranslate', 'https://raw.githubusercontent.com/LibreTranslate/LibreTranslate/main/README.md', r"\[(?:[^\s\/]+\.)+[a-zA-Z0-9]+\]\((https?:\/{2}(?:[^\s\/]+\.)+[a-zA-Z0-9]+)\/?\)\|") +def breezeWiki(): + fetchRegexList('breezeWiki', 'BreezeWiki', 'https://gitdab.com/cadence/breezewiki-docs/raw/branch/main/docs.scrbl', r"\(\"[^\n\s\r\t\f\v\"]+\" \"https?:\/{2}(?:[^\s\/]+\.)+[a-zA-Z0-9]+(?:\/[^\s\/]+)*\" \"(https?:\/{2}(?:[^\s\/]+\.)+[a-zA-Z0-9]+(?:\/[^\s\/]+)*)\"\)") + + def peertube(): r = requests.get( 'https://instances.joinpeertube.org/api/v1/instances?start=0&count=1045&sort=-createdAt') @@ -485,6 +489,7 @@ beatbump() hyperpipe() facil() simpleertube() +breezeWiki() mightyList = filterLastSlash(mightyList) mightyList = idnaEncode(mightyList) diff --git a/src/pages/background/background.js b/src/pages/background/background.js index e8d0fd7..3f0e0fd 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -30,11 +30,14 @@ browser.runtime.onInstalled.addListener(details => { .then(async data => { browser.storage.local.set({ blacklists: JSON.parse(data) }, async () => { switch (details.previousVersion) { + case "2.2.0": case "2.2.1": await generalHelper.initDefaults() await servicesHelper.initDefaults() await servicesHelper.upgradeOptions() break + default: + await servicesHelper.processUpdate() } }) }) diff --git a/src/pages/options/index.html b/src/pages/options/index.html index 323984e..faeb512 100644 --- a/src/pages/options/index.html +++ b/src/pages/options/index.html @@ -84,6 +84,11 @@ Reuters +
+
+ + +
+ +
+
@@ -2200,6 +2212,114 @@
+ +
+
+

Fandom

+
+
+
+

Enable

+ +
+
+
+
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+
+ + +
+
+
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+
+
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+
+
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+
+ +
+
+

PeerTube

@@ -186,6 +191,11 @@

Reuters

+

PeerTube

From 12b6f9cdbb8bb20452b900c51edd69bea6c489a5 Mon Sep 17 00:00:00 2001 From: Hygna Date: Wed, 5 Oct 2022 18:00:27 +0100 Subject: [PATCH 51/67] Added search redirections from Fandom to BreezeWiki --- src/assets/javascripts/services.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index d7cb520..944a6d3 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -390,7 +390,8 @@ function redirect(url, type, initiator) { let wiki = url.hostname.match(/^[a-zA-Z0-9]+(?=\.fandom\.com)/) if (wiki == "www" || !wiki) wiki = "" else wiki = "/" + wiki - return `${randomInstance}${wiki}${url.pathname}${url.search}`.replace(/Special:Search\?query/, "search?q") + if (url.href.search(/Special:Search\?query/) > -1) return `${randomInstance}${wiki}${url.pathname}${url.search}`.replace(/Special:Search\?query/, "search?q").replace(/\/wiki/, "") + else return `${randomInstance}${wiki}${url.pathname}${url.search}` default: return `${randomInstance}${url.pathname}${url.search}` } From beaaeb1d309555531a22e350b73ff014cccd1e16 Mon Sep 17 00:00:00 2001 From: Hygna Date: Wed, 5 Oct 2022 19:27:27 +0100 Subject: [PATCH 52/67] Added support for i.stack.imgur.com and rimgo embeds Closes https://codeberg.org/LibRedirect/libredirect/issues/18 --- src/assets/javascripts/services.js | 16 ++++++++++++++-- src/config/config.json | 10 +++++++--- src/pages/options/index.html | 10 +++++++++- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 944a6d3..98f1776 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -61,6 +61,7 @@ function regexArray(service, url, config) { } function redirect(url, type, initiator) { + if (type != "main_frame" && type != "sub_frame") return let randomInstance let frontend for (const service in config.services) { @@ -392,6 +393,9 @@ function redirect(url, type, initiator) { else wiki = "/" + wiki if (url.href.search(/Special:Search\?query/) > -1) return `${randomInstance}${wiki}${url.pathname}${url.search}`.replace(/Special:Search\?query/, "search?q").replace(/\/wiki/, "") else return `${randomInstance}${wiki}${url.pathname}${url.search}` + case "rimgo": + if (url.href.search(/^https?:\/{2}(?:[im]\.)?stack\./) > -1) return `${randomInstance}/stack${url.pathname}${url.search}` + else return `${randomInstance}${url.pathname}${url.search}` default: return `${randomInstance}${url.pathname}${url.search}` } @@ -440,8 +444,16 @@ function switchInstance(url) { for (const service in config.services) { if (!all(service, null, options, config, redirects).includes(protocolHost)) continue - let instancesList = [...options[options[service].frontend][options.network].enabled, ...options[options[service].frontend][options.network].custom] - if (instancesList.length === 0 && options.networkFallback) instancesList = [...options[options[service].frontend].clearnet.enabled, ...options[options[service].frontend].clearnet.custom] + let instancesList + if (Object.keys(config.services[service].frontends).length == 1) { + const frontend = Object.keys(config.services[service].frontends)[0] + instancesList = [...options[frontend][options.network].enabled, ...options[frontend][options.network].custom] + if (instancesList.length === 0 && options.networkFallback) instancesList = [...options[frontend].clearnet.enabled, ...options[frontend].clearnet.custom] + } else { + const frontend = options[service].frontend + instancesList = [...options[frontend][options.network].enabled, ...options[frontend][options.network].custom] + if (instancesList.length === 0 && options.networkFallback) instancesList = [...options[frontend].clearnet.enabled, ...options[frontend].clearnet.custom] + } let oldInstance const i = instancesList.indexOf(protocolHost) diff --git a/src/config/config.json b/src/config/config.json index 6119583..9716826 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -254,14 +254,18 @@ "frontends": { "rimgo": { "name": "rimgo", + "embeddable": true, "instanceList": true } }, - "targets": ["^https?:\\/{2}([im]\\.)?imgur\\.(com|io)(\\/|$)"], + "targets": ["^https?:\\/{2}([im]\\.)?(stack\\.)?imgur\\.(com|io)(\\/|$)"], "name": "Imgur", - "options": { "enabled": true }, + "options": { + "enabled": true, + "redirectType": "both" + }, "imageType": "png", - "embeddable": false, + "embeddable": true, "url": "https://imgur.com" }, "wikipedia": { diff --git a/src/pages/options/index.html b/src/pages/options/index.html index faeb512..597d7cb 100644 --- a/src/pages/options/index.html +++ b/src/pages/options/index.html @@ -1574,7 +1574,15 @@

Enable

-
+
+

Redirect Type

+ +
+
From c0b93130f00fbef01e89d3318a68bc56e1e347ed Mon Sep 17 00:00:00 2001 From: Hygna Date: Thu, 6 Oct 2022 08:29:34 +0100 Subject: [PATCH 53/67] Fixed Libreddit and LibreX instance fetching --- src/instances/get_instances.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/instances/get_instances.py b/src/instances/get_instances.py index fc730cf..f0fa849 100644 --- a/src/instances/get_instances.py +++ b/src/instances/get_instances.py @@ -141,6 +141,8 @@ def fetchJsonList(frontend, name, url, urlItem, jsonObject): try: r = requests.get(url) rJson = json.loads(r.text) + if jsonObject: + rJson = rJson['instances'] _list = {} for network in config['networks']: _list[network] = [] @@ -148,12 +150,10 @@ def fetchJsonList(frontend, name, url, urlItem, jsonObject): for item in rJson: for network in config['networks']: if urlItem[network] is not None: - if urlItem[network] in item: + if urlItem[network] in item and item[urlItem[network]] is not None: if item[urlItem[network]].strip() != '': _list[network].append(item[urlItem[network]]) else: - if jsonObject: - rJson = rJson['instances'] for item in rJson: tmpItem = item if urlItem is not None: From 3bd83642f367d1b27d1acfa7ebd4ef6ba7116fcb Mon Sep 17 00:00:00 2001 From: Hygna Date: Thu, 6 Oct 2022 11:12:35 +0100 Subject: [PATCH 54/67] Made peertube instance list use cache if it fails --- src/instances/get_instances.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/instances/get_instances.py b/src/instances/get_instances.py index f0fa849..2f3c75d 100644 --- a/src/instances/get_instances.py +++ b/src/instances/get_instances.py @@ -442,16 +442,19 @@ def breezeWiki(): def peertube(): - r = requests.get( - 'https://instances.joinpeertube.org/api/v1/instances?start=0&count=1045&sort=-createdAt') - rJson = json.loads(r.text) + try: + r = requests.get( + 'https://instances.joinpeertube.org/api/v1/instances?start=0&count=1045&sort=-createdAt') + rJson = json.loads(r.text) - myList = ['https://search.joinpeertube.org'] - for k in rJson['data']: - myList.append('https://'+k['host']) + myList = ['https://search.joinpeertube.org'] + for k in rJson['data']: + myList.append('https://'+k['host']) - mightyList['peertube'] = myList - print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'PeerTube') + mightyList['peertube'] = myList + print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'PeerTube') + except Exception: + fetchCache('peertube', 'PeerTube') def isValid(url): # This code is contributed by avanitrachhadiya2155 From 04fd2de0bb051a9cde33095f0d338f4700c335ce Mon Sep 17 00:00:00 2001 From: Hygna Date: Thu, 6 Oct 2022 14:19:05 +0100 Subject: [PATCH 55/67] Fixed twimg redirects Closes https://github.com/libredirect/libredirect/issues/307 --- src/assets/javascripts/services.js | 53 ++++++++++++------------------ 1 file changed, 21 insertions(+), 32 deletions(-) diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 98f1776..af3e238 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -150,9 +150,13 @@ function redirect(url, type, initiator) { if (search !== "") search = `?${search}` if (url.host.split(".")[0] === "pbs" || url.host.split(".")[0] === "video") { - const [, id, format, extra] = url.search.match(/(.*)\?format=(.*)&(.*)/) - const query = encodeURIComponent(`${id}.${format}?${extra}`) - return `${randomInstance}/pic${search}${query}` + try { + const [, id, format, extra] = search.match(/(.*)\?format=(.*)&(.*)/) + const query = encodeURIComponent(`${id}.${format}?${extra}`) + return `${randomInstance}/pic${url.pathname}${query}` + } catch { + return `${randomInstance}/pic${url.pathname}${search}` + } } if (url.pathname.split("/").includes("tweets")) return `${randomInstance}${url.pathname.replace("/tweets", "")}${search}` @@ -412,20 +416,13 @@ function computeService(url, returnFrontend) { const options = r.options for (const service in config.services) { if (regexArray(service, url, config)) { - if (returnFrontend) { - resolve([service, null]) - } else { - resolve(service) - } + resolve(service) return } else { for (const frontend in config.services[service].frontends) { if (all(service, frontend, options, config, redirects).includes(utils.protocolHost(url))) { - if (returnFrontend) { - resolve([service, frontend]) - } else { - resolve(service) - } + if (returnFrontend) resolve([service, frontend, url.hostname]) + else resolve(service) return } } @@ -601,12 +598,8 @@ function initDefaults() { const latency = {} for (const service in config.services) { options[service] = {} - if (config.services[service].targets == "datajson") { - targets[service] = redirects[service] - } - for (const defaultOption in config.services[service].options) { - options[service][defaultOption] = config.services[service].options[defaultOption] - } + if (config.services[service].targets == "datajson") targets[service] = redirects[service] + for (const defaultOption in config.services[service].options) options[service][defaultOption] = config.services[service].options[defaultOption] for (const frontend in config.services[service].frontends) { if (config.services[service].frontends[frontend].instanceList) { options[frontend] = {} @@ -717,24 +710,20 @@ function processUpdate() { let targets = r.targets let config = JSON.parse(configData) for (const service in config.services) { - if (!options[service]) { - options[service] = {} - if (config.services[service].targets == "datajson") { - targets[service] = redirects[service] - } - for (const defaultOption in config.services[service].options) { - options[service][defaultOption] = config.services[service].options[defaultOption] - } - } + if (!options[service]) options[service] = {} + if (config.services[service].targets == "datajson") targets[service] = redirects[service] + for (const defaultOption in config.services[service].options) if (!options[service][defaultOption]) options[service][defaultOption] = config.services[service].options[defaultOption] for (const frontend in config.services[service].frontends) { - if (!options[service][frontend]) { - if (config.services[service].frontends[frontend].instanceList) { - options[frontend] = {} - for (const network in config.networks) { + if (config.services[service].frontends[frontend].instanceList) { + for (const network in config.networks) { + if (!options[frontend][network]) { options[frontend][network] = {} options[frontend][network].enabled = JSON.parse(data)[frontend][network] options[frontend][network].custom = [] } + } + if (!options[service][frontend]) { + options[frontend] = {} for (const blacklist in r.blacklists) { for (const instance of r.blacklists[blacklist]) { let i = options[frontend].clearnet.enabled.indexOf(instance) From 9b996dcdf2af3cd9a91919cbbca9ea1dbe538f62 Mon Sep 17 00:00:00 2001 From: Hygna Date: Thu, 6 Oct 2022 21:12:51 +0100 Subject: [PATCH 56/67] Fixed some more bugs --- src/assets/javascripts/services.js | 18 +++++++++--------- src/pages/popup/popup.js | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index af3e238..a102a29 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -73,7 +73,7 @@ function redirect(url, type, initiator) { if (!regexArray(service, url, config)) continue if (initiator) { if (targets.test(initiator.host)) continue - if (all(service, null, options, config, redirects).includes(initiator.origin)) return "BYPASSTAB" + if (all(service, null, options, config, redirects).includes(initiator.origin) && reverse(initiator) == url) return "BYPASSTAB" } if (Object.keys(config.services[service].frontends).length > 1) { @@ -715,19 +715,19 @@ function processUpdate() { for (const defaultOption in config.services[service].options) if (!options[service][defaultOption]) options[service][defaultOption] = config.services[service].options[defaultOption] for (const frontend in config.services[service].frontends) { if (config.services[service].frontends[frontend].instanceList) { + if (!options[frontend]) options[frontend] = {} for (const network in config.networks) { if (!options[frontend][network]) { options[frontend][network] = {} options[frontend][network].enabled = JSON.parse(data)[frontend][network] options[frontend][network].custom = [] - } - } - if (!options[service][frontend]) { - options[frontend] = {} - for (const blacklist in r.blacklists) { - for (const instance of r.blacklists[blacklist]) { - let i = options[frontend].clearnet.enabled.indexOf(instance) - if (i > -1) options[frontend].clearnet.enabled.splice(i, 1) + if (network == "clearnet") { + for (const blacklist in r.blacklists) { + for (const instance of r.blacklists[blacklist]) { + let i = options[frontend].clearnet.enabled.indexOf(instance) + if (i > -1) options[frontend].clearnet.enabled.splice(i, 1) + } + } } } } diff --git a/src/pages/popup/popup.js b/src/pages/popup/popup.js index ed1546c..a4b7309 100644 --- a/src/pages/popup/popup.js +++ b/src/pages/popup/popup.js @@ -81,7 +81,7 @@ browser.storage.local.get("options", r => { let service = await serviceHelper.computeService(url, true) let frontend if (service) { - if (service[0]) { + if (typeof service != "string") { frontend = service[1] service = service[0] } From 9d2b5c5877f4315457af45d9275f0dd8a452e062 Mon Sep 17 00:00:00 2001 From: Woodpecker CI Date: Fri, 7 Oct 2022 00:09:41 +0000 Subject: [PATCH 57/67] updated instances --- src/instances/blacklist.json | 19 +++++-- src/instances/data.json | 104 +++++++++++++++++++++++++++-------- 2 files changed, 95 insertions(+), 28 deletions(-) diff --git a/src/instances/blacklist.json b/src/instances/blacklist.json index d75c36d..992466d 100644 --- a/src/instances/blacklist.json +++ b/src/instances/blacklist.json @@ -3,13 +3,11 @@ "https://invidious.kavin.rocks", "https://invidious.rhyshl.live", "https://piped.kavin.rocks", - "https://piped.tokhmi.xyz", "https://piped.moomoo.me", "https://piped.mha.fi", "https://de-piped.shimul.me", "https://pipedus.palash.dev", "https://watch.whatever.social", - "https://piped.garudalinux.org", "https://y.rivo.lol", "https://nitter.domain.glass", "https://birdsite.xanny.family", @@ -28,6 +26,17 @@ "https://n.sneed.network", "https://nitter.twei.space", "https://nitter.d420.de", + "https://libreddit.domain.glass", + "https://r.nf", + "https://libreddit.hu", + "https://reddi.tk", + "https://r.walkx.org", + "https://r.ahwx.org", + "https://reddit.dr460nf1r3.org", + "https://libreddit.encrypted-data.xyz", + "https://libreddit.eu.org", + "https://libreddit.cachyos.org", + "https://futureddit.gq", "https://teddit.domain.glass", "https://teddit.httpjames.space", "https://teddit.encrypted-data.xyz", @@ -57,6 +66,7 @@ ], "offline": [ "https://invidious.rhyshl.live", + "https://invidious.esmailelbob.xyz", "https://proxitok.odyssey346.dev", "https://nhanh.cloud", "https://nitter.winscloud.net", @@ -65,6 +75,7 @@ "https://teddit.tokhmi.xyz", "https://quetre.odyssey346.dev", "https://simplytranslate.org", + "https://translate.northboot.xyz", "https://st.odyssey346.dev", "https://jsearch.pw", "https://searx.gnu.style", @@ -74,11 +85,11 @@ "https://searx.ericaftereric.top", "https://searx.fmac.xyz", "https://www.webrats.xyz", + "https://gowogle.voring.me", "https://whoogle.esmailelbob.xyz", "https://search.wef.lol", "https://i.bcow.xyz", - "https://rimgo.totaldarkness.net", - "https://imgur.artemislena.eu", + "https://i.actionsack.com", "https://lbry.bcow.xyz", "https://beatbump.ml", "https://bw.odyssey346.dev" diff --git a/src/instances/data.json b/src/instances/data.json index eaefc4e..cbff9aa 100644 --- a/src/instances/data.json +++ b/src/instances/data.json @@ -9,24 +9,23 @@ "https://invidio.xamh.de", "https://y.com.sb", "https://yt.artemislena.eu", - "https://invidious.tiekoetter.com", "https://invidious.sethforprivacy.com", + "https://invidious.tiekoetter.com", "https://invidious.flokinet.to", "https://inv.bp.projectsegfau.lt", + "https://inv.vern.cc", "https://invidious.nerdvpn.de", "https://invidious.projectsegfau.lt", "https://invidious.rhyshl.live", "https://inv.privacy.com.de", - "https://invidious.slipfox.xyz", - "https://youtube.076.ne.jp", "https://invidious.esmailelbob.xyz", - "https://inv.vern.cc", + "https://youtube.076.ne.jp", + "https://invidious.slipfox.xyz", "https://invidious.namazso.eu" ], "tor": [ - "http://c7hqkpkpemu6e7emz5b4vyz7idjgdvgaaa3dyimmeojqbgpea3xqjoid.onion", "http://w6ijuptxiku4xpnnaetxvnkc5vqcdu7mgns2u77qefoixi63vbvnpnqd.onion", - "http://kbjggqkzv65ivcqj6bumvp337z6264huv5kpkwuv6gu5yjiskvan7fad.onion", + "http://c7hqkpkpemu6e7emz5b4vyz7idjgdvgaaa3dyimmeojqbgpea3xqjoid.onion", "http://grwp24hodrefzvjjuccrkw3mjq4tzhaaq32amf33dzpmuxe7ilepcmad.onion", "http://osbivz6guyeahrwp2lnwyjk2xos342h4ocsxyqrlaopqjuhwn2djiiyd.onion", "http://u2cvlit75owumwpy4dj2hsmvkq7nvrclkpht7xgyye2pyoxhpmclkrad.onion", @@ -34,7 +33,8 @@ "http://invidious.esmail5pdn24shtvieloeedh7ehz3nrwcdivnfhfcedl7gf4kwddhkqd.onion", "http://inv.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion", "http://am74vkcrjp2d5v36lcdqgsj2m6x36tbrkhsruoegwfcizzabnfgf5zyd.onion", - "http://ng27owmagn5amdm7l5s3rsqxwscl5ynppnis5dqcasogkyxcfqn7psid.onion" + "http://ng27owmagn5amdm7l5s3rsqxwscl5ynppnis5dqcasogkyxcfqn7psid.onion", + "http://kbjggqkzv65ivcqj6bumvp337z6264huv5kpkwuv6gu5yjiskvan7fad.onion" ], "i2p": [], "loki": [] @@ -42,18 +42,18 @@ "piped": { "clearnet": [ "https://piped.kavin.rocks", - "https://piped.tokhmi.xyz", "https://piped.moomoo.me", "https://piped.mha.fi", "https://de-piped.shimul.me", "https://pipedus.palash.dev", "https://watch.whatever.social", - "https://piped.garudalinux.org", "https://y.rivo.lol", "https://yt.jae.fi", + "https://piped.mint.lgbt", "https://il.ax", "https://piped.projectsegfau.lt", "https://piped.privacydev.net", + "https://piped.palveluntarjoaja.eu", "https://piped.smnz.de", "https://piped.adminforge.de", "https://watch.whatevertinfoil.de", @@ -260,8 +260,55 @@ "loki": [] }, "libreddit": { - "clearnet": [], - "tor": [], + "clearnet": [ + "https://libreddit.spike.codes", + "https://libreddit.kavin.rocks", + "https://reddit.invak.id", + "https://lr.riverside.rocks", + "https://libreddit.strongthany.cc", + "https://libreddit.privacy.com.de", + "https://libreddit.domain.glass", + "https://r.nf", + "https://reddit.stuehieyr.com", + "https://lr.mint.lgbt", + "https://libreddit.drivet.xyz", + "https://libreddit.de", + "https://libreddit.pussthecat.org", + "https://libreddit.northboot.xyz", + "https://leddit.xyz", + "https://libreddit.hu", + "https://libreddit.totaldarkness.net", + "https://libreddit.esmailelbob.xyz", + "https://lr.vern.cc", + "https://libreddit.nl", + "https://reddi.tk", + "https://r.walkx.org", + "https://libreddit.kylrth.com", + "https://libreddit.tiekoetter.com", + "https://reddit.rtrace.io", + "https://libreddit.privacydev.net", + "https://r.ahwx.org", + "https://bob.fr.to", + "https://libreddit.dcs0.hu", + "https://reddit.dr460nf1r3.org", + "https://rd.jae.su", + "https://libreddit.foss.wtf", + "https://libreddit.encrypted-data.xyz", + "https://libreddit.eu.org", + "https://l.opnxng.com", + "https://libreddit.cachyos.org", + "https://rd.funami.tech", + "https://libreddit.projectsegfau.lt", + "https://futureddit.gq", + "https://lr.slipfox.xyz", + "https://libreddit.oxymagnesium.com", + "https://reddit.utsav2.dev" + ], + "tor": [ + "http://ecue64ybzvn6vjzl37kcsnwt4ycmbsyf74nbttyg7rkc3t3qwnj7mcyd.onion", + "http://libreddit.esmail5pdn24shtvieloeedh7ehz3nrwcdivnfhfcedl7gf4kwddhkqd.onion", + "http://ojwp2gtj7dq7scd7gnbac6wp53tklgsicteabrnx2pr7zai64wriiaad.onion" + ], "i2p": [], "loki": [] }, @@ -271,7 +318,6 @@ "https://teddit.ggc-project.de", "https://teddit.zaggy.nl", "https://teddit.namazso.eu", - "https://teddit.nautolan.racing", "https://teddit.tinfoil-hat.net", "https://teddit.domain.glass", "https://snoo.ioens.is", @@ -311,7 +357,7 @@ "i2p": [ "http://xugoqcf2pftm76vbznx4xuhrzyb5b6zwpizpnw2hysexjdn5l2tq.b32.i2p", "http://teddit.i2p", - "https://codeberg.org/teddit/teddit/src/branch/main/vzeiwzi7ogwl3ijrfek4fbtwhvamxcpyqoc3s4vcgnhlp54s5clq.b32.i2p", + "http://vzeiwzi7ogwl3ijrfek4fbtwhvamxcpyqoc3s4vcgnhlp54s5clq.b32.i2p", "http://verncco2oaxjikammz4pi7umzp673cme6zuemx7yeeewspwrw3va.b32.i2p" ], "loki": [] @@ -516,11 +562,10 @@ "http://3afisqjw2rxm6z7mmstyt5rx75qfqrgxnkzftknbp2vhipr2nrmrjdyd.onion", "http://yra4tke2pwcnatxjkufpw6kvebu3h3ti2jca2lcdpgx3mpwol326lzid.onion", "http://z5vawdol25vrmorm4yydmohsd4u6rdoj2sylvoi3e3nqvxkvpqul7bqd.onion", - "http://searxdr3pqz4nydgnqocsia2xbywptxbkympa2emn7zlgggrir4bkfad.onion", "http://zbuc3bbzbfdqqo2x46repx2ddajbha6fpsjeeptjhhhhzji3zopxdqyd.onion", "http://f4qfqajszpx5b7itzxt6mb7kj4ktpgbdq7lq6xaiqyqx6a7de3epptad.onion", - "http://searx.esmail5pdn24shtvieloeedh7ehz3nrwcdivnfhfcedl7gf4kwddhkqd.onion", - "http://searx.micohauwkjbyw5meacrb4ipicwvwg4xtzl7y7viv53kig2mdcsvwkyyd.onion" + "http://searx.micohauwkjbyw5meacrb4ipicwvwg4xtzl7y7viv53kig2mdcsvwkyyd.onion", + "http://searx.privpw3tndpkw6pnp3g727zfgfdzbu3k6a7chv226s3xymv2p4eiuqyd.onion" ], "i2p": [ "http://ransack.i2p", @@ -616,8 +661,9 @@ "http://searxngg6zleq6ceboe5ltkyo4hyrb3aaycrgzmrljv3jjlb5vcytead.onion", "http://gbat2pbpg7ys3fi3pbp64667tt5x66mg45xok35bxdw7v55brm7a27yd.onion", "http://b2c7fvbhnfvwnl6oh2tydhzfx4i37kmmrycq42heqbbe7wovq3uzenid.onion", + "http://searxdr3pqz4nydgnqocsia2xbywptxbkympa2emn7zlgggrir4bkfad.onion", + "http://searx.esmail5pdn24shtvieloeedh7ehz3nrwcdivnfhfcedl7gf4kwddhkqd.onion", "http://searxfilowxokbogygrigir4wqxfxqzuxofxgdon7dg6rsii4yxzytyd.onion", - "http://searx.privpw3tndpkw6pnp3g727zfgfdzbu3k6a7chv226s3xymv2p4eiuqyd.onion", "http://rq2w52kyrif3xpfihkgjnhqm3a5aqhoikpv72z3drpjglfzc2wr5z4yd.onion", "http://fub6vgedgeadlu3ctskrpkcqjruh76tckwtj5swfhyblgml2tzgzckqd.onion/searx", "http://searx3aolosaf3urwnhpynlhuokqsgz47si4pzz5hvb7uuzyjncl2tid.onion", @@ -648,9 +694,23 @@ "loki": [] }, "librex": { - "clearnet": [], - "tor": [], - "i2p": [], + "clearnet": [ + "https://librex.beparanoid.de", + "https://librex.extravi.dev", + "https://search.davidovski.xyz", + "https://librex.kitscomputer.tk", + "https://search.funami.tech", + "https://librex.catalyst.sx", + "https://search.madreyk.xyz", + "https://search.pabloferreiro.es" + ], + "tor": [ + "http://librex.2356uhnbpv5nk3bni5bv6jg2cd6lgj664kwx3lhyelstpttpyv4kk2qd.onion", + "http://ncblhz7q4sfbf755bdbhebfzxcpypz7ewafgi4agatecojz7pln4i3id.onion" + ], + "i2p": [ + "http://rra33hiaf6nmby7jfpqe2gqmng3jnzkvbu2n7jgce7vbhoyuhzya.b32.i2p" + ], "loki": [] }, "rimgo": { @@ -821,7 +881,6 @@ "https://tube.reseau-canope.fr", "https://frentube.myyouniverse.observer", "https://tube-maternelle.apps.education.fr", - "https://peertube.onionstorm.net", "https://dev.dollarvigilante.tv", "https://video.trankil.info", "https://video.uriopss-pdl.fr", @@ -903,7 +962,6 @@ "https://videos.tormentasolar.win", "https://tube.nestor.coop", "https://live.oldskool.fi", - "https://tube.thierrytalbert.fr", "https://peertube.informaction.info", "https://tube.ac-amiens.fr", "https://tube.alado.space", @@ -950,7 +1008,6 @@ "https://videos-passages.huma-num.fr", "https://video.linc.systems", "https://video.sftblw.moe", - "https://peertube.dsmouse.net", "https://ptube.horsentiers.fr", "https://video.cnt.social", "https://tube.03281.fspfc.org", @@ -1339,7 +1396,6 @@ "https://video.lespoesiesdheloise.fr", "https://peertube.luga.at", "https://peertube.roflcopter.fr", - "https://ptube.rousset.nom.fr", "https://peertube.swrs.net", "https://tube.shanti.cafe", "https://videos.cloudron.io", From 6d9ddaae2f6a7c06b01c4df098acb6508021236e Mon Sep 17 00:00:00 2001 From: Hygna Date: Fri, 7 Oct 2022 17:19:35 +0100 Subject: [PATCH 58/67] Added support for fetching invidious i2p instances --- src/instances/get_instances.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/instances/get_instances.py b/src/instances/get_instances.py index 2f3c75d..b36cf7a 100644 --- a/src/instances/get_instances.py +++ b/src/instances/get_instances.py @@ -246,6 +246,8 @@ def invidious(): _list['clearnet'].append(instance[1]['uri']) elif instance[1]['type'] == 'onion': _list['tor'].append(instance[1]['uri']) + elif instance[1]['type'] == 'i2p': + _list['i2p'].append(instance[1]['uri']) mightyList[frontend] = _list print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + name) except Exception: From be78f86a67458208279b8cb51b2c6fab4491244c Mon Sep 17 00:00:00 2001 From: Hygna Date: Sat, 8 Oct 2022 11:37:45 +0100 Subject: [PATCH 59/67] Added context menu to toggle redirects for a certain tab Closes https://github.com/libredirect/libredirect/issues/464 --- src/_locales/en/messages.json | 4 ++ src/assets/javascripts/services.js | 28 +++++++------ src/pages/background/background.js | 67 ++++++++++++++++++++---------- 3 files changed, 65 insertions(+), 34 deletions(-) diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index d4217ad..003a878 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -210,5 +210,9 @@ }, "lbryDesktop": { "message": "LBRY Desktop" + }, + "bypassTab": { + "message": "Toggle redirects in this tab", + "description": "Used in context menus when right clicking on a page/tab" } } diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index a102a29..7e0a76a 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -68,13 +68,14 @@ function redirect(url, type, initiator) { if (!options[service].enabled) continue if (config.services[service].embeddable && type != options[service].redirectType && options[service].redirectType != "both") continue if (!config.services[service].embeddable && type != "main_frame") continue - let targets = new RegExp(config.services[service].targets.join("|"), "i") + // let targets = new RegExp(config.services[service].targets.join("|"), "i") if (!regexArray(service, url, config)) continue - if (initiator) { - if (targets.test(initiator.host)) continue - if (all(service, null, options, config, redirects).includes(initiator.origin) && reverse(initiator) == url) return "BYPASSTAB" - } + // if (initiator) { + // console.log(initiator.host) + // if (targets.test(initiator.host)) continue + // //if (all(service, null, options, config, redirects).includes(initiator.origin) && reverse(initiator) == url) return "BYPASSTAB" + // } if (Object.keys(config.services[service].frontends).length > 1) { if (type == "sub_frame" && config.services[service].embeddable && !config.services[service].frontends[options[service].frontend].embeddable) frontend = options[service].embedFrontend @@ -473,26 +474,29 @@ function switchInstance(url) { }) } -function reverse(url) { +function reverse(url, urlString) { return new Promise(async resolve => { await init() - let protocolHost = utils.protocolHost(url) + let protocolHost + if (!urlString) protocolHost = utils.protocolHost(url) + else protocolHost = url.match(/https?:\/{2}(?:[^\s\/]+\.)+[a-zA-Z0-9]+/)[0] for (const service in config.services) { if (!all(service, null, options, config, redirects).includes(protocolHost)) continue switch (service) { case "instagram": - if (url.pathname.startsWith("/p")) resolve(`https://instagram.com${url.pathname.replace("/p", "")}${url.search}`) - if (url.pathname.startsWith("/u")) resolve(`https://instagram.com${url.pathname.replace("/u", "")}${url.search}`) - resolve(config.services[service].url + url.pathname + url.search) - return case "youtube": case "imdb": case "imgur": case "tiktok": case "twitter": case "reddit": - resolve(config.services[service].url + url.pathname + url.search) + case "imdb": + case "reuters": + case "quora": + case "medium": + if (!urlString) resolve(config.services[service].url + url.pathname + url.search) + else resolve(url.replace(/https?:\/{2}(?:[^\s\/]+\.)+[a-zA-Z0-9]+/, config.services[service].url)) return default: resolve() diff --git a/src/pages/background/background.js b/src/pages/background/background.js index 3f0e0fd..f53d7b9 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -69,11 +69,11 @@ browser.webRequest.onBeforeRequest.addListener( console.log(`Canceled ${url}`) return { cancel: true } } - if (newUrl === "BYPASSTAB") { - console.log(`Bypassed ${details.tabId} ${url}`) - if (!BYPASSTABs.includes(details.tabId)) BYPASSTABs.push(details.tabId) - return null - } + // if (newUrl === "BYPASSTAB") { + // console.log(`Bypassed ${details.tabId} ${url}`) + // if (!BYPASSTABs.includes(details.tabId)) BYPASSTABs.push(details.tabId) + // return null + // } console.info("Redirecting", url.href, "=>", newUrl) return { redirectUrl: newUrl } } @@ -91,18 +91,6 @@ browser.tabs.onRemoved.addListener(tabId => { } }) -/* -browser.webRequest.onHeadersReceived.addListener( - e => { - let response = youtubeHelper.removeXFrameOptions(e) - if (!response) response = twitterHelper.removeXFrameOptions(e) - return response - }, - { urls: [""] }, - ["blocking", "responseHeaders"] -) -*/ - async function redirectOfflineInstance(url, tabId) { let newUrl = await servicesHelper.switchInstance(url, true) @@ -170,11 +158,46 @@ browser.contextMenus.create({ contexts: ["browser_action"], }) -browser.contextMenus.onClicked.addListener(info => { - if (info.menuItemId == "switchInstance") utils.switchInstance() - else if (info.menuItemId == "settings") browser.runtime.openOptionsPage() - else if (info.menuItemId == "copyRaw") utils.copyRaw() - else if (info.menuItemId == "unify") utils.unify() +browser.contextMenus.create({ + id: "bypassTab", + title: browser.i18n.getMessage("bypassTab"), + contexts: ["page", "tab"], +}) + +browser.contextMenus.onClicked.addListener((info, tab) => { + return new Promise(async resolve => { + switch (info.menuItemId) { + case "switchInstance": + utils.switchInstance() + resolve() + return + case "settings": + browser.runtime.openOptionsPage() + resolve() + return + case "copyRaw": + utils.copyRaw() + resolve() + return + case "unify": + utils.unify() + resolve() + return + case "bypassTab": + if (!BYPASSTABs.includes(tab.id)) { + BYPASSTABs.push(tab.id) + let newUrl = await servicesHelper.reverse(tab.url, true) + if (newUrl) browser.tabs.update(tab.id, { url: newUrl }) + resolve() + return + } else { + BYPASSTABs.splice(BYPASSTABs.indexOf(tab.id), 1) + browser.tabs.reload(tab.id) + resolve() + return + } + } + }) }) browser.runtime.onMessage.addListener((message, sender, sendResponse) => { From 9560cfc3e793d9fcb4fd8184c3d83fc0f4958f67 Mon Sep 17 00:00:00 2001 From: Hygna Date: Sat, 8 Oct 2022 16:33:39 +0100 Subject: [PATCH 60/67] Fixed bugs present in the previous commit --- src/_locales/en/messages.json | 2 +- src/assets/javascripts/services.js | 5 +- src/config/config.json | 61 +++++++++++++----- src/pages/background/background.js | 82 ++++++++++++++++++------- src/pages/background/reset_warning.html | 59 ------------------ src/pages/background/reset_warning.js | 7 --- src/pages/stylesheets/styles.css | 5 ++ 7 files changed, 114 insertions(+), 107 deletions(-) delete mode 100644 src/pages/background/reset_warning.html delete mode 100644 src/pages/background/reset_warning.js diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index 003a878..b8dccda 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -211,7 +211,7 @@ "lbryDesktop": { "message": "LBRY Desktop" }, - "bypassTab": { + "toggleTab": { "message": "Toggle redirects in this tab", "description": "Used in context menus when right clicking on a page/tab" } diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 7e0a76a..6614bf9 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -60,12 +60,12 @@ function regexArray(service, url, config) { return false } -function redirect(url, type, initiator) { +function redirect(url, type, initiator, forceRedirection) { if (type != "main_frame" && type != "sub_frame") return let randomInstance let frontend for (const service in config.services) { - if (!options[service].enabled) continue + if (!forceRedirection && !options[service].enabled) continue if (config.services[service].embeddable && type != options[service].redirectType && options[service].redirectType != "both") continue if (!config.services[service].embeddable && type != "main_frame") continue // let targets = new RegExp(config.services[service].targets.join("|"), "i") @@ -407,6 +407,7 @@ function redirect(url, type, initiator) { } function computeService(url, returnFrontend) { + console.log(url) return new Promise(resolve => { fetch("/config/config.json") .then(response => response.text()) diff --git a/src/config/config.json b/src/config/config.json index 9716826..642d90e 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -188,7 +188,9 @@ }, "targets": ["^https?:\\/{2}(www\\.)?instagram\\.com\\/p\\/"], "name": "Instagram", - "options": { "enabled": true }, + "options": { + "enabled": true + }, "imageType": "png", "embeddable": false, "url": "https://instagram.com" @@ -205,7 +207,9 @@ }, "targets": ["^https?:\\/{2}(www\\.|)tiktok\\.com.*"], "name": "TikTok", - "options": { "enabled": true }, + "options": { + "enabled": true + }, "imageType": "png", "embeddable": false, "url": "https://tiktok.com" @@ -223,6 +227,7 @@ "preferences": { "cookies": [ "collapse_child_comments", + "default_comment_sort", "domain_instagram", "domain_twitter", "domain_youtube", @@ -230,8 +235,11 @@ "highlight_controversial", "nsfw_enabled", "post_media_max_height", + "prefer_frontpage", + "show_large_gallery_images", "show_upvoted_percentage", "show_upvotes", + "subbed_subreddits", "theme", "videos_muted" ] @@ -280,7 +288,9 @@ }, "targets": ["^https?:\\/{2}(?:[a-z]+\\.)*wikipedia\\.org"], "name": "Wikipedia", - "options": { "enabled": false }, + "options": { + "enabled": false + }, "imageType": "svg", "embeddable": false, "url": "https://wikipedia.org" @@ -313,7 +323,9 @@ "^writingcooperative\\.com" ], "name": "Medium", - "options": { "enabled": true }, + "options": { + "enabled": true + }, "imageType": "svgMono", "embeddable": false, "url": "https://medium.com" @@ -330,7 +342,9 @@ }, "targets": ["^https?:\\/{2}([a-z]+\\.)*quora\\.com.*"], "name": "Quora", - "options": { "enabled": true }, + "options": { + "enabled": true + }, "imageType": "png", "embeddable": false, "url": "https://quora.com" @@ -345,9 +359,11 @@ "instanceList": true } }, - "targets": ["^https?:\\/{2}(?:www\\.|)imdb\\.com.*"], + "targets": ["^https?:\\/{2}(?:www\\.|)imdb\\.com\\/title"], "name": "IMDb", - "options": { "enabled": false }, + "options": { + "enabled": true + }, "imageType": "svg", "embeddable": false, "url": "https://imdb.com" @@ -361,7 +377,9 @@ }, "targets": ["^https?:\\/{2}(www\\.|)reuters\\.com.*"], "name": "Reuters", - "options": { "enabled": false }, + "options": { + "enabled": false + }, "imageType": "svg", "embeddable": false, "url": "https://reuters.com" @@ -375,7 +393,9 @@ }, "targets": ["^https?:\\/{2}(?:[a-zA-Z0-9]+\\.)?fandom\\.com(?=(?:\\/wiki)|(?:\\/?$))"], "name": "Fandom", - "options": { "enabled": true }, + "options": { + "enabled": true + }, "imageType": "svg", "embeddable": false, "url": "https://fandom.com" @@ -389,7 +409,9 @@ }, "targets": "datajson", "name": "PeerTube", - "options": { "enabled": false }, + "options": { + "enabled": false + }, "imageType": "svg", "embeddable": false, "url": "https://search.joinpeertube.org" @@ -414,7 +436,7 @@ "targets": ["^https?:\\/{2}odysee\\.com", "^https?:\\/{2}lbry\\.tv"], "name": "LBRY", "options": { - "enabled": false, + "enabled": true, "frontend": "librarian", "redirectType": "both", "embedFrontend": "librarian" @@ -455,6 +477,7 @@ "cookies": [ "autocomplete", "categories", + "center_alignment", "disabled_engines", "disabled_plugins", "doi_resolver", @@ -561,15 +584,23 @@ }, "targets": ["^https?:\\/{2}send\\.libredirect\\.invalid", "^https?:\\/{2}send\\.firefox\\.com\\/?$", "^https?:\\/{2}sendfiles\\.online\\/?$"], "name": "Send Files", - "options": { "enabled": true }, + "options": { + "enabled": true + }, "imageType": "svgMono", "embeddable": false, "url": "https://send.libredirect.invalid" } }, "blacklist": { - "cloudflare": { "color": "red" }, - "authenticate": { "color": "orange" }, - "offline": { "color": "grey" } + "cloudflare": { + "color": "red" + }, + "authenticate": { + "color": "orange" + }, + "offline": { + "color": "grey" + } } } diff --git a/src/pages/background/background.js b/src/pages/background/background.js index f53d7b9..54a8001 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -20,6 +20,7 @@ function initDefaults() { } browser.runtime.onInstalled.addListener(details => { + if (details.previousVersion != browser.runtime.getManifest().version) { switch (details.reason) { case "install": initDefaults() @@ -42,9 +43,11 @@ browser.runtime.onInstalled.addListener(details => { }) }) } + } }) -let BYPASSTABs = [] +let tabIdRedirects = {} +// true == Always redirect, false == Never redirect, null/undefined == follow options for services browser.webRequest.onBeforeRequest.addListener( details => { const url = new URL(details.url) @@ -57,23 +60,23 @@ browser.webRequest.onBeforeRequest.addListener( return null } - let newUrl = servicesHelper.redirect(url, details.type, initiator) + if (tabIdRedirects[details.tabId] == false) return null + let newUrl = servicesHelper.redirect(url, details.type, initiator, tabIdRedirects[details.tabId]) if (details.frameAncestors && details.frameAncestors.length > 0 && generalHelper.isException(new URL(details.frameAncestors[0].url))) newUrl = null if (generalHelper.isException(url)) newUrl = "BYPASSTAB" - if (BYPASSTABs.includes(details.tabId)) newUrl = null if (newUrl) { if (newUrl === "CANCEL") { console.log(`Canceled ${url}`) return { cancel: true } } - // if (newUrl === "BYPASSTAB") { - // console.log(`Bypassed ${details.tabId} ${url}`) - // if (!BYPASSTABs.includes(details.tabId)) BYPASSTABs.push(details.tabId) - // return null - // } + if (newUrl === "BYPASSTAB") { + console.log(`Bypassed ${details.tabId} ${url}`) + if (tabIdRedirects[details.tabId] != false) tabIdRedirects[details.tabId] = false + return null + } console.info("Redirecting", url.href, "=>", newUrl) return { redirectUrl: newUrl } } @@ -84,10 +87,9 @@ browser.webRequest.onBeforeRequest.addListener( ) browser.tabs.onRemoved.addListener(tabId => { - const i = BYPASSTABs.indexOf(tabId) - if (i > -1) { - BYPASSTABs.splice(i, 1) - console.log("Removed BYPASSTABs", tabId) + if (tabIdRedirects[tabId] != undefined) { + delete tabIdRedirects[tabId] + console.log("Removed tab " + tabId + " from tabIdRedirects") } }) @@ -159,11 +161,30 @@ browser.contextMenus.create({ }) browser.contextMenus.create({ - id: "bypassTab", - title: browser.i18n.getMessage("bypassTab"), + id: "toggleTab", + title: browser.i18n.getMessage("toggleTab"), contexts: ["page", "tab"], }) +function handleToggleTab(tab) { + return new Promise(async resolve => { + console.log(tabIdRedirects[tab.id]) + switch (tabIdRedirects[tab.id]) { + case false: + console.log("kj") + const newUrl = await servicesHelper.reverse(tab.url, true) + if (newUrl) browser.tabs.update(tab.id, { url: newUrl }) + resolve() + return + case true: + console.log("lsad") + browser.tabs.reload(tab.id) + resolve() + return + } + }) +} + browser.contextMenus.onClicked.addListener((info, tab) => { return new Promise(async resolve => { switch (info.menuItemId) { @@ -183,18 +204,33 @@ browser.contextMenus.onClicked.addListener((info, tab) => { utils.unify() resolve() return - case "bypassTab": - if (!BYPASSTABs.includes(tab.id)) { - BYPASSTABs.push(tab.id) - let newUrl = await servicesHelper.reverse(tab.url, true) - if (newUrl) browser.tabs.update(tab.id, { url: newUrl }) + case "toggleTab": + if (tabIdRedirects[tab.id] != undefined) { + tabIdRedirects[tab.id] = !tabIdRedirects[tab.id] + await handleToggleTab(tab) resolve() return } else { - BYPASSTABs.splice(BYPASSTABs.indexOf(tab.id), 1) - browser.tabs.reload(tab.id) - resolve() - return + console.log("n") + const url = new URL(tab.url) + const service = await servicesHelper.computeService(url) + console.log(service) + if (service) { + console.log("h") + browser.storage.local.get("options", async r => { + console.log(r.options[service]) + if (r.options[service].enabled) tabIdRedirects[tab.id] = false + else tabIdRedirects[tab.id] = true + await handleToggleTab(tab) + resolve() + return + }) + } else { + tabIdRedirects[tab.id] = false + await handleToggleTab(tab) + resolve() + return + } } } }) diff --git a/src/pages/background/reset_warning.html b/src/pages/background/reset_warning.html deleted file mode 100644 index f1881ed..0000000 --- a/src/pages/background/reset_warning.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - Reset Warning - - - - - -
- - -

All settings have been reset as they're incompatible with the previous version.

-

Sorry for the inconvenience, but we're going in a fast development process and can't support nor convert older settings. It will reach a stable plateau though.

- - - - - -   - Export Settings - -
- - - diff --git a/src/pages/background/reset_warning.js b/src/pages/background/reset_warning.js deleted file mode 100644 index 9ce49c9..0000000 --- a/src/pages/background/reset_warning.js +++ /dev/null @@ -1,7 +0,0 @@ -let params = new URLSearchParams(location.search) - -const resultString = JSON.stringify(JSON.parse(params.get("data")), null, " ") - -let exportSettingsElement = document.getElementById("export-settings") -exportSettingsElement.href = "data:application/json;base64," + btoa(resultString) -exportSettingsElement.download = "libredirect-settings.json" diff --git a/src/pages/stylesheets/styles.css b/src/pages/stylesheets/styles.css index eb59965..072b5d5 100644 --- a/src/pages/stylesheets/styles.css +++ b/src/pages/stylesheets/styles.css @@ -477,3 +477,8 @@ input:disabled { opacity: 0.6; cursor: not-allowed; } + +div.about a { + width: 500px; + display: inline-block; +} From 6fdf65663053d2e9c951f6153f108be8d3744204 Mon Sep 17 00:00:00 2001 From: Hygna Date: Sat, 8 Oct 2022 17:48:24 +0100 Subject: [PATCH 61/67] Added context menu to redirect Closes https://github.com/libredirect/libredirect/issues/414 --- src/_locales/en/messages.json | 4 ++ src/assets/javascripts/services.js | 1 - src/config/config.json | 2 +- src/pages/background/background.js | 62 ++++++++++++++++-------------- 4 files changed, 39 insertions(+), 30 deletions(-) diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index b8dccda..3887856 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -214,5 +214,9 @@ "toggleTab": { "message": "Toggle redirects in this tab", "description": "Used in context menus when right clicking on a page/tab" + }, + "redirectLink": { + "message": "Attempt to redirect this hyperlink", + "description": "Used in context menus when right clicking on a hyperlink" } } diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 6614bf9..80a1ac4 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -407,7 +407,6 @@ function redirect(url, type, initiator, forceRedirection) { } function computeService(url, returnFrontend) { - console.log(url) return new Promise(resolve => { fetch("/config/config.json") .then(response => response.text()) diff --git a/src/config/config.json b/src/config/config.json index 642d90e..ff4a869 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -414,7 +414,7 @@ }, "imageType": "svg", "embeddable": false, - "url": "https://search.joinpeertube.org" + "url": "https://joinpeertube.org" }, "lbry": { "frontends": { diff --git a/src/pages/background/background.js b/src/pages/background/background.js index 54a8001..d252e58 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -21,28 +21,28 @@ function initDefaults() { browser.runtime.onInstalled.addListener(details => { if (details.previousVersion != browser.runtime.getManifest().version) { - switch (details.reason) { - case "install": - initDefaults() - break - case "update": - fetch("/instances/blacklist.json") - .then(response => response.text()) - .then(async data => { - browser.storage.local.set({ blacklists: JSON.parse(data) }, async () => { - switch (details.previousVersion) { - case "2.2.0": - case "2.2.1": - await generalHelper.initDefaults() - await servicesHelper.initDefaults() - await servicesHelper.upgradeOptions() - break - default: - await servicesHelper.processUpdate() - } + switch (details.reason) { + case "install": + initDefaults() + break + case "update": + fetch("/instances/blacklist.json") + .then(response => response.text()) + .then(async data => { + browser.storage.local.set({ blacklists: JSON.parse(data) }, async () => { + switch (details.previousVersion) { + case "2.2.0": + case "2.2.1": + await generalHelper.initDefaults() + await servicesHelper.initDefaults() + await servicesHelper.upgradeOptions() + break + default: + await servicesHelper.processUpdate() + } + }) }) - }) - } + } } }) @@ -166,18 +166,21 @@ browser.contextMenus.create({ contexts: ["page", "tab"], }) +browser.contextMenus.create({ + id: "redirectLink", + title: browser.i18n.getMessage("redirectLink"), + contexts: ["link"], +}) + function handleToggleTab(tab) { return new Promise(async resolve => { - console.log(tabIdRedirects[tab.id]) switch (tabIdRedirects[tab.id]) { case false: - console.log("kj") const newUrl = await servicesHelper.reverse(tab.url, true) if (newUrl) browser.tabs.update(tab.id, { url: newUrl }) resolve() return case true: - console.log("lsad") browser.tabs.reload(tab.id) resolve() return @@ -211,14 +214,10 @@ browser.contextMenus.onClicked.addListener((info, tab) => { resolve() return } else { - console.log("n") const url = new URL(tab.url) const service = await servicesHelper.computeService(url) - console.log(service) if (service) { - console.log("h") browser.storage.local.get("options", async r => { - console.log(r.options[service]) if (r.options[service].enabled) tabIdRedirects[tab.id] = false else tabIdRedirects[tab.id] = true await handleToggleTab(tab) @@ -232,6 +231,13 @@ browser.contextMenus.onClicked.addListener((info, tab) => { return } } + case "redirectLink": + console.log(info.linkUrl) + const tmpUrl = new URL(info.linkUrl) + const newUrl = servicesHelper.redirect(tmpUrl, "main_frame", null, true) + if (newUrl) browser.tabs.create({ url: newUrl }) + resolve() + return } }) }) From b9d25cd73733d7421c3464dbcb4a87c64ce42b4d Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Sun, 9 Oct 2022 09:34:59 +0200 Subject: [PATCH 62/67] Changed matrix url from Space to just the room --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8c5d608..483852b 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A web extension that redirects YouTube, Twitter, Instagram... requests to alternative privacy friendly frontends and backends. -[![Matrix Badge](https://img.shields.io/matrix/libredirect:matrix.org?label=matrix%20chat)](https://matrix.to/#/#libredirect-space:matrix.org) +[![Matrix Badge](https://img.shields.io/matrix/libredirect:matrix.org?label=matrix%20chat)](https://matrix.to/#/#libredirect:matrix.org) [![Firefox users Badge](https://img.shields.io/amo/users/libredirect?label=Firefox%20users)](https://addons.mozilla.org/firefox/addon/libredirect/) [![LibrePay Badge](https://img.shields.io/liberapay/gives/libredirect?label=Liberapay)](https://liberapay.com/LibRedirect) From 394ef5d3bbe21d28164d8a4ae659c286f737cc58 Mon Sep 17 00:00:00 2001 From: EdwardLangdon Date: Sun, 9 Oct 2022 07:36:44 +0000 Subject: [PATCH 63/67] Added OpenCollective to Readme --- .gitignore | 1 + README.md | 3 ++- img/Open-Collective.png | Bin 0 -> 37041 bytes 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 img/Open-Collective.png diff --git a/.gitignore b/.gitignore index f6fc62d..09e0ce2 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ web-ext-artifacts/ nod node_modules package-lock.json +.vscode \ No newline at end of file diff --git a/README.md b/README.md index 8c5d608..b0a3c9f 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,8 @@ Send Files => [Send](https://gitlab.com/timvisee/send) [![Liberapay](./img/liberapay.svg)](https://liberapay.com/LibRedirect)  [![Patreon](./img/patreon.svg)](https://patreon.com/LibRedirect)  -[![Buy me a coffee](./img/bmc.svg)](https://www.buymeacoffee.com/libredirect) +[![Buy me a coffee](./img/bmc.svg)](https://www.buymeacoffee.com/libredirect)  + BTC: bc1qrhue0frps6p2vkg978u9ayethnwprtmfug827q\ BCH: qqz5vfnrngk0tjy73q2688qzw4wnllnuzqfndflhl8\ diff --git a/img/Open-Collective.png b/img/Open-Collective.png new file mode 100644 index 0000000000000000000000000000000000000000..d667babcae177d300fbb550db98bc7556cab47ef GIT binary patch literal 37041 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 MboFyt=akR{0R5I Date: Sun, 9 Oct 2022 07:45:47 +0000 Subject: [PATCH 64/67] Fixed minor markdown error in Previous Commit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a42ad18..16e04a2 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Send Files => [Send](https://gitlab.com/timvisee/send) [![Liberapay](./img/liberapay.svg)](https://liberapay.com/LibRedirect)  [![Patreon](./img/patreon.svg)](https://patreon.com/LibRedirect)  [![Buy me a coffee](./img/bmc.svg)](https://www.buymeacoffee.com/libredirect)  - + BTC: bc1qrhue0frps6p2vkg978u9ayethnwprtmfug827q\ BCH: qqz5vfnrngk0tjy73q2688qzw4wnllnuzqfndflhl8\ From 9a87e7acb6bd7d3072c6ac1b1525c8e639602cd4 Mon Sep 17 00:00:00 2001 From: EdwardLangdon Date: Sun, 9 Oct 2022 07:53:06 +0000 Subject: [PATCH 65/67] Changed order of Mirror repos --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 16e04a2..cc6ba93 100644 --- a/README.md +++ b/README.md @@ -52,8 +52,9 @@ XMR: 4AM5CVfaGsnEXQQjZSzJvaWufe7pT86ubcZPr83fCjb2Hn3iwcForTWFy2Z3ugXcufUwHaGcucf ## Mirror Repos -[![GitHub](https://raw.githubusercontent.com/ManeraKai/manerakai/main/icons/github.svg)](https://github.com/libredirect/libredirect/)   [![Codeberg](https://raw.githubusercontent.com/ManeraKai/manerakai/main/icons/codeberg.svg)](https://codeberg.org/LibRedirect/libredirect)   +[![GitHub](https://raw.githubusercontent.com/ManeraKai/manerakai/main/icons/github.svg)](https://github.com/libredirect/libredirect/)   + ## Translate From 375f4371c3c5e703b07ae3e3d677315134a035ce Mon Sep 17 00:00:00 2001 From: Hygna Date: Sun, 9 Oct 2022 13:11:05 +0100 Subject: [PATCH 66/67] Toggle current instance in popup Fixed bug where testing latency of multiple frontends at the same time wouldn't save all of the timings --- src/assets/images/instance-icon.svg | 3 + src/assets/javascripts/services.js | 4 +- src/assets/javascripts/utils.js | 17 ++- src/config/config.json | 192 ++++++++++++++++++++++------ src/pages/background/background.js | 1 - src/pages/popup/popup.ejs | 6 + src/pages/popup/popup.html | 12 +- src/pages/popup/popup.js | 31 ++++- src/pages/popup/style.css | 40 ++++++ 9 files changed, 252 insertions(+), 54 deletions(-) create mode 100644 src/assets/images/instance-icon.svg diff --git a/src/assets/images/instance-icon.svg b/src/assets/images/instance-icon.svg new file mode 100644 index 0000000..6b034c6 --- /dev/null +++ b/src/assets/images/instance-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 80a1ac4..806624d 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -422,7 +422,7 @@ function computeService(url, returnFrontend) { } else { for (const frontend in config.services[service].frontends) { if (all(service, frontend, options, config, redirects).includes(utils.protocolHost(url))) { - if (returnFrontend) resolve([service, frontend, url.hostname]) + if (returnFrontend) resolve([service, frontend, utils.protocolHost(url)]) else resolve(service) return } @@ -520,7 +520,7 @@ function unifyPreferences(url, tabId) { const frontendObject = config.services[service].frontends[frontend] if ("cookies" in frontendObject.preferences) { for (const cookie of frontendObject.preferences.cookies) { - utils.copyCookie(frontendObject, url, instancesList, cookie) + await utils.copyCookie(frontendObject, url, instancesList, cookie) } } if ("localstorage" in frontendObject.preferences) { diff --git a/src/assets/javascripts/utils.js b/src/assets/javascripts/utils.js index 9ae9123..6204169 100644 --- a/src/assets/javascripts/utils.js +++ b/src/assets/javascripts/utils.js @@ -424,17 +424,20 @@ function latency(service, frontend, document, location) { latencyElement.addEventListener("click", async () => { let reloadWindow = () => location.reload() latencyElement.addEventListener("click", reloadWindow) - browser.storage.local.get(["redirects", "latency"], r => { + browser.storage.local.get("redirects", r => { let redirects = r.redirects - let latency = r.latency const oldHtml = latencyLabel.innerHTML latencyLabel.innerHTML = "..." testLatency(latencyLabel, redirects[frontend].clearnet, frontend).then(r => { - latency[frontend] = r - browser.storage.local.set({ latency }) - latencyLabel.innerHTML = oldHtml - processDefaultCustomInstances(service, frontend, "clearnet", document) - latencyElement.removeEventListener("click", reloadWindow) + const frontendLatency = r + browser.storage.local.get("latency", r => { + let latency = r.latency + latency[frontend] = frontendLatency + browser.storage.local.set({ latency }) + latencyLabel.innerHTML = oldHtml + processDefaultCustomInstances(service, frontend, "clearnet", document) + latencyElement.removeEventListener("click", reloadWindow) + }) }) }) }) diff --git a/src/config/config.json b/src/config/config.json index ff4a869..8110748 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -22,8 +22,12 @@ "frontends": { "invidious": { "preferences": { - "cookies": ["PREFS"], - "localstorage": ["dark_mode"] + "cookies": [ + "PREFS" + ], + "localstorage": [ + "dark_mode" + ] }, "name": "Invidious", "embeddable": true, @@ -59,7 +63,9 @@ }, "pipedMaterial": { "preferences": { - "localstorage": ["PREFERENCES"] + "localstorage": [ + "PREFERENCES" + ] }, "name": "Piped-Material", "embeddable": false, @@ -109,7 +115,9 @@ "frontends": { "beatbump": { "preferences": { - "localstorage": ["settings"], + "localstorage": [ + "settings" + ], "indexeddb": "beatbump" }, "name": "Beatbump", @@ -117,14 +125,26 @@ }, "hyperpipe": { "preferences": { - "localstorage": ["api", "authapi", "codec", "locale", "next", "pipedapi", "quality", "theme", "vol"], + "localstorage": [ + "api", + "authapi", + "codec", + "locale", + "next", + "pipedapi", + "quality", + "theme", + "vol" + ], "indexeddb": "hyperpipedb" }, "name": "HyperPipe", "instanceList": true } }, - "targets": ["^https?:\\/{2}music\\.youtube\\.com(\\/.*|$)"], + "targets": [ + "^https?:\\/{2}music\\.youtube\\.com(\\/.*|$)" + ], "name": "YT Music", "options": { "enabled": true, @@ -139,24 +159,23 @@ "nitter": { "preferences": { "cookies": [ - "theme", - "infiniteScroll", - "stickyProfile", + "autoplayGifs", "bidiSupport", - "hideTweetStats", "hideBanner", "hidePins", "hideReplies", - "squareAvatars", - "mp4Playback", + "hideTweetStats", "hlsPlayback", - "proxyVideos", + "infiniteScroll", + "mp4Playback", "muteVideos", - "autoplayGifs", + "proxyVideos", "replaceInstagram", "replaceReddit", "replaceTwitter", - "replaceYouTube" + "replaceYouTube", + "squareAvatars", + "theme" ] }, "name": "Nitter", @@ -164,7 +183,12 @@ "instanceList": true } }, - "targets": ["^https?:\\/{2}(www\\.|mobile\\.|)twitter\\.com", "^https?:\\/{2}(pbs\\.|video\\.|)twimg\\.com", "^https?:\\/{2}platform\\.twitter\\.com/embed", "^https?:\\/{2}t\\.co"], + "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", "options": { "enabled": true, @@ -186,7 +210,9 @@ "instanceList": true } }, - "targets": ["^https?:\\/{2}(www\\.)?instagram\\.com\\/p\\/"], + "targets": [ + "^https?:\\/{2}(www\\.)?instagram\\.com\\/p\\/" + ], "name": "Instagram", "options": { "enabled": true @@ -199,13 +225,18 @@ "frontends": { "proxiTok": { "preferences": { - "cookies": ["api-test_endpoints", "theme"] + "cookies": [ + "api-test_endpoints", + "theme" + ] }, "name": "ProxiTok", "instanceList": true } }, - "targets": ["^https?:\\/{2}(www\\.|)tiktok\\.com.*"], + "targets": [ + "^https?:\\/{2}(www\\.|)tiktok\\.com.*" + ], "name": "TikTok", "options": { "enabled": true @@ -218,7 +249,20 @@ "frontends": { "libreddit": { "preferences": { - "cookies": ["theme", "front_page", "layout", "wide", "post_sort", "comment_sort", "show_nsfw", "autoplay_videos", "use_hls", "hide_hls_notification", "subscriptions", "filters"] + "cookies": [ + "theme", + "front_page", + "layout", + "wide", + "post_sort", + "comment_sort", + "show_nsfw", + "autoplay_videos", + "use_hls", + "hide_hls_notification", + "subscriptions", + "filters" + ] }, "name": "Libreddit", "instanceList": true @@ -248,7 +292,10 @@ "instanceList": true } }, - "targets": ["^https?:\\/{2}(www\\.|old\\.|np\\.|new\\.|amp\\.|)reddit\\.com", "^https?:\\/{2}(i\\.|preview\\.)redd\\.it"], + "targets": [ + "^https?:\\/{2}(www\\.|old\\.|np\\.|new\\.|amp\\.|)reddit\\.com", + "^https?:\\/{2}(i\\.|preview\\.)redd\\.it" + ], "name": "Reddit", "options": { "enabled": true, @@ -266,7 +313,9 @@ "instanceList": true } }, - "targets": ["^https?:\\/{2}([im]\\.)?(stack\\.)?imgur\\.(com|io)(\\/|$)"], + "targets": [ + "^https?:\\/{2}([im]\\.)?(stack\\.)?imgur\\.(com|io)(\\/|$)" + ], "name": "Imgur", "options": { "enabled": true, @@ -280,13 +329,18 @@ "frontends": { "wikiless": { "preferences": { - "cookies": ["theme", "default_lang"] + "cookies": [ + "theme", + "default_lang" + ] }, "name": "Wikiless", "instanceList": true } }, - "targets": ["^https?:\\/{2}(?:[a-z]+\\.)*wikipedia\\.org"], + "targets": [ + "^https?:\\/{2}(?:[a-z]+\\.)*wikipedia\\.org" + ], "name": "Wikipedia", "options": { "enabled": false @@ -334,13 +388,17 @@ "frontends": { "quetre": { "preferences": { - "localstorage": ["theme"] + "localstorage": [ + "theme" + ] }, "name": "Quetre", "instanceList": true } }, - "targets": ["^https?:\\/{2}([a-z]+\\.)*quora\\.com.*"], + "targets": [ + "^https?:\\/{2}([a-z]+\\.)*quora\\.com.*" + ], "name": "Quora", "options": { "enabled": true @@ -353,13 +411,17 @@ "frontends": { "libremdb": { "preferences": { - "localstorage": ["theme"] + "localstorage": [ + "theme" + ] }, "name": "libremdb", "instanceList": true } }, - "targets": ["^https?:\\/{2}(?:www\\.|)imdb\\.com\\/title"], + "targets": [ + "^https?:\\/{2}(?:www\\.|)imdb\\.com\\/title" + ], "name": "IMDb", "options": { "enabled": true @@ -375,7 +437,9 @@ "instanceList": true } }, - "targets": ["^https?:\\/{2}(www\\.|)reuters\\.com.*"], + "targets": [ + "^https?:\\/{2}(www\\.|)reuters\\.com.*" + ], "name": "Reuters", "options": { "enabled": false @@ -391,7 +455,9 @@ "instanceList": true } }, - "targets": ["^https?:\\/{2}(?:[a-zA-Z0-9]+\\.)?fandom\\.com(?=(?:\\/wiki)|(?:\\/?$))"], + "targets": [ + "^https?:\\/{2}(?:[a-zA-Z0-9]+\\.)?fandom\\.com(?=(?:\\/wiki)|(?:\\/?$))" + ], "name": "Fandom", "options": { "enabled": true @@ -420,8 +486,18 @@ "frontends": { "librarian": { "preferences": { - "cookies": ["nsfw", "theme"], - "localstorage": ["autoplay", "autoplayNextVid", "collapseComments", "plyr", "sb_categories", "showRelated"] + "cookies": [ + "nsfw", + "theme" + ], + "localstorage": [ + "autoplay", + "autoplayNextVid", + "collapseComments", + "plyr", + "sb_categories", + "showRelated" + ] }, "name": "Librarian", "embeddable": true, @@ -433,7 +509,10 @@ "instanceList": false } }, - "targets": ["^https?:\\/{2}odysee\\.com", "^https?:\\/{2}lbry\\.tv"], + "targets": [ + "^https?:\\/{2}odysee\\.com", + "^https?:\\/{2}lbry\\.tv" + ], "name": "LBRY", "options": { "enabled": true, @@ -506,13 +585,26 @@ }, "librex": { "preferences": { - "cookies": ["bibliogram", "disable_frontends", " disable_special", "invidious", "libreddit", "nitter", "proxitok", "save", "theme", "wikiless"] + "cookies": [ + "bibliogram", + "disable_frontends", + " disable_special", + "invidious", + "libreddit", + "nitter", + "proxitok", + "save", + "theme", + "wikiless" + ] }, "name": "LibreX", "instanceList": true } }, - "targets": ["^https?:\\/{2}search\\.libredirect\\.invalid"], + "targets": [ + "^https?:\\/{2}search\\.libredirect\\.invalid" + ], "name": "Search", "options": { "enabled": true, @@ -526,14 +618,24 @@ "frontends": { "simplyTranslate": { "preferences": { - "cookies": ["from_lang", "to_lang", "tts_enabled", "use_text_fields"] + "cookies": [ + "from_lang", + "to_lang", + "tts_enabled", + "use_text_fields" + ] }, "name": "SimplyTranslate", "instanceList": true }, "lingva": { "preferences": { - "localstorage": ["isauto", "source", "target", "chakra-ui-color-mode"] + "localstorage": [ + "isauto", + "source", + "target", + "chakra-ui-color-mode" + ] }, "name": "Lingva Translate", "instanceList": true @@ -543,7 +645,10 @@ "instanceList": true } }, - "targets": ["^https?:\\/{2}translate\\.google(\\.[a-z]{2,3}){1,2}\\/", "^https?:\\/{2}translate\\.libredirect\\.invalid"], + "targets": [ + "^https?:\\/{2}translate\\.google(\\.[a-z]{2,3}){1,2}\\/", + "^https?:\\/{2}translate\\.libredirect\\.invalid" + ], "name": "Translate", "options": { "enabled": true, @@ -565,7 +670,10 @@ "singleInstance": "https://www.openstreetmap.org" } }, - "targets": ["^https?:\\/{2}maps\\.libredirect\\.invalid", "^https?:\\/{2}(((www|maps)\\.)?(google\\.).*(\\/maps)|maps\\.(google\\.).*)"], + "targets": [ + "^https?:\\/{2}maps\\.libredirect\\.invalid", + "^https?:\\/{2}(((www|maps)\\.)?(google\\.).*(\\/maps)|maps\\.(google\\.).*)" + ], "name": "Maps", "options": { "enabled": true, @@ -582,7 +690,11 @@ "instanceList": "true" } }, - "targets": ["^https?:\\/{2}send\\.libredirect\\.invalid", "^https?:\\/{2}send\\.firefox\\.com\\/?$", "^https?:\\/{2}sendfiles\\.online\\/?$"], + "targets": [ + "^https?:\\/{2}send\\.libredirect\\.invalid", + "^https?:\\/{2}send\\.firefox\\.com\\/?$", + "^https?:\\/{2}sendfiles\\.online\\/?$" + ], "name": "Send Files", "options": { "enabled": true diff --git a/src/pages/background/background.js b/src/pages/background/background.js index d252e58..dd8f171 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -232,7 +232,6 @@ browser.contextMenus.onClicked.addListener((info, tab) => { } } case "redirectLink": - console.log(info.linkUrl) const tmpUrl = new URL(info.linkUrl) const newUrl = servicesHelper.redirect(tmpUrl, "main_frame", null, true) if (newUrl) browser.tabs.create({ url: newUrl }) diff --git a/src/pages/popup/popup.ejs b/src/pages/popup/popup.ejs index e862e0c..e6cc6fc 100644 --- a/src/pages/popup/popup.ejs +++ b/src/pages/popup/popup.ejs @@ -8,6 +8,12 @@
+ <%- include('src/pages/widgets/switches', {services: services}) -%>

diff --git a/src/pages/popup/popup.html b/src/pages/popup/popup.html index 2dcc12b..6dc4847 100644 --- a/src/pages/popup/popup.html +++ b/src/pages/popup/popup.html @@ -8,6 +8,14 @@
+

Youtube

@@ -78,7 +86,7 @@

Fandom

-
+

PeerTube

@@ -196,7 +204,7 @@

Fandom

-
+

PeerTube

diff --git a/src/pages/popup/popup.js b/src/pages/popup/popup.js index a4b7309..78e5000 100644 --- a/src/pages/popup/popup.js +++ b/src/pages/popup/popup.js @@ -2,7 +2,6 @@ window.browser = window.browser || window.chrome import utils from "../../assets/javascripts/utils.js" -// import generalHelper from "../../assets/javascripts/general.js" import serviceHelper from "../../assets/javascripts/services.js" let config, @@ -40,6 +39,7 @@ const currSite = document.getElementsByClassName("current_site")[0] function setDivs() { return new Promise(resolve => { + divs.instance = document.getElementById("instance") for (const service in config.services) { divs[service] = {} divs[service].toggle = {} @@ -56,8 +56,9 @@ await setDivs() const currentSiteIsFrontend = document.getElementById("current_site_divider") -browser.storage.local.get("options", r => { +browser.storage.local.get(["options", "redirects"], r => { browser.tabs.query({ active: true, currentWindow: true }, async tabs => { + document.getElementById("instance-div").classList.add("hide") for (const service in config.services) { if (!r.options.popupServices.includes(service)) allSites.getElementsByClassName(service)[0].classList.add("hide") else allSites.getElementsByClassName(service)[0].classList.remove("hide") @@ -80,10 +81,36 @@ browser.storage.local.get("options", r => { let service = await serviceHelper.computeService(url, true) let frontend + let instance if (service) { if (typeof service != "string") { + instance = service[2] frontend = service[1] service = service[0] + divs.instance.innerHTML = instance.replace(/https?:\/{2}/, "") + let tmp + let instanceNetwork + for (const network in config.networks) { + tmp = r.redirects[frontend][network].indexOf(instance) + if (tmp > -1) { + const instanceDiv = document.getElementById("instance-enabled") + tmp = r.options[frontend][network].enabled.indexOf(instance) + if (tmp > -1) instanceDiv.checked = true + else instanceDiv.checked = false + instanceNetwork = network + instanceDiv.addEventListener("change", () => { + browser.storage.local.get("options", r => { + // Although options would be avaliable in this context, it is fetched again to make sure it is up to date + let options = r.options + if (instanceDiv.checked) options[frontend][instanceNetwork].enabled.push(instance) + else options[frontend][instanceNetwork].enabled.splice(options[frontend][instanceNetwork].enabled.indexOf(instance), 1) + browser.storage.local.set({ options }) + }) + }) + break + } + } + document.getElementById("instance-div").classList.remove("hide") } divs[service].current.classList.remove("hide") divs[service].all.classList.add("hide") diff --git a/src/pages/popup/style.css b/src/pages/popup/style.css index 0cb2791..3b409be 100644 --- a/src/pages/popup/style.css +++ b/src/pages/popup/style.css @@ -22,3 +22,43 @@ body { .space { height: 10px; } + +input { + height: 23px; + width: 46px; +} + +#instance { + max-width: 110px; + max-height: 22px; + overflow-x: scroll; + white-space: nowrap; + scrollbar-width: none; + -ms-overflow-style: none; +} + +#instance::-webkit-scrollbar { + display: none; +} + +#instance::before { + background-image: linear-gradient(to right, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0)); + position: absolute; + width: 5px; + height: 22px; + content: ""; + display: block; + pointer-events: none; +} + +#end::before { + background-image: linear-gradient(to left, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0)); + position: absolute; + width: 5px; + height: 22px; + content: ""; + display: block; + pointer-events: none; + top: 13px; + left: 157.4px; +} From 96f6ca4c223c377debd2d1d5a1ffdd39979c2755 Mon Sep 17 00:00:00 2001 From: Hygna Date: Sun, 9 Oct 2022 13:56:04 +0100 Subject: [PATCH 67/67] Updated instances --- src/config/config.json | 2 +- src/instances/blacklist.json | 14 ++++++------ src/instances/data.json | 41 ++++++++++++++++-------------------- src/pages/popup/style.css | 4 ++-- 4 files changed, 29 insertions(+), 32 deletions(-) diff --git a/src/config/config.json b/src/config/config.json index 8110748..bb97052 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -397,7 +397,7 @@ } }, "targets": [ - "^https?:\\/{2}([a-z]+\\.)*quora\\.com.*" + "^https?:\\/{2}([a-z]+\\.)*quora\\.com" ], "name": "Quora", "options": { diff --git a/src/instances/blacklist.json b/src/instances/blacklist.json index 992466d..8bf43eb 100644 --- a/src/instances/blacklist.json +++ b/src/instances/blacklist.json @@ -3,11 +3,12 @@ "https://invidious.kavin.rocks", "https://invidious.rhyshl.live", "https://piped.kavin.rocks", + "https://piped.tokhmi.xyz", "https://piped.moomoo.me", "https://piped.mha.fi", "https://de-piped.shimul.me", - "https://pipedus.palash.dev", "https://watch.whatever.social", + "https://piped.garudalinux.org", "https://y.rivo.lol", "https://nitter.domain.glass", "https://birdsite.xanny.family", @@ -37,6 +38,7 @@ "https://libreddit.eu.org", "https://libreddit.cachyos.org", "https://futureddit.gq", + "https://libreddit.freedit.eu", "https://teddit.domain.glass", "https://teddit.httpjames.space", "https://teddit.encrypted-data.xyz", @@ -66,21 +68,22 @@ ], "offline": [ "https://invidious.rhyshl.live", - "https://invidious.esmailelbob.xyz", "https://proxitok.odyssey346.dev", "https://nhanh.cloud", - "https://nitter.winscloud.net", "https://ntr.odyssey346.dev", + "https://futureddit.gq", "https://teddit.ggc-project.de", + "https://teddit.froth.zone", "https://teddit.tokhmi.xyz", + "https://wiki.privacytools.io", "https://quetre.odyssey346.dev", - "https://simplytranslate.org", - "https://translate.northboot.xyz", "https://st.odyssey346.dev", + "https://translate.projectsegfau.lt", "https://jsearch.pw", "https://searx.gnu.style", "https://searx.semipvt.com", "https://etsi.me", + "https://search.chemicals-in-the-water.eu", "https://search.zzls.xyz", "https://searx.ericaftereric.top", "https://searx.fmac.xyz", @@ -89,7 +92,6 @@ "https://whoogle.esmailelbob.xyz", "https://search.wef.lol", "https://i.bcow.xyz", - "https://i.actionsack.com", "https://lbry.bcow.xyz", "https://beatbump.ml", "https://bw.odyssey346.dev" diff --git a/src/instances/data.json b/src/instances/data.json index cbff9aa..a5a7177 100644 --- a/src/instances/data.json +++ b/src/instances/data.json @@ -18,9 +18,9 @@ "https://invidious.projectsegfau.lt", "https://invidious.rhyshl.live", "https://inv.privacy.com.de", + "https://invidious.slipfox.xyz", "https://invidious.esmailelbob.xyz", "https://youtube.076.ne.jp", - "https://invidious.slipfox.xyz", "https://invidious.namazso.eu" ], "tor": [ @@ -36,24 +36,28 @@ "http://ng27owmagn5amdm7l5s3rsqxwscl5ynppnis5dqcasogkyxcfqn7psid.onion", "http://kbjggqkzv65ivcqj6bumvp337z6264huv5kpkwuv6gu5yjiskvan7fad.onion" ], - "i2p": [], + "i2p": [ + "http://verni6dr4qxjgjumnvesxerh5rvhv6oy5ddeibaqy5d7tgbiiyfa.b32.i2p" + ], "loki": [] }, "piped": { "clearnet": [ "https://piped.kavin.rocks", + "https://piped.tokhmi.xyz", "https://piped.moomoo.me", "https://piped.mha.fi", "https://de-piped.shimul.me", "https://pipedus.palash.dev", "https://watch.whatever.social", + "https://piped.garudalinux.org", "https://y.rivo.lol", "https://yt.jae.fi", "https://piped.mint.lgbt", "https://il.ax", + "https://piped.esmailelbob.xyz", "https://piped.projectsegfau.lt", "https://piped.privacydev.net", - "https://piped.palveluntarjoaja.eu", "https://piped.smnz.de", "https://piped.adminforge.de", "https://watch.whatevertinfoil.de", @@ -234,7 +238,10 @@ "http://qwikxx2erhx6qrymued6ox2qkf2yeogjwypqvzoif4fqkljixasr6oid.onion", "http://4g47cxugkohbweao2x66nnxxfoe3k7gdfzxej537nhdbwr522sbjxeqd.onion", "http://nt.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion", - "http://tw.lpoaj7z2zkajuhgnlltpeqh3zyq7wk2iyeggqaduhgxhyajtdt2j7wad.onion" + "http://tw.lpoaj7z2zkajuhgnlltpeqh3zyq7wk2iyeggqaduhgxhyajtdt2j7wad.onion", + "http://r2eqimhkvxboaltbdsectoo3hkf476pyemsdykclexzajbfx5v6ojlyd.onion", + "http://li7snkj6oituazbkr5clmilccwwumhd2dntbhttxomy4dfakeeoar4qd.onion", + "http://a5xyidyppowvblric6k6nixgf2eqwnb7zzeaarj7slqbv7tb6ip5t3ad.onion" ], "i2p": [ "http://axd6uavsstsrvstva4mzlzh4ct76rc6zdug3nxdgeitrzczhzf4q.b32.i2p", @@ -302,7 +309,8 @@ "https://futureddit.gq", "https://lr.slipfox.xyz", "https://libreddit.oxymagnesium.com", - "https://reddit.utsav2.dev" + "https://reddit.utsav2.dev", + "https://libreddit.freedit.eu" ], "tor": [ "http://ecue64ybzvn6vjzl37kcsnwt4ycmbsyf74nbttyg7rkc3t3qwnj7mcyd.onion", @@ -522,7 +530,6 @@ "searx": { "clearnet": [ "https://dynabyte.ca", - "https://icanfindit.online", "https://jsearch.pw", "https://search.ethibox.fr", "https://search.snopyta.org", @@ -538,6 +545,7 @@ "https://searx.nakhan.net", "https://searx.netzspielplatz.de", "https://searx.nixnet.services", + "https://searx.rimkus.it", "https://searx.ru", "https://searx.run", "https://searx.semipvt.com", @@ -560,12 +568,12 @@ ], "tor": [ "http://3afisqjw2rxm6z7mmstyt5rx75qfqrgxnkzftknbp2vhipr2nrmrjdyd.onion", + "http://privateoz3u5utrimal2edr56j3r5caakektxxgixigdkycuxigvquid.onion", "http://yra4tke2pwcnatxjkufpw6kvebu3h3ti2jca2lcdpgx3mpwol326lzid.onion", "http://z5vawdol25vrmorm4yydmohsd4u6rdoj2sylvoi3e3nqvxkvpqul7bqd.onion", "http://zbuc3bbzbfdqqo2x46repx2ddajbha6fpsjeeptjhhhhzji3zopxdqyd.onion", "http://f4qfqajszpx5b7itzxt6mb7kj4ktpgbdq7lq6xaiqyqx6a7de3epptad.onion", - "http://searx.micohauwkjbyw5meacrb4ipicwvwg4xtzl7y7viv53kig2mdcsvwkyyd.onion", - "http://searx.privpw3tndpkw6pnp3g727zfgfdzbu3k6a7chv226s3xymv2p4eiuqyd.onion" + "http://searx.micohauwkjbyw5meacrb4ipicwvwg4xtzl7y7viv53kig2mdcsvwkyyd.onion" ], "i2p": [ "http://ransack.i2p", @@ -633,7 +641,6 @@ "https://searx.orion-hub.fr", "https://searx.priv.pw", "https://searx.prvcy.eu", - "https://searx.rimkus.it", "https://searx.sethforprivacy.com", "https://searx.sev.monster", "https://searx.slipfox.xyz/searx", @@ -656,7 +663,6 @@ "tor": [ "http://w5rl6wsd7mzj4bdkbuqvzidet5osdsm5jhg2f7nvfidakfq5exda5wid.onion", "http://4n53nafyi77iplnbrpmxnp3x4exbswwxigujaxy3b37fvr7bvlopxeyd.onion", - "http://privateoz3u5utrimal2edr56j3r5caakektxxgixigdkycuxigvquid.onion", "http://b6sxmon57qza6dt36li7huabie5ntrvjr4q5rc2vvbn4hqvzd4phrvyd.onion", "http://searxngg6zleq6ceboe5ltkyo4hyrb3aaycrgzmrljv3jjlb5vcytead.onion", "http://gbat2pbpg7ys3fi3pbp64667tt5x66mg45xok35bxdw7v55brm7a27yd.onion", @@ -664,6 +670,7 @@ "http://searxdr3pqz4nydgnqocsia2xbywptxbkympa2emn7zlgggrir4bkfad.onion", "http://searx.esmail5pdn24shtvieloeedh7ehz3nrwcdivnfhfcedl7gf4kwddhkqd.onion", "http://searxfilowxokbogygrigir4wqxfxqzuxofxgdon7dg6rsii4yxzytyd.onion", + "http://searx.privpw3tndpkw6pnp3g727zfgfdzbu3k6a7chv226s3xymv2p4eiuqyd.onion", "http://rq2w52kyrif3xpfihkgjnhqm3a5aqhoikpv72z3drpjglfzc2wr5z4yd.onion", "http://fub6vgedgeadlu3ctskrpkcqjruh76tckwtj5swfhyblgml2tzgzckqd.onion/searx", "http://searx3aolosaf3urwnhpynlhuokqsgz47si4pzz5hvb7uuzyjncl2tid.onion", @@ -823,10 +830,10 @@ }, "peertube": [ "https://search.joinpeertube.org", + "https://video.bmu.cloud", "https://freedomadultgames.video", "https://tbh.co-shaoghal.net", "https://tube.kansanvalta.org", - "https://duanrra.cf", "https://ytube.retronerd.at", "https://tube.media-techport.de", "https://notobono.de", @@ -844,7 +851,6 @@ "https://videos.im.allmendenetz.de", "https://tube.cyberia.club", "https://casstream.nohost.me", - "https://peertube.as62430.net", "https://peertube.askan.info", "https://apertatube.net", "https://beetoons.tv", @@ -860,7 +866,6 @@ "https://tube-test.apps.education.fr", "https://tube-sciences-technologies.apps.education.fr", "https://tube-institutionnel.apps.education.fr", - "https://trutube.online", "https://tube-cycle-3.apps.education.fr", "https://video.manicphase.me", "https://tubulus.openlatin.org", @@ -893,7 +898,6 @@ "https://jahve.pl", "https://videos.yesil.club", "https://peertube.adjutor.xyz", - "https://peertube.terranout.mine.nu", "https://tube.hunterjozwiak.com", "https://tube-numerique-educatif.apps.education.fr", "https://tube.itsg.host", @@ -928,7 +932,6 @@ "https://seka.pona.la", "https://syop.tv", "https://watch.thelema.social", - "https://tube.miegl.cz", "https://mov.clov.fr", "https://video.vaku.org.ua", "https://videos.trom.lt", @@ -991,7 +994,6 @@ "https://ocfedtest.hosted.spacebear.ee", "https://video.lono.space", "https://mirrored.rocks", - "https://videopen.net", "https://demo.lioncast.org", "https://peertube.get-racing.de", "https://pierre.tube", @@ -1011,14 +1013,12 @@ "https://ptube.horsentiers.fr", "https://video.cnt.social", "https://tube.03281.fspfc.org", - "https://tube.linc.systems", "https://peertube.ketchup.noho.st", "https://yt.x1337x.fr", "https://videos.rabbit-company.com", "https://video.paradigmthreat.net", "https://vid.twhtv.club", "https://video.retroedge.tech", - "https://truvitv.com", "https://pt.ilyamikcoder.com", "https://peertube.sensin.eu", "https://video.sadmin.io", @@ -1084,7 +1084,6 @@ "https://peertube.revelin.fr", "https://peertube.ti-fr.com", "https://video.turbo.chat", - "https://peertube.am-networks.fr", "https://video.chbmeyer.de", "https://video.rs-einrich.de", "https://p2ptv.ru", @@ -1143,7 +1142,6 @@ "https://tube.childrenshealthdefense.eu", "https://stream.litera.tools", "https://peertube.kriom.net", - "https://peertube.grosist.fr", "https://peertube.gemlog.ca", "https://nettube.uc-netcorsoft.de", "https://live.solari.com", @@ -1196,7 +1194,6 @@ "https://video.windfluechter.org", "https://pocketnetpeertube10.nohost.me", "https://tube.io18.top", - "https://peertube.remerge.net", "https://tube.geekyboo.net", "https://notretube.asselma.eu", "https://canal.facil.services", @@ -1482,7 +1479,6 @@ "https://video.mycrowd.ca", "https://kodcast.com", "https://video.altertek.org", - "https://ruraletv.ovh", "https://tube.oisux.org", "https://peertube.louisematic.site", "https://clap.nerv-project.eu", @@ -1667,7 +1663,6 @@ "https://video.vny.fr", "https://peervideo.club", "https://tube.taker.fr", - "https://peertube.co.uk", "https://video.fitchfamily.org", "https://video.fdlibre.eu", "https://peer.philoxweb.be", diff --git a/src/pages/popup/style.css b/src/pages/popup/style.css index 3b409be..5358973 100644 --- a/src/pages/popup/style.css +++ b/src/pages/popup/style.css @@ -59,6 +59,6 @@ input { content: ""; display: block; pointer-events: none; - top: 13px; - left: 157.4px; + top: 14px; + left: 156px; }