From e11a37ffecc55524fe4804f0c07baadd7c8add3f Mon Sep 17 00:00:00 2001 From: hrz <1710360675@qq.com> Date: Mon, 31 Mar 2025 21:04:11 +0800 Subject: [PATCH] =?UTF-8?q?update:=E4=BC=98=E5=8C=96=E6=B5=8B=E8=AF=95web?= =?UTF-8?q?=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../security/controller/LoginController.java | 3 + .../modules/security/oauth2/Oauth2Filter.java | 1 - main/xiaozhi-server/test/test_page.html | 893 ++++++++++-------- 3 files changed, 486 insertions(+), 411 deletions(-) diff --git a/main/manager-api/src/main/java/xiaozhi/modules/security/controller/LoginController.java b/main/manager-api/src/main/java/xiaozhi/modules/security/controller/LoginController.java index 657217ae..7db612b5 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/security/controller/LoginController.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/security/controller/LoginController.java @@ -19,6 +19,7 @@ import xiaozhi.common.page.TokenDTO; import xiaozhi.common.user.UserDetail; import xiaozhi.common.utils.Result; import xiaozhi.common.validator.AssertUtils; +import xiaozhi.common.validator.ValidatorUtils; import xiaozhi.modules.security.dto.LoginDTO; import xiaozhi.modules.security.password.PasswordUtils; import xiaozhi.modules.security.service.CaptchaService; @@ -104,6 +105,8 @@ public class LoginController { @PutMapping("/change-password") @Operation(summary = "修改用户密码") public Result changePassword(@RequestBody PasswordDTO passwordDTO) { + // 判断非空 + ValidatorUtils.validateEntity(passwordDTO); Long userId = SecurityUser.getUserId(); sysUserTokenService.changePassword(userId, passwordDTO); return new Result<>(); diff --git a/main/manager-api/src/main/java/xiaozhi/modules/security/oauth2/Oauth2Filter.java b/main/manager-api/src/main/java/xiaozhi/modules/security/oauth2/Oauth2Filter.java index e155b77c..e66327f5 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/security/oauth2/Oauth2Filter.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/security/oauth2/Oauth2Filter.java @@ -90,7 +90,6 @@ public class Oauth2Filter extends AuthenticatingFilter { String json = JsonUtils.toJsonString(r); httpResponse.getWriter().print(json); } catch (IOException e1) { - logger.error("onLoginFailure:登录失败! msg:{}", e1.getMessage(), e1); } return false; diff --git a/main/xiaozhi-server/test/test_page.html b/main/xiaozhi-server/test/test_page.html index f63dee17..63f9f90e 100644 --- a/main/xiaozhi-server/test/test_page.html +++ b/main/xiaozhi-server/test/test_page.html @@ -1,5 +1,6 @@ + @@ -11,36 +12,45 @@ padding: 20px; background-color: #f5f5f5; } + .container { max-width: 800px; margin: 0 auto; background-color: white; border-radius: 10px; - box-shadow: 0 2px 10px rgba(0,0,0,0.1); - padding: 20px; + box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); + padding: 10px 20px 10px 20px; } + h1 { color: #333; text-align: center; margin-bottom: 30px; } + .section { margin-bottom: 20px; padding: 15px; border-radius: 8px; background-color: #f9f9f9; } + .section h2 { margin-top: 0; color: #444; font-size: 18px; + display: flex; + align-items: center; + gap: 10px; } + .control-panel { display: flex; flex-wrap: wrap; gap: 10px; - margin-bottom: 20px; + margin-top: 10px; } + button { padding: 8px 15px; border: none; @@ -50,36 +60,43 @@ cursor: pointer; transition: background-color 0.2s; } + button:hover { background-color: #3367d6; } + button:disabled { background-color: #cccccc; cursor: not-allowed; } + #serverUrl { flex-grow: 1; padding: 8px; border: 1px solid #ddd; border-radius: 5px; } + .message-input { display: flex; gap: 10px; margin-bottom: 20px; } + #messageInput { flex-grow: 1; padding: 8px; border: 1px solid #ddd; border-radius: 5px; } + #nfcCardId { flex-grow: 1; padding: 8px; border: 1px solid #ddd; border-radius: 5px; } + .conversation { max-height: 300px; overflow-y: auto; @@ -87,36 +104,45 @@ border-radius: 5px; padding: 10px; background-color: white; + flex: 1; + margin-right: 10px; } + .message { margin-bottom: 10px; padding: 8px 12px; border-radius: 8px; max-width: 80%; } + .user { background-color: #e2f2ff; margin-left: auto; margin-right: 10px; text-align: right; } + .server { background-color: #f0f0f0; margin-right: auto; margin-left: 10px; } + .status { color: #666; font-style: italic; - text-align: center; - margin-bottom: 10px; + font-size: 14px; + margin: 0; + padding: 0; } + .audio-controls { display: flex; justify-content: center; gap: 10px; margin-top: 20px; } + .audio-visualizer { height: 60px; width: 100%; @@ -125,47 +151,74 @@ border-radius: 5px; background-color: #fafafa; } + .record-button { background-color: #db4437; } + .record-button:hover { background-color: #c53929; } + .record-button.recording { animation: pulse 1.5s infinite; } + @keyframes pulse { - 0% { background-color: #db4437; } - 50% { background-color: #ff6659; } - 100% { background-color: #db4437; } + 0% { + background-color: #db4437; + } + + 50% { + background-color: #ff6659; + } + + 100% { + background-color: #db4437; + } } + #logContainer { - margin-top: 20px; + margin-top: 0; padding: 10px; background-color: #f0f0f0; border-radius: 5px; font-family: monospace; - height: 150px; + height: 300px; overflow-y: auto; + flex: 1; + margin-left: 10px; } + .log-entry { margin: 5px 0; font-size: 12px; } - .log-info { color: #333; } - .log-error { color: #db4437; } - .log-success { color: #0f9d58; } - .info-box { - background-color: #e8f4ff; - border-left: 4px solid #4285f4; - width: auto; - display: none; - margin: 10px 0; - padding: 10px; - font-size: 14px; - line-height: 1.5; + + .log-info { + color: #333; } - + + .log-error { + color: #db4437; + } + + .log-success { + color: #0f9d58; + } + + @keyframes fadeIn { + from { + opacity: 0; + transform: translate(-50%, -60%); + } + + to { + opacity: 1; + transform: translate(-50%, -50%); + } + } + .script-status { display: inline-block; width: 10px; @@ -173,11 +226,19 @@ border-radius: 50%; margin-right: 5px; } - - .script-loaded { background-color: #0f9d58; } - .script-loading { background-color: #f4b400; } - .script-error { background-color: #db4437; } - + + .script-loaded { + background-color: #0f9d58; + } + + .script-loading { + background-color: #f4b400; + } + + .script-error { + background-color: #db4437; + } + .script-list { margin: 10px 0; padding: 10px; @@ -186,93 +247,134 @@ font-family: monospace; font-size: 11px; } - - /* 状态消息样式 */ - #scriptStatus { - padding: 10px 15px; - border-radius: 5px; - margin-bottom: 15px; - font-weight: bold; - } - + #scriptStatus.success { background-color: #e6f4ea; color: #0f9d58; border-left: 4px solid #0f9d58; } - + #scriptStatus.error { background-color: #fce8e6; color: #db4437; border-left: 4px solid #db4437; } - + #scriptStatus.warning { background-color: #fef7e0; color: #f4b400; border-left: 4px solid #f4b400; } + + /* 标签页样式 */ + .tabs { + display: flex; + margin-bottom: 20px; + border-bottom: 2px solid #e0e0e0; + } + + .tab { + padding: 10px 20px; + cursor: pointer; + border: none; + background: none; + font-size: 16px; + color: #666; + position: relative; + transition: all 0.3s ease; + } + + .tab:hover { + color: #4285f4; + } + + .tab.active { + color: #4285f4; + font-weight: bold; + } + + .tab.active::after { + content: ''; + position: absolute; + bottom: -2px; + left: 0; + width: 100%; + height: 2px; + background-color: #4285f4; + } + + .tab-content { + display: none; + } + + .tab-content.active { + display: block; + } + + .flex-container { + display: flex; + gap: 20px; + margin-top: 10px; + } +

小智服务器测试页面

- -
- + +
+ 正在加载Opus库...
+
-

WebSocket连接

+

WebSocket连接 未连接

- + -
-
未连接
- +
-

文本消息

-
- - +

消息发送

+
+ + +
+ +
+
+ + +
+
+ +
+
+ +
+
- -
-

NFC卡片模拟

-
- - -
-
- -
-

语音消息

-
- - -
- -
- +

会话记录

-
-
- -
-
准备就绪,请连接服务器开始测试...
+
+
+
+
准备就绪,请连接服务器开始测试...
+
+
- + - \ No newline at end of file + + \ No newline at end of file