media-rip/backend/app/routers/system.py
xpltd 44eb8c758a Clear button, toolbar row, admin format defaults, cyberpunk background
Queue toolbar:
- Filter tabs (All/Active/Completed/Failed) and action buttons (Download
  All/Clear) share one row — filters left, actions right
- Download All moved from DownloadTable to DownloadQueue toolbar
- Clear button: muted style → red border on hover → 'Sure?' red confirm
  state → executes on second click, auto-resets after 3s
- Clear removes all completed and failed jobs (leaves active untouched)

Admin format defaults:
- Settings tab has Video/Audio default format dropdowns
- Stored in settings_overrides (same as welcome_message)
- Public config returns default_video_format and default_audio_format
- UrlInput resolves Auto format against admin defaults — if admin sets
  audio default to MP3, 'Auto' chip shows 'Auto (.mp3)' and downloads
  convert accordingly

Cyberpunk animated background:
- Diagonal crossing lines (blue 45° + orange -45°) drift slowly (60s cycle)
- Subtle radial gradient pulse (8s breathing effect)
- Layered on top of the existing grid pattern
- All CSS-only, no JS — zero performance cost
- Only active on cyberpunk theme (scoped to [data-theme=cyberpunk])
2026-03-19 04:13:17 -05:00

37 lines
1.3 KiB
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
# Runtime overrides (set via admin settings endpoint) take precedence
overrides = getattr(request.app.state, "settings_overrides", {})
return {
"session_mode": config.session.mode,
"default_theme": config.ui.default_theme,
"welcome_message": overrides.get(
"welcome_message", config.ui.welcome_message
),
"purge_enabled": config.purge.enabled,
"max_concurrent_downloads": config.downloads.max_concurrent,
"default_video_format": overrides.get("default_video_format", "auto"),
"default_audio_format": overrides.get("default_audio_format", "auto"),
}