mirror of
https://github.com/xpltdco/media-rip.git
synced 2026-04-03 02:53:58 -06:00
Settings are now persisted to SQLite (config table) and survive restarts. New admin-configurable settings (migrated from env-var-only): - Max concurrent downloads (1-10, default 3) - Session mode (isolated/shared/open) - Session timeout hours (1-8760, default 72) - Admin username - Auto-purge enabled (bool) - Purge max age hours (1-87600, default 168) Existing admin settings now also persist: - Welcome message - Default video/audio formats - Privacy mode + retention hours Architecture: - New settings service (services/settings.py) handles DB read/write - Startup loads persisted settings and applies to AppConfig - Admin PUT /settings validates, updates live config, and persists - GET /admin/settings returns all configurable fields - DownloadService.update_max_concurrent() hot-swaps the thread pool Also: - Fix footer GitHub URL (jlightner → xpltdco) - Add DEPLOY-TEST-PROMPT.md for deployment testing
32 lines
1.1 KiB
Python
32 lines
1.1 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.
|
|
|
|
Reads from the live AppConfig which includes persisted admin settings.
|
|
"""
|
|
config = request.app.state.config
|
|
|
|
return {
|
|
"session_mode": config.session.mode,
|
|
"default_theme": config.ui.default_theme,
|
|
"welcome_message": config.ui.welcome_message,
|
|
"purge_enabled": config.purge.enabled,
|
|
"max_concurrent_downloads": config.downloads.max_concurrent,
|
|
"default_video_format": getattr(request.app.state, "_default_video_format", "auto"),
|
|
"default_audio_format": getattr(request.app.state, "_default_audio_format", "auto"),
|
|
"privacy_mode": config.purge.privacy_mode,
|
|
"privacy_retention_hours": config.purge.privacy_retention_hours,
|
|
}
|