From cd01a7083ced7f53c4d87e604f4edadce64ca49e Mon Sep 17 00:00:00 2001 From: Hygna Date: Tue, 4 Oct 2022 21:45:39 +0100 Subject: Added LibreTranslate --- src/assets/javascripts/services.js | 5 ++ src/config/config.json | 4 ++ src/instances/blacklist.json | 3 ++ src/instances/data.json | 34 +++++++++---- src/instances/get_instances.py | 7 ++- src/pages/background/background.js | 11 ----- src/pages/options/index.html | 97 ++++++++++++++++++++++++++++++++++++++ 7 files changed, 141 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index eed1e6c6..572a6a9c 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -163,6 +163,11 @@ function redirect(url, type, initiator) { return `freetube://https://youtu.be${url.pathname}${url.search}`.replace(/watch\?v=/, "") case "simplyTranslate": return `${randomInstance}/${url.search}` + case "libreTranslate": + return `${randomInstance}/${url.search}` + .replace(/(?<=\/?)sl/, "source") + .replace(/(?<=&)tl/, "target") + .replace(/(?<=&)text/, "q") case "osm": { if (initiator && initiator.host === "earth.google.com") return const travelModes = { diff --git a/src/config/config.json b/src/config/config.json index 09c95bbb..fde17a02 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -496,6 +496,10 @@ }, "name": "Lingva Translate", "instanceList": true + }, + "libreTranslate": { + "name": "LibreTranslate", + "instanceList": true } }, "targets": ["^https?:\\/{2}translate\\.google(\\.[a-z]{2,3}){1,2}\\/", "^https?:\\/{2}translate\\.libredirect\\.invalid"], diff --git a/src/instances/blacklist.json b/src/instances/blacklist.json index edce1958..90febd0a 100644 --- a/src/instances/blacklist.json +++ b/src/instances/blacklist.json @@ -53,6 +53,7 @@ "https://scribe.rawbit.ninja", "https://lingva.garudalinux.org", "https://translate.dr460nf1r3.org", + "https://libretranslate.com", "https://searx.run", "https://searx.org", "https://search.garudalinux.org", @@ -77,11 +78,13 @@ "https://libreddit.notyourcomputer.net", "https://teddit.ggc-project.de", "https://teddit.tokhmi.xyz", + "https://wiki.privacytools.io", "https://quetre.odyssey346.dev", "https://st.odyssey346.dev", "https://jsearch.pw", "https://searx.gnu.style", "https://searx.semipvt.com", + "https://searx.tyil.nl", "https://etsi.me", "https://search.zzls.xyz", "https://searx.ericaftereric.top", diff --git a/src/instances/data.json b/src/instances/data.json index 839b155b..fac7962d 100644 --- a/src/instances/data.json +++ b/src/instances/data.json @@ -6,9 +6,11 @@ "https://invidious.snopyta.org", "https://invidious.kavin.rocks", "https://inv.riverside.rocks", + "https://invidio.xamh.de", "https://y.com.sb", "https://yt.artemislena.eu", "https://invidious.tiekoetter.com", + "https://invidious.sethforprivacy.com", "https://invidious.flokinet.to", "https://inv.bp.projectsegfau.lt", "https://inv.vern.cc", @@ -19,13 +21,11 @@ "https://invidious.slipfox.xyz", "https://invidious.esmailelbob.xyz", "https://youtube.076.ne.jp", - "https://invidious.sethforprivacy.com", - "https://invidious.namazso.eu", - "https://invidio.xamh.de" + "https://invidious.namazso.eu" ], "tor": [ + "http://w6ijuptxiku4xpnnaetxvnkc5vqcdu7mgns2u77qefoixi63vbvnpnqd.onion", "http://c7hqkpkpemu6e7emz5b4vyz7idjgdvgaaa3dyimmeojqbgpea3xqjoid.onion", - "http://kbjggqkzv65ivcqj6bumvp337z6264huv5kpkwuv6gu5yjiskvan7fad.onion", "http://grwp24hodrefzvjjuccrkw3mjq4tzhaaq32amf33dzpmuxe7ilepcmad.onion", "http://osbivz6guyeahrwp2lnwyjk2xos342h4ocsxyqrlaopqjuhwn2djiiyd.onion", "http://u2cvlit75owumwpy4dj2hsmvkq7nvrclkpht7xgyye2pyoxhpmclkrad.onion", @@ -34,7 +34,7 @@ "http://inv.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion", "http://am74vkcrjp2d5v36lcdqgsj2m6x36tbrkhsruoegwfcizzabnfgf5zyd.onion", "http://ng27owmagn5amdm7l5s3rsqxwscl5ynppnis5dqcasogkyxcfqn7psid.onion", - "http://w6ijuptxiku4xpnnaetxvnkc5vqcdu7mgns2u77qefoixi63vbvnpnqd.onion" + "http://kbjggqkzv65ivcqj6bumvp337z6264huv5kpkwuv6gu5yjiskvan7fad.onion" ], "i2p": [], "loki": [] @@ -535,6 +535,24 @@ "i2p": [], "loki": [] }, + "libreTranslate": { + "clearnet": [ + "https://libretranslate.com", + "https://libretranslate.de", + "https://translate.argosopentech.com", + "https://translate.api.skitzen.com", + "https://translate.fortytwo-it.com", + "https://translate.terraprint.co", + "https://lt.vern.cc" + ], + "tor": [ + "http://lt.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion" + ], + "i2p": [ + "http://vernf45n7mxwqnp5riaax7p67pwcl7wcefdcnqqvim7ckdx4264a.b32.i2p" + ], + "loki": [] + }, "searx": { "clearnet": [ "https://dynabyte.ca", @@ -572,12 +590,10 @@ "https://suche.uferwerk.org", "https://sx.catgirl.cloud", "https://timdor.noip.me/searx", - "https://xo.wtf", "https://searx.roflcopter.fr" ], "tor": [ "http://3afisqjw2rxm6z7mmstyt5rx75qfqrgxnkzftknbp2vhipr2nrmrjdyd.onion", - "http://w5rl6wsd7mzj4bdkbuqvzidet5osdsm5jhg2f7nvfidakfq5exda5wid.onion", "http://yra4tke2pwcnatxjkufpw6kvebu3h3ti2jca2lcdpgx3mpwol326lzid.onion", "http://z5vawdol25vrmorm4yydmohsd4u6rdoj2sylvoi3e3nqvxkvpqul7bqd.onion", "http://zbuc3bbzbfdqqo2x46repx2ddajbha6fpsjeeptjhhhhzji3zopxdqyd.onion", @@ -667,9 +683,11 @@ "https://trydex.tk/searxng", "https://www.gruble.de", "https://www.webrats.xyz", - "https://xcxc.ml" + "https://xcxc.ml", + "https://xo.wtf" ], "tor": [ + "http://w5rl6wsd7mzj4bdkbuqvzidet5osdsm5jhg2f7nvfidakfq5exda5wid.onion", "http://4n53nafyi77iplnbrpmxnp3x4exbswwxigujaxy3b37fvr7bvlopxeyd.onion", "http://privateoz3u5utrimal2edr56j3r5caakektxxgixigdkycuxigvquid.onion", "http://b6sxmon57qza6dt36li7huabie5ntrvjr4q5rc2vvbn4hqvzd4phrvyd.onion", diff --git a/src/instances/get_instances.py b/src/instances/get_instances.py index 96902feb..9fc64adc 100644 --- a/src/instances/get_instances.py +++ b/src/instances/get_instances.py @@ -309,7 +309,7 @@ def bibliogram(): def libreddit(): - fetchRegexList('libreddit', 'Libreddit', 'https://raw.githubusercontent.com/spikecodes/libreddit/master/README.md', r"\| \[.*\]\(([-a-zA-Z0-9@:%_\+.~#?&//=]{2,}\.[a-z]{2,}\b(?:\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?)\)*\|*[A-Z]{0,}.*\|.*\|") + fetchJsonList('libreddit', 'Libreddit', 'https://github.com/libbacon/libreddit-instances/raw/master/instances.json', {'clearnet': 'url', 'tor': 'onion', 'i2p': 'i2p', 'loki': None}, True) def teddit(): @@ -433,6 +433,10 @@ def facil(): fetchFromFile('facil', 'FacilMap') +def libreTranslate(): + fetchRegexList('libreTranslate', 'LibreTranslate', 'https://raw.githubusercontent.com/LibreTranslate/LibreTranslate/main/README.md', r"\[(?:[^\s\/]+\.)+[a-zA-Z0-9]+\]\((https?:\/{2}(?:[^\s\/]+\.)+[a-zA-Z0-9]+)\/?\)\|") + + def peertube(): r = requests.get( 'https://instances.joinpeertube.org/api/v1/instances?start=0&count=1045&sort=-createdAt') @@ -470,6 +474,7 @@ quetre() libremdb() simplytranslate() linvgatranslate() +libreTranslate() searx_searxng() whoogle() librex() diff --git a/src/pages/background/background.js b/src/pages/background/background.js index cad08580..e8d0fd76 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -20,17 +20,6 @@ function initDefaults() { } browser.runtime.onInstalled.addListener(details => { - // if (details.reason == 'install' || (details.reason == "update" && details.previousVersion != browser.runtime.getManifest().version)) { - // if (details.reason == "update") - // browser.storage.local.get(null, r => { - // if (r.theme) { - // const old = encodeURIComponent(JSON.stringify(r)) - // browser.tabs.create({ url: browser.runtime.getURL(`/pages/background/reset_warning.html?data=${old}`) }); - // } - // initDefaults(); - // }) - // else initDefaults(); - // } switch (details.reason) { case "install": initDefaults() diff --git a/src/pages/options/index.html b/src/pages/options/index.html index 53ee562e..323984ed 100644 --- a/src/pages/options/index.html +++ b/src/pages/options/index.html @@ -2863,6 +2863,7 @@ @@ -3058,6 +3059,102 @@
+ +
+
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+
+ + +
+
+
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+
+
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+
+
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+
+
-- cgit 1.4.1