feat: API Key 系统 — CRUD + panel_auth 集成 + 持久化
新增: - services/web_panel/routes/apikeys.py — 创建/列表/删除 API Key - panel_auth() 双重验证: Session Store → API Key fallback - _check_plugin_auth() 支持 API Key - API Key 持久化到 SenSuDB (config_kv 表) - 格式: sk- + 48 hex chars - 脱敏显示 (前8后4) - 删除后立即失效 (401) WebPanelManager 注册 apikeys 路由 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,7 @@ import hashlib
|
||||
import secrets
|
||||
from pathlib import Path
|
||||
from aiohttp import web
|
||||
from .routes import auth, status, plugins, commands, logs, projects, proxy, plugin_web, files
|
||||
from .routes import auth, status, plugins, commands, logs, projects, proxy, plugin_web, files, apikeys
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -78,6 +78,7 @@ class WebPanelManager:
|
||||
|
||||
# 注册 API 路由
|
||||
auth.setup_routes(app, self.base_path)
|
||||
apikeys.setup_routes(app, self.base_path)
|
||||
status.setup_routes(app, self.base_path)
|
||||
plugins.setup_routes(app, self.base_path)
|
||||
commands.setup_routes(app, self.base_path)
|
||||
|
||||
Reference in New Issue
Block a user