fix: resolve WebSocket failure and crypto.randomUUID crash on HTTP/LXC
- Replace crypto.randomUUID() with a polyfill (generateUUID) that falls back to crypto.getRandomValues or Math.random — fixes crash on HTTP non-secure contexts where randomUUID is unavailable - Fix WebSocket URL hardcoding port 8000 — use window.location.host so connections go through Nginx proxy in Docker/LXC instead of bypassing it - Add /api/v1/status/ws/ location block in nginx.conf with WebSocket upgrade headers (must precede /api/ to avoid missing Upgrade header)
This commit is contained in:
@@ -23,8 +23,8 @@ export function useStatusPolling() {
|
||||
if (STANDALONE || !isAuthenticated || !token) return
|
||||
|
||||
const protocol = window.location.protocol === 'https:' ? 'wss' : 'ws'
|
||||
const host = window.location.hostname
|
||||
const url = `${protocol}://${host}:8000/api/v1/status/ws/status?token=${encodeURIComponent(token)}`
|
||||
const host = window.location.host // includes port when non-standard
|
||||
const url = `${protocol}://${host}/api/v1/status/ws/status?token=${encodeURIComponent(token)}`
|
||||
|
||||
const ws = new WebSocket(url)
|
||||
wsRef.current = ws
|
||||
|
||||
Reference in New Issue
Block a user