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:
Pouzor
2026-03-18 00:16:42 +01:00
parent df3b7a8cb0
commit e5d7260696
6 changed files with 69 additions and 6 deletions
+2 -2
View File
@@ -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