Adds website theme serialization system

This commit is contained in:
Your Name
2026-07-06 06:52:18 +00:00
parent b932d65658
commit 8cd54459ec
29 changed files with 418 additions and 4 deletions
+12
View File
@@ -1,15 +1,20 @@
"""Station config router: read/update the singleton station branding config."""
import logging
from fastapi import APIRouter, Depends, HTTPException, status
from app.auth import get_current_admin_user
from app.database import get_session
from app.models import StationConfig
from app.schemas import StationConfigResponse, StationConfigUpdate
from app.theme_export import write_theme_json
from app.user_models import User
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession
logger = logging.getLogger(__name__)
router = APIRouter()
@@ -47,4 +52,11 @@ async def update_station_config(
await session.commit()
await session.refresh(config)
# Regenerate theme.json on disk (best-effort)
try:
await write_theme_json()
except Exception:
logger.warning("Failed to regenerate theme.json after config update", exc_info=True)
return config