Sharing settings API, public profiles and ActivityPub docs (phase 1, step 4)
CI / validate-monitoring (push) Successful in 7s
CI / lint (push) Successful in 12s
CI / test (push) Successful in 1m5s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 5s

- /api/v1/federation/settings (GET, PATCH): sharing on/off, visibility
  (followers-only default), follow approval, discoverable/indexable,
  display name and bio, plus the read-only handle and URLs
- /api/v1/federation/profiles/<name>: public profile for the UI page,
  only for users sharing
- ActivityPub endpoints documented under an ActivityPub tag
- docs/openapi.json is now exported with every optional module on
  (python -m scrobbler.openapi.export); the drift test and route checks
  cover both a federation-off and a federation-on app
- Boundary: federation may use scrobbler.api.get_api to register its
  blueprint; the checker proves other scrobbler.api modules stay off
  limits

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
This commit is contained in:
mattandClaude Opus 5.5 committed 2026-09-25 20:26:33 +01:00
1 parent ce39e8f865
commit 0b10469514
11 files changed
+1175 -11

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
from marshmallow import Schema, fields, validate
from scrobbler.federation.models import VISIBILITIES
class SharingSettingsSchema(Schema):
enabled = fields.Boolean(metadata={"description": "Share listening on the fediverse"})
visibility = fields.String(
validate=validate.OneOf(VISIBILITIES),
metadata={
"description": (
"Who sees posts: `followers` (default), `unlisted` (anyone visiting the "
"profile, not public timelines) or `public`. Followers-only is only as private "
"as who may follow: see `manually_approves_followers`."
)
},
)
manually_approves_followers = fields.Boolean()
discoverable = fields.Boolean(metadata={"description": "May appear in profile directories"})
indexable = fields.Boolean(metadata={"description": "Posts may be indexed for search"})
display_name = fields.String(allow_none=True, validate=validate.Length(max=100))
bio = fields.String(allow_none=True, validate=validate.Length(max=500))
handle = fields.String(dump_only=True, metadata={"example": "@alice@scrobble.example"})
actor_url = fields.String(dump_only=True)
profile_url = fields.String(dump_only=True)
followers = fields.Integer(
dump_only=True, metadata={"description": "0 until following arrives"}
)
class PublicProfileSchema(Schema):
username = fields.String()
display_name = fields.String()
bio = fields.String(allow_none=True)
handle = fields.String(metadata={"example": "@alice@scrobble.example"})
actor_url = fields.String()
class SharingSettingsUpdateSchema(SharingSettingsSchema):
"""Any subset of the editable settings (read-only fields are rejected)."""