@@ 1,713 0,0 @@
-// ==UserScript==
-// @name Proxy Redirect
-// @author Schimon Jehudah, Adv.
-// @homepageURL https://openuserjs.org/scripts/sjehuda/Proxy_Redirect
-// @supportURL https://openuserjs.org/scripts/sjehuda/Proxy_Redirect/issues
-// @updateURL https://openuserjs.org/meta/sjehuda/Proxy_Redirect.meta.js
-// @downloadURL https://openuserjs.org/install/sjehuda/Proxy_Redirect.user.js
-// @copyright 2023, Schimon Jehudah (http://schimon.i2p)
-// @license AGPL-3.0-only; https://www.gnu.org/licenses/agpl-3.0.en.html
-// @namespace i2p.schimon.proxy-redirect
-// @description Redirect to privacy respecting proxy frontends
-// @run-at document-start
-// @version 23.06.10
-// @grant GM_xmlhttpRequest
-// @grant GM.xmlHttpRequest
-// @exclude *#noredirect
-// @match *://bandcamp.com/*
-// @match *://*.bandcamp.com/*
-// @match *://bilibili.com/*
-// @match *://*.bilibili.com/*
-// @match *://bing.com/maps*
-// @match *://www.bing.com/maps*
-// @match *://bing.com/search*
-// @match *://www.bing.com/search*
-// @match *://bt4g.org/magnet/*
-// @match *://*.bt4g.org/magnet/*
-// @match *://*.fandom.com/wiki/*
-// @match *://gist.github.com/*
-// @match *://github.com/*
-// @match *://*.github.com/*
-// @exclude *://github.com/*/*/*
-// @exclude *://github.com/events
-// @exclude *://github.com/events/*
-// @exclude *://github.com/login*
-// @exclude *://github.com/notifications*
-// @exclude *://github.com/sessions*
-// @exclude *://github.com/signup*
-// @exclude *://github.com/topics
-// @exclude *://github.com/topics/*
-// @match *://gitlab.com/*
-// @match *://goodreads.com/*
-// @match *://*.goodreads.com/*
-// @match /^(https?:\/\/)?(www\.)?google\.[^\/]+\/maps/i
-// @match /^(https?:\/\/)?(www\.)?google\.[^\/]+\/search/i
-// @match *://google.com/search*
-// @match *://www.google.com/search*
-// @match *://google.com/sorry*
-// @match *://consent.google.com/*
-// @match *://www.google.com/sorry*
-// @match *://translate.google.com/*
-// @match *://imdb.com/*
-// @match *://www.imdb.com/*
-// @exclude *://imdb.com/*/*/reviews/*
-// @exclude *://www.imdb.com/*/*/reviews/*
-// @match *://imgur.com/*
-// @match *://i.imgur.com/*
-// @match *://instagram.com/*
-// @match *://www.instagram.com/*
-// @match *://invidious-invidious.invidious.svc.cluster.local:3000/*
-// @match *://medium.com/*
-// @match *://*.medium.com/*
-// @exclude */v2/*
-// @exclude */c/*
-// @exclude */fit/*
-// @exclude */resize:fit:*
-// @exclude */format:*
-// @match *://moovitapp.com/*
-// @match *://*.moovitapp.com/*
-// @match *://odysee.com/*
-// @match *://*.odysee.com/*
-// @match *://quora.com/*
-// @match *://*.quora.com/*
-// @match *://reuters.com/*
-// @match *://*.reuters.com/*
-// @match *://tiktok.com/*
-// @match *://*.tiktok.com/*
-// @match *://reddit.com/*
-// @match *://*.reddit.com/*
-// @match *://stackoverflow.com/questions/*
-// @exclude *://stackoverflow.com/questions/tagged/*
-// @match *://www.torrentdownload.info/*
-// @exclude *://www.torrentdownload.info/feed_latest
-// @exclude *://www.torrentdownload.info/search?q=*
-// @match *://torrentz.eu/*
-// @exclude *://torrentz.eu/search?f=*
-// @match *://*.torrentz.eu/*
-// @exclude *://*.torrentz.eu/search?f=*
-// @match *://torrentz.me/*
-// @exclude *://torrentz.me/search?f=*
-// @match *://*.torrentz.me/*
-// @exclude *://*.torrentz.me/search?f=*
-// @match *://torrentz2.eu/*
-// @exclude *://torrentz2.eu/search?f=*
-// @match *://torrentz2.is/*
-// @exclude *://torrentz.is/search?f=*
-// @match *://*.torrentz2.is/*
-// @exclude *://*.torrentz.is/search?f=*
-// @match *://twitter.com/*
-// @exclude *://twitter.com/intent/*
-// @match *://*.twitter.com/*
-// @exclude *://*.twitter.com/intent/*
-// @match *://urbandictionary.com/*
-// @match *://*.urbandictionary.com/*
-// @match *://userscripts.org/*
-// @match *://*.userscripts.org/*
-// @match *://waze.com/live-map*
-// @match *://*.waze.com/live-map*
-// @match *://waze.com/ul*
-// @match *://*.waze.com/ul*
-// @match *://ul.waze.com/ul*
-// @match *://wikimap.toolforge.org/*
-// @match *://wikipedia.org/*
-// @match *://*.wikipedia.org/*
-// @match *://yahoo.com/search*
-// @match *://www.yahoo.com/search*
-// @match *://search.yahoo.co.jp/search?p=*
-// @match *://search.yahoo.com/?q=*
-// @match *://yandex.com/search*
-// @match *://www.yandex.com/search*
-// @match *://yandex.com/maps/*
-// @match *://www.yandex.com/maps/*
-// @match *://yandex.ru/search*
-// @match *://www.yandex.ru/search*
-// @match *://translate.yandex.com/*
-// @match *://youtu.be/*
-// @match *://youtube.com/*
-// @match *://*.youtube.com/*
-// @match *://youtube-nocookie.com/*
-// @match *://*.youtube-nocookie.com/*
-// @connect bibliogram.art
-// @connect openstreetmap.org
-// @connect scribe.rip
-// @connect teddit.cleberg.net
-// @connect libreddit.cleberg.net
-// @connect invidious.cleberg.net
-// @connect libretranslate.cleberg.net
-// @connect gh.cleberg.net
-// @connect search.cleberg.net
-// @connect nitter.cleberg.net
-// @icon data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjRtbSIgaGVpZ2h0PSI2NG1tIiB2aWV3Qm94PSIwIDAgNjQgNjQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHRleHQgeG1sOnNwYWNlPSJwcmVzZXJ2ZSIgc3R5bGU9ImZvbnQtd2VpZ2h0OjQwMDtmb250LXNpemU6MTkycHg7bGluZS1oZWlnaHQ6MDt0ZXh0LWluZGVudDowO3RleHQtYWxpZ246c3RhcnQ7dGV4dC1kZWNvcmF0aW9uLXN0eWxlOnNvbGlkO3RleHQtZGVjb3JhdGlvbi1jb2xvcjojMDAwO3dyaXRpbmctbW9kZTpsci10YjtkaXJlY3Rpb246bHRyO3RleHQtb3JpZW50YXRpb246bWl4ZWQ7ZG9taW5hbnQtYmFzZWxpbmU6YXV0bztiYXNlbGluZS1zaGlmdDpiYXNlbGluZTt0ZXh0LWFuY2hvcjpzdGFydDtzaGFwZS1wYWRkaW5nOjA7c2hhcGUtbWFyZ2luOjA7aW5saW5lLXNpemU6MDtvcGFjaXR5OjE7ZmlsbDojMDAwO2ZpbGwtb3BhY2l0eToxO3N0cm9rZS13aWR0aDoxLjI3OTgyO3N0cm9rZS1saW5lY2FwOmJ1dHQ7c3Ryb2tlLWxpbmVqb2luOm1pdGVyO3N0cm9rZS1taXRlcmxpbWl0OjQ7c3Ryb2tlLWRhc2hvZmZzZXQ6MDtzdHJva2Utb3BhY2l0eToxO3N0b3AtY29sb3I6IzAwMDtzdG9wLW9wYWNpdHk6MSIgeD0iMTcuMDA1MjQ1IiB5PSIzMS42NTg0MDUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC00LjQzNjg1NjQgNDAuODk0OTQpIHNjYWxlKC4yNjQ1OCkiPjx0c3BhbiB4PSIxNy4wMDUyNDUiIHk9IjMxLjY1ODQwNSIgc3R5bGU9ImZvbnQtc2l6ZToxOTJweCI+8J+luDwvdHNwYW4+PC90ZXh0Pjwvc3ZnPgo=
-// ==/UserScript==
-
-//TODO
-//Rebrand: Open Redirect, Proxy Redirect
-//Rebrand: Freelink, LibreProxy, Libreproxy, Open Link, Proxy Direct, Proxy Link, Proxy Redirect
-
-/*
-
-<!-- **Read:** Appeal to [Falkon (QupZilla) Web Browser](#-help-enhancing-userscript-support-for-falkon-web-browser) - Part of the KDE Project -->
-
-## 🕶️ Proxy Redirect <!-- 😎➿⏭️🔁➰ -->
-### _Redirection userscript for privacy-oriented and open-source proxy frontends._
-
-Proxy Redirect automatically redirects to instances of privacy-oriented frontends, such as Scribe, Nitter, Libreddit, etc.
-
-This allows more reliable access to available public instances per service, while also helping to distribute traffic more evenly across all instances and avoid performance bottlenecks and rate-limiting.
-
----
-
-#### Recommended Userscripts
-
-#### ⛓️ [Proxify Links](https://openuserjs.org/scripts/sjehuda/Proxify_Links)
-Correct links to privacy respecting proxy frontends.
-
----
-
-#### Please visit our counterparts
-
-#### Userscript
-
-#### [GreaseMonkey-Redirect](https://codeberg.org/zortazert/GreaseMonkey-Redirect)
-Collection of user created GreaseMonkey scripts that will convert privacy disrespecting websites to FOSS/Libre alternatives.
-
-#### [Search Engine Jumper](https://openuserjs.org/scripts/sycom/Search_Engine_Jumper) (Search Engine Kangaroo)
-When using some search engines the script creates links to a long list of alternative search engines. Don't be a search engine prisoner
-
-#### Web Extension
-
-#### [Privacy-Redirect](https://github.com/SimonBrazell/privacy-redirect#get)
-Simple web extension that redirects requests to privacy friendly counterparts.
-
-#### [LibRedirect](https://libredirect.github.io/)
-##### Based on [Privacy-Redirect](#privacy-redirect)
-Web extension that redirects requests to privacy friendly frontends and backends.
-
-#### [Invidition](https://codeberg.org/Booteille/invidition#downloads)
-##### Deprecated in favor of [Privacy-Redirect](#privacy-redirect)
-Invidition is an extension allowing you to redirect requests to their counterparts before loading them.
-
-#### Mobile App
-
-#### [UntrackMe](https://framagit.org/tom79/nitterizeme#download)
-A small application that allows to handle requests and redirect them to their Nitter or Invidious URLs and open them with the appropriate app.
-
-#### Server
-
-#### [Farside](https://farside.link/)
-Redirecting service for FOSS frontends.
-
----
-
-#### <!-- img src="https://raw.githubusercontent.com/KDE/falkon/master/logo.png" height="30" alt="Falkon" title="Download Falkon Browser"/ --> Help enhancing userscript support for <span style='color:MediumPurple'>Falkon web browser</span>
-C++ developers, please help [Falkon](https://falkon.org/) web browser to bring [better support](https://bugs.kde.org/show_bug.cgi?id=466533) for [GM.xmlHttpRequest](https://sourceforge.net/p/greasemonkey/wiki/GM_xmlhttpRequest/).
-
-If you find this program useful, please help Falkon so we would also be able to enjoy this program. Web browsers that respect our privacy are rare. That's why Falkon is important.
-
-##### Disclosure: This program was made particularly for people who use Falkon, Jumanji, Opera, Otter, Pale Moon, Surf, Uzbl and other web browsers with Userscript support, to which non has a redirector extension like [Privacy-Redirect](#privacy-redirect).
-
-_Sincerely,
-Schimon Jehudah, Adv._
-
-*/
-
-/*
-
-NOTE
-This program was inspired by Farside project from Ben Busby
-For more information: https://farside.link
-
-TODO Brand
-FreeDirector, Free Direct, FreeDirect.js
-Open Redirector, Open Redirect, Open Direct, OpenDirect.js
-Redirect.js, Redirect.user.js, Redirector.js
-UserDirect, UserRedirect
-
-FIXME
-// @match *://*.imgur.com/*
-// @exclude *://i.*.imgur.com/*
-
-FIXME RegEx
-// @exclude /*.medium\.com\/*\/(c|fit|v2)\/.*$/
-
-*/
-
-// https://github.com/makyen
-// https://github.com/greasemonkey/greasemonkey/issues/3160#issuecomment-1456758080
-const gmXmlhttpRequest = typeof GM_xmlhttpRequest === 'function' ? GM_xmlhttpRequest : GM.xmlHttpRequest;
-
-var
- loop, attemptCounter = 0,
- hostname, pathname,
- inst, addr, brand, code, cord, hash, lang, name, para, paras,
- farside, partedURL, path, proxyArray, urlArray, instance, modURL, newURL;
-
-//const url = location.href;
-
-const proxy = {
-'anonymousoverflow' : [
-'https://ao.cleberg.net'
-], // AnonymousOverflow
-'bibliogram' : [
-'https://bibliogram.art',
-], // Bibliogram
-'gothub' : [
-'https://gh.cleberg.net'
-], // GotHub
-'invidious' : [
-'https://invidious.cleberg.net'
-], // Invidious
-'libreddit' : [
-'https://libreddit.cleberg.net'
-], // libreddit
-'map' : [
-'https://www.openstreetmap.org'
-], // Maps
-'nitter' : [
-'https://nitter.cleberg.net'
-], // Nitter
-'scribe' : [
-'https://scribe.rip'
-], // Scribe
-'searx' : [
-'https://search.cleberg.net',
-], // SearXNG
-'libretranslate' : [
-'https://libretranslate.cleberg.net'
-], // LibreTranslate
-'teddit' : [
-'https://teddit.cleberg.net'
-], // teddit
-};
-
-function pageLoader() {
-//window.onprogress = (event) => {
- // /questions/6464592/how-to-align-entire-html-body-to-the-center
- const loadPage = '<html><head><link type="image/svg+xml" rel="shortcut icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🥸</text></svg>"><title>Proxy Redirect</title><style>html,body{height:100%;}html{display:table;margin:auto;}body{display:table-cell;vertical-align:middle;}body{background-color:#f1f1f1;font-family:"Helvetica Neue", Helvetica,Arial,sans-serif;cursor:default;user-select:none;max-height:100%;max-width:100%;}div{font-size:2.3em;font-weight:bold;}#main{font-size:2em;color:#F83600;text-transform:uppercase;position:relative;text-align:center;}#loader{font-style:italic;animation:flickerAnimation 1s infinite;}.centerm{display:block;margin-left:auto;margin-right:auto;width:100%;}.center{padding:1em 0px 1em 0px;text-align:center;}@keyframes flickerAnimation{0%{opacity:1;}50%{opacity:0;}100%{opacity:1;}}.flip{display:inline-block;transform:scaleX(-1);-moz-transform:scaleX(-1);-o-transform:scaleX(-1);-webkit-transform:scaleX(-1);filter:FlipH;-ms-filter:FlipH;}</style></head><body><div id="message" class="center"></div><div id="loader" class="center">🔀 Redirecting...</div></body></html>';
- //const loadPage = '<html><head><link type="image/svg+xml" rel="shortcut icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🥸</text></svg>"><title>Proxy Redirect</title><style>html,body{height:100%;}html{display:table;margin:auto;}body{display:table-cell;vertical-align:middle;}body{background-color:#f1f1f1;font-family:"Helvetica Neue", Helvetica,Arial,sans-serif;cursor:default;user-select:none;max-height:100%;max-width:100%;}div{font-size:2.3em;font-weight:bold;}#icon-tc:before{content:"🔀";font-size:4em;display:flow-root;text-align:center;}#icon-tc{font-size:3em;}#main{font-size:2em;color:#F83600;text-transform:uppercase;position:relative;text-align:center;}#loader{font-style:italic;animation:flickerAnimation 1s infinite;}.centerm{display:block;margin-left:auto;margin-right:auto;width:100%;}.center{padding:1em 0px 1em 0px;text-align:center;}@keyframes flickerAnimation{0%{opacity:1;}50%{opacity:0;}100%{opacity:1;}}.flip{display:inline-block;transform:scaleX(-1);-moz-transform:scaleX(-1);-o-transform:scaleX(-1);-webkit-transform:scaleX(-1);filter:FlipH;-ms-filter:FlipH;}</style></head><body><div id="icon-tc"></div><div id="message" class="center"></div><div id="loader" class="center">Redirecting...</div></body></html>';
- //const loadPage = '<html><head><link type="image/svg+xml" rel="shortcut icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🥸</text></svg>"><title>Proxy Redirect</title><meta http-equiv="content-type" content="text/html;charset=utf-8" /><meta name="generator" content="Clear Cinema Player" /><style>body {background-color:#efefef;font-family:"Helvetica Neue", Helvetica,Arial,sans-serif; cursor: default; user-select: none;max-height:100%;max-width:100%;}div{font-size:2.3em;font-weight:bold;}#icon-tc:before{content:"🔀";font-size:4em;display:flow-root;text-align:center;}#icon-tc{font-size:3em;}#main{font-size:2em;color:#F83600;text-transform:uppercase;position:relative;text-align:center;}#loader{font-style: italic;animation:flickerAnimation 1s infinite;} #wait, #reload, #footer {font-size:14px;font-weight:normal;} #wait {font-style: italic;} .centerm {display:block;margin-left:auto;margin-right:auto;width:100%;}.center{padding:1em 0px 1em 0px;text-align:center;/* border: 3px solid green; */}@keyframes flickerAnimation {0%{opacity:1;}50%{opacity:0;}100% {opacity:1;}}.flip {display: inline-block; transform: scaleX(-1); -moz-transform: scaleX(-1); -o-transform: scaleX(-1); -webkit-transform: scaleX(-1); filter: FlipH; -ms-filter: FlipH;}</style></head><body><div id="intro" class="center">Proxy Redirect</div><div id="icon-tc" onclick="(function(){document.location = document.location})();"></div><div id="loader" class="center">Redirecting...</div><div id="wait" class="center">Please wait while our monkeys find a working proxy</div><div id="reload" class="center" onclick="(function(){document.location = document.location})();"></div><div id="footer" class="center">Made with <a href="https://falkon.org/">Falkon</a> web browser (<a href="https://openuserjs.org/scripts/sjehuda/Proxy_Redirect/issues">Report issue</a>)</div></body></html>';
- const domParser = new DOMParser();
- const newDocument = domParser.parseFromString(loadPage, 'text/html');
- //newDocument.querySelector('#icon-tc').onclick = () => {disable()}; // FIXME
- //newDocument.querySelector('#icon-tc').addEventListener("click", disable, false);
- const insertDocument = document.importNode(newDocument.documentElement, true);
- const removeDocument = document.documentElement;
- document.replaceChild(insertDocument, removeDocument);
- setTimeout(message, 9000); // FIXME
-}
-
-function message() {
- var div = document.querySelector('#message');
- if (div) {
- div.innerHTML = `🔀 Continue to ${modURL.hostname}`;
- div.onclick = () => {location.href = modURL};
- document.querySelector('#loader').remove();
- } else {
- location.href = 'https://openuserjs.org/scripts/sjehuda/Proxy_Redirect?autoredirect'
- }
-}
-
-function noRespond() {
- var div = document.querySelector('#message');
- div.id = 'message-error'
- div.innerHTML = 'Proxy list appears to be out of date. Continue to ' + location.host + ' or...';
- div.onclick = () => {location.href = location.href + '#noredirect'; location.reload()};
- var div = document.querySelector('#loader');
- div.innerHTML = '🥸 Update Proxy Redirect';
- div.onclick = () => {location.href = 'https://openuserjs.org/scripts/sjehuda/Proxy_Redirect'};
-}
-
-// FIXME
-// /questions/1397329/how-to-remove-the-hash-from-window-location-url-with-javascript-without-page-r
-function disable() {
- window.location.href =
- window.location.href.substr(
- 0,
- window.location.href.indexOf('#'))
- + '#noredirect';
-}
-
-/*
-loop = setInterval(function() {
- //modifyURL(location.href);
- window.open(newURL,'_self');
- //location.href = newURL;
- console.info('Redirecting to ' + newURL);
- clearInterval(loop);
-}, 1000);
-*/
-
-/*
-function modifyURL() {
- inst = pickURL();
- // make function synchronous
- // /questions/8778267/synchronous-gm-xmlhttprequest-acting-asynchronously
- stat = statRES(inst);
- if (stat.match(200)) {
- newURL = settURL();
- } else {
- pickURL(url);
- }
- return newURL;
-}
-*/
-
-// var caller = (function xhr() {
-var init = (function xhr() {
- instance = pickURL();
-try {
- gmXmlhttpRequest({
- method: 'GET',
- url: instance,
- synchronous: true,
- onprogress: pageLoader(),
- onload: function(response) {
- if (response.finalUrl.startsWith(instance)) {
- location.href = settURL();
- } else {
- instance = instance.slice(instance.lastIndexOf('/')+1);
- instance = instance.replace(/\./g,'-');
- console.warn('Instance URL ' + instance + ' might be out of service. URL has changed. Please report this to the developer.');
- if (maxAttempts()) {
- noRespond()
- return;
- }
- maxAttempts()
- xhr();
- }
- },
- onerror: function(response) {
- instance = instance.slice(instance.lastIndexOf('/')+1);
- instance = instance.replace(/\./g,'-');
- console.warn('Instance URL ' + instance + ' might be offline. Status error: ' + response.status + '. Please report this to the developer.');
- if (maxAttempts()) {
- noRespond()
- return;
- }
- maxAttempts()
- xhr();
- }
- });
-} catch (err) {
- console.warn(err)
- console.info('Please contribute C++ to Greasemonkey for Falkon https://bugs.kde.org/show_bug.cgi?id=466533')
- //pickURL();
- farside = true;
- location.href = settURL();
-}
-
-})();
-
-function maxAttempts() {
- attemptCounter = attemptCounter + 1;
- if (attemptCounter == urlArray.length) { return true; }
-}
-
-function setValue(para) {
- if (partedURL.searchParams.get(para)) {
- para = [para];
- return pickParameters(para);
- } else {
- return 'auto';
- }
-}
-
-function pickParameters(para) {
- for (let i = 0; i < para.length; i++) {
- if (partedURL.searchParams.get(para[i])) {
- para = partedURL.searchParams.get(para[i]);
- partedURL.searchParams.delete(para[i]);
- return para;
- }
- }
-}
-
-function pickURL() {
-
- partedURL = new URL(location.href);
-
- paras = ['continue', 'retpath']
- for (let i = 0; i < paras.length; i++) {
- if (partedURL.searchParams.get(paras[i])) {
- //partedURL = pickParameters(paras[i]);
- partedURL = partedURL.searchParams.get(paras[i]);
- partedURL = new URL(partedURL);
- }
- }
-
- hostname = partedURL.hostname;
- pathname = partedURL.pathname;
-
- switch (true) {
-
- case hostname.endsWith('github.com'):
- urlArray = proxy.gothub;
- break;
-
- // TODO quadkey (mapquest)
- // NOTE quadkeyToTile(quadkey) See /mapbox/tilebelt
- case hostname.endsWith('wikimap.toolforge.org'):
- case (hostname.endsWith('moovitapp.com') &&
- partedURL.search.includes('tll')):
- case (hostname.endsWith('bing.com') &&
- pathname.startsWith('/maps')):
- case (hostname.includes('google.') &&
- pathname.startsWith('/maps')):
- case (hostname.includes('waze.com') &&
- pathname.startsWith('/live-map')):
- case (hostname.includes('waze.com') &&
- pathname.startsWith('/ul')):
- case (hostname.includes('yandex.') &&
- pathname.startsWith('/maps')):
- urlArray = proxy.map;
- break;
-
- case hostname.endsWith('instagram.com'):
- urlArray = proxy.bibliogram;
- break;
-
- case hostname.endsWith('medium.com'):
- proxyArray = [proxy.libmedium, proxy.scribe];
- break;
-
- case hostname.endsWith('reddit.com'):
- proxyArray = [proxy.libreddit, proxy.teddit];
- break;
-
- // FIXME
- case (hostname.startsWith('search.yahoo.')):
- case (pathname.startsWith('/search')):
- case (hostname.includes('yandex.') &&
- pathname.startsWith('/search')):
- case (hostname.includes('yahoo.') &&
- pathname.startsWith('/search')):
- case (hostname.includes('bing.') &&
- pathname.startsWith('/search')):
- case (hostname.includes('google.') &&
- pathname.startsWith('/search')):
- proxyArray = [proxy.searx];
- break;
-
- case hostname.endsWith('stackoverflow.com'):
- urlArray = proxy.anonymousoverflow;
- break;
-
- case hostname.endsWith('tiktok.com'):
- urlArray = proxy.proxitok;
- break;
-
- case (hostname.endsWith('translate.yandex.com')):
- // FIXME website blocks us from redirecting
- // function setTimeout() seems to not work
- // consider different approach/way
- case (hostname.endsWith('translate.google.com')):
- proxyArray = [proxy.libretranslate];
- break;
-
- case hostname.endsWith('twitter.com'):
- urlArray = proxy.nitter;
- break;
-
- case hostname.endsWith('youtu.be'):
- case hostname.endsWith('youtube.com'):
- case hostname.endsWith('youtube-nocookie.com'):
- case hostname.endsWith('invidious-invidious.invidious.svc.cluster.local:3000'):
- proxyArray = [proxy.invidious];
- break;
-
- //default:
- // return target;
-
- }
-
- // proxy select
- if (proxyArray) {
- urlArray = proxyArray[Math.floor(Math.random()*proxyArray.length)];
- }
-
- // instance select
- return urlArray[Math.floor(Math.random()*urlArray.length)];
-
-}
-
-// Settlement
-function settURL() {
- let newPath;
- switch (urlArray) {
-
- // consider function setTimeout()
- case proxy.bibliogram:
- if (!pathname.includes('accounts/login')) {
- newPath = `/u/${para}`;
- } else {
- if (partedURL.searchParams.get('next')) {
- para = ['next'];
- para = pickParameters(para);
- newPath = `/u/${para}`;
- }
- }
- break;
-
- case proxy.invidious:
- if (partedURL.searchParams.get('v')) {
- para = ['v'];
- para = pickParameters(para);
- newPath = `/watch?v=${para}`;
- }
- break;
-
- case proxy.gothub:
- if (hostname.endsWith('gist.github.com')) {
- newPath = `/gist${pathname}`;
- }
- break;
-
- case proxy.libmedium:
- partedHost = hostname.split('.');
- if (partedHost.length === 3 || partedHost.length === 4) {
- name = partedHost[0];
- }
- newPath = `/@${name}${pathname}`;
- break;
-
- //if (paras[2] === 'auto') { paras[2] = ''; }
-
- if ((paras[0] == 'auto') && (paras[1] == 'auto')) {
- newPath = `/${paras[2]}`;
- } else {
- newPath = `/${paras[0]}/${paras[1]}/${paras[2]}`;
- }
- break;
-
- case proxy.map:
- // extract coordinations
- /*
- if (pathname.includes('@')) {
- cord = pathname.split('/')[2].split('&')[0].slice(1);
- cord = cord.split(',');
- }
- newPath = '/#map=' + cord[2].slice(0, 1) +
- '/' + cord[0] + '/' + cord[1];
- */
- let lat, lon, zoom;
- // extract coordinations
- if (partedURL.search.includes('%7E')) { // %7E is ~
- para = ['cp'];
- cord = pickParameters(para);
- cord = cord.split('~');
- para = ['lvl'];
- zoom = pickParameters(para);
- lat = cord[0];
- lon = cord[1];
- } else
- if (partedURL.search.includes('to')) {
- para = ['to'];
- cord = pickParameters(para);
- cord = cord.slice(3).split(',');
- lat = cord[0];
- lon = cord[1];
- } else
- if (pathname.includes('ul') &&
- partedURL.search.includes('ll')) {
- para = ['ll'];
- cord = pickParameters(para);
- cord = cord.split(',');
- para = ['zoom'];
- zoom = pickParameters(para);
- lat = cord[0];
- lon = cord[1];
- } else
- if (partedURL.search.includes('ll')) {
- para = ['ll'];
- cord = pickParameters(para);
- cord = cord.split(',');
- para = ['z'];
- zoom = pickParameters(para);
- lat = cord[0];
- lon = cord[1];
- } else
- if (partedURL.search.includes('tll')) {
- para = ['tll'];
- cord = pickParameters(para);
- cord = cord.split('_');
- lat = cord[0];
- lon = cord[1];
- } else
- if (pathname.includes('@')) {
- partedPath = pathname.split('/')
- for (let i = 0; i < partedPath.length; i++) {
- if (partedPath[i].startsWith('@')) {
- cord = partedPath[i].split(',');
- }
- }
- lat = cord[0].slice(1);
- lon = cord[1];
- zoom = cord[2];
- //newPath = `/#map=${cord[2].slice(0, 2)}/${cord[0].slice(1)}/${cord[1]}`;
- //newPath = `/#map=${cord[2]}/${cord[0].slice(1)}/${cord[1]}`;
- //newPath = `/#${cord[2]}/${cord[0].slice(1)}/${cord[1]}/`;
- }
-
- if (lat && lon && zoom) {
- newPath = `/#${zoom}/${lat}/${lon}/`;
- } else
- if (lat && lon && !zoom) {
- newPath = `/#10/${lat}/${lon}/`;
- }
-
- if (!newPath && partedURL.searchParams.get('q')) {
- para = ['q'];
- para = pickParameters(para);
- newPath = `/search?query=${para}`;
- instance = 'https://www.openstreetmap.org';
- }
- break;
-
- case proxy.searx:
- // extract search parameter
- para = ['q','text','p'];
- para = pickParameters(para);
- newPath = `/search?q=${para}`;
- break;
-
- case proxy.mikuinvidious:
- if (!hostname.startsWith('www.')) {
- partedHost = hostname.split('.');
- if (partedHost.length === 3 || partedHost.length === 4) {
- name = partedHost[0];
- }
- newPath = `/${name}${pathname}`;
- }
- break;
-
- case proxy.tent:
- partedHost = hostname.split('.');
- if (partedHost.length === 3 || partedHost.length === 4) {
- artist = partedHost[0];
- }
- partedPath = pathname.split('/');
- type = partedPath[1];
- name = partedPath[2];
- if (name) {
- newPath = `/release.php?artist=${artist}&type=${type}&name=${name}`;
- } else {
- newPath = `/release.php?artist=${artist}&type=${type}`;
- }
- break;
-
- }
-
- if (!newPath || newPath == '/') {
- newPath = pathname + partedURL.search + partedURL.hash;
- }
-
- if (farside) {
- if (urlArray.filter(str => str.includes('farside.link')).length) {
- instance = urlArray.filter(str => str.includes('farside.link'))[0];
- }
- }
-
- modURL = new URL(instance + newPath);
- return modURL;
-
-}
@@ 0,0 1,166 @@
+/* Forked from https://github.com/forLoop42/open-source-alternative-redirector */
+
+// ==UserScript==
+// @name Open-Source Alternative Redirector
+// @name:ar معيد التوجيه البديل مفتوح المصدر
+// @name:bg Алтернативно пренасочване с отворен код
+// @name:cs Open-Source alternativní přesměrovač
+// @name:da Open Source Alternativ Redirector
+// @name:de Open-Source-alternativer Redirector
+// @name:es Redirector alternativo de código abierto
+// @name:fi Open-Source Alternative Redirector
+// @name:fr Redirecteur alternatif open source
+// @name:he מפנה אלטרנטיבי בקוד פתוח
+// @name:it Reindirizzamento alternativo open source
+// @name:ja オープンソースの代替リダイレクター
+// @name:ko 오픈 소스 대체 리디렉터
+// @name:nl Alternatieve Open Source-redirector
+// @name:pl Alternatywny readresator typu open source
+// @name:ro Redirector alternativ cu sursă deschisă
+// @name:ru Альтернативный перенаправитель с открытым исходным кодом
+// @name:tr Açık Kaynak Alternatif Yönlendirici
+// @name:uk Альтернативний перенаправник з відкритим вихідним кодом
+// @name:zh-CN 开源替代重定向器
+// @name:zh-TW 開源替代重定向器
+// @namespace -
+// @version 10.0.1
+// @description Redirects you from proprietary web-services to ethical alternatives(front-end).
+// @description:ar يعيد توجيهك من خدمات الويب المسجلة الملكية إلى البدائل الأخلاقية (الواجهة الأمامية).
+// @description:bg Пренасочва ви от собствени уеб-услуги към етични алтернативи (front-end).
+// @description:cs Přesměruje vás z proprietárních webových služeb na etické alternativy (front-end).
+// @description:da Omdirigerer dig fra proprietære web-tjenester til etiske alternativer (front-end).
+// @description:de Leitet Sie von proprietären Webdiensten zu ethischen Alternativen (Front-End) weiter.
+// @description:es Lo redirige de servicios web propietarios a alternativas éticas (front-end).
+// @description:fi Ohjaa sinut patentoiduista verkkopalveluista eettisiin vaihtoehtoihin (käyttöliittymä).
+// @description:fr Vous redirige des services Web propriétaires vers des alternatives éthiques (front-end).
+// @description:he מפנה אותך משירותי אינטרנט קנייניים לחלופות אתיות (חזית).
+// @description:it Ti reindirizza da servizi web proprietari ad alternative etiche (front-end).
+// @description:ja 独自のWebサービスから倫理的な代替手段(フロントエンド)にリダイレクトします。
+// @description:ko 독점 웹 서비스에서 윤리적 대안(프론트 엔드)으로 리디렉션합니다.
+// @description:nl Leidt u om van propriëtaire webservices naar ethische alternatieven (front-end).
+// @description:pl Przekierowuje Cię z zastrzeżonych usług internetowych do etycznych alternatyw (front-end).
+// @description:ro Vă redirecționează de la servicii web proprietare la alternative etice (front-end).
+// @description:ru Перенаправляет вас с проприетарных веб-сервисов на этические альтернативы (интерфейс).
+// @description:tr Sizi tescilli web hizmetlerinden etik alternatiflere (ön uç) yönlendirir.
+// @description:uk Перенаправляє вас із власних веб-сервісів до етичних альтернатив (фронт-енд).
+// @description:zh-CN 将您从专有网络服务重定向到道德替代品(前端)。
+// @description:zh-TW 將您從專有網絡服務重定向到道德替代品(前端)。
+// @author NotYou
+// @include *youtube.com/*
+// @include *google.*
+// @include *yahoo.com/*
+// @include *bing.com/*
+// @include *reddit.com/*
+// @include *twitter.com/*
+// @include *instagram.com/*
+// @include *wikipedia.org/*
+// @include *medium.com/*
+// @include *towardsdatascience.com/*
+// @include *i.imgur.com/*
+// @include *i.stack.imgur.com/*
+// @include *odysee.com/*
+// @include *tiktok.com/*
+// @include *quora.com/*
+// @run-at document-start
+// @license GPL-3.0-or-later
+// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAHkklEQVRYw8WXW2xUxxnHf3Nuu2e9CxhjsGPHmARzMddwSUmghBKSpkpJSpU0rdrmoVVbuVIESl4iRaJNpKh9IUpfitoHXhKJKqhBSkVFgDYkiLpJKJcaMMTY2MaXZe31ei/e3XOb6YOXxSwmgvQh83IumnPmN//v+2b+I5RSfJ3N4GtuBsCWH/3qbvs/AjwDrADqABsoAHGgA/gAaL+bHx3f/6e7VsACXgXaFs5vrFve0kzt7Goidhhd0/F8n4lCgZFk6ukLV3pf7bk2FAf2Ar8H3P83BC8bur5n05oVPLpuJXYohFIKpUChSveKWTOiNMydw6olLeSLxbr2M+df/7yj83U/kK8Ab31VgLcfbGrYueOJzcSqqlBKkclNkMlkKTgOnufh+wEAuqETMi1mxKqwbZtN61axcslCPvzk0z29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AAAAAElFTkSuQmCC
+// @grant none
+// ==/UserScript==
+
+var url = new URL(location.href),
+
+// INSTANCES //
+invidious = 'invidious.cleberg.net',
+libreddit = 'libreddit.cleberg.net',
+nitter = 'nitter.cleberg.net',
+searx = 'search.cleberg.net',
+bibliogram = 'bibliogram.pussthecat.org',
+wikiless = 'wikiless.org',
+lingva = 'lingva.ml',
+scribe = 'scribe.rip',
+rimgo = 'rimgo.pussthecat.org',
+librarian = 'librarian.pussthecat.org',
+proxitok = 'proxitok.pussthecat.org',
+quetre = 'qr.vern.cc'
+
+// YouTube | Invidious //
+if(hostHas('youtube.com')) {
+ location.replace('https://' + invidious + location.pathname + location.search)
+}
+
+if(hostHas('google.')) {
+ // Google Translate | Lingva Translate //
+ if(location.hostname.match(/translate.google.+/)){
+ if(location.search === '') {
+ location.replace('https://' + lingva)
+ } else {
+ var
+ base = location.search.split('&'),
+ lang1 = base[0].split('=')[1],
+ lang2 = base[1].split('=')[1],
+ text = base[2].split('=')[1]
+ location.replace('https://' + lingva + '/' + lang1 + '/' + lang2 + '/' + text)
+ }
+ // Google | SearX //
+ //} else if(location.href.match(/(www\.)?google\.com(\/search)?(?!\/\w)/)) {
+ } else if(location.host.match(/www.google.+/) && location.href.match(/google+\..*(\/search)/)) {
+ location.replace('https://' + searx + location.pathname + location.search)
+ }
+}
+
+// Yahoo | SearX //
+if(hostHas('yahoo.com')) {
+ var search = location.search.replace('?p', '?q')
+ location.replace('https://' + searx + location.pathname + search)
+}
+
+// Bing | SearX //
+if(hostHas('bing.com')) {
+ location.replace('https://' + searx + location.pathname + location.search)
+}
+
+// Reddit | Libreddit //
+if(hostHas('reddit.com')) {
+ location.replace('https://' + libreddit + location.pathname + location.search)
+}
+
+// Twitter | Nitter //
+if(hostHas('twitter.com')) {
+ location.replace('https://' + nitter + location.pathname + location.search)
+}
+
+// Wikipedia | Wikiless //
+/*
+if(hostHas('wikipedia.org')) {
+ location.replace('https://' + wikiless + location.pathname + '?lang=' + url.hostname.split('.')[0])
+}
+*/
+
+// Medium | Scribe //
+if(hostHas('medium.com') || hostHas('towardsdatascience.com')) {
+ location.replace('https://' + scribe + location.pathname + location.search)
+}
+
+// i.Imgur | Rimgo //
+if(hostHas('i.imgur.com')) {
+ location.replace('https://' + rimgo + location.pathname + location.search)
+}
+
+// Odysee | Librarinan //
+if(hostHas('odysee.com')) {
+ location.replace('https://' + librarian + location.pathname + location.search)
+}
+
+// TikTok | ProxiTok //
+if(hostHas('tiktok.com')) {
+ location.replace('https://' + proxitok + location.pathname + location.search)
+}
+
+// Quora | Quetre //
+if(hostHas('quora.com')) {
+ location.replace('https://' + quetre + location.pathname + location.search)
+}
+
+function hostHas(str) {
+ return location.host.indexOf(str) != -1
+}<
\ No newline at end of file