feat: save progress on web server foundation and add new tickets

This commit is contained in:
syntaxbullet
2026-01-07 13:02:36 +01:00
parent 894cad91a8
commit 6f4426e49d
9 changed files with 191 additions and 59 deletions

36
src/web/public/script.js Normal file
View File

@@ -0,0 +1,36 @@
function formatUptime(seconds) {
if (seconds < 0) return "0s";
const days = Math.floor(seconds / (3600 * 24));
const hours = Math.floor((seconds % (3600 * 24)) / 3600);
const minutes = Math.floor((seconds % 3600) / 60);
const secs = Math.floor(seconds % 60);
const parts = [];
if (days > 0) parts.push(`${days}d`);
if (hours > 0) parts.push(`${hours}h`);
if (minutes > 0) parts.push(`${minutes}m`);
parts.push(`${secs}s`);
return parts.join(" ");
}
function updateUptime() {
const el = document.getElementById("uptime-display");
if (!el) return;
const startTimestamp = parseInt(el.getAttribute("data-start-timestamp"), 10);
if (isNaN(startTimestamp)) return;
const now = Date.now();
const elapsedSeconds = (now - startTimestamp) / 1000;
el.textContent = formatUptime(elapsedSeconds);
}
document.addEventListener("DOMContentLoaded", () => {
// Update immediately to prevent stale content flash if possible
updateUptime();
// Update every second
setInterval(updateUptime, 1000);
});