websocket 远程连接地址错误
临时修正,修复远程访问 WebUI 时,日志 websocket 连接错误的问题
This commit is contained in:
@@ -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 颜色编码
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user