UI/runtime polish, session rotation limit, login errors, docs update
This commit is contained in:
+12
-1
@@ -38,6 +38,7 @@ cat > /opt/portal/index.html <<HTML
|
||||
rfb.resizeSession = true;
|
||||
const enableHeartbeat = "${ENABLE_HEARTBEAT}" === "1";
|
||||
const SESSION_CLOSED_URL = '/?session_closed=idle';
|
||||
const CLOSE_PATH = '${TOUCH_PATH}'.replace(/\/touch$/, '/close');
|
||||
function goSessionClosed() {
|
||||
try {
|
||||
if (window.top && window.top !== window) {
|
||||
@@ -55,9 +56,19 @@ cat > /opt/portal/index.html <<HTML
|
||||
}
|
||||
} catch(e) {}
|
||||
}
|
||||
let closing = false;
|
||||
async function closeSessionNow() {
|
||||
if (closing) return;
|
||||
closing = true;
|
||||
try {
|
||||
await fetch(CLOSE_PATH, {method:'POST', credentials:'include', keepalive:true});
|
||||
} catch (e) {}
|
||||
}
|
||||
if (enableHeartbeat) {
|
||||
setInterval(touch, 60000);
|
||||
setInterval(touch, 15000);
|
||||
touch();
|
||||
window.addEventListener('pagehide', closeSessionNow);
|
||||
window.addEventListener('beforeunload', closeSessionNow);
|
||||
}
|
||||
document.addEventListener('contextmenu', (e) => e.preventDefault());
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user