websocket 远程连接地址错误

临时修正,修复远程访问 WebUI 时,日志 websocket 连接错误的问题
This commit is contained in:
2026-04-21 21:06:29 +08:00
parent 06d4b605b1
commit 471cc8fed6
2 changed files with 5 additions and 1 deletions

View File

@@ -14,7 +14,7 @@ ansiUp.use_classes = true
let ws: WebSocket | null = null let ws: WebSocket | null = null
const initWebSocket = () => { const initWebSocket = () => {
ws = new WebSocket('ws://127.0.0.1:8000/ws/logs') ws = new WebSocket(`ws://${window.location.hostname}:8000/ws/logs`)
ws.onmessage = (event) => { ws.onmessage = (event) => {
// 1. 解析 ANSI 颜色编码 // 1. 解析 ANSI 颜色编码

View File

@@ -53,6 +53,10 @@ export default defineConfig({
target: 'http://localhost:8000', target: 'http://localhost:8000',
changeOrigin: true, changeOrigin: true,
}, },
'/ws': {
target: 'http://localhost:8000',
changeOrigin: true,
},
'/version': { '/version': {
target: 'http://localhost:8000', target: 'http://localhost:8000',
changeOrigin: true, changeOrigin: true,