remote profiles

This commit is contained in:
rimu 2023-11-24 20:22:58 +13:00
parent 021c527147
commit d73eb55d72
3 changed files with 9 additions and 5 deletions

View file

@ -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']

View file

@ -2,7 +2,7 @@
{% if user.deleted %}
[deleted]
{% else %}
<a href="{{ url_for('activitypub.user_profile', actor=user.user_name) }}">{{ user.user_name }}</a>
<a href="/u/{{ user.link() }}">{{ user.user_name if user.ap_id == none else user.ap_id }}</a>
{% endif %}
{% endmacro %}
<!doctype html>

View file

@ -15,14 +15,14 @@
</nav>
</div>
<img class="community_icon_big bump_up rounded-circle" src="{{ user.avatar_image() }}" />
<h1 class="mt-2">{{ user.user_name }}</h1>
<h1 class="mt-2">{{ user.user_name if user.ap_id == none else user.ap_id }}</h1>
{% elif user.avatar_image() != '' %}
<div class="row">
<div class="col-2">
<img class="community_icon_big rounded-circle" src="{{ user.avatar_image() }}" />
</div>
<div class="col-10">
<h1 class="mt-3">{{ user.user_name }}</h1>
<h1 class="mt-3">{{ user.user_name if user.ap_id == none else user.ap_id }}</h1>
</div>
</div>
{% else %}
@ -33,7 +33,7 @@
<li class="breadcrumb-item active">{{ user.user_name|shorten }}</li>
</ol>
</nav>
<h1 class="mt-2">{{ user.user_name }}</h1>
<h1 class="mt-2">{{ user.user_name if user.ap_id == none else user.ap_id }}</h1>
{{ user.about_html|safe }}
{% endif %}