diff --git a/privacy-redirector.js b/privacy-redirector.js index fbf50bf..7e3a59e 100644 --- a/privacy-redirector.js +++ b/privacy-redirector.js @@ -4,7 +4,7 @@ // @name:de Datenschutz Umleiter // @namespace https://github.com/dybdeskarphet/privacy-redirector // @license GPLv3 -// @version 1.2.10 +// @version 1.2.9 // @description Redirect social media platforms to their privacy respecting frontends // @description:tr Sosyal medya platformlarını, gizliliğe saygı duyan önyüzlerine yönlendirir // @description:de Leitet von Social-Media-Plattformen auf deren jeweilige datenschutzfreundlicheren Frontends @@ -41,18 +41,19 @@ CHANGE THE RELEVANT VALUE TO "false" TO DISABLE THE REDIRECTION FOR THAT PARTICULAR SITE */ -var redirect_youtube = true; -var redirect_instagram = false; -var redirect_twitter = true; -var redirect_reddit = true; -var redirect_tiktok = true; -var redirect_imgur = true; -var redirect_medium = true; -var redirect_hackernews = true; var redirect_gtranslate = true; -var redirect_reuters = true; -var redirect_wikipedia = true; +var redirect_hackernews = true; var redirect_imdb = true; +var redirect_imgur = true; +var redirect_instagram = false; +var redirect_medium = true; +var redirect_quora = true; +var redirect_reddit = true; +var redirect_reuters = true; +var redirect_tiktok = true; +var redirect_twitter = true; +var redirect_wikipedia = true; +var redirect_youtube = true; // // // // // // // // // // // // // @@ -83,23 +84,48 @@ function redirectInstagram() { if (window.location.pathname.startsWith("/accounts/login/")) { if (window.location.search.indexOf("/reel/") != -1) { // reels - let newURL = window.location.protocol + "//" + randomInstance + window.location.pathname.replace("/accounts/login/", "/") + window.location.search.replace("?next=/reel", "p") + window.location.hash; + let newURL = window.location.protocol + + "//" + randomInstance + + window.location.pathname.replace("/accounts/login/", "/") + + window.location.search.replace("?next=/reel", "p") + + window.location.hash; + window.location.replace(newURL); } else if (window.location.search.indexOf("/p/") == -1) { // user pages - it will break if it's not the second last block - let newURL = window.location.protocol + "//" + randomInstance + window.location.pathname.replace("/accounts/login/", "/") + window.location.search.replace("?next=", "u") + window.location.hash; + let newURL = window.location.protocol + + "//" + randomInstance + + window.location.pathname.replace("/accounts/login/", "/") + + window.location.search.replace("?next=", "u") + + window.location.hash; + window.location.replace(newURL); } else { // probably a post - let newURL = window.location.protocol + "//" + randomInstance + window.location.pathname.replace("/accounts/login/", "") + window.location.search.replace("?next=", "") + window.location.hash; + let newURL = window.location.protocol + + "//" +randomInstance + + window.location.pathname.replace("/accounts/login/", "") + + window.location.search.replace("?next=", "") + + window.location.hash; + window.location.replace(newURL); } } else { if (window.location.pathname == "/") { // home page location.hostname = randomInstance } else if (window.location.pathname.startsWith("/reel/")) { // reel - let newURL = window.location.protocol + "//" + randomInstance + window.location.pathname.replace("/reel", "/p") + window.location.hash; + let newURL = window.location.protocol + + "//" + randomInstance + + window.location.pathname.replace("/reel", "/p") + + window.location.hash; + window.location.replace(newURL); + } else if (! window.location.pathname.startsWith("/p/")) { // user page - it will break if it's not the second last block - let newURL = window.location.protocol + "//" + randomInstance + "/u" + window.location.pathname + window.location.search + window.location.hash; + let newURL = window.location.protocol + + "//" + randomInstance + + "/u" + window.location.pathname + + window.location.search + + indow.location.hash; + window.location.replace(newURL); } else { // probably a post location.hostname = randomInstance @@ -114,7 +140,12 @@ function redirectTwitter() { window.stop(); - let newURL = window.location.protocol + "//" + farsideInstance + "/nitter" + window.location.pathname + window.location.search + window.location.hash; + let newURL = window.location.protocol + + "//" + farsideInstance + "/nitter" + + window.location.pathname + + window.location.search + + window.location.hash; + window.location.replace(newURL); } @@ -129,10 +160,20 @@ function redirectReddit() { let farsideTeddit = farsideInstance + "/teddit"; if (window.location.hostname == "old.reddit.com") { - let newURL = window.location.protocol + "//" + farsideTeddit + window.location.pathname + window.location.search + window.location.hash; + let newURL = window.location.protocol + + "//" + farsideTeddit + + window.location.pathname + + window.location.search + + window.location.hash; + window.location.replace(newURL); } else { - let newURL = window.location.protocol + "//" + farsideLibreddit + window.location.pathname + window.location.search + window.location.hash; + let newURL = window.location.protocol + + "//" + farsideLibreddit + + window.location.pathname + + window.location.search + + window.location.hash; + window.location.replace(newURL); } } @@ -144,7 +185,12 @@ function redirectYoutube() { window.stop(); - let newURL = window.location.protocol + "//" + farsideInstance + "/invidious" + window.location.pathname + window.location.search + window.location.hash; + let newURL = window.location.protocol + + "//" + farsideInstance + "/invidious" + + window.location.pathname + + window.location.search + + window.location.hash; + window.location.replace(newURL); } @@ -165,13 +211,27 @@ function redirectTiktok() { window.stop(); if (window.location.pathname.startsWith("/discover")) { - let newURL = window.location.protocol + "//" + randomInstance + window.location.pathname.replace("discover", "tag") + window.location.hash; + let newURL = window.location.protocol + + "//" + randomInstance + + window.location.pathname.replace("discover", "tag") + + window.location.hash; + window.location.replace(newURL); } else if (window.location.pathname.search(/[a-z][a-z]\-[A-Z][A-Z]/g) != -1) { - let newURL = window.location.protocol + "//" + randomInstance + window.location.pathname + window.location.search + window.location.hash; + let newURL = window.location.protocol + + "//" + randomInstance + + window.location.pathname + + window.location.search + + window.location.hash; + window.location.replace(newURL); } else { - let newURL = window.location.protocol + "//" + randomInstance + window.location.pathname + window.location.search + window.location.hash; + let newURL = window.location.protocol + + "//" + randomInstance + + window.location.pathname + + window.location.search + + window.location.hash; + window.location.replace(newURL); } @@ -184,8 +244,13 @@ function redirectImgur() { window.stop(); - let newURL = window.location.protocol + "//" + farsideInstance + "/rimgo" + window.location.pathname + window.location.search + window.location.hash; - window.location.replace(newURL); + let newURL = window.location.protocol + + "//" + farsideInstance + "/rimgo" + + window.location.pathname + + window.location.search + + window.location.hash; + + window.location.replace(newURL); } function redirectMedium() { @@ -195,7 +260,12 @@ function redirectMedium() { window.stop(); - let newURL = window.location.protocol + "//" + farsideInstance + "/scribe" + window.location.pathname + window.location.search + window.location.hash; + let newURL = window.location.protocol + + "//" + farsideInstance + "/scribe" + + window.location.pathname + + window.location.search + + window.location.hash; + window.location.replace(newURL); } @@ -207,16 +277,36 @@ function redirectYoutubeMusic() { window.stop(); if (window.location.pathname.startsWith("/playlist")) { - let newURL = window.location.protocol + "//" + "beatbump.ml" + window.location.pathname + window.location.search.replace("?list=", "/VL") + window.location.hash; + let newURL = window.location.protocol + + "//" + "beatbump.ml" + + window.location.pathname + + window.location.search.replace("?list=", "/VL") + + window.location.hash; + window.location.replace(newURL); } else if (window.location.pathname.startsWith("/channel")) { - let newURL = window.location.protocol + "//" + "beatbump.ml" + window.location.pathname.replace("/channel", "/artist") + window.location.search + window.location.hash; + let newURL = window.location.protocol + + "//" + "beatbump.ml" + + window.location.pathname.replace("/channel", "/artist") + + window.location.search + + window.location.hash; + window.location.replace(newURL); } else if (window.location.pathname.startsWith("/explore")) { - let newURL = window.location.protocol + "//" + "beatbump.ml" + window.location.pathname.replace("/explore", "/trending") + window.location.search + window.location.hash; + let newURL = window.location.protocol + + "//" + "beatbump.ml" + + window.location.pathname.replace("/explore", "/trending") + + window.location.search + + window.location.hash; + window.location.replace(newURL); } else if (window.location.pathname.startsWith("/moods_and_genres")) { - let newURL = window.location.protocol + "//" + "beatbump.ml" + window.location.pathname.replace("/moods_and_genres", "/explore") + window.location.search + window.location.hash; + let newURL = window.location.protocol + + "//" + "beatbump.ml" + + window.location.pathname.replace("/moods_and_genres", "/explore") + + window.location.search + + window.location.hash; + window.location.replace(newURL); } else { location.hostname = "beatbump.ml"; @@ -243,10 +333,22 @@ function redirectGTranslate() { if (window.location.search != "") { - let newURL = window.location.protocol + "//" + farsideInstance + "/lingva" + window.location.pathname + window.location.search.replace(/\?hl=tr/, "").replace(/.sl=/, "").replace("&tl=", "/").replace("&text=", "/").replace("&op=translate", "") + window.location.hash; + let newURL = window.location.protocol + + "//" + farsideInstance + "/lingva" + + window.location.pathname + + window.location.search + .replace(/\?hl=tr/, "") + .replace(/.sl=/, "") + .replace("&tl=", "/") + .replace("&text=", "/") + .replace("&op=translate", "") + + window.location.hash; + window.location.replace(newURL); } else { - let newURL = window.location.protocol + "//" + farsideInstance + "/lingva"; + let newURL = window.location.protocol + + "//" + farsideInstance + "/lingva"; + window.location.replace(newURL); } } @@ -264,39 +366,63 @@ function redirectWikipedia() { if (redirect_wikipedia == false) { return; } - + let langCodeIndex = window.location.hostname.search(/^[a-z][a-z]\./) window.stop(); if (langCodeIndex != -1) { - let newURL = window.location.protocol + "//" + farsideInstance + "/wikiless" + window.location.pathname + "?lang=" + window.location.hostname[langCodeIndex] + window.location.hostname[langCodeIndex + 1] + window.location.hash; + let newURL = window.location.protocol + + "//" + farsideInstance + "/wikiless" + + window.location.pathname + + "?lang=" + + window.location.hostname[langCodeIndex] + window.location.hostname[langCodeIndex + 1] + + window.location.hash; window.location.replace(newURL); } else { - let newURL = window.location.protocol + "//" + farsideInstance + "/wikiless" + window.location.pathname + "?lang=en" + window.location.hash; + let newURL = window.location.protocol + + "//" + farsideInstance + "/wikiless" + + window.location.pathname +"?lang=en" + + window.location.hash; window.location.replace(newURL); } } function redirectImdb() { - if (redirect_imdb == false) { - return; - } + if (redirect_imdb == false) { + return; + } - if (window.location.pathname.startsWith("/title/")) { - window.stop(); - let newURL = - window.location.protocol + - "//" + - farsideInstance + - "/libremdb" + - window.location.pathname + - window.location.search + - window.location.hash; - window.location.replace(newURL); - } + if (window.location.pathname.startsWith("/title/")) { + window.stop(); + let newURL = + window.location.protocol + + "//" + farsideInstance + "/libremdb" + + window.location.pathname + + window.location.search + + window.location.hash; + window.location.replace(newURL); + } } +function redirectQuora() { + if (redirect_quora == false) { + return; + } + + window.stop(); + + let newURL = + window.location.protocol + + "//" + farsideInstance + "/querte" + + window.location.pathname + + window.location.search + + window.location.hash; + + window.location.replace(newURL); +} + + let urlHostname = window.location.hostname; switch (urlHostname) {