Bugfix/vnc 122 fix idle disconnect (#158)
* VNC-122 log idle disconnect, add backup method if postMessage fails * VNC-122 fix bug with brave, fix location of disconnect.html --------- Co-authored-by: matt mcclaskey <matt@kasmweb.com>
This commit is contained in:
parent
e7a2f06dae
commit
6a8e7349b1
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ window.addEventListener('touchstart', function onFirstTouch() {
|
|||
// brings us a bit closer but is not optimal.
|
||||
export let dragThreshold = 10 * (window.devicePixelRatio || 1);
|
||||
|
||||
export const supportsKeyboardLock = ('keyboard' in navigator && 'lock' in navigator.keyboard && typeof(navigator.keyboard.lock) === 'function');
|
||||
export const supportsKeyboardLock = typeof navigator.keyboard?.lock === 'function';
|
||||
|
||||
let _supportsCursorURIs = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,72 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Session Disconnected</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<style>
|
||||
:root {
|
||||
--bg-color: #f8f9fa;
|
||||
--card-bg: #ffffff;
|
||||
--accent-color: #d9534f;
|
||||
--accent-dark: #c9302c;
|
||||
--text-color: #333;
|
||||
--font-family: 'Segoe UI', Tahoma, sans-serif;
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
background-color: var(--bg-color);
|
||||
color: var(--text-color);
|
||||
font-family: var(--font-family);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100vh;
|
||||
}
|
||||
.card {
|
||||
background: var(--card-bg);
|
||||
padding: 2rem;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 4px 20px rgba(0,0,0,0.08);
|
||||
max-width: 400px;
|
||||
width: 90%;
|
||||
text-align: center;
|
||||
}
|
||||
.icon {
|
||||
font-size: 3rem;
|
||||
color: var(--accent-color);
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
h1 {
|
||||
font-size: 1.5rem;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
p {
|
||||
font-size: 1rem;
|
||||
margin-bottom: 1.5rem;
|
||||
color: #555;
|
||||
}
|
||||
.btn {
|
||||
display: inline-block;
|
||||
padding: 0.6rem 1.2rem;
|
||||
background-color: var(--accent-color);
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
border-radius: 6px;
|
||||
font-weight: 500;
|
||||
transition: background-color 0.2s ease;
|
||||
}
|
||||
.btn:hover {
|
||||
background-color: var(--accent-dark);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="card">
|
||||
<div class="icon">⚠️</div>
|
||||
<h1>Session Disconnected</h1>
|
||||
<p>Your remote session has ended due to inactivity or disconnection.</p>
|
||||
<a class="btn" href="/">Return to Dashboard</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -17,6 +17,7 @@ export default defineConfig({
|
|||
ViteRestart({restart: ['core/**', 'app/**','kasmvnc-version.txt']}),
|
||||
],
|
||||
build: {
|
||||
sourcemap: false,
|
||||
rollupOptions: {
|
||||
input: {
|
||||
main: './index.html',
|
||||
|
|
|
|||
Loading…
Reference in New Issue