Redirector de confidențialitate

Redirecționarea platformelor de socializare către paginile lor de început care respectă viața privată

La data de 08-12-2023. Vezi ultima versiune.

  1. // ==UserScript==
  2. // @name Privacy Redirector
  3. // @name:bg Пренасочване на поверителността
  4. // @name:br Rediretor de privacidade
  5. // @name:cs Přesměrování soukromí
  6. // @name:de Datenschutz Umleiter
  7. // @name:da Omdirigeringsenhed for privatlivets fred
  8. // @name:et Privaatsuse ümbersuunaja
  9. // @name:es Redirección de privacidad
  10. // @name:fi Yksityisyydensuojan uudelleenohjaus
  11. // @name:fr Redirecteur de confidentialité
  12. // @name:el Επανακατευθυντής απορρήτου
  13. // @name:hu Adatvédelmi átirányító
  14. // @name:id Pengarah Privasi
  15. // @name:it Reindirizzatore di privacy
  16. // @name:ja プライバシーリダイレクト
  17. // @name:lt Privatumo nukreipiklis
  18. // @name:lv Konfidencialitātes pāradresētājs
  19. // @name:nl Privacy-omleiding
  20. // @name:pl Przekierownik prywatności
  21. // @name:pt Redirector de Privacidade
  22. // @name:ro Redirector de confidențialitate
  23. // @name:ru Перенаправление конфиденциальности
  24. // @name:sv Omdirigering av sekretess
  25. // @name:sl Preusmerjevalnik zasebnosti
  26. // @name:sk Presmerovanie súkromia
  27. // @name:tr Gizlilik Yönlendiricisi
  28. // @name:uk Редиректор конфіденційності
  29. // @name:zh 隐私重定向器
  30. // @name:zh-CN 隐私重定向器
  31. // @description Redirect social media platforms to their privacy respecting frontends
  32. // @description:bg Пренасочване на платформите за социални медии към заглавните им страници, съобразени с поверителността
  33. // @description:br Redirecionando as plataformas de mídia social para suas primeiras páginas de privacidade
  34. // @description:cs Přesměrování platforem sociálních médií na jejich titulní stránky šetrné k soukromí
  35. // @description:de Leitet von Social-Media-Plattformen auf deren jeweilige datenschutzfreundlicheren Frontends
  36. // @description:da Omdirigering af sociale medieplatforme til deres privatlivsvenlige forsider
  37. // @description:et Sotsiaalmeediaplatvormide ümbersuunamine nende privaatsussõbralikele esilehtedele
  38. // @description:es Redirigir las plataformas de medios sociales a sus portadas respetuosas con la privacidad
  39. // @description:fi Sosiaalisen median alustojen ohjaaminen yksityisyyden suojaa edistäville etusivuille.
  40. // @description:fr Rediriger les plateformes de médias sociaux vers leurs pages d'accueil respectueuses de la vie privée
  41. // @description:el Αναπροσανατολισμός των πλατφορμών κοινωνικής δικτύωσης στις μπροστινές σελίδες τους που είναι φιλικές προς το απόρρητο
  42. // @description:hu A közösségi médiaplatformok átirányítása az adatvédelem-barát kezdőlapokra
  43. // @description:id Mengarahkan platform media sosial ke halaman depan yang ramah privasi
  44. // @description:it Reindirizzare le piattaforme di social media verso le loro pagine frontali che rispettano la privacy
  45. // @description:ja ソーシャルメディアプラットフォームをプライバシーに配慮したフロントページにリダイレクトする
  46. // @description:lt Socialinės žiniasklaidos platformų nukreipimas į privatumą užtikrinančius pirmuosius puslapius
  47. // @description:lv Sociālo plašsaziņas līdzekļu platformu pāradresēšana uz to privātumam draudzīgajām pirmajām lapām.
  48. // @description:nl Sociale-mediaplatforms omleiden naar hun privacyvriendelijke voorpagina's
  49. // @description:pl Przekierowanie platform mediów społecznościowych na ich przyjazne dla prywatności strony tytułowe
  50. // @description:pt Redireccionar as plataformas de redes sociais para as suas primeiras páginas amigas da privacidade
  51. // @description:ro Redirecționarea platformelor de socializare către paginile lor de început care respectă viața privată
  52. // @description:ru Перенаправление платформ социальных сетей на их главные страницы, дружественные к конфиденциальности
  53. // @description:sv Omdirigera sociala medieplattformar till deras integritetsvänliga förstasidor.
  54. // @description:sl preusmeritev platform družabnih medijev na njihove naslovne strani, ki so prijazne do zasebnosti.
  55. // @description:sk Presmerovanie platforiem sociálnych médií na ich úvodné stránky, ktoré chránia súkromie
  56. // @description:tr Sosyal medya platformlarını, gizliliğe saygı duyan önyüzlerine yönlendirir
  57. // @description:uk Перенаправлення соціальних медіа-платформ на їхні головні сторінки, дружні до приватності
  58. // @description:zh 将社交媒体平台重定向到其隐私友好的首页
  59. // @description:zh-CN 将社交媒体平台重定向到其隐私友好的首页
  60. // @namespace https://github.com/dybdeskarphet/privacy-redirector
  61. // @author Ahmet Arda Kavakcı
  62. // @license GPLv3
  63. // @version 1.5.4
  64. // @supportURL https://github.com/dybdeskarphet/privacy-redirector
  65. // @run-at document-start
  66. // @match *://*.bandcamp.com/*
  67. // @match *://*.fandom.com/*
  68. // @match *://*.genius.com/*
  69. // @match *://*.google.com/*
  70. // @match *://*.imdb.com/*
  71. // @match *://*.imgur.com/*
  72. // @match *://*.imgur.io/*
  73. // @match *://*.instagram.com/*
  74. // @match *://*.medium.com/*
  75. // @match *://*.pinterest.com/*
  76. // @match *://i.pinimg.com/*
  77. // @match *://*.quora.com/*
  78. // @match *://*.reddit.com/*
  79. // @match *://*.reuters.com/*
  80. // @match *://*.tiktok.com/*
  81. // @match *://*.twitter.com/*
  82. // @match *://*.wikipedia.org/*
  83. // @match *://*.youtube-nocookie.com/*
  84. // @match *://*.youtube.com/*
  85. // @match *://*.soundcloud.com/*
  86. // @match *://f4.bcbits.com/*
  87. // @match *://genius.com/*
  88. // @match *://imgur.com/*
  89. // @match *://instagram.com/*
  90. // @match *://medium.com/*
  91. // @match *://news.ycombinator.com/*
  92. // @match *://reddit.com/*
  93. // @match *://stackoverflow.com/*
  94. // @match *://t4.bcbits.com/*
  95. // @match *://translate.google.com/*
  96. // @match *://twitter.com/*
  97. // @match *://www.goodreads.com/*
  98. // @match *://www.pixiv.net/*
  99. // @match *://youtube.com/*
  100. // @exclude *://*.youtube.com/redirect*
  101. // @exclude *://youtube.com/redirect*
  102. // ==/UserScript==
  103.  
  104. /*
  105. ___ _ _ ___ _____ _____
  106. / _ \| \ | | / _ \| ___| ___|
  107. | | | | \| |_____| | | | |_ | |_
  108. | |_| | |\ |_____| |_| | _| | _|
  109. \___/|_| \_| \___/|_| |_|
  110.  
  111. CHANGE THE RELEVANT VALUE TO "false" TO
  112. DISABLE THE REDIRECTION/FARSIDE FOR THAT
  113. PARTICULAR PLATFORM */
  114.  
  115. // REDIRECTON / FARSIDE
  116.  
  117. let bandcamp = [true, true];
  118. let fandom = [true, true];
  119. let genius = [true, true];
  120. let goodreads = [true, false];
  121. let google = [true, true];
  122. let gtranslate = [true, true];
  123. let hackernews = [true, true];
  124. let imdb = [true, true];
  125. let imgur = [true, false];
  126. let medium = [true, true];
  127. let pinterest = [true, true];
  128. let pixiv = [true, true];
  129. let quora = [true, false];
  130. let reddit = [true, false];
  131. let reuters = [true, true];
  132. let soundcloud = [true, true];
  133. let stackoverflow = [true, true];
  134. let tiktok = [true, false];
  135. let twitter = [true, true];
  136. let wikipedia = [true, false];
  137. let youtube = [true, false];
  138. let instagram = [true, true];
  139.  
  140. // PREFERRED FRONTEND
  141. let youtubeFrontend = "piped"; // accepts "invidious", "piped", "tubo"
  142. let youtubeMusicFrontend = "hyperpipe"; // accepts "hyperpipe", "invidious", "piped"
  143. let redditFrontend = "libreddit"; // accepts "libreddit", "teddit"
  144. let googleFrontend = "librey"; // accepts "librey", "searx", "searxng"
  145. let geniusFrontend = "intellectual"; // accepts dumb, intellectual
  146. let mediumFrontend = "scribe"; // accepts libmedium, scribe
  147. let hackernewsFrontend = "better"; // accepts better, worker
  148.  
  149. // OTHER SETTINGS
  150. let keepHistory = false; // keeps farside.link in the browser history
  151.  
  152. // // // // // // // // // // // // //
  153.  
  154. /*
  155. ___ _
  156. |_ _|_ __ ___| |_ __ _ _ __ ___ ___ ___
  157. | || '_ \/ __| __/ _` | '_ \ / __/ _ \/ __|
  158. | || | | \__ \ || (_| | | | | (_| __/\__ \
  159. |___|_| |_|___/\__\__,_|_| |_|\___\___||___/
  160.  
  161. LIST OF INSTANCES TO USE IF FARSIDE IS NOT ENABLED
  162. */
  163.  
  164. const Instances = {
  165. anonymousoverflow: [
  166. "code.whatever.social",
  167. "ao.vern.cc",
  168. "overflow.smnz.de",
  169. "overflow.lunar.icu",
  170. "overflow.adminforge.de",
  171. "overflow.projectsegfau.lt",
  172. "code.whateveritworks.org",
  173. "ao.bloat.cat",
  174. "anonoverflow.frontendfriendly.xyz",
  175. "ao.owo.si",
  176. "overflow.datura.network",
  177. "overflow.freedit.eu",
  178. "ao.rootdo.org",
  179. "anonoverflow.hyperreal.coffee",
  180. "a.opnxng.com",
  181. "overflow.sudovanilla.com",
  182. "anonymousoverflow.privacyfucking.rocks",
  183. "exchange.seitan-ayoub.lol",
  184. "overflow.r4fo.com",
  185. ],
  186. hyperpipe: [
  187. "hyperpipe.surge.sh",
  188. "hyperpipe.onrender.com",
  189. "hyperpipe.esmailelbob.xyz",
  190. "music.adminforge.de",
  191. "music.pfcd.me",
  192. "listen.whateveritworks.org",
  193. "hyperpipe.projectsegfau.lt",
  194. "hp.ggtyler.dev",
  195. "hyperpipe.lunar.icu",
  196. "music.seitan-ayoub.lol",
  197. ],
  198. proxigram: [
  199. "proxigram.privacyfrontends.repl.co",
  200. "proxigram.protokolla.fi",
  201. "proxigram.kyun.li",
  202. "proxigram.lunar.icu",
  203. "ig.opnxng.com",
  204. ],
  205. biblioreads: [
  206. "biblioreads.eu.org",
  207. "biblioreads.vercel.app",
  208. "biblioreads.mooo.com",
  209. "bl.vern.cc",
  210. "biblioreads.lunar.icu",
  211. "read.whateveritworks.org",
  212. "biblioreads.privacyfucking.rocks",
  213. "read.seitan-ayoub.lol",
  214. ],
  215. binternet: [
  216. "binternet.ahwx.org",
  217. "bn.bloat.cat",
  218. "bn.opnxng.com",
  219. "binternet.privacyfucking.rocks",
  220. "bn.vern.cc",
  221. "pin.whateveritworks.org",
  222. "binternet.esmailelbob.xyz",
  223. ],
  224. breezewiki: [
  225. "breezewiki.com",
  226. "antifandom.com",
  227. "breezewiki.pussthecat.org",
  228. "bw.hamstro.dev",
  229. "bw.projectsegfau.lt",
  230. "breeze.hostux.net",
  231. "bw.artemislena.eu",
  232. "nerd.whatever.social",
  233. "breezewiki.frontendfriendly.xyz",
  234. "breeze.nohost.network",
  235. "breeze.whateveritworks.org",
  236. "z.opnxng.com",
  237. "breezewiki.hyperreal.coffee",
  238. "breezewiki.catsarch.com",
  239. "breeze.mint.lgbt",
  240. "breezewiki.woodland.cafe",
  241. "breezewiki.lunar.icu",
  242. "fandom.adminforge.de",
  243. ],
  244. dumb: [
  245. "dumb.privacydev.net",
  246. "db.vern.cc",
  247. "sing.whatever.social",
  248. "dumb.lunar.icu",
  249. "dumb.esmailelbob.xyz",
  250. ],
  251. intellectual: [
  252. "intellectual.insprill.net",
  253. "in.bloat.cat",
  254. "intellectual.privacyfucking.rocks",
  255. "intellectual.frontendfriendly.xyz",
  256. ],
  257. invidious: [
  258. "yewtu.be",
  259. "vid.puffyan.us",
  260. "yt.artemislena.eu",
  261. "invidious.flokinet.to",
  262. "invidious.projectsegfau.lt",
  263. "invidious.slipfox.xyz",
  264. "invidious.privacydev.net",
  265. "vid.priv.au",
  266. "iv.ggtyler.dev",
  267. "invidious.lunar.icu",
  268. "inv.tux.pizza",
  269. "invidious.protokolla.fi",
  270. "proxied.invidious.fi",
  271. "onion.tube",
  272. "inv.citw.lgbt",
  273. "yt.oelrichsgarcia.de",
  274. "invidious.no-logs.com",
  275. "invidious.io.lol",
  276. "iv.nboeck.de",
  277. "invidious.private.coffee",
  278. "invidious.asir.dev",
  279. "iv.datura.network",
  280. "invidious.fdn.fr",
  281. "anontube.lvkaszus.pl",
  282. "invidious.perennialte.ch",
  283. "yt.cdaut.de",
  284. "invidious.einfachzocken.eu",
  285. "yt.drgnz.club",
  286. ],
  287. piped: [
  288. "piped.video",
  289. "cf.piped.video",
  290. "fl.piped.video",
  291. "do.piped.video",
  292. "az.piped.video",
  293. "piped.mha.fi",
  294. "piped.garudalinux.org",
  295. "watch.leptons.xyz",
  296. "piped.lunar.icu",
  297. "piped.r4fo.com",
  298. "piped.game.yt",
  299. "piped.privacydev.net",
  300. "piped.smnz.de",
  301. "piped.adminforge.de",
  302. "piped.hostux.net",
  303. "piped.astartes.nl",
  304. "piped.osphost.fi",
  305. "piped.simpleprivacy.fr",
  306. "pi.ggtyler.dev",
  307. "piped.seitan-ayoub.lol",
  308. "yt.owo.si",
  309. "piped.12a.app",
  310. "piped.minionflo.net",
  311. "piped.game.yt",
  312. ],
  313. libmedium: [
  314. "libmedium.batsense.net",
  315. "md.vern.cc",
  316. "medium.hostux.net",
  317. "read.sudovanilla.com",
  318. "libmedium.privacyfucking.rocks",
  319. "libmedium.frontendfriendly.xyz",
  320. "libmedium.esmailelbob.xyz",
  321. ],
  322. libreddit: [
  323. "redditor.fly.dev",
  324. "libreddit.kavin.rocks",
  325. "libreddit.strongthany.cc",
  326. "libreddit.northboot.xyz",
  327. "libreddit.kylrth.com",
  328. "libreddit.tiekoetter.com",
  329. "l.opnxng.com",
  330. "libreddit.projectsegfau.lt",
  331. "libreddit.privacydev.net",
  332. "libreddit.frontendfriendly.xyz",
  333. "libreddit.oxymagnesium.com",
  334. "libreddit.freedit.eu",
  335. "libreddit.mha.fi",
  336. "lr.artemislena.eu",
  337. "libreddit.nohost.network",
  338. "lr.aeong.one",
  339. "libreddit.lunar.icu",
  340. "libreddit.r4fo.com",
  341. "snoo.habedieeh.re",
  342. "libreddit.kutay.dev",
  343. "libreddit.tux.pizza",
  344. "libreddit.nerdyfam.tech",
  345. "libreddit.perennialte.ch",
  346. "libreddit.baczek.me",
  347. "libreddit.private.coffee",
  348. "lr.seitan-ayoub.lol",
  349. "l.bloat.cat",
  350. "reddit.pfcd.me",
  351. ],
  352. libremdb: [
  353. "libremdb.iket.me",
  354. "libremdb.pussthecat.org",
  355. "ld.vern.cc",
  356. "libremdb.esmailelbob.xyz",
  357. "binge.whatever.social",
  358. "libremdb.lunar.icu",
  359. "libremdb.jeikobu.net",
  360. "libremdb.nerdyfam.tech",
  361. "libremdb.tux.pizza",
  362. "libremdb.frontendfriendly.xyz",
  363. "d.opnxng.com",
  364. "libremdb.catsarch.com",
  365. ],
  366. librey: [
  367. "search.ahwx.org",
  368. "ly.owo.si",
  369. "librey.danyaal.xyz",
  370. "librey.org",
  371. "librex.supernets.org",
  372. "search.davidovski.xyz",
  373. "librex.uk.to",
  374. "search.funami.tech",
  375. "librex.retro-hax.net",
  376. "librex.nohost.network",
  377. "search.pabloferreiro.es",
  378. "librex.yogeshlamichhane.com.np",
  379. "librey.baczek.me",
  380. "lx.benike.me",
  381. "search.seitan-ayoub.lol",
  382. "librey.hyperreal.coffee",
  383. ],
  384. lingva: [
  385. "lingva.ml",
  386. "lingva.thedaviddelta.com",
  387. "lingva.frontendfriendly.xyz",
  388. "lingva.retiolus.net",
  389. "translate.plausibility.cloud",
  390. "lingva.lunar.icu",
  391. "lingva.garudalinux.org",
  392. "lingva.seitan-ayoub.lol",
  393. ],
  394. neuters: [
  395. "neuters.de",
  396. "news.whateveritworks.org",
  397. "neuters.hyperreal.coffee",
  398. "neuters.privacyfucking.rocks",
  399. ],
  400. nitter: [
  401. "nitter.net",
  402. "nitter.unixfox.eu",
  403. "nitter.esmailelbob.xyz",
  404. "nitter.poast.org",
  405. "nitter.privacydev.net",
  406. "nitter.projectsegfau.lt",
  407. "nitter.soopy.moe",
  408. "nitter.rawbit.ninja",
  409. "nitter.d420.de",
  410. "nitter.freedit.eu",
  411. "nitter.nohost.network",
  412. "nitter.no-logs.com",
  413. "nitter.io.lol",
  414. "nitter.x86-64-unknown-linux-gnu.zip",
  415. "nitter.woodland.cafe",
  416. "nitter.dafriser.be",
  417. "nitter.catsarch.com",
  418. "nitter.perennialte.ch",
  419. "nitter.salastil.com",
  420. "nitter.uni-sonia.com",
  421. "n.opnxng.com",
  422. "nitter.ktachibana.party",
  423. ],
  424. pixivfe: ["pixivfe.exozy.me", "pix.chaotic.ninja"],
  425. proxitok: [
  426. "proxitok.pabloferreiro.es",
  427. "proxitok.pussthecat.org",
  428. "tok.habedieeh.re",
  429. "proxitok.privacydev.net",
  430. "tok.artemislena.eu",
  431. "tok.adminforge.de",
  432. "tik.hostux.net",
  433. "cringe.whatever.social",
  434. "proxitok.lunar.icu",
  435. "proxitok.privacy.com.de",
  436. "proxitok.r4fo.com",
  437. "cringe.whateveritworks.org",
  438. "cringe.seitan-ayoub.lol",
  439. "cringe.datura.network",
  440. "tt.opnxng.com",
  441. "proxitok.tinfoil-hat.net",
  442. "tiktok.wpme.pl",
  443. ],
  444. quetre: [
  445. "quetre.iket.me",
  446. "qr.vern.cc",
  447. "quetre.pussthecat.org",
  448. "quetre.privacydev.net",
  449. "ask.habedieeh.re",
  450. "quetre.blackdrgn.nl",
  451. "quetre.lunar.icu",
  452. "questions.whateveritworks.org",
  453. "quetre.frontendfriendly.xyz",
  454. "q.opnxng.com",
  455. "quetre.rootdo.org",
  456. "quora.seitan-ayoub.lol",
  457. "quetre.esmailelbob.xyz",
  458. "quetre.catsarch.com",
  459. "ask.sudovanilla.org",
  460. "quetre.smnz.de",
  461. ],
  462. rimgo: [
  463. "rimgo.totaldarkness.net",
  464. "imgur.artemislena.eu",
  465. "rimgo.lunar.icu",
  466. "imgur.010032.xyz",
  467. "rimgo.kling.gg",
  468. "rimgo.projectsegfau.lt",
  469. "rimgo.nohost.network",
  470. "rimgo.catsarch.com",
  471. "rimgo.quantenzitrone.eu",
  472. "rimgo.frylo.net",
  473. ],
  474. scribe: [
  475. "scribe.rip",
  476. "scribe.citizen4.eu",
  477. "scribe.bus-hit.me",
  478. "scribe.projectsegfau.lt",
  479. "scribe.rawbit.ninja",
  480. "m.opnxng.com",
  481. "scribe.hyperreal.coffee",
  482. ],
  483. teddit: [
  484. "i.opnxng.com",
  485. "teddit.bus-hit.me",
  486. "teddit.hostux.net",
  487. "teddit.net",
  488. "teddit.rawbit.ninja",
  489. "teddit.projectsegfau.lt",
  490. "teddit.pussthecat.org",
  491. "teddit.zaggy.nl",
  492. "t.sneed.network",
  493. "td.vern.cc",
  494. ],
  495. tent: ["tent.sny.sh", "tent.bloat.cat", "tn.vern.cc"],
  496. tubo: ["tubo.migalmoreno.com"],
  497. wikiless: [
  498. "wikiless.whateveritworks.org",
  499. "wikiless.tiekoetter.com",
  500. "wikiless.funami.tech",
  501. "wl.vern.cc",
  502. "wiki.froth.zone",
  503. "wikiless.northboot.xyz",
  504. "wikiless.rawbit.ninja",
  505. "wiki.adminforge.de",
  506. "wikiless.rootdo.org",
  507. "w.sneed.network",
  508. "wikiless.r4fo.com",
  509. "wiki.seitan-ayoub.lol",
  510. "wikiless.esmailelbob.xyz",
  511. "wikiless.ditatompel.com",
  512. ],
  513. searx: [
  514. "search.bus-hit.me",
  515. "search.projectsegfau.lt",
  516. "northboot.xyz",
  517. "opnxng.com",
  518. ],
  519. searxng: [
  520. "search.sapti.me",
  521. "priv.au",
  522. "search.demoniak.ch",
  523. "www.gruble.de",
  524. "search.lvkaszus.pl",
  525. "searx.divided-by-zero.eu",
  526. "xo.wtf",
  527. "freesearch.club",
  528. "search.ovh",
  529. "baresearch.org",
  530. "searx.perennialte.ch",
  531. "searx.techsaviours.org",
  532. "search.mdosch.de",
  533. "searx.kutay.dev",
  534. "searx.si",
  535. "searx.namejeff.xyz",
  536. "search.whateveritworks.org",
  537. "search.ononoki.org",
  538. "etsi.me",
  539. "searx.work",
  540. "search.smnz.de",
  541. "searx.prvcy.eu",
  542. "searx.headpat.exchange",
  543. ],
  544. hackernews: {
  545. better: "better-hackernews.vercel.app",
  546. worker: "news.workers.tools",
  547. },
  548. };
  549.  
  550. let farsideInstance = keepHistory ? "farside.link/_" : "farside.link";
  551.  
  552. // // // // // // // // // // // // //
  553.  
  554. const hash = window.location.hash,
  555. scheme = `${window.location.protocol}//`;
  556.  
  557. let debug_mode = false;
  558.  
  559. if (debug_mode) {
  560. alert(
  561. "\n== DEBUG MODE IS ON ==" +
  562. "\nIf you're seeing this" +
  563. "\nset the debug_mode value to" +
  564. "\nfalse for Privacy Redirector." +
  565. "\n======================" +
  566. "\n\nHostname: " +
  567. window.location.hostname +
  568. "\nPath: " +
  569. window.location.pathname +
  570. "\nQuery: " +
  571. window.location.search +
  572. "\nHash: " +
  573. hash
  574. );
  575. }
  576.  
  577. let selectedInstance = "",
  578. newURL = "";
  579.  
  580. const getrandom = async (instances) =>
  581. instances[Math.floor(Math.random() * instances.length)];
  582.  
  583. async function redirectInstagram() {
  584. if (instagram[0]) {
  585. window.stop();
  586. let pathname = window.location.pathname;
  587. let search = window.location.search;
  588. let params = new URLSearchParams(search);
  589.  
  590. selectedInstance = await getrandom(Instances.proxigram);
  591.  
  592. switch (true) {
  593. case pathname.startsWith("/accounts/login/"):
  594. case pathname.startsWith("/accounts/signup/"):
  595. pathname = pathname.replace(/^\/accounts\/(login|signup)\/[a-z]*/, "");
  596. params.delete("next");
  597. search = params.size ? `?${params}` : "";
  598. break;
  599. case pathname.startsWith("/reel/"):
  600. case pathname.startsWith("/tv/"):
  601. pathname = pathname.replace(/^\/(reel|tv)\//, "/p/");
  602. break;
  603. case pathname.endsWith("/reels/"):
  604. pathname = pathname.replace("/reels", "");
  605. break;
  606. }
  607. newURL = `${scheme}${selectedInstance}${pathname}${search}${hash}`;
  608. window.location.replace(newURL);
  609. }
  610. }
  611.  
  612. async function redirectTwitter() {
  613. if (twitter[0]) {
  614. window.stop();
  615.  
  616. const pathname = window.location.pathname;
  617. let searchpath = `${pathname}${window.location.search}`;
  618.  
  619. selectedInstance = twitter[1]
  620. ? `${farsideInstance}/nitter`
  621. : await getrandom(Instances.nitter);
  622.  
  623. if (pathname === "/i/flow/login")
  624. searchpath = searchpath.replace(
  625. "/i/flow/login?redirect_after_login=",
  626. ""
  627. );
  628.  
  629. if (searchpath.includes("%")) searchpath = decodeURIComponent(searchpath);
  630.  
  631. newURL = `${scheme}${selectedInstance}${searchpath}${hash}`;
  632. window.location.replace(newURL);
  633. }
  634. }
  635.  
  636. async function redirectReddit() {
  637. if (reddit[0] && !window.location.pathname.startsWith("/domain")) {
  638. window.stop();
  639. let pathname = window.location.pathname;
  640. let search = window.location.search;
  641.  
  642. selectedInstance = reddit[1]
  643. ? `${farsideInstance}/${redditFrontend}`
  644. : await getrandom(Instances[redditFrontend]);
  645.  
  646. if (pathname === "/media" && search) {
  647. const params = new URLSearchParams(search);
  648. const mediaURL = new URL(params.get("url"));
  649. if (["i.redd.it", "preview.redd.it"].includes(mediaURL.hostname)) {
  650. pathname = `/img${mediaURL.pathname}`;
  651. search = mediaURL.search;
  652. }
  653. }
  654. newURL = `${scheme}${selectedInstance}${pathname}${search}${hash}`;
  655.  
  656. window.location.replace(newURL);
  657. }
  658. }
  659.  
  660. async function redirectYoutube(frontend) {
  661. if (youtube[0]) {
  662. window.stop();
  663. let searchpath = `${window.location.pathname}${window.location.search}`;
  664. if (frontend !== "tubo") {
  665. selectedInstance =
  666. youtube[1] && frontend !== "hyperpipe"
  667. ? `${farsideInstance}/${frontend}`
  668. : await getrandom(Instances[frontend]);
  669. } else {
  670. selectedInstance = await getrandom(Instances.tubo);
  671.  
  672. searchpath = `/stream?url=${window.location.href}`;
  673. if (
  674. window.location.pathname.startsWith("/@") ||
  675. window.location.pathname.startsWith("/channel")
  676. )
  677. searchpath = `/channel?url=${window.location.href}`;
  678. }
  679. newURL = `${scheme}${selectedInstance}${searchpath}${hash}`;
  680. window.location.replace(newURL);
  681. }
  682. }
  683.  
  684. async function redirectTiktok() {
  685. if (tiktok[0]) {
  686. window.stop();
  687. let pathname = window.location.pathname;
  688. selectedInstance = tiktok[1]
  689. ? `${farsideInstance}/proxitok`
  690. : await getrandom(Instances.proxitok);
  691.  
  692. await Promise.any(
  693. [
  694. ["/@/", "/@placeholder/"],
  695. ["/discover/", "/tag/"],
  696. ["/foryou", "/trending"],
  697. ].map(async ([key, value]) => {
  698. if (pathname.startsWith(key)) pathname = pathname.replace(key, value);
  699. })
  700. );
  701.  
  702. newURL = `${scheme}${selectedInstance}${pathname}${window.location.search}${hash}`;
  703. window.location.replace(newURL);
  704. }
  705. }
  706.  
  707. async function redirectImgur() {
  708. if (imgur[0]) {
  709. window.stop();
  710.  
  711. selectedInstance = imgur[1]
  712. ? `${farsideInstance}/rimgo`
  713. : await getrandom(Instances.rimgo);
  714.  
  715. newURL = `${scheme}${selectedInstance}${window.location.pathname}${window.location.search}${hash}`;
  716.  
  717. window.location.replace(newURL);
  718. }
  719. }
  720.  
  721. async function redirectMedium() {
  722. if (medium[0]) {
  723. let pathname = window.location.pathname;
  724. const host_path = `${window.location.hostname}${pathname}`;
  725.  
  726. if (
  727. (/^.+?\.medium\.com\/.+/.test(host_path) ||
  728. /^\/@?[a-z0-9\-\_]+\//.test(pathname) ||
  729. host_path === "medium.com/") &&
  730. !(
  731. /^\/(tag|m|hc)\//.test(pathname) ||
  732. /\/(about|followers|following)/.test(pathname)
  733. )
  734. ) {
  735. window.stop();
  736. selectedInstance =
  737. medium[1] && mediumFrontend === "scribe"
  738. ? `${farsideInstance}/scribe`
  739. : await getrandom(Instances[mediumFrontend]);
  740. const username = window.location.hostname.replace(/\.?medium\.com/, "");
  741. if (username) pathname = `/${username}${pathname}`;
  742. newURL = `${scheme}${selectedInstance}${pathname}${window.location.search}${hash}`;
  743. window.location.replace(newURL);
  744. }
  745. }
  746. }
  747.  
  748. async function redirectHackerNews() {
  749. if (hackernews[0]) {
  750. let pathname = window.location.pathname;
  751. if (
  752. ["/newest", "/item", "/user", "/ask", "/show", "/jobs", "/"].includes(
  753. pathname
  754. )
  755. ) {
  756. if (
  757. hackernewsFrontend === "better" &&
  758. window.location.pathname === "/newest"
  759. )
  760. pathname = "/new";
  761. selectedInstance = Instances.hackernews[hackernewsFrontend];
  762. } else if (
  763. ["/best", "/news", "/submitted", "/threads", "/classic"].includes(
  764. pathname
  765. )
  766. ) {
  767. selectedInstance = Instances.hackernews.worker;
  768. }
  769. if (selectedInstance) {
  770. window.stop();
  771. newURL = `${scheme}${selectedInstance}${pathname}${window.location.search}`;
  772. window.location.replace(newURL);
  773. }
  774. }
  775. }
  776.  
  777. async function redirectGTranslate() {
  778. if (gtranslate[0]) {
  779. window.stop();
  780.  
  781. selectedInstance = gtranslate[1]
  782. ? `${farsideInstance}/lingva`
  783. : await getrandom(Instances.lingva);
  784.  
  785. let pathname = window.location.pathname;
  786. if (window.location.search) {
  787. const params = new URLSearchParams(window.location.search);
  788. pathname = `/${params.get("sl")}/${params.get("tl")}/${params.get(
  789. "text"
  790. )}`;
  791. } else if (/^\/\w+\/\w+\/.*/.test(pathname)) {
  792. pathname = pathname.replace(/\+/g, " ");
  793. }
  794. newURL = `${scheme}${selectedInstance}${pathname}`;
  795. window.location.replace(newURL);
  796. }
  797. }
  798.  
  799. async function redirectReuters() {
  800. if (reuters[0]) {
  801. window.stop();
  802. selectedInstance = await getrandom(Instances.neuters);
  803. newURL = `${scheme}${selectedInstance}${window.location.pathname}${window.location.search}${hash}`;
  804. window.location.replace(newURL);
  805. }
  806. }
  807.  
  808. async function redirectWikipedia() {
  809. if (wikipedia[0]) {
  810. window.stop();
  811. let langCode = /^([a-z\-]+)\./.exec(window.location.hostname)[1];
  812.  
  813. selectedInstance = wikipedia[1]
  814. ? `${farsideInstance}/wikiless`
  815. : await getrandom(Instances.wikiless);
  816.  
  817. if (langCode === "www") langCode = "en";
  818. newURL = `${scheme}${selectedInstance}${window.location.pathname}?lang=${langCode}${hash}`;
  819. window.location.replace(newURL);
  820. }
  821. }
  822.  
  823. async function redirectImdb() {
  824. if (imdb[0]) {
  825. window.stop();
  826.  
  827. selectedInstance = imdb[1]
  828. ? `${farsideInstance}/libremdb`
  829. : await getrandom(Instances.libremdb);
  830.  
  831. newURL = `${scheme}${selectedInstance}${window.location.pathname}${window.location.search}${hash}`;
  832.  
  833. window.location.replace(newURL);
  834. }
  835. }
  836.  
  837. async function redirectQuora() {
  838. if (quora[0]) {
  839. window.stop();
  840.  
  841. selectedInstance = quora[1]
  842. ? `${farsideInstance}/quetre`
  843. : await getrandom(Instances.quetre);
  844.  
  845. newURL = `${scheme}${selectedInstance}${window.location.pathname}${window.location.search}${hash}`;
  846.  
  847. window.location.replace(newURL);
  848. }
  849. }
  850.  
  851. async function redirectFandom() {
  852. if (fandom[0]) {
  853. window.stop();
  854. const fandomName = window.location.hostname.replace(/\..+/, "");
  855. selectedInstance = await getrandom(Instances.breezewiki);
  856.  
  857. let pathname = window.location.pathname;
  858. if (fandomName !== "www") pathname = `/${fandomName}${pathname}`;
  859. newURL = `${scheme}${selectedInstance}${pathname}${window.location.search}${hash}`;
  860.  
  861. window.location.replace(newURL);
  862. }
  863. }
  864.  
  865. async function redirectGoogle() {
  866. if (
  867. google[0] &&
  868. window.location.hostname.startsWith("www") &&
  869. window.location.pathname.startsWith("/search")
  870. ) {
  871. window.stop();
  872.  
  873. selectedInstance = google[1]
  874. ? `${farsideInstance}/${googleFrontend}`
  875. : (selectedInstance = await getrandom(Instances[googleFrontend]));
  876.  
  877. let pathname = window.location.pathname;
  878. if (googleFrontend === "librey" && pathname === "/search")
  879. pathname += ".php";
  880. const params = new URLSearchParams(window.location.search);
  881. const query = params.entries().q;
  882. const search = query ? `?q=${query}` : window.location.search;
  883. newURL = `${scheme}${selectedInstance}${pathname}${search}${hash}`;
  884. window.location.replace(newURL);
  885. }
  886. }
  887.  
  888. async function redirectGoodreads() {
  889. if (goodreads[0]) {
  890. window.stop();
  891.  
  892. selectedInstance = await getrandom(Instances.biblioreads);
  893.  
  894. if (window.location.pathname.startsWith("/search")) {
  895. const params = new URLSearchParams(search);
  896. search = `/${params.get("q")}`;
  897. }
  898. newURL = `${scheme}${selectedInstance}${window.location.pathname}${search}${hash}`;
  899. window.location.replace(newURL);
  900. }
  901. }
  902.  
  903. async function redirectStackoverflow() {
  904. if (
  905. stackoverflow[0] &&
  906. (window.location.pathname.startsWith("/questions/") ||
  907. window.location.pathname === "/")
  908. ) {
  909. window.stop();
  910. selectedInstance = stackoverflow[1]
  911. ? `${farsideInstance}/anonymousoverflow`
  912. : await getrandom(Instances.anonymousoverflow);
  913.  
  914. newURL = `${scheme}${selectedInstance}${window.location.pathname}${window.location.search}${hash}`;
  915. window.location.replace(newURL);
  916. }
  917. }
  918.  
  919. async function redirectBandcamp() {
  920. if (bandcamp[0]) {
  921. // thanks to libredirect
  922.  
  923. selectedInstance = await getrandom(Instances.tent);
  924. const params = new URLSearchParams(window.location.search);
  925. const artist = window.location.hostname.replace(/\..+/, "");
  926. const regex = /^\/(.+?)\/(.+)/.exec(window.location.pathname);
  927. const audio = /^\/stream\/([a-f0-9]+)\/(.+)\/([0-9]+)/.exec(
  928. window.location.pathname
  929. );
  930. const image = /^\/img\/(.+)/.exec(window.location.pathname);
  931. let searchpath = "";
  932.  
  933. switch (true) {
  934. case window.location.pathname === "/search":
  935. searchpath = `/search.php?query=${params.get("q")}`;
  936. break;
  937. case window.location.hostname.search(/(daily)?\.bandcamp\.com/) > 0:
  938. if (window.location.pathname === "/") {
  939. searchpath = `/artist.php?name=${artist}`;
  940. } else if (regex.length > 2) {
  941. searchpath = `/release.php?artist=${artist}&type=${regex[1]}&name=${regex[2]}`;
  942. }
  943. break;
  944. case window.location.hostname === "f4.bcbits.com":
  945. if (image.length > 1) searchpath = `/image.php?file=${image[1]}`;
  946. break;
  947. case window.location.hostname === "t4.bcbits.com":
  948. if (audio.length > 3)
  949. searchpath = `/audio.php?directory=${audio[1]}&format=${
  950. audio[2]
  951. }&file=${audio[3]}&token=${params.get("token")}`;
  952. break;
  953. default:
  954. return;
  955. }
  956. window.stop();
  957. newURL = `${scheme}${selectedInstance}${searchpath}`;
  958. window.location.replace(newURL);
  959. }
  960. }
  961.  
  962. async function redirectGenius() {
  963. if (genius[0]) {
  964. const pathname = window.location.pathname;
  965. selectedInstance = await getrandom(Instances[geniusFrontend]);
  966.  
  967. await Promise.any(
  968. [
  969. ["lyrics", pathname.endsWith("-lyrics")],
  970. ["album", pathname.startsWith("/albums/")],
  971. ["artist", pathname.startsWith("/artists/")],
  972. [, ["/", "/search"].includes(pathname)],
  973. ].map(async ([key, value]) => {
  974. if (value) {
  975. const searchpath =
  976. geniusFrontend === "intellectual" && key
  977. ? `/${key}?path=${pathname.slice(1)}`
  978. : `${pathname}${window.location.search}`;
  979. window.stop();
  980. newURL = `${scheme}${selectedInstance}${searchpath}${hash}`;
  981. window.location.replace(newURL);
  982. }
  983. })
  984. );
  985. }
  986. }
  987.  
  988. async function redirectPinterest() {
  989. if (pinterest[0]) {
  990. selectedInstance = await getrandom(Instances.binternet);
  991.  
  992. let searchpath = "";
  993. if (window.location.hostname === "i.pinimg.com") {
  994. searchpath = `/image_proxy.php?url=${window.location.href}`;
  995. } else if (window.location.pathname.startsWith("/search")) {
  996. searchpath = `${window.location.pathname
  997. .replace("search", "search.php")
  998. .replace("/pins/", "")}${window.location.search}`;
  999. } else if (window.location.pathname !== "/") return;
  1000.  
  1001. window.stop();
  1002. newURL = `${scheme}${selectedInstance}${searchpath}`;
  1003. window.location.replace(newURL);
  1004. }
  1005. }
  1006.  
  1007. async function redirectSoundcloud() {
  1008. if (soundcloud[0]) {
  1009. window.stop();
  1010. selectedInstance = await getrandom(Instances.tubo);
  1011.  
  1012. let searchpath = "/kiosk?serviceId=1";
  1013. if (window.location.pathname !== "/")
  1014. searchpath = `/stream?url=${window.location.href}`;
  1015. newURL = `${scheme}${selectedInstance}${searchpath}`;
  1016. window.location.replace(newURL);
  1017. }
  1018. }
  1019.  
  1020. async function redirectPixiv() {
  1021. if (pixiv[0]) {
  1022. window.stop();
  1023. selectedInstance = await getrandom(Instances.pixivfe);
  1024.  
  1025. const pathname = window.location.pathname.replace(/^\/\w{2}\//, "/");
  1026. newURL = `${scheme}${selectedInstance}${pathname}${window.location.search}`;
  1027. window.location.replace(newURL);
  1028. }
  1029. }
  1030.  
  1031. const urlHostname = window.location.hostname;
  1032.  
  1033. switch (urlHostname) {
  1034. case "www.instagram.com":
  1035. redirectInstagram();
  1036. break;
  1037.  
  1038. case "twitter.com":
  1039. case "mobile.twitter.com":
  1040. redirectTwitter();
  1041. break;
  1042.  
  1043. case "www.youtube.com":
  1044. case "m.youtube.com":
  1045. case "www.youtube-nocookie.com":
  1046. redirectYoutube(youtubeFrontend);
  1047. break;
  1048.  
  1049. case "www.tiktok.com":
  1050. redirectTiktok();
  1051. break;
  1052.  
  1053. case "music.youtube.com":
  1054. redirectYoutube(youtubeMusicFrontend);
  1055. break;
  1056.  
  1057. case "news.ycombinator.com":
  1058. redirectHackerNews();
  1059. break;
  1060.  
  1061. case "translate.google.com":
  1062. redirectGTranslate();
  1063. break;
  1064.  
  1065. case "www.reuters.com":
  1066. redirectReuters();
  1067. break;
  1068.  
  1069. case "www.imdb.com":
  1070. case "m.imdb.com":
  1071. redirectImdb();
  1072. break;
  1073.  
  1074. case "www.quora.com":
  1075. redirectQuora();
  1076. break;
  1077.  
  1078. case "www.google.com":
  1079. redirectGoogle();
  1080. break;
  1081.  
  1082. case "www.goodreads.com":
  1083. redirectGoodreads();
  1084. break;
  1085.  
  1086. case "genius.com":
  1087. redirectGenius();
  1088. break;
  1089.  
  1090. case "stackoverflow.com":
  1091. redirectStackoverflow();
  1092. break;
  1093.  
  1094. case "f4.bcbits.com":
  1095. case "t4.bcbits.com":
  1096. redirectBandcamp();
  1097. break;
  1098.  
  1099. case "i.pinimg.com":
  1100. redirectPinterest();
  1101. break;
  1102.  
  1103. case "soundcloud.com":
  1104. case "m.soundcloud.com":
  1105. redirectSoundcloud();
  1106. break;
  1107.  
  1108. case "www.pixiv.net":
  1109. redirectPixiv();
  1110. break;
  1111.  
  1112. case urlHostname.includes("reddit.com") ? urlHostname : 0:
  1113. redirectReddit();
  1114. break;
  1115.  
  1116. case urlHostname.includes("medium.com") ? urlHostname : 0:
  1117. redirectMedium();
  1118. break;
  1119.  
  1120. case urlHostname.includes("imgur.com") ? urlHostname : 0:
  1121. case urlHostname.includes("imgur.io") ? urlHostname : 0:
  1122. redirectImgur();
  1123. break;
  1124.  
  1125. case urlHostname.includes("wikipedia.org") ? urlHostname : 0:
  1126. redirectWikipedia();
  1127. break;
  1128.  
  1129. case urlHostname.includes("fandom.com") ? urlHostname : 0:
  1130. redirectFandom();
  1131. break;
  1132.  
  1133. case urlHostname.includes("bandcamp.com") ? urlHostname : 0:
  1134. redirectBandcamp();
  1135. break;
  1136.  
  1137. case urlHostname.includes("pinterest.com") ? urlHostname : 0:
  1138. redirectPinterest();
  1139. break;
  1140. }