1
0
Fork 0
mirror of https://github.com/Lynnesbian/FediBooks/ synced 2024-11-25 08:38:59 +00:00

block certain instance types in accounts_add

This commit is contained in:
Lynne Megido 2019-09-10 13:03:28 +10:00
parent d6b43fa6d4
commit c9da5d9f40

View file

@ -212,6 +212,15 @@ def bot_accounts_add():
username = handle_list[1] username = handle_list[1]
instance = handle_list[2] instance = handle_list[2]
# gab check
r = requests.get("https://{}/api/v1/instance".format(instance), timeout=10)
if r.status_code == 200:
j = r.json()
if 'is_pro' in j['contact_account']:
# gab instance
error = "Gab instances are not supported."
return render_template("bot_accounts_add.html", error = error)
# 1. download host-meta to find webfinger URL # 1. download host-meta to find webfinger URL
r = requests.get("https://{}/.well-known/host-meta".format(instance), timeout=10) r = requests.get("https://{}/.well-known/host-meta".format(instance), timeout=10)
# 2. use webfinger to find user's info page # 2. use webfinger to find user's info page