mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
Avoid error caused by fstab.sh admin with a http:// URL
This commit is contained in:
parent
64c40b11db
commit
dfce93202e
1 changed files with 8 additions and 6 deletions
14
app/cli.py
14
app/cli.py
|
@ -283,12 +283,14 @@ def register(app):
|
|||
instance_data = response.json()
|
||||
admin_profile_ids = []
|
||||
for admin in instance_data['admins']:
|
||||
admin_profile_ids.append(admin['person']['actor_id'].lower())
|
||||
user = find_actor_or_create(admin['person']['actor_id'])
|
||||
if user and not instance.user_is_admin(user.id):
|
||||
new_instance_role = InstanceRole(instance_id=instance.id, user_id=user.id,
|
||||
role='admin')
|
||||
db.session.add(new_instance_role)
|
||||
profile_id = admin['person']['actor_id']
|
||||
if profile_id.startswith('https://'):
|
||||
admin_profile_ids.append(profile_id.lower())
|
||||
user = find_actor_or_create(profile_id)
|
||||
if user and not instance.user_is_admin(user.id):
|
||||
new_instance_role = InstanceRole(instance_id=instance.id, user_id=user.id,
|
||||
role='admin')
|
||||
db.session.add(new_instance_role)
|
||||
# remove any InstanceRoles that are no longer part of instance-data['admins']
|
||||
for instance_admin in InstanceRole.query.filter_by(instance_id=instance.id):
|
||||
if instance_admin.user.profile_id() not in admin_profile_ids:
|
||||
|
|
Loading…
Add table
Reference in a new issue