feat: complete Epic 1 production foundation

This commit is contained in:
2026-08-25 01:24:11 +03:00
parent 767428436d
commit 182bde8ac0
298 changed files with 35719 additions and 5299 deletions
+22
View File
@@ -175,6 +175,15 @@
}
sessionPromise = window.CrankApi.getSession()
.then(function(session) {
if (session && !session.csrf_token && window.CrankApi && typeof window.CrankApi.refreshSessionCsrf === 'function') {
return window.CrankApi.refreshSessionCsrf().then(function(csrf) {
session.csrf_token = csrf && csrf.csrf_token ? csrf.csrf_token : '';
return session;
});
}
return session;
})
.then(function(session) {
return replaceSession(session);
})
@@ -221,6 +230,15 @@
window.location.href = homeUrl();
}
async function completeBootstrap(token, password) {
var session = await window.CrankApi.completeBootstrap({
token: token,
password: password,
});
replaceSession(session);
window.location.href = homeUrl();
}
async function logout() {
try {
await window.CrankApi.logout();
@@ -243,12 +261,16 @@
fetchSession: fetchSession,
replaceSession: replaceSession,
getCachedSession: function() { return sessionCache; },
getCsrfToken: function() {
return sessionCache && sessionCache.csrf_token ? sessionCache.csrf_token : '';
},
renderShellIdentity: function() {
renderShellIdentity(sessionCache);
},
guardProtectedPage: guardProtectedPage,
guardLoginPage: guardLoginPage,
login: login,
completeBootstrap: completeBootstrap,
logout: logout,
handleUnauthorized: handleUnauthorized,
};