Files
live/backend/routes/settings_route.py
T
admin efde5597bd 品牌化设置 + Claude米色衬线体主题 + 全站中文
- 品牌设置API: GET/PUT /api/settings/brand (名称/标语/Logo)
- 管理页系统设置: 品牌编辑器表单(名称/标语/Logo URL)
- 恢复Anthropic风格: 米色(#FBF9F6) 底色, Source Serif 4 + Noto Serif SC 衬线体
- 暖棕(#C2693A) 主色调, 更充裕的间距与留白, 庄重大气
- 全站中文: antd zhCN locale, 所有页面文本汉化
- 数据存储在 Config singleton, 运行时更新
2026-08-10 16:24:45 +08:00

34 lines
976 B
Python

from fastapi import APIRouter, Depends
from pydantic import BaseModel
from typing import Optional
from config import settings
from routes.auth import require_auth
router = APIRouter(prefix="/api/settings", tags=["settings"])
class BrandUpdate(BaseModel):
brand_name: Optional[str] = None
brand_tagline: Optional[str] = None
brand_logo_url: Optional[str] = None
@router.get("/brand")
async def get_brand():
return {
"brand_name": settings.brand_name,
"brand_tagline": settings.brand_tagline,
"brand_logo_url": settings.brand_logo_url,
}
@router.put("/brand")
async def update_brand(body: BrandUpdate, _: bool = Depends(require_auth)):
if body.brand_name is not None:
settings.brand_name = body.brand_name
if body.brand_tagline is not None:
settings.brand_tagline = body.brand_tagline
if body.brand_logo_url is not None:
settings.brand_logo_url = body.brand_logo_url
return {"ok": True}