Tune idle timeout, heartbeat redirect, and update project context
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user