detect friendica

This commit is contained in:
rimu 2024-03-24 15:35:45 +13:00
parent bb3798428e
commit c5055cd09f
2 changed files with 5 additions and 2 deletions

View file

@ -892,12 +892,15 @@ def refresh_instance_profile_task(instance_id: int):
except requests.exceptions.JSONDecodeError as ex: except requests.exceptions.JSONDecodeError as ex:
instance_json = {} instance_json = {}
if 'type' in instance_json and instance_json['type'] == 'Application': if 'type' in instance_json and instance_json['type'] == 'Application':
# 'name' is unreliable as the admin can change it to anything. todo: find better way
if instance_json['name'].lower() == 'kbin': if instance_json['name'].lower() == 'kbin':
software = 'Kbin' software = 'Kbin'
elif instance_json['name'].lower() == 'mbin': elif instance_json['name'].lower() == 'mbin':
software = 'Mbin' software = 'Mbin'
elif instance_json['name'].lower() == 'piefed': elif instance_json['name'].lower() == 'piefed':
software = 'PieFed' software = 'PieFed'
elif instance_json['name'].lower() == 'system account':
software = 'Friendica'
else: else:
software = 'Lemmy' software = 'Lemmy'
instance.inbox = instance_json['inbox'] instance.inbox = instance_json['inbox']

View file

@ -343,8 +343,8 @@ def activitypub_application():
'@context': default_context(), '@context': default_context(),
'type': 'Application', 'type': 'Application',
'id': f"https://{current_app.config['SERVER_NAME']}/", 'id': f"https://{current_app.config['SERVER_NAME']}/",
'name': g.site.name, 'name': 'PieFed',
'summary': g.site.description, 'summary': g.site.name + ' - ' + g.site.description,
'published': ap_datetime(g.site.created_at), 'published': ap_datetime(g.site.created_at),
'updated': ap_datetime(g.site.updated), 'updated': ap_datetime(g.site.updated),
'inbox': f"https://{current_app.config['SERVER_NAME']}/site_inbox", 'inbox': f"https://{current_app.config['SERVER_NAME']}/site_inbox",