mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
more ban imports steps
This commit is contained in:
parent
d046df22e3
commit
49a9e3e692
1 changed files with 12 additions and 4 deletions
|
@ -466,6 +466,8 @@ def import_bans_task(filename):
|
||||||
else:
|
else:
|
||||||
# allow the instance
|
# allow the instance
|
||||||
db.session.add(AllowedInstances(domain=ia))
|
db.session.add(AllowedInstances(domain=ia))
|
||||||
|
# commit to the db
|
||||||
|
db.session.commit()
|
||||||
|
|
||||||
# import banned_instances
|
# import banned_instances
|
||||||
else:
|
else:
|
||||||
|
@ -487,7 +489,8 @@ def import_bans_task(filename):
|
||||||
else:
|
else:
|
||||||
# ban the domain
|
# ban the domain
|
||||||
db.session.add(BannedInstances(domain=ib))
|
db.session.add(BannedInstances(domain=ib))
|
||||||
|
# commit to the db
|
||||||
|
db.session.commit()
|
||||||
|
|
||||||
# import banned_domains
|
# import banned_domains
|
||||||
# check for banned_domains existing and being more than 0 entries
|
# check for banned_domains existing and being more than 0 entries
|
||||||
|
@ -508,6 +511,8 @@ def import_bans_task(filename):
|
||||||
else:
|
else:
|
||||||
# ban the domain
|
# ban the domain
|
||||||
db.session.add(Domain(name=domb, banned=True))
|
db.session.add(Domain(name=domb, banned=True))
|
||||||
|
# commit to the db
|
||||||
|
db.session.commit()
|
||||||
|
|
||||||
# import banned_tags
|
# import banned_tags
|
||||||
# check for banned_tags existing and being more than 0 entries
|
# check for banned_tags existing and being more than 0 entries
|
||||||
|
@ -528,6 +533,8 @@ def import_bans_task(filename):
|
||||||
else:
|
else:
|
||||||
# ban the domain
|
# ban the domain
|
||||||
db.session.add(Tag(name=tb['name'], display_as=tb['display_as'], banned=True))
|
db.session.add(Tag(name=tb['name'], display_as=tb['display_as'], banned=True))
|
||||||
|
# commit to the db
|
||||||
|
db.session.commit()
|
||||||
|
|
||||||
# import banned_users
|
# import banned_users
|
||||||
# check for banned_users existing and being more than 0 entries
|
# check for banned_users existing and being more than 0 entries
|
||||||
|
@ -543,12 +550,13 @@ def import_bans_task(filename):
|
||||||
# loop through the user_bans
|
# loop through the user_bans
|
||||||
for ub in user_bans:
|
for ub in user_bans:
|
||||||
# check if we have already banned this user
|
# check if we have already banned this user
|
||||||
if ub in already_banned_domains:
|
if ub in already_banned_users:
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
# ban the user
|
# ban the user
|
||||||
# db.session.add(Tag(name=tb['name'], display_as=tb['display_as'], banned=True))
|
db.session.add(User(name=ub.split('@')[0], ap_id=ub, banned=True))
|
||||||
pass
|
# commit to the db
|
||||||
|
db.session.commit()
|
||||||
|
|
||||||
@bp.route('/activities', methods=['GET'])
|
@bp.route('/activities', methods=['GET'])
|
||||||
@login_required
|
@login_required
|
||||||
|
|
Loading…
Add table
Reference in a new issue