disconnect sessions first before logout on idletimeout (#5838)

Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
Simon Smith 2024-02-20 21:59:30 +00:00 committed by GitHub
parent 272015483b
commit 936aaa0b2b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2330,7 +2330,23 @@
function setSessionActivity() { sessionActivity = Date.now(); QH('idleTimeoutNotify', ''); }
function checkIdleSessionTimeout() {
var delta = (Date.now() - sessionActivity);
if (delta > serverinfo.timeout) { window.location.href = 'logout'; } else {
if (delta > serverinfo.timeout) {
if (desktop != null) { // Disconnect remote desktop
desktop.Stop();
webRtcDesktopReset();
desktopNode = desktop = null;
if (pluginHandler != null) { pluginHandler.callHook('onDesktopDisconnect'); }
}
if (terminal != null) { // Disconnect terminal
terminal.Stop();
terminal = null;
}
if (files != null) { // Disconnect files
files.Stop();
files = null;
}
window.location.href = 'logout';
} else {
var ds = Math.round((serverinfo.timeout - delta) / 1000);
if (ds <= 60) {
QH('idleTimeoutNotify', '<br />' + format((ds == 1)?"1 second until disconnect":"{0} seconds until disconnect", ds));