KASM-7180 ensure UI.rfb is defined (#133)
Co-authored-by: Matt McClaskey <matt@kasmweb.com>
This commit is contained in:
parent
5d468a3fe1
commit
14c8c2af59
23
app/ui.js
23
app/ui.js
|
@ -1551,18 +1551,19 @@ const UI = {
|
||||||
//keep alive for websocket connection to stay open, since we may not control reverse proxies
|
//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
|
//send a keep alive within a window that we control
|
||||||
UI._sessionTimeoutInterval = setInterval(function() {
|
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))) {
|
||||||
|
idleDisconnectInS = parseFloat(UI.rfb.idleDisconnect) * 60;
|
||||||
|
}
|
||||||
|
|
||||||
const timeSinceLastActivityInS = (Date.now() - UI.rfb.lastActiveAt) / 1000;
|
if (timeSinceLastActivityInS > idleDisconnectInS) {
|
||||||
let idleDisconnectInS = 1200; //20 minute default
|
parent.postMessage({ action: 'idle_session_timeout', value: 'Idle session timeout exceeded'}, '*' );
|
||||||
if (Number.isFinite(parseFloat(UI.rfb.idleDisconnect))) {
|
} else {
|
||||||
idleDisconnectInS = parseFloat(UI.rfb.idleDisconnect) * 60;
|
//send keep-alive
|
||||||
}
|
UI.rfb.sendKey(1, null, false);
|
||||||
|
}
|
||||||
if (timeSinceLastActivityInS > idleDisconnectInS) {
|
|
||||||
parent.postMessage({ action: 'idle_session_timeout', value: 'Idle session timeout exceeded'}, '*' );
|
|
||||||
} else {
|
|
||||||
//send keep-alive
|
|
||||||
UI.rfb.sendKey(1, null, false);
|
|
||||||
}
|
}
|
||||||
}, 5000);
|
}, 5000);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue