feat: api-tokens pro gerät (backend)

Tokens werden einmal angezeigt und nur gehasht gespeichert. Anmeldung
per Authorization: Bearer für Clips, Dateien, Projektliste/-anlage und
den Live-Sync (WebSocket ohne Origin). Konto, Admin, Sessions, Tokens
und Projektverwaltung bleiben der Browser-Session vorbehalten. Widerruf
schließt die Verbindungen des Tokens sofort.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dbildhauerandClaude Opus 5.5 committed 2026-10-25 14:52:04 +01:00
1 parent 4ae459cf53
commit d8377c8a04
14 files changed
+520 -32

No files matched your search

+6 -1
View File
@@ -23,7 +23,9 @@ CLOSE_UNAUTHORIZED = 4401
class Connection:
websocket: WebSocket
user_id: int
session_id: int
# Exactly one of these: browser session or device token
session_id: int | None = None
token_id: int | None = None
class Hub:
@@ -57,6 +59,9 @@ class Hub:
async def close_session(self, session_id: int) -> None:
await self._close_where(lambda c: c.session_id == session_id)
async def close_token(self, token_id: int) -> None:
await self._close_where(lambda c: c.token_id == token_id)
async def close_user(self, user_id: int, except_session_id: int | None = None) -> None:
await self._close_where(
lambda c: c.user_id == user_id and c.session_id != except_session_id