From a72a32612032280fb994c7f4495ca153123ac5c7 Mon Sep 17 00:00:00 2001 From: Hygna Date: Sun, 18 Sep 2022 17:13:07 +0100 Subject: [PATCH] Rollback master to pre-OOP --- .woodpecker/instances.yml | 23 +++++++++++++++++++++++ README.md | 2 +- src/instances/beatbump.json | 7 ++----- src/instances/bibliogram.json | 6 ++++++ src/instances/get_instances.py | 13 +++---------- 5 files changed, 35 insertions(+), 16 deletions(-) create mode 100644 .woodpecker/instances.yml create mode 100644 src/instances/bibliogram.json diff --git a/.woodpecker/instances.yml b/.woodpecker/instances.yml new file mode 100644 index 00000000..96fe59f6 --- /dev/null +++ b/.woodpecker/instances.yml @@ -0,0 +1,23 @@ +pipeline: + instancefetch: + image: python:3.8 + secrets: [token, mail] + when: + event: cron + commands: + - python -m pip install --upgrade pip + - pip install requests bs4 colorama + - python src/instances/get_instances.py + # Git configuration + - git config --global user.email $MAIL + - git config --global user.name "Woodpecker CI" + - git commit -am "updated instances" + - mkdir ~/.ssh + - ssh-keyscan -t ed25519 codeberg.org >> ~/.ssh/known_hosts + - git remote set-url origin git@codeberg.org:libredirect/libredirect.git + #- echo $TOKEN > key + #- chmod 0600 key + - eval `ssh-agent` + - echo "$TOKEN" | tr -d '\r' | ssh-add - + #- ssh-add key + - git push --set-upstream origin master diff --git a/README.md b/README.md index db740eb0..c97a20ff 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Send Files => [Send](https://gitlab.com/timvisee/send) **Note**: The Extension will be using random instances by default. You can modify this and add custom instances too. -[FAQ](https://libredirect.github.io/faq.html) +# Please read the [FAQ](https://libredirect.github.io/faq.html) if you have any questions! ## Donate diff --git a/src/instances/beatbump.json b/src/instances/beatbump.json index df5a20f7..e09273dd 100644 --- a/src/instances/beatbump.json +++ b/src/instances/beatbump.json @@ -1,9 +1,6 @@ { - "normal": [ - "https://beatbump.ml", - "https://beatbump.esmailelbob.xyz" - ], - "tor": [], + "normal": ["https://beatbump.ml", "https://beatbump.esmailelbob.xyz"], + "tor": ["http://beatbump.esmail5pdn24shtvieloeedh7ehz3nrwcdivnfhfcedl7gf4kwddhkqd.onion"], "i2p": [], "loki": [] } diff --git a/src/instances/bibliogram.json b/src/instances/bibliogram.json new file mode 100644 index 00000000..d72f2129 --- /dev/null +++ b/src/instances/bibliogram.json @@ -0,0 +1,6 @@ +{ + "normal": ["https://bibliogram.1d4.us", "https://bibliogram.froth.zone", "https://ig.tokhmi.xyz", "https://ig.beparanoid.de", "https://bibliogram.priv.pw"], + "tor": [], + "i2p": [], + "loki": [] +} diff --git a/src/instances/get_instances.py b/src/instances/get_instances.py index 085d7273..250dd258 100644 --- a/src/instances/get_instances.py +++ b/src/instances/get_instances.py @@ -230,16 +230,9 @@ def nitter(): def bibliogram(): - r = requests.get('https://bibliogram.art/api/instances') - rJson = json.loads(r.text) - bibliogramList = {} - bibliogramList['normal'] = [] - bibliogramList['tor'] = [] - bibliogramList['i2p'] = [] - bibliogramList['loki'] = [] - for item in rJson['data']: - bibliogramList['normal'].append(item['address']) - mightyList['bibliogram'] = bibliogramList + json_object = json.dumps(mightyList, ensure_ascii=False, indent=2) + with open('./src/instances/bibliogram.json') as file: + mightyList['bibliogram'] = json.load(file) print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'Bibliogram')