Let users share their profile image with the fediverse (SCR-1)
CI / validate-monitoring (push) Successful in 9s
CI / lint (push) Successful in 13s
CI / federation-interop (push) Successful in 1m44s
CI / test (push) Failing after 6m30s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / trigger-deploy (push) Skipped
CI / notify (push) Successful in 6s

A share_avatar switch (off by default) in the sharing settings publishes the image as
the actor's icon and on the public profile page, via a public avatar endpoint.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
mattandClaude Sonnet 5.5 committed 2026-10-13 11:43:55 +01:00
1 parent 9243fe4d3f
commit 016fc707d1
12 files changed
+286 -3

No files matched your search

+18
View File
@@ -178,10 +178,28 @@ def public_profile(username):
"now_playing": actors.now_playing_text(user)
if settings.now_playing_mode != "off"
else None,
"has_avatar": settings.share_avatar and user.has_avatar,
**{k: v for k, v in _identity(user.username).items() if k != "profile_url"},
}
@blp.route("/profiles/<string:username>/avatar", methods=["GET"])
@blp.response(200, content_type="image/jpeg", description="The profile image (JPEG, PNG or WebP)")
@blp.alt_response(404, schema=ErrorSchema, description="No image shared under that name")
def public_avatar(username):
"""A public profile image
For the web UI's profile page. Only served when the user shares and has chosen to
share their image.
"""
found = sharing.shared_avatar(username)
if found is None:
fed_metrics.lookups_total.labels(kind="avatar", result="not_found").inc()
abort(404, code="not_found", message="No shared profile image under that name.")
fed_metrics.lookups_total.labels(kind="avatar", result="found").inc()
return sharing.avatar_response(*found)
@blp.route("/profiles/<string:username>/posts/<string:post_uuid>", methods=["GET"])
@blp.response(200, PublicPostSchema)
@blp.alt_response(404, schema=ErrorSchema, description="Not found, not public, or deleted")