fix: terminal WebSocket connection timing + better mock fallback
- Fix xterm.js container not found: use requestAnimationFrame retry loop instead of single $nextTick (Alpine x-for renders asynchronously) - Better mock fallback: use host name+IP instead of raw UUID - Add logging for WebSocket connection path (found/not-found/hostname)
This commit is contained in:
@@ -48,10 +48,16 @@ func TerminalWS(c *websocket.Conn) {
|
||||
log.Printf("WS connected: host=%s", hostID)
|
||||
|
||||
host, found := hostStore.Get(hostID)
|
||||
if !found || host.Hostname == "" {
|
||||
if !found {
|
||||
log.Printf("Host %s not found, using mock", hostID)
|
||||
mockTerminal(c, hostID)
|
||||
return
|
||||
}
|
||||
if host.Hostname == "" {
|
||||
log.Printf("Host %s has no hostname, using mock (name=%s, ip=%s)", hostID, host.Name, host.IP)
|
||||
mockTerminal(c, host.Name+" ("+host.IP+")")
|
||||
return
|
||||
}
|
||||
|
||||
client, err := sshconn.Dial(host)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user