From 936aaa0b2bb89e54411cdb03c4efe710daf5160a Mon Sep 17 00:00:00 2001 From: Simon Smith Date: Tue, 20 Feb 2024 21:59:30 +0000 Subject: [PATCH] disconnect sessions first before logout on idletimeout (#5838) Signed-off-by: si458 --- views/default.handlebars | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/views/default.handlebars b/views/default.handlebars index 207b2796..449df7e9 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -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', '
' + format((ds == 1)?"1 second until disconnect":"{0} seconds until disconnect", ds));