KASM-7180 ensure UI.rfb is defined (#133)

Co-authored-by: Matt McClaskey <matt@kasmweb.com>
This commit is contained in:
Matt McClaskey 2025-04-16 05:52:13 -04:00 committed by GitHub
parent 5d468a3fe1
commit 14c8c2af59
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 11 deletions

View File

@ -1551,7 +1551,7 @@ const UI = {
//keep alive for websocket connection to stay open, since we may not control reverse proxies
//send a keep alive within a window that we control
UI._sessionTimeoutInterval = setInterval(function() {
if (UI.rfb) {
const timeSinceLastActivityInS = (Date.now() - UI.rfb.lastActiveAt) / 1000;
let idleDisconnectInS = 1200; //20 minute default
if (Number.isFinite(parseFloat(UI.rfb.idleDisconnect))) {
@ -1564,6 +1564,7 @@ const UI = {
//send keep-alive
UI.rfb.sendKey(1, null, false);
}
}
}, 5000);
} else {
document.getElementById('noVNC_status').style.visibility = "visible";