Remove old index page and add offline maintenance page with server status information

This commit is contained in:
2026-04-01 20:09:18 -05:00
parent be4cc0bf1c
commit 158c3f335c
2 changed files with 28 additions and 0 deletions
+28
View File
@@ -10,6 +10,34 @@
const liveRunsUrl = `${liveServerBase}/api/runs`;
const liveEventsUrl = `${liveServerBase}/events`;
const liveDataFileUrl = `${liveServerBase}/server/data.txt`;
const offlinePage = 'offlineindex.html';
function redirectToOffline(){
if(window.location.pathname.endsWith(`/${offlinePage}`)) return;
window.location.replace(offlinePage);
}
function probeLiveServer(timeoutMs = 5000){
const controller = new AbortController();
const timeoutId = setTimeout(()=>controller.abort(), timeoutMs);
return fetch(liveServerBase, {
method:'HEAD',
cache:'no-store',
signal: controller.signal
}).then(response => {
clearTimeout(timeoutId);
return response;
}).catch(error => {
clearTimeout(timeoutId);
throw error;
});
}
if(!window.location.pathname.endsWith(`/${offlinePage}`)){
probeLiveServer().catch(()=>{
redirectToOffline();
});
}
let cachedItems = null;
let cachedRuns = null;
let cachedLevelMeta = null;
View File