UI REST API: accounts, bearer auth, API apps, sessions, OpenAPI docs
CI / lint (push) Successful in 14s
CI / test (push) Successful in 28s
CI / notify (push) Successful in 5s

- flask-smorest API under /api/v1 with a uniform JSON error shape;
  spec at /api/openapi.json, Swagger UI at /api/docs, ReDoc at /api/redoc
- Register/login/logout/me with hashed, expiring bearer tokens,
  documented as an OpenAPI bearer security scheme
- API application and client-session management endpoints
- CORS restricted to the configured UI origin(s)
- Flask no longer serves static files: it is API-only
- Login and registration metrics

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mattandClaude Opus 5.5 committed 2026-09-25 13:59:59 +01:00
1 parent 9af8a4be8b
commit e026e56ee3
13 files changed
+626 -1

No files matched your search

+14
View File
@@ -26,6 +26,7 @@ def _clean_tables(app):
tables = ", ".join(t.name for t in db.metadata.sorted_tables)
db.session.execute(text(f"TRUNCATE {tables} RESTART IDENTITY CASCADE"))
db.session.commit()
db.session.remove() # drop identities that pointed at truncated rows
@pytest.fixture
@@ -128,3 +129,16 @@ def signed(params: dict, secret: str) -> dict:
def days_ago(days: float) -> int:
return int((datetime.now(UTC) - timedelta(days=days)).timestamp())
@pytest.fixture
def ui_token(user):
from scrobbler.services.accounts import issue_ui_token
return issue_ui_token(user)
@pytest.fixture
def auth(ui_token):
"""Authorization headers for the default user."""
return {"Authorization": f"Bearer {ui_token}"}