mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-03 01:40:21 +08:00
feat: 添加 API Key 锁定功能和请求头规则系统
1. API Key 锁定功能 - 管理员可锁定/解锁用户的 API Key - 锁定后用户无法使用、修改或删除该 Key - 前端显示锁定状态并禁用相关操作 2. 请求头规则系统 - 将 endpoint.headers 升级为 header_rules - 支持 set(设置)、drop(删除)、rename(重命名)操作 - 前端提供可视化规则编辑界面 - 包含数据迁移脚本 Close #37 Close #86 Close #88
This commit is contained in:
@@ -140,16 +140,17 @@ class PassthroughRequestBuilder(RequestBuilder):
|
||||
|
||||
builder = HeaderBuilder()
|
||||
|
||||
# 2. 透传原始头部(排除敏感头部 - 黑名单模式)
|
||||
# 2. 透传原始头部(排除默认敏感头部)
|
||||
if original_headers:
|
||||
for name, value in original_headers.items():
|
||||
if name.lower() in SENSITIVE_HEADERS:
|
||||
continue
|
||||
builder.add(name, value)
|
||||
|
||||
# 3. 添加 endpoint 配置的额外头部(不能覆盖认证头/Content-Type)
|
||||
if endpoint.headers:
|
||||
builder.add_protected(endpoint.headers, protected_keys)
|
||||
# 3. 应用 endpoint 的请求头规则
|
||||
header_rules = getattr(endpoint, "header_rules", None)
|
||||
if header_rules:
|
||||
builder.apply_rules(header_rules, protected_keys)
|
||||
|
||||
# 4. 添加额外头部
|
||||
if extra_headers:
|
||||
|
||||
Reference in New Issue
Block a user