Adds website theme serialization system
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user