Privacy Redirector

Redirect social media platforms to their privacy respecting frontends

当前为 2022-04-17 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Privacy Redirector
  3. // @name:tr Gizlilik Yönlendiricisi
  4. // @namespace https://github.com/dybdeskarphet/privacy-redirector
  5. // @license WTFPL
  6. // @version 1.1.6
  7. // @description Redirect social media platforms to their privacy respecting frontends
  8. // @description:tr Sosyal medya platformlarını, gizliliğe saygı duyan önyüzlerine yönlendirir
  9. // @run-at document-start
  10. // @match *://instagram.com/*
  11. // @match *://*.instagram.com/*
  12. // @match *://twitter.com/*
  13. // @match *://*.twitter.com/*
  14. // @match *://reddit.com/*
  15. // @match *://*.reddit.com/*
  16. // @match *://youtube.com/*
  17. // @match *://*.youtube.com/*
  18. // @match *://*.tiktok.com/*
  19. // @match *://imgur.com/*
  20. // @match *://*.imgur.com/*
  21. // @match *://medium.com/*
  22. // @match *://*.medium.com/*
  23. // ==/UserScript==
  24.  
  25. /*
  26. ___ _ _ ___ _____ _____
  27. / _ \| \ | | / _ \| ___| ___|
  28. | | | | \| |_____| | | | |_ | |_
  29. | |_| | |\ |_____| |_| | _| | _|
  30. \___/|_| \_| \___/|_| |_|
  31.  
  32. CHANGE THE RELEVANT VALUE TO "false" TO
  33. DISABLE THE REDIRECTION FOR THAT
  34. PARTICULAR SITE */
  35.  
  36. let redirect_youtube = true;
  37. let redirect_instagram = true;
  38. let redirect_twitter = true;
  39. let redirect_reddit = true;
  40. let redirect_tiktok = true;
  41. let redirect_imgur = true;
  42. let redirect_medium = true;
  43.  
  44. // // // // // // // // // // // // //
  45.  
  46. /*
  47. function redirectInstagram() {
  48.  
  49. if (redirect_instagram == false) {
  50. return;
  51. }
  52.  
  53. if (window.location.pathname.includes("/p/") == false) {
  54. window.stop();
  55. location.hostname = 'bibliogram.pussthecat.org';
  56. } else if (window.location.pathname == "/") {
  57. window.stop();
  58. location.hostname = 'bibliogram.pussthecat.org';
  59. } else if (window.location.pathname === "/accounts/login/") {
  60. window.stop();
  61. let oldQuery = window.location.search;
  62. let newQuery = oldQuery.replace("?next=/", "/")
  63. let newURL = window.location.protocol + "//" + "bibliogram.pussthecat.org" + "/u" + newQuery + window.location.hash;
  64. window.location.replace(newURL);
  65. } else {
  66. window.stop();
  67. let oldUrlPath = window.location.pathname;
  68. let newURL = window.location.protocol + "//" + "bibliogram.pussthecat.org" + "/u" + oldUrlPath + window.location.search + window.location.hash;
  69. window.location.replace(newURL);
  70. }
  71.  
  72. }
  73. */
  74.  
  75. function redirectTwitter() {
  76. if (redirect_twitter == false) {
  77. return;
  78. }
  79. window.stop();
  80. location.hostname = "nitter.42l.fr";
  81. }
  82. function redirectReddit() {
  83. if (redirect_reddit == false) {
  84. return;
  85. }
  86. window.stop();
  87.  
  88. if (window.location.hostname == "old.reddit.com"){
  89. location.hostname = "reddit.lol";
  90. } else {
  91. location.hostname = "libreddit.spike.codes";
  92. }
  93. }
  94. function redirectYoutube() {
  95. if (redirect_youtube == false) {
  96. return;
  97. }
  98.  
  99. window.stop();
  100. location.hostname = "vid.puffyan.us";
  101. }
  102.  
  103. function redirectTiktok() {
  104. if (redirect_tiktok == false) {
  105. return;
  106. }
  107. window.stop();
  108.  
  109. let langcodeIndex = window.location.pathname.search(/[a-z][a-z]\-[A-Z][A-Z]/g);
  110.  
  111. if (window.location.pathname.includes("/discover") == true) {
  112. let oldPath = window.location.pathname;
  113. let newPath = oldPath.replace("discover", "tag")
  114. let newURL = window.location.protocol + "//" + "proxitok.herokuapp.com" + newPath + window.location.hash;
  115. window.location.replace(newURL);
  116. } else if(langcodeIndex != -1) {
  117. let newURL = window.location.protocol + "//" + "proxitok.herokuapp.com";
  118. window.location.replace(newURL);
  119. } else {
  120. location.hostname = "proxitok.herokuapp.com";
  121. }
  122.  
  123. // Add this if language query strings start to break proxitok in the future
  124. // if (window.location.search.includes("?lang") == true) {
  125. // let newURL = window.location.protocol + "//" + "proxitok.herokuapp.com" + window.location.pathname + window.location.hash;
  126. // window.location.replace(newURL);
  127. // }
  128.  
  129. }
  130.  
  131. function redirectImgur() {
  132. if (redirect_imgur == false) {
  133. return;
  134. }
  135.  
  136. window.stop();
  137. location.hostname = "rimgo.pussthecat.org";
  138. }
  139.  
  140. function redirectMedium() {
  141. if (redirect_medium == false) {
  142. window.stop();
  143. }
  144. if (window.location.pathname == "/") {
  145. window.stop();
  146. alert("Disable the script for viewing this Medium account")
  147. return;
  148. } else {
  149. window.stop();
  150. location.hostname = "scribe.rip";
  151. }
  152. }
  153.  
  154. var urlHostname = window.location.hostname;
  155. switch (urlHostname) {
  156. /*
  157. case "www.instagram.com":
  158. redirectInstagram();
  159. break;
  160. */
  161. case "twitter.com":
  162. redirectTwitter();
  163. break;
  164. case "mobile.twitter.com":
  165. redirectTwitter();
  166. break;
  167. case "www.reddit.com":
  168. redirectReddit();
  169. break;
  170. case "old.reddit.com":
  171. redirectReddit();
  172. break;
  173. case "www.youtube.com":
  174. redirectYoutube();
  175. break;
  176. case "m.youtube.com":
  177. redirectYoutube();
  178. break;
  179.  
  180. case "www.tiktok.com":
  181. redirectTiktok();
  182. break;
  183. }
  184.  
  185. if (urlHostname.includes("medium.com")) {
  186. redirectMedium();
  187. } else if (urlHostname.includes("imgur.com")) {
  188. redirectImgur();
  189. }