Spaces:
Sleeping
Sleeping
Download backend/app/branding_api.py from dauphinking/pump: direct link, hf CLI and curl.
- Browser
- Download file 858 Bytes
-
https://huggingface.co/spaces/dauphinking/pump/resolve/main/backend/app/branding_api.py
- Command line
-
hf download hf://spaces/dauphinking/pump/backend/app/branding_api.py
-
curl -L -o branding_api.py https://huggingface.co/spaces/dauphinking/pump/resolve/main/backend/app/branding_api.py
858 Bytes
| """品牌/首页 API:公开读(首页用) + 管理写 + 简易登录校验。""" | |
| from __future__ import annotations | |
| from fastapi import APIRouter | |
| from pydantic import BaseModel | |
| from .branding import BrandingStore, BrandingUpdate | |
| router = APIRouter(prefix="/api/branding", tags=["品牌/首页"]) | |
| store = BrandingStore() | |
| class LoginRequest(BaseModel): | |
| password: str = "" | |
| def get_branding(): | |
| """公开只读:首页/大屏读取水厂名、公司、联系方式等(不含登录口令)。""" | |
| return store.public() | |
| def put_branding(update: BrandingUpdate): | |
| return store.save(update).model_dump() | |
| def login(req: LoginRequest): | |
| """简易登录校验(可选):未设口令则始终放行;设了则比对。""" | |
| ok = store.verify(req.password) | |
| return {"success": ok} | |