From d73eb55d72222739e8a6efca145ae7d9113149a4 Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Fri, 24 Nov 2023 20:22:58 +1300 Subject: [PATCH] remote profiles --- app/activitypub/routes.py | 6 +++++- app/templates/base.html | 2 +- app/templates/user/show_profile.html | 6 +++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/activitypub/routes.py b/app/activitypub/routes.py index fef560a1..287d4e9a 100644 --- a/app/activitypub/routes.py +++ b/app/activitypub/routes.py @@ -137,7 +137,11 @@ def user_profile(actor): """ Requests to this endpoint can be for a JSON representation of the user, or a HTML rendering of their profile. The two types of requests are differentiated by the header """ actor = actor.strip() - user = User.query.filter_by(user_name=actor, deleted=False, banned=False, ap_id=None).first() + if '@' in actor: + user = User.query.filter_by(ap_id=actor, deleted=False, banned=False).first() + else: + user = User.query.filter_by(user_name=actor, deleted=False, banned=False, ap_id=None).first() + if user is not None: if 'application/ld+json' in request.headers.get('Accept', ''): server = current_app.config['SERVER_NAME'] diff --git a/app/templates/base.html b/app/templates/base.html index 246d090a..ae87e0c9 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -2,7 +2,7 @@ {% if user.deleted %} [deleted] {% else %} - {{ user.user_name }} + {{ user.user_name if user.ap_id == none else user.ap_id }} {% endif %} {% endmacro %} diff --git a/app/templates/user/show_profile.html b/app/templates/user/show_profile.html index 636b720b..c0fce66f 100644 --- a/app/templates/user/show_profile.html +++ b/app/templates/user/show_profile.html @@ -15,14 +15,14 @@ -