项目改造

This commit is contained in:
2026-09-03 15:44:57 +08:00
parent 24d7c64e17
commit 2849a6250c
60 changed files with 166 additions and 13754 deletions
@@ -2,7 +2,7 @@
"""群聊人设卡 Web API 子应用(挂载到 /api/galgame_card)。
统一鉴权走 hexi.web_auth(OAuth2 + SQLite),与统一管理台 /hub 共用登录态。
旧版独立后台 /galgame_card(JWT 自鉴权)仍保留可用,前端由 hub 渲染。
前端由统一管理台 hexi/web 渲染。
"""
from __future__ import annotations
@@ -15,7 +15,6 @@ from fastapi.responses import JSONResponse
from hexi.web_auth import require_admin
from . import repository
from .config import config
API = require_admin
@@ -42,11 +41,8 @@ async def _first_bot():
def build_admin_app() -> FastAPI | None:
"""构建群聊人设卡管理 API 子应用(挂载到 /api/galgame_card)。
在 hub 统一登录态下可用;未启用 Web 时返回 None。
鉴权由 hub 统一登录态提供(hexi.web_auth)。
"""
if not config.web_enable:
return None
app = FastAPI(title="Galgame Card API")
@app.get("/groups", dependencies=[API])
@@ -213,8 +209,6 @@ def build_admin_app() -> FastAPI | None:
return _ok(
{
"web_username": config.web_username,
"web_enable": config.web_enable,
"thresholds": {
"max_content_len": processor.MAX_CONTENT_LEN,
"repeat_window": processor.REPEAT_WINDOW,