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. """ 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 """ The two types of requests are differentiated by the header """
actor = actor.strip() actor = actor.strip()
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() user = User.query.filter_by(user_name=actor, deleted=False, banned=False, ap_id=None).first()
if user is not None: if user is not None:
if 'application/ld+json' in request.headers.get('Accept', ''): if 'application/ld+json' in request.headers.get('Accept', ''):
server = current_app.config['SERVER_NAME'] server = current_app.config['SERVER_NAME']

View file

@ -2,7 +2,7 @@
{% if user.deleted %} {% if user.deleted %}
[deleted] [deleted]
{% else %} {% 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 %} {% endif %}
{% endmacro %} {% endmacro %}
<!doctype html> <!doctype html>

View file

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