修复ws连接问题

This commit is contained in:
qaq
2025-07-03 11:55:03 +08:00
parent 58353dec5c
commit 2db8e834a8
+2 -2
View File
@@ -114,8 +114,8 @@ export default function NodePage() {
closeWebSocket(); closeWebSocket();
} }
// 构建WebSocket URL,将HTTP协议转换为WS协议 // 构建WebSocket URL,使用与API相同的地址逻辑
let baseUrl = import.meta.env.VITE_API_BASE || 'http://localhost:8080'; let baseUrl = import.meta.env.VITE_API_BASE || window.location.origin;
const wsUrl = baseUrl.replace(/^http/, 'ws') + `/system-info?type=0&secret=${localStorage.getItem('token')}`; const wsUrl = baseUrl.replace(/^http/, 'ws') + `/system-info?type=0&secret=${localStorage.getItem('token')}`;
try { try {