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
+10 -1
View File
@@ -10,7 +10,7 @@ from app.config import settings
from app.database import async_session, engine
from app.models import Base, Show, StationConfig, HistoryEntry, TeamMember, CommunityHighlight, Underwriter
from app.user_models import User
from app.api import events, auth, station_config, history, team, community, shows, storage, underwriters, stats, mobile_builds
from app.api import events, auth, station_config, history, team, community, shows, storage, underwriters, stats, mobile_builds, theme
def _cleanup_orphaned_sequences(sync_conn):
@@ -153,6 +153,14 @@ async def lifespan(app: FastAPI):
async with async_session() as session:
await _ensure_station_config(session)
# Write theme.json on startup
try:
from app.theme_export import write_theme_json
await write_theme_json()
print(f" ✓ Theme JSON written to {settings.THEME_JSON_PATH}")
except Exception as e:
print(f" WARNING: Failed to write theme.json on startup: {e}")
# Bootstrap admin user if configured
if settings.ADMIN_USERNAME and settings.ADMIN_PASSWORD:
async with async_session() as session:
@@ -224,6 +232,7 @@ app.include_router(storage.router, prefix="/api/storage", tags=["storage"])
app.include_router(underwriters.router, prefix="/api/underwriters", tags=["underwriters"])
app.include_router(stats.router, prefix="/api/stats", tags=["stats"])
app.include_router(mobile_builds.router, prefix="/api/mobile-builds", tags=["mobile-builds"])
app.include_router(theme.router, prefix="/api/theme", tags=["theme"])
# Dev-only admin router (disabled in production)
if settings.ENV != "production":