From 1eae1221b6d8b526ba4d24d93358cfc8c93f6e33 Mon Sep 17 00:00:00 2001 From: matt mcclaskey Date: Wed, 13 Aug 2025 17:03:44 +0000 Subject: [PATCH] VNC-122 log idle disconnect, add backup method if postMessage fails --- app/ui.js | 6 ++++ public/disconnected.html | 72 ++++++++++++++++++++++++++++++++++++++++ vite.config.js | 3 +- 3 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 public/disconnected.html diff --git a/app/ui.js b/app/ui.js index 83def8d3..86b98ea7 100644 --- a/app/ui.js +++ b/app/ui.js @@ -1566,7 +1566,13 @@ const UI = { } if (timeSinceLastActivityInS > idleDisconnectInS) { + Log.Warn("Idle Disconnect reached, disconnecting rfb session..."); parent.postMessage({ action: 'idle_session_timeout', value: 'Idle session timeout exceeded'}, '*' ); + + // in some cases the intra-frame message could be blocked, fall back to navigating to a disconnect page. + setTimeout(function() { + window.location.replace('/disconnected.html'); + }, 10000); } else { //send keep-alive UI.rfb.sendKey(1, null, false); diff --git a/public/disconnected.html b/public/disconnected.html new file mode 100644 index 00000000..a8965ae9 --- /dev/null +++ b/public/disconnected.html @@ -0,0 +1,72 @@ + + + + +Session Disconnected + + + + +
+
⚠️
+

Session Disconnected

+

Your remote session has ended due to inactivity or disconnection.

+ Return to Dashboard +
+ + diff --git a/vite.config.js b/vite.config.js index f09cadc0..90905a95 100644 --- a/vite.config.js +++ b/vite.config.js @@ -13,10 +13,11 @@ export default defineConfig({ plugins: [ viteCommonjs(), envCompatible(), - ViteMinifyPlugin(), + //ViteMinifyPlugin(), ViteRestart({restart: ['core/**', 'app/**','kasmvnc-version.txt']}), ], build: { + sourcemap: true, rollupOptions: { input: { main: './index.html',