mirror of
https://github.com/Lynnesbian/FediBooks/
synced 2024-11-25 08:38:59 +00:00
nope, you are nitpicking and biased, i win, bye bye
This commit is contained in:
parent
b1aec4c8d5
commit
49d2d15493
3 changed files with 28 additions and 3 deletions
17
app/blacklist.json
Normal file
17
app/blacklist.json
Normal 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"
|
||||||
|
]
|
|
@ -1,7 +1,7 @@
|
||||||
from flask import session, render_template, request, redirect
|
from flask import session, render_template, request, redirect, url_for
|
||||||
import requests
|
import requests
|
||||||
from mastodon import Mastodon
|
from mastodon import Mastodon
|
||||||
import re
|
import re, json
|
||||||
|
|
||||||
def bot_accounts_add(mysql, cfg):
|
def bot_accounts_add(mysql, cfg):
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
|
@ -21,6 +21,10 @@ def bot_accounts_add(mysql, cfg):
|
||||||
session['instance'] = handle_list[2]
|
session['instance'] = handle_list[2]
|
||||||
session['handle'] = request.form['account']
|
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:
|
try:
|
||||||
r = requests.get("https://{}/api/v1/instance".format(session['instance']), timeout=10)
|
r = requests.get("https://{}/api/v1/instance".format(session['instance']), timeout=10)
|
||||||
except requests.exceptions.ConnectionError:
|
except requests.exceptions.ConnectionError:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from flask import request, session, render_template, redirect, url_for
|
from flask import request, session, render_template, redirect, url_for
|
||||||
import requests
|
import requests
|
||||||
from mastodon import Mastodon
|
from mastodon import Mastodon
|
||||||
import re
|
import re, json
|
||||||
|
|
||||||
def bot_create(mysql, cfg, scopes, scopes_pleroma):
|
def bot_create(mysql, cfg, scopes, scopes_pleroma):
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
|
@ -9,6 +9,10 @@ def bot_create(mysql, cfg, scopes, scopes_pleroma):
|
||||||
# strip leading https://, if provided
|
# strip leading https://, if provided
|
||||||
session['instance'] = re.match(r"^(?:https?:\/\/)?(.*)", request.form['instance']).group(1)
|
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
|
# check for mastodon/pleroma
|
||||||
try:
|
try:
|
||||||
r = requests.get("https://{}/api/v1/instance".format(session['instance']), timeout=10)
|
r = requests.get("https://{}/api/v1/instance".format(session['instance']), timeout=10)
|
||||||
|
|
Loading…
Reference in a new issue