You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: backend/lobby/lobby-architecture.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ Portal service for room management, authentication, and game client serving.
18
18
19
19
### Public (replay access)
20
20
-`GET /play/history/{game_id}` - Game client HTML page for replay viewing (serves same play.html template, no auth required)
21
-
-`GET /api/replays/{game_id}` - Replay API endpoint returning gzip-compressed NDJSON replay content (`Content-Encoding: gzip`, `Cache-Control: immutable`). Returns 404 for invalid/nonexistent game IDs. Rate-limited via Traefik in production
21
+
-`GET /api/replays/{game_id}` - Replay API endpoint returning gzip-compressed NDJSON replay content (`Content-Encoding: gzip`, `Cache-Control: immutable`). Requires game_id to be at least 4 characters; returns 404 for invalid/nonexistent game IDs. Rate-limited via Traefik in production
22
22
23
23
### Protected (session cookie or API key required)
24
24
-`GET /` - Lobby HTML page (server-rendered, lists rooms from local room manager)
@@ -174,7 +174,7 @@ These practices are mandatory for all lobby code. Violations must be caught in c
174
174
- **Views** (`views/`) - Jinja2 templates and view handlers split by domain:
- `history_handlers.py`— History page handler and game data transformation (`history_page`, `_format_duration`, `_prepare_history_for_display`)
177
-
- `replay_handlers.py`— Replay API handler (`replay_content`); reads gzip-compressed replay files with path traversal protection and file size limits
177
+
- `replay_handlers.py`— Replay API handler (`replay_content`); resolves sharded replay file paths via `shared.storage.replay_file_path`, enforces minimum game ID length, path traversal protection, and file size limits
178
178
- `game_handlers.py`— Game client and dev page handlers (`play_page`, `styleguide_page`)
179
179
- `assets.py`— Vite manifest utilities and Jinja2 template factory (`create_templates`, `load_vite_manifest`, `resolve_vite_asset_urls`)
- `shared.validators`- String list parsing (CORS origins, allowed hosts) and custom env settings source
191
191
- `shared.auth`- `AuthService`, `AuthSessionStore`, `PlayerRepository` for player management; `create_signed_ticket` and `sign_game_ticket` for HMAC-signed game tickets
192
192
- `shared.db`- `Database`, `SqlitePlayerRepository` for SQLite-backed player storage, `SqliteGameRepository` for played game queries
193
+
- `shared.storage`- `replay_file_path` for resolving sharded replay file paths, `_MIN_GAME_ID_LEN` for game ID validation
193
194
194
195
## Project Structure
195
196
@@ -306,7 +307,7 @@ Lobby settings (prefixed with `LOBBY_`):
306
307
- `LOBBY_GAME_CLIENT_URL` - Game client URL for room creation redirects and join links (default: `/play`)
307
308
- `LOBBY_WS_ALLOWED_ORIGIN` - Allowed origin for WebSocket connections (CSRF protection). Default: `http://localhost:8710`. Set to `None` to allow all origins
308
309
- `LOBBY_GAME_ASSETS_DIR` - Directory containing built game client assets and `.vite/manifest.json` (default: `frontend/dist`)
0 commit comments