From f56733ca03e46d3bf154b947db53c83f80b8057d Mon Sep 17 00:00:00 2001 From: BobIsMyManager Date: Sat, 9 Apr 2022 09:19:13 +0000 Subject: [PATCH] Automatic send instance fetching (#174) --- src/assets/javascripts/helpers/common.js | 4 +++ src/assets/javascripts/helpers/general.js | 2 +- src/assets/javascripts/helpers/sendTargets.js | 22 +++----------- src/instances/data.json | 29 +++++++++++++++---- src/instances/get_instances.py | 10 +++++++ 5 files changed, 42 insertions(+), 25 deletions(-) diff --git a/src/assets/javascripts/helpers/common.js b/src/assets/javascripts/helpers/common.js index 678b9dd5..50180497 100644 --- a/src/assets/javascripts/helpers/common.js +++ b/src/assets/javascripts/helpers/common.js @@ -8,6 +8,7 @@ import searchHelper from "./search.js"; import translateHelper from "./translate/translate.js"; import wikipediaHelper from "./wikipedia.js"; import localise from '../localise.js' +import sendTargetsHelper from "./sendTargets.js"; function getRandomInstance(instances) { return instances[~~(instances.length * Math.random())]; @@ -22,6 +23,7 @@ async function wholeInit() { await searchHelper.init(); await wikipediaHelper.init(); await mediumHelper.init(); + await sendTargetsHelper.init(); } async function updateInstances() { @@ -55,6 +57,8 @@ async function updateInstances() { mediumHelper.setRedirects(instances.scribe); + sendTargetsHelper.setRedirects(instances.send); + console.info("Successfully updated Instances"); return true; } diff --git a/src/assets/javascripts/helpers/general.js b/src/assets/javascripts/helpers/general.js index 67c8b57b..1ee6bcf5 100644 --- a/src/assets/javascripts/helpers/general.js +++ b/src/assets/javascripts/helpers/general.js @@ -147,4 +147,4 @@ export default { isException, init, -} \ No newline at end of file +} diff --git a/src/assets/javascripts/helpers/sendTargets.js b/src/assets/javascripts/helpers/sendTargets.js index 8cfca7bb..5b6d4201 100644 --- a/src/assets/javascripts/helpers/sendTargets.js +++ b/src/assets/javascripts/helpers/sendTargets.js @@ -10,23 +10,7 @@ const targets = [ let redirects = { "send": { - "normal": [ - "https://send.silkky.cloud", - "https://send.turingpoint.de", - "https://send.ephemeral.land", - "https://send.monks.tools", - "https://send.jeugdhulp.be", - "https://send.aurorabilisim.com", - "https://nhanh.cloud", - "https://send.datahoarder.dev", - "https://send.navennec.net", - "https://fileupload.ggc-project.de", - "https://drop.chapril.org", - "https://files.psu.ru", - "https://send.portailpro.net", - "https://bytefile.de", - "https://transfer.acted.org ", - ], + "normal": [], "tor": [] } } @@ -35,7 +19,8 @@ const getRedirects = () => redirects; const getCustomRedirects = function () { return { "send": { - "normal": [...sendNormalRedirectsChecks, ...sendNormalCustomRedirects] + "normal": [...sendNormalRedirectsChecks, ...sendNormalCustomRedirects], + "tor": [...sendTorRedirectsChecks, ...sendTorCustomRedirects] }, }; }; @@ -173,6 +158,7 @@ async function init() { protocol = r.sendTargetsProtocol ?? "normal"; + //redirects.send = dataJson.send; if (r.sendTargetsRedirects) redirects = r.sendTargetsRedirects; sendNormalRedirectsChecks = r.sendNormalRedirectsChecks ?? [...redirects.send.normal]; diff --git a/src/instances/data.json b/src/instances/data.json index 079bc7a6..7eecdae1 100644 --- a/src/instances/data.json +++ b/src/instances/data.json @@ -16,10 +16,10 @@ "https://inv.bp.mutahar.rocks", "https://invidious.lunar.icu", "https://invidious.mutahar.rocks", - "https://invidious.weblibre.org", - "https://invidious.esmailelbob.xyz", "https://invidious.privacy.gd", + "https://invidious.esmailelbob.xyz", "https://youtube.076.ne.jp", + "https://invidious.weblibre.org", "https://invidious.namazso.eu" ], "tor": [ @@ -33,6 +33,26 @@ "http://2rorw2w54tr7jkasn53l5swbjnbvz3ubebhswscnc54yac6gmkxaeeqd.onion" ] }, + "send": { + "normal": [ + "https://send.vis.ee", + "https://send.silkky.cloud", + "https://send.turingpoint.de", + "https://send.ephemeral.land", + "https://send.monks.tools", + "https://send.jeugdhulp.be", + "https://send.aurorabilisim.com", + "https://nhanh.cloud", + "https://send.datahoarder.dev", + "https://send.navennec.net", + "https://fileupload.ggc-project.de", + "https://drop.chapril.org", + "https://files.psu.ru", + "https://send.portailpro.net", + "https://bytefile.de", + "https://transfer.acted.org" + ] + }, "nitter": { "normal": [ "https://nitter.net", @@ -434,6 +454,7 @@ ] }, "peertube": [ + "https://dalek.zone", "https://video.sadmin.io", "https://stream.jurnalfm.md", "https://video.asgardius.company", @@ -509,7 +530,6 @@ "https://video.barcelo.cf", "https://videotube.duckdns.org", "https://peertube.1001solutions.net", - "https://peertube.razorserver.fr", "https://tv.based.quest", "https://peertube.beardedtek.com", "https://casnocensure.site", @@ -975,7 +995,6 @@ "https://the.jokertv.eu", "https://climatejustice.video", "https://wikileaks.video", - "https://video.cnt.social", "https://fair.tube", "https://tube.lokad.com", "https://videos.benjaminbrady.ie", @@ -1196,13 +1215,11 @@ "https://video.cigliola.com", "https://xxx.noho.st", "https://peertube.stefofficiel.me", - "https://video.eradicatinglove.xyz", "https://canard.tube", "https://videos.jordanwarne.xyz", "https://tube.jeena.net", "https://tube.cloud-libre.eu", "https://videos.coletivos.org", - "https://peertube.nogafa.org", "https://peertube.xwiki.com", "https://tuvideo.encanarias.info", "https://cinema.yunohost.support", diff --git a/src/instances/get_instances.py b/src/instances/get_instances.py index 4fe3bc9c..790cd25b 100644 --- a/src/instances/get_instances.py +++ b/src/instances/get_instances.py @@ -35,6 +35,16 @@ mightyList['invidious'] = invidiousList print(Fore.GREEN + 'fetched ' + Style.RESET_ALL + 'Invidious') +# Send +r = requests.get('https://gitlab.com/timvisee/send-instances/-/raw/master/README.md') +tmp = re.findall(r"- ([-a-zA-Z0-9@:%_\+.~#?&//=]{2,}\.[a-z0-9]{2,}\b(?:\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?)\)*\|*[A-Z]{0,}", r.text) +sendList = {} +sendList['normal'] = [] +for item in tmp: + sendList['normal'].append(item) +mightyList['send'] = sendList +print('fetched Send') + # Nitter r = requests.get('https://github.com/zedeus/nitter/wiki/Instances') soup = BeautifulSoup(r.text, 'html.parser')