Tune idle timeout, heartbeat redirect, and update project context

This commit is contained in:
2026-04-21 13:31:47 +00:00
parent 9c9b97374c
commit c97cf5308d
11 changed files with 400 additions and 56 deletions
+14 -1
View File
@@ -101,10 +101,23 @@ cat > /opt/portal/index.html <<'HTML'
const enableHeartbeat = (new URLSearchParams(location.search).get('hb') ?? '1') !== '0';
const sid = new URLSearchParams(location.search).get('sid');
const SESSION_CLOSED_URL = '/?session_closed=idle';
function goSessionClosed() {
try {
if (window.top && window.top !== window) {
window.top.location.href = SESSION_CLOSED_URL;
return;
}
} catch (e) {}
window.location.href = SESSION_CLOSED_URL;
}
async function touch() {
if (!sid) return;
try {
await fetch(`/api/sessions/${sid}/touch`, {method:'POST', credentials:'include'});
const res = await fetch(`/api/sessions/${sid}/touch`, {method:'POST', credentials:'include'});
if (!res.ok) {
goSessionClosed();
}
} catch (e) {}
}
if (enableHeartbeat) {