diff --git a/src/_locales/pt/messages.json b/src/_locales/pt/messages.json index dd7658b..fdb2291 100644 --- a/src/_locales/pt/messages.json +++ b/src/_locales/pt/messages.json @@ -36,7 +36,7 @@ "description": "used in the settings page" }, "excludeFromRedirecting": { - "message": "Excluded from redirecting", + "message": "Excluído do redirecionamento", "description": "used in the settings page" }, "importSettings": { @@ -56,7 +56,7 @@ "description": "used in the settings page" }, "showInPopup": { - "message": "Show in popup", + "message": "Mostrar no pop-up", "description": "used in the settings page" }, "frontend": { @@ -80,7 +80,7 @@ "description": "used in the settings page" }, "addYourFavoriteInstances": { - "message": "Add your favorite instances", + "message": "Adicionar a sua instância favorita", "description": "used in the settings page" }, "copyRaw": { @@ -90,14 +90,14 @@ "message": "Copiado" }, "redirectToOriginal": { - "message": "Redirect to original", + "message": "Redirecionar para o original", "description": "Used in context menus when right clicking on a page/tab" }, "redirectLink": { - "message": "Tentar redirecionar esta hiperligação", + "message": "Tentar redirecionar", "description": "Used in context menus when right clicking on a hyperlink" }, "about": { - "message": "About" + "message": "Sobre" } -} \ No newline at end of file +} diff --git a/src/assets/images/instructables-icon.svg b/src/assets/images/instructables-icon.svg new file mode 100644 index 0000000..9b7eaa2 --- /dev/null +++ b/src/assets/images/instructables-icon.svg @@ -0,0 +1,372 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/assets/images/myIp-icon-light.svg b/src/assets/images/myIp-icon-light.svg new file mode 100644 index 0000000..bfa5bbd --- /dev/null +++ b/src/assets/images/myIp-icon-light.svg @@ -0,0 +1,39 @@ + + + + + + diff --git a/src/assets/images/myIp-icon.svg b/src/assets/images/myIp-icon.svg new file mode 100644 index 0000000..c386420 --- /dev/null +++ b/src/assets/images/myIp-icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/images/pixiv-icon.svg b/src/assets/images/pixiv-icon.svg new file mode 100644 index 0000000..9460979 --- /dev/null +++ b/src/assets/images/pixiv-icon.svg @@ -0,0 +1,49 @@ + + + + diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index cc7c3e1..e949088 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -60,20 +60,23 @@ function redirect(url, type, initiator, forceRedirection) { frontend = options[service].frontend - if (!regexArray(service, url, config, frontend)) { - frontend = null - continue - } - if ( - (config.services[service].embeddable && type != options[service].redirectType && options[service].redirectType != "both") - || - (!config.services[service].embeddable && type != "main_frame") + config.services[service].embeddable && + type != options[service].redirectType && options[service].redirectType != "both" ) { if (options[service].unsupportedUrls == 'block') return 'CANCEL' return } + if (config.services[service].frontends[frontend].desktopApp && type != "main_frame" && options[service].redirectType != "main_frame") + frontend = options[service].embedFrontend + + + if (!regexArray(service, url, config, frontend)) { + frontend = null + continue + } + let instanceList = options[frontend] if (instanceList === undefined) break if (instanceList.length === 0) return null @@ -461,7 +464,6 @@ function redirect(url, type, initiator, forceRedirection) { } } case "biblioReads": { - if (!url.pathname.startsWith('/book/show/') && url.pathname != '/') return randomInstance return `${randomInstance}${url.pathname}${url.search}` } case "wikiless": { @@ -596,6 +598,24 @@ function redirect(url, type, initiator, forceRedirection) { if (path == "/") path = "" return `${randomInstance}/${url.hostname}${path}${url.search}` } + case "quetre": { + const regex = /([a-z]+)\.quora\.com/.exec(url.hostname) + console.log(regex) + if (regex) { + const lang = regex[1] + url.searchParams.append("lang", lang) + return `${randomInstance}${url.pathname}${url.search}` + } + return `${randomInstance}${url.pathname}${url.search}` + } + case "pixivFe": { + const regex = /\/[a-z]{1,3}\/(.*)/.exec(url.pathname) + if (regex) { + const path = regex[1] + return `${randomInstance}/${path}${url.search}` + } + return `${randomInstance}${url.pathname}${url.search}` + } default: { return `${randomInstance}${url.pathname}${url.search}` } @@ -749,7 +769,10 @@ const defaultInstances = { "laboratory": ['https://lab.vern.cc'], "libreSpeed": ['https://librespeed.org'], 'jitsi': ['https://meet.jit.si', 'https://8x8.vc'], - 'binternet': ['https://binternet.ahwx.org'] + 'binternet': ['https://binternet.ahwx.org'], + 'pixivFe': ['https://pixivfe.exozy.me'], + 'indestructables': ['https://indestructables.private.coffee'], + 'wtfismyip': ['https://myip.wtf'] } function initDefaults() { diff --git a/src/config.json b/src/config.json index 473090b..326b89b 100644 --- a/src/config.json +++ b/src/config.json @@ -69,6 +69,7 @@ ], "name": "FreeTube", "embeddable": false, + "desktopApp": true, "instanceList": false, "url": "https://github.com/FreeTubeApp/FreeTube" }, @@ -79,24 +80,26 @@ ], "name": "Yattee", "embeddable": false, + "desktopApp": true, "instanceList": false, "url": "https://github.com/yattee/yattee" } }, "targets": [ "^https?:\\/{2}redirect\\.invidious\\.io\\/.*", - "^https?:\\/{2}(?:www\\.|m\\.|)youtube.com(\\/|$)(?!iframe_api\\/|redirect\\/)", + "^https?:\\/{2}(www\\.|m\\.)?youtube.com(\\/|$)(?!iframe_api\\/|redirect\\/)", "^https?:\\/{2}img\\.youtube.com\\/vi\\/.*\\/..*", - "^https?:\\/{2}(?:i|s)\\.ytimg.com\\/vi\\/.*\\/..*", - "^https?:\\/{2}(?:www\\.|)youtube.com\\/watch?v=..*", - "^https?:\\/{2}youtu\\.be\\/..*", - "^https?:\\/{2}(?:www\\.|)(youtube|youtube-nocookie)\\.com\\/embed\\/..*" + "^https?:\\/{2}(i|s)\\.ytimg.com\\/vi\\/.*\\/..*", + "^https?:\\/{2}(www\\.)?youtube.com\\/watch?v=..*", + "^https?:\\/{2}(www\\.)?youtu\\.be\\/..*", + "^https?:\\/{2}(www\\.)?(youtube|youtube-nocookie)\\.com\\/embed\\/..*" ], "name": "YouTube", "options": { "enabled": false, "redirectType": "main_frame", "frontend": "invidious", + "embedFrontend": "invidious", "unsupportedUrls": "bypass" }, "imageType": "png", @@ -126,7 +129,6 @@ "unsupportedUrls": "bypass" }, "imageType": "png", - "embeddable": false, "url": "https://music.youtube.com" }, "mixi": { @@ -191,8 +193,8 @@ } }, "targets": [ - "^https?:\\/{2}(www\\.|mobile\\.|)twitter\\.com(\\/|$)", - "^https?:\\/{2}(pbs\\.|video\\.|)twimg\\.com(\\/|$)", + "^https?:\\/{2}(www\\.|mobile\\.)?twitter\\.com(\\/|$)", + "^https?:\\/{2}(pbs\\.|video\\.)twimg\\.com(\\/|$)", "^https?:\\/{2}platform\\.twitter\\.com/embed(\\/|$)", "^https?:\\/{2}t\\.co(\\/|$)" ], @@ -218,7 +220,7 @@ } }, "targets": [ - "^https?:\\/{2}(www\\.|)tiktok\\.com(\\/|$)" + "^https?:\\/{2}(www\\.)?tiktok\\.com(\\/|$)" ], "name": "TikTok", "options": { @@ -228,7 +230,6 @@ "instance": "public" }, "imageType": "png", - "embeddable": false, "url": "https://tiktok.com" }, "reddit": { @@ -247,7 +248,7 @@ } }, "targets": [ - "^https?:\\/{2}(www\\.|old\\.|np\\.|new\\.|amp\\.|)(reddit|reddittorjg6rue252oqsxryoxengawnmo46qy4kyii5wtqnwfj4ooad)\\.(com|onion)(?=\\/u(ser)?\\/|\\/r\\/|\\/search|\\/new|\\/?$)", + "^https?:\\/{2}(www\\.|old\\.|np\\.|new\\.|amp\\.)?(reddit|reddittorjg6rue252oqsxryoxengawnmo46qy4kyii5wtqnwfj4ooad)\\.(com|onion)(?=\\/u(ser)?\\/|\\/r\\/|\\/search|\\/new|\\/?$)", "^https?:\\/{2}(i|(external-)?preview)\\.redd\\.it" ], "name": "Reddit", @@ -258,7 +259,6 @@ "instance": "public" }, "imageType": "png", - "embeddable": false, "url": "https://reddit.com" }, "imgur": { @@ -286,6 +286,26 @@ "embeddable": true, "url": "https://imgur.com" }, + "pixiv": { + "name": "Pixiv", + "frontends": { + "pixivFe": { + "name": "PixivFE", + "instanceList": true, + "url": "https://codeberg.org/VnPower/pixivfe" + } + }, + "targets": [ + "^https?:\\/{2}(www\\.)?pixiv\\.net\\/" + ], + "options": { + "enabled": false, + "unsupportedUrls": "bypass", + "frontend": "pixivFe" + }, + "imageType": "svg", + "url": "https://www.pixiv.net" + }, "medium": { "frontends": { "scribe": { @@ -327,7 +347,6 @@ "unsupportedUrls": "bypass" }, "imageType": "svg", - "embeddable": false, "url": "https://medium.com" }, "quora": { @@ -350,7 +369,6 @@ "instance": "public" }, "imageType": "png", - "embeddable": false, "url": "https://quora.com" }, "imdb": { @@ -363,7 +381,7 @@ } }, "targets": [ - "^https?:\\/{2}(?:www\\.|m\\.|)imdb\\.com" + "^https?:\\/{2}(www\\.|m\\.)?imdb\\.com" ], "name": "IMDb", "options": { @@ -373,7 +391,6 @@ "instance": "public" }, "imageType": "svg", - "embeddable": false, "url": "https://imdb.com" }, "fandom": { @@ -385,7 +402,7 @@ } }, "targets": [ - "^https?:\\/{2}(?:[a-zA-Z0-9-]+\\.)?(?:fandom|wikia)\\.com(?=\\/wiki|\\/?$)" + "^https?:\\/{2}([a-zA-Z0-9-]+\\.)?(fandom|wikia)\\.com(?=\\/wiki|\\/?$)" ], "name": "Fandom", "options": { @@ -395,7 +412,6 @@ "frontend": "breezeWiki" }, "imageType": "svg", - "embeddable": false, "url": "https://fandom.com" }, "pinterest": { @@ -487,7 +503,6 @@ "instance": "public" }, "imageType": "svgMono", - "embeddable": false, "url": "https://search.libreredirect.invalid" }, "translate": { @@ -522,7 +537,6 @@ "instance": "public" }, "imageType": "svgMono", - "embeddable": false, "url": "https://translate.libreredirect.invalid" }, "maps": { @@ -549,7 +563,6 @@ "unsupportedUrls": "bypass" }, "imageType": "svgMono", - "embeddable": false, "url": "https://maps.libreredirect.invalid" }, "sendFiles": { @@ -572,7 +585,6 @@ "frontend": "send" }, "imageType": "svgMono", - "embeddable": false, "url": "https://send.libreredirect.invalid" }, "textStorage": { @@ -593,7 +605,6 @@ "frontend": "privateBin" }, "imageType": "svgMono", - "embeddable": false, "url": "https://paste.libreredirect.invalid" }, "reuters": { @@ -614,7 +625,6 @@ "frontend": "neuters" }, "imageType": "svg", - "embeddable": false, "url": "https://reuters.com" }, "genius": { @@ -643,7 +653,6 @@ "instance": "public" }, "imageType": "svg", - "embeddable": false, "url": "https://genius.com" }, "urbanDictionary": { @@ -664,7 +673,6 @@ "frontend": "ruralDictionary" }, "imageType": "svg", - "embeddable": false, "url": "https://urbandictionary.com" }, "stackOverflow": { @@ -677,7 +685,7 @@ } }, "targets": [ - "^https?:\\/{2}?stackoverflow\\.com\\/", + "^https?:\\/{2}(www\\.)?stackoverflow\\.com\\/", "^https?:\\/{2}([a-zA-Z0-9-]+\\.)?stackexchange\\.com\\/" ], "name": "Stack Overflow", @@ -688,7 +696,6 @@ "instance": "public" }, "imageType": "svgMono", - "embeddable": false, "url": "https://stackoverflow.com/" }, "goodreads": { @@ -711,7 +718,6 @@ "instance": "public" }, "imageType": "svgMono", - "embeddable": false, "url": "https://goodreads.com/" }, "wikipedia": { @@ -723,7 +729,7 @@ } }, "targets": [ - "^https?:\\/{2}(?:[a-z]+\\.)*wikipedia\\.org\\/?" + "^https?:\\/{2}([a-z]+\\.)*wikipedia\\.org\\/?" ], "name": "Wikipedia", "options": { @@ -732,7 +738,6 @@ "frontend": "wikiless" }, "imageType": "svg", - "embeddable": false, "url": "https://wikipedia.org" }, "snopes": { @@ -753,7 +758,6 @@ "frontend": "suds" }, "imageType": "svg", - "embeddable": false, "url": "https://www.snopes.com" }, "waybackMachine": { @@ -774,7 +778,6 @@ "frontend": "waybackClassic" }, "imageType": "svgMono", - "embeddable": false, "url": "https://web.archive.org" }, "github": { @@ -795,7 +798,6 @@ "frontend": "gothub" }, "imageType": "svgMono", - "embeddable": false, "url": "https://github.com" }, "bilibili": { @@ -817,7 +819,6 @@ "frontend": "mikuInvidious" }, "imageType": "svgMono", - "embeddable": false, "url": "https://bilibili.com/" }, "bandcamp": { @@ -839,7 +840,6 @@ "frontend": "tent" }, "imageType": "svg", - "embeddable": false, "url": "https://bandcamp.com" }, "gitlab": { @@ -862,30 +862,8 @@ "frontend": "laboratory" }, "imageType": "svg", - "embeddable": false, "url": "https://gitlab.com/" }, - "wolframAlpha": { - "frontends": { - "wolfreeAlpha": { - "name": "WolfreeAlpha", - "instanceList": true, - "url": "https://git.disroot.org/wolfree" - } - }, - "targets": [ - "^https?:\\/{2}(www\\.)?wolframalpha\\.com\\/" - ], - "name": "Wolfram Alpha", - "options": { - "enabled": false, - "unsupportedUrls": "bypass", - "frontend": "wolfreeAlpha" - }, - "imageType": "svg", - "embeddable": false, - "url": "https://www.wolframalpha.com" - }, "speedTest": { "frontends": { "libreSpeed": { @@ -906,9 +884,28 @@ "frontend": "libreSpeed" }, "imageType": "svgMono", - "embeddable": false, "url": "https://speedtest.libreredirect.invalid" }, + "instructables": { + "name": "Instructables", + "frontends": { + "indestructables": { + "name": "Indestructables", + "instanceList": true, + "url": "https://indestructables.codeberg.page" + } + }, + "targets": [ + "^https?:\\/{2}(www\\.)?instructables\\.com\\/" + ], + "options": { + "enabled": false, + "unsupportedUrls": "bypass", + "frontend": "indestructables" + }, + "imageType": "svg", + "url": "https://www.instructables.com" + }, "meet": { "name": "Meet", "frontends": { @@ -927,8 +924,48 @@ "frontend": "jitsi" }, "imageType": "svgMono", - "embeddable": false, "url": "https://meet.libreredirect.invalid" + }, + "myIp": { + "frontends": { + "wtfismyip": { + "name": "wtfismyip", + "instanceList": true, + "url": "https://gitlab.com/wtfismyip/wtfismyip" + } + }, + "targets": [ + "^https?:\\/{2}myip\\.libreredirect\\.invalid\\/" + ], + "name": "My IP", + "options": { + "enabled": false, + "unsupportedUrls": "bypass", + "frontend": "wtfismyip" + }, + "imageType": "svgMono", + "url": "https://myip.libreredirect.invalid" + }, + "wolframAlpha": { + "frontends": { + "wolfreeAlpha": { + "name": "WolfreeAlpha", + "instanceList": true, + "url": "https://git.disroot.org/wolfree" + } + }, + "targets": [ + "^https?:\\/{2}(www\\.)?wolframalpha\\.com\\/" + ], + "name": "Wolfram Alpha", + "options": { + "enabled": false, + "unsupportedUrls": "bypass", + "frontend": "wolfreeAlpha" + }, + "imageType": "svg", + "url": "https://www.wolframalpha.com" +>>>>>>> c46c0fb83a38ca73aa30a64a49c7973bcf1d01df } } } diff --git a/src/pages/options/index.js b/src/pages/options/index.js index 31222ad..be76c64 100644 --- a/src/pages/options/index.js +++ b/src/pages/options/index.js @@ -33,7 +33,11 @@ async function changeFrontendsSettings(service) { if (config.services[service].frontends[frontend].instanceList) { const frontendDiv = document.getElementById(frontend) if (typeof divs[service].frontend !== "undefined") { - if (frontend == divs[service].frontend.value) { + if ( + frontend == divs[service].frontend.value + || + (!config.services[service].frontends[divs[service].frontend.value].embeddable && divs[service].embedFrontend && frontend == divs[service].embedFrontend.value) + ) { frontendDiv.style.display = "" if (config.services[service].frontends[frontend].localhost === true) { document.getElementById(`${service}-instance-div`).style.display = "" @@ -58,13 +62,29 @@ async function changeFrontendsSettings(service) { ` - document.getElementById(`${service}-redirectType`).value = options[frontend].redirectType = options[service].redirectType + } + else if (config.services[service].frontends[frontend].desktopApp && Object.values(config.services[service].frontends).some(frontend => frontend.embeddable)) { + document.getElementById(`${service}-redirectType`).innerHTML = ` + + ` + if (options[service].redirectType == "sub_frame") { + options[service].redirectType = "main_frame" + browser.storage.local.set({ options }) + } } else { document.getElementById(`${service}-redirectType`).innerHTML = '' options[service].redirectType = "main_frame" + browser.storage.local.set({ options }) } + document.getElementById(`${service}-redirectType`).value = options[service].redirectType + if (config.services[service].frontends[frontend].desktopApp && options[service].redirectType != "main_frame") { + document.getElementById(`${service}-embedFrontend-div`).style.display = '' + } else { + document.getElementById(`${service}-embedFrontend-div`).style.display = 'none' + } } const frontend_name_element = document.getElementById(`${service}_page`).getElementsByClassName("frontend_name")[0] frontend_name_element.href = config.services[service].frontends[divs[service].frontend.value].url diff --git a/src/pages/options/widgets/services.pug b/src/pages/options/widgets/services.pug index d9e5acd..564ba50 100644 --- a/src/pages/options/widgets/services.pug +++ b/src/pages/options/widgets/services.pug @@ -29,10 +29,18 @@ each val, service in services option(value="localhost") localhost option(value="public") public instances - if services[service].embeddable - div(class="some-block option-block") - h4(data-localise="__MSG_redirectType__") Redirect Type - select(id=service+"-redirectType") + div(class="some-block option-block") + h4(data-localise="__MSG_redirectType__") Redirect Type + select(id=service+"-redirectType") + + + div(id=service+"-embedFrontend-div" class="some-block option-block") + h4(data-localise="__MSG_embedFrontend__") Embed Frontend + select(id=service+"-embedFrontend") + each val, frontend in services[service].frontends + if services[service].frontends[frontend].embeddable && services[service].frontends[frontend].instanceList + option(value=frontend)=services[service].frontends[frontend].name + div(class="some-block option-block") h4 Unsupported iframes handling diff --git a/src/pages/stylesheets/styles.css b/src/pages/stylesheets/styles.css index 875763d..fb246b7 100644 --- a/src/pages/stylesheets/styles.css +++ b/src/pages/stylesheets/styles.css @@ -128,7 +128,7 @@ section.links { flex-wrap: wrap; flex-direction: column; width: 300px; - max-height: 800px; + max-height: 850px; } section.links div {