项目改造
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user