Loop-Fix
release-tag / release-image (push) Successful in 1m57s
release-main / release-images (push) Successful in 4m13s

This commit is contained in:
2026-08-24 23:03:42 +02:00
parent 7709b9fd33
commit 402422bf30
@@ -63,52 +63,12 @@
}); });
} }
function recoverFromGuacamoleLogout() { // Guacamole owns its own authentication state. Do not automatically
if (redirecting) { // reload the SPA merely because Guacamole is in its logged-out state.
return; // With header authentication, Guacamole's built-in "Login again" action
} // can re-authenticate against the next request. Automatic reload here
// creates a / -> /#/ -> / loop while the SessionGuard access session is
// Guacamole authentication tokens live in the selected webapp process. // still perfectly valid.
// A worker failover/restart can therefore cause Guacamole to enter its
// logged-out state even though the upstream SessionGuard/PocketID
// browser session is still valid. Never turn that condition into a
// full IdP logout. Re-enter Guacamole and let header auth mint a fresh
// Guacamole token instead.
getAccessSessionStatus().then(function (response) {
if (response.ok) {
redirect(safeReturnURL());
}
else if (response.status === 401 || response.status === 403) {
redirect(loginURL());
}
}).catch(function () {
// Keep Guacamole's normal logged-out UI visible during a transient
// SessionGuard outage instead of forcing any logout/login loop.
});
}
function watchForGuacamoleLoggedOutState() {
function loggedOutModalPresent() {
return document.querySelector('.logged-out-modal') !== null;
}
if (loggedOutModalPresent()) {
recoverFromGuacamoleLogout();
return;
}
var observer = new MutationObserver(function () {
if (loggedOutModalPresent()) {
observer.disconnect();
recoverFromGuacamoleLogout();
}
});
observer.observe(document.documentElement, {
childList: true,
subtree: true
});
}
function watchForExplicitLogout() { function watchForExplicitLogout() {
// Guacamole assigns the CSS class "logout" to its explicit logout // Guacamole assigns the CSS class "logout" to its explicit logout
@@ -133,7 +93,6 @@
function start() { function start() {
watchForExplicitLogout(); watchForExplicitLogout();
watchForGuacamoleLoggedOutState();
checkAccessSession(); checkAccessSession();
window.setInterval(checkAccessSession, STATUS_INTERVAL_MS); window.setInterval(checkAccessSession, STATUS_INTERVAL_MS);
} }