Let users pick their Gravatar as their profile image (SCR-1)
CI / validate-monitoring (push) Successful in 8s
CI / lint (push) Successful in 13s
CI / federation-interop (push) Successful in 1m42s
CI / test (push) Successful in 5m46s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / trigger-deploy (push) Skipped
CI / notify (push) Successful in 7s

Opt-in per user and gated by AVATAR_GRAVATAR_ENABLED. The server fetches the image by
the SHA-256 of the account email and caches it with the uploads, so browsers never
contact Gravatar.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
mattandClaude Sonnet 5.5 committed 2026-10-13 11:41:32 +01:00
1 parent c55a6596d0
commit 9243fe4d3f
8 files changed
+328 -4

No files matched your search

+8
View File
@@ -1,6 +1,7 @@
"""Marshmallow schemas for the /api/v1 JSON API. They drive both request
validation and the generated OpenAPI document."""
from flask import current_app
from flask_smorest.fields import Upload
from marshmallow import Schema, ValidationError, fields, validate, validates_schema
@@ -31,6 +32,13 @@ class UserSchema(Schema):
avatar_updated_at = fields.DateTime(
dump_only=True, allow_none=True, metadata={"description": "When it last changed"}
)
gravatar_enabled = fields.Method(
"_gravatar_enabled",
metadata={"type": "boolean", "description": "Whether this server offers Gravatar"},
)
def _gravatar_enabled(self, _user) -> bool:
return bool(current_app.config["AVATAR_GRAVATAR_ENABLED"])
class RegisterSchema(Schema):