1
0
Fork 0
mirror of https://github.com/Lynnesbian/FediBooks/ synced 2024-12-27 23:08:58 +00:00

nope, you are nitpicking and biased, i win, bye bye

This commit is contained in:
Lynne Megido 2019-09-24 12:05:14 +10:00
parent b1aec4c8d5
commit 49d2d15493
3 changed files with 28 additions and 3 deletions

17
app/blacklist.json Normal file
View file

@ -0,0 +1,17 @@
[
"freespeechextremist.com",
"kiwifarms.cc",
"neckbeard.xyz",
"gameliberty.club",
"freespeech.firedragonstudios.com",
"shitposter.club",
"pawoo.net",
"the.hedgehoghunter.club",
"honey.church",
"anime.website",
"aria.company",
"pl.765racing.com",
"yorishiro.space",
"pl.smuglo.li",
"albin.social"
]

View file

@ -1,7 +1,7 @@
from flask import session, render_template, request, redirect
from flask import session, render_template, request, redirect, url_for
import requests
from mastodon import Mastodon
import re
import re, json
def bot_accounts_add(mysql, cfg):
if request.method == 'POST':
@ -21,6 +21,10 @@ def bot_accounts_add(mysql, cfg):
session['instance'] = handle_list[2]
session['handle'] = request.form['account']
if session['instance'] in json.load(open("blacklist.json")):
session['error'] = "Learning from accounts on this instance is not allowed."
return redirect(url_for("render_bot_accounts_add"))
try:
r = requests.get("https://{}/api/v1/instance".format(session['instance']), timeout=10)
except requests.exceptions.ConnectionError:

View file

@ -1,13 +1,17 @@
from flask import request, session, render_template, redirect, url_for
import requests
from mastodon import Mastodon
import re
import re, json
def bot_create(mysql, cfg, scopes, scopes_pleroma):
if request.method == 'POST':
if session['step'] == 1:
# strip leading https://, if provided
session['instance'] = re.match(r"^(?:https?:\/\/)?(.*)", request.form['instance']).group(1)
if session['instance'] in json.load(open("blacklist.json")):
session['error'] = "Creating a bot on this instance is not allowed."
return redirect(url_for("render_bot_create"))
# check for mastodon/pleroma
try: