media-rip/backend/app/routers/system.py
xpltd efc2ead796 M001: media.rip() v1.0 — complete application
Full-featured self-hosted yt-dlp web frontend:
- Python 3.12+ / FastAPI backend with async SQLite, SSE transport, session isolation
- Vue 3 / TypeScript / Pinia frontend with real-time progress, theme picker
- 3 built-in themes (cyberpunk/dark/light) + drop-in custom theme system
- Admin auth (bcrypt), purge system, cookie upload, file serving
- Docker multi-stage build, GitHub Actions CI/CD
- 179 backend tests, 29 frontend tests (208 total)

Slices: S01 (Foundation), S02 (SSE+Sessions), S03 (Frontend),
        S04 (Admin+Auth), S05 (Themes), S06 (Docker+CI)
2026-03-18 20:00:17 -05:00

28 lines
890 B
Python

"""System endpoints — public (non-sensitive) configuration for the frontend."""
from __future__ import annotations
import logging
from fastapi import APIRouter, Request
logger = logging.getLogger("mediarip.system")
router = APIRouter(tags=["system"])
@router.get("/config/public")
async def public_config(request: Request) -> dict:
"""Return the safe subset of application config for the frontend.
Explicitly constructs the response dict from known-safe fields.
Does NOT serialize the full AppConfig and strip fields — that pattern
is fragile when new sensitive fields are added later.
"""
config = request.app.state.config
return {
"session_mode": config.session.mode,
"default_theme": config.ui.default_theme,
"purge_enabled": config.purge.enabled,
"max_concurrent_downloads": config.downloads.max_concurrent,
}