feat: 支持按键分离事件与键盘捕获,并优化UI
- 后端与前端新增 keyAction 参数,支持按键按下/抬起独立事件,保持向下兼容 - 前端控制栏支持 pointerdown/pointerup 长按,新增键盘捕获输入框,映射浏览器按键到 Android KeyEvent - 重构顶栏布局:用户区右置并添加在线指示器、状态文本省略,优化窄屏响应式表现 - 控制栏录制按钮组防拆行,分辨率/帧率选择器自适应收缩,全局样式增强 - 修复 AdminAuthFilter 中 doFilter 被异常捕获导致误返回 401 的问题 - 移除管理后台中用户 admin 角色及相关 UI 与 API - 更新信令前端环境代理地址,修正路由名称大小写
This commit is contained in:
@@ -60,17 +60,24 @@ public class AdminAuthFilter extends OncePerRequestFilter {
|
||||
writeUnauthorized(response, "管理员令牌为空");
|
||||
return;
|
||||
}
|
||||
AdminAuthPrincipal principal;
|
||||
try {
|
||||
Map<String, Object> claims = adminService.verifyToken(token);
|
||||
String sub = com.ttstd.signaling.security.JwtService.claimAsString(claims, "sub");
|
||||
AdminAuthPrincipal principal = new AdminAuthPrincipal(sub);
|
||||
request.setAttribute("adminPrincipal", principal);
|
||||
filterChain.doFilter(request, response);
|
||||
principal = new AdminAuthPrincipal(sub);
|
||||
} catch (AuthException e) {
|
||||
writeUnauthorized(response, e.getMessage());
|
||||
writeUnauthorized(response, e.getPublicMessage());
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
writeUnauthorized(response, "令牌校验失败");
|
||||
return;
|
||||
}
|
||||
|
||||
// 令牌校验通过后才放行。注意:doFilter 必须在 try/catch 之外,
|
||||
// 否则下游 Controller/Service 抛出的业务异常(如密码强度不足的 400)
|
||||
// 会被误捕获并改写成 401,导致前端清除令牌、管理员被强制下线。
|
||||
request.setAttribute("adminPrincipal", principal);
|
||||
filterChain.doFilter(request, response);
|
||||
}
|
||||
|
||||
private void writeUnauthorized(HttpServletResponse response, String message) throws IOException {
|
||||
|
||||
Reference in New Issue
Block a user