feat: fully normalize CUSTOM_VITE_WS_URL (strip scheme/path, keep port)
Docker Build (ARM64) / Build & Push (push) Successful in 2m2s
Docker Build (ARM64) / Build & Push (push) Successful in 2m2s
This commit is contained in:
@@ -435,10 +435,15 @@ function App(): JSX.Element {
|
||||
return
|
||||
}
|
||||
|
||||
let wsUrl = import.meta.env.CUSTOM_VITE_WS_URL || 'wss://excalidraw.forkless.com'
|
||||
if (wsUrl && !wsUrl.startsWith('ws://') && !wsUrl.startsWith('wss://')) {
|
||||
wsUrl = 'wss://' + wsUrl
|
||||
let rawUrl = import.meta.env.CUSTOM_VITE_WS_URL || 'wss://excalidraw.forkless.com'
|
||||
try {
|
||||
const parsed = new URL(rawUrl.startsWith('ws') ? rawUrl.replace(/^ws/, 'http') : rawUrl)
|
||||
rawUrl = 'wss://' + parsed.host
|
||||
} catch {
|
||||
// Bare hostname/IP — prepend wss://
|
||||
rawUrl = 'wss://' + rawUrl
|
||||
}
|
||||
const wsUrl = rawUrl
|
||||
|
||||
websocketRef.current = new WebSocket(wsUrl)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user