feat(auth): 添加用户认证中间件并重构Linux.do登录流程

- 新增UserAuth中间件用于验证用户登录状态和权限
- 移除Linux.do登录中的redirectUri和minimumTrustLevel配置项
- 修改Linux.do登录流程以支持动态构建回调URL
- 将API v1接口组迁移至需要用户认证的路由
- 在远程AI服务调用中添加用户令牌认证
- 修复被封禁用户的认证检查逻辑
- 更新登录重定向函数以处理请求来源
- 添加RequestOrigin函数解析转发的主机和协议头
This commit is contained in:
HouYunFei
2026-05-25 12:05:02 +08:00
parent b2cae2471d
commit fe3294ed60
13 changed files with 72 additions and 67 deletions
+2
View File
@@ -12,6 +12,8 @@ function proxyHeaders(request: NextRequest) {
headers.delete("host");
headers.delete("content-length");
headers.delete("connection");
headers.set("x-forwarded-host", request.nextUrl.host);
headers.set("x-forwarded-proto", request.nextUrl.protocol.replace(":", ""));
return headers;
}