From c5055cd09f99296af35391cfca5b1c93741d65a0 Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Sun, 24 Mar 2024 15:35:45 +1300 Subject: [PATCH] detect friendica --- app/activitypub/util.py | 3 +++ app/main/routes.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/activitypub/util.py b/app/activitypub/util.py index 239dedcf..3ea9040c 100644 --- a/app/activitypub/util.py +++ b/app/activitypub/util.py @@ -892,12 +892,15 @@ def refresh_instance_profile_task(instance_id: int): except requests.exceptions.JSONDecodeError as ex: instance_json = {} 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': software = 'Kbin' elif instance_json['name'].lower() == 'mbin': software = 'Mbin' elif instance_json['name'].lower() == 'piefed': software = 'PieFed' + elif instance_json['name'].lower() == 'system account': + software = 'Friendica' else: software = 'Lemmy' instance.inbox = instance_json['inbox'] diff --git a/app/main/routes.py b/app/main/routes.py index 68eca138..cc2a69aa 100644 --- a/app/main/routes.py +++ b/app/main/routes.py @@ -343,8 +343,8 @@ def activitypub_application(): '@context': default_context(), 'type': 'Application', 'id': f"https://{current_app.config['SERVER_NAME']}/", - 'name': g.site.name, - 'summary': g.site.description, + 'name': 'PieFed', + 'summary': g.site.name + ' - ' + g.site.description, 'published': ap_datetime(g.site.created_at), 'updated': ap_datetime(g.site.updated), 'inbox': f"https://{current_app.config['SERVER_NAME']}/site_inbox",