✨ feat(status): 新增请求日志并重设计状态页

- 新增 server.request_log 配置:记录业务请求元数据(IP/方法/路径/状态/耗时,
  key 自动脱敏)与 4xx/5xx 错误摘要(前 4KB),按保留天数自动清理
- 移除 /self-info 与 /vacuum 接口及相关文档
- 状态页重设计:毛玻璃卡片+吸顶玻璃栏、服务状态条、KPI 卡与请求分类
  条形图、可折叠 API 文档分组、行内测试面板;深浅色分别调校,
  含 reduced-motion / reduced-transparency / 无 backdrop-filter 兜底
This commit is contained in:
chenxin committed 2026-10-09 18:03:02 +08:00
1 parent bf49805bb6
commit bfb4290c15
11 files changed
+1060 -838

No files matched your search

+2 -63
View File
@@ -8,7 +8,7 @@ info:
多数接口直接转发上游 JSON(结构随上游版本变化,`data` 字段以实际返回为准);
错误统一返回 `{"code": -1, "msg": "..."}`。
需要鉴权的端点(`/status`、`/self-info`、`/vacuum`)通过查询参数 `key`
需要鉴权的端点(`/status`)通过查询参数 `key`
或请求头 `X-Access-Key` 携带访问密钥,未配置 `server.access_key` 时不启用验证。
license:
name: MIT
@@ -18,7 +18,7 @@ servers:
description: 本地开发
tags:
- name: 系统
description: 服务状态、设备信息与数据库维护
description: 服务状态监控
- name: 书籍
description: 搜索、详情、目录与批量详情
- name: 内容
@@ -85,68 +85,7 @@ paths:
"401":
$ref: "#/components/responses/Unauthorized"
/self-info:
get:
tags: [系统]
summary: 设备密钥池信息
description: 返回设备池启用状态与统计,包含设备密钥等敏感数据。
operationId: getSelfInfo
security:
- accessKeyQuery: []
- accessKeyHeader: []
parameters:
- $ref: "#/components/parameters/AccessKeyQuery"
responses:
"200":
description: 设备池信息
content:
application/json:
schema:
type: object
properties:
code: { type: integer, example: 0 }
message: { type: string, example: SUCCESS }
data:
type: object
properties:
device_pool_enabled: { type: boolean }
device_pool_stats:
type: object
properties:
total: { type: integer }
valid: { type: integer }
invalid: { type: integer }
current_index: { type: integer }
"401":
$ref: "#/components/responses/Unauthorized"
/vacuum:
post:
tags: [系统]
summary: 压缩数据库
description: |
执行数据库压缩以释放磁盘空间。
- SQLite: 执行 VACUUM
- PostgreSQL: 由 autovacuum 自动管理,本操作为空操作
仅支持 POST,GET 请求会被拒绝。
operationId: vacuumDatabase
security:
- accessKeyQuery: []
- accessKeyHeader: []
parameters:
- $ref: "#/components/parameters/AccessKeyQuery"
responses:
"200":
description: 压缩结果
content:
application/json:
schema:
type: object
properties:
success: { type: boolean }
message: { type: string, example: 数据库压缩完成 }
"401":
$ref: "#/components/responses/Unauthorized"
/search:
get: