feat(server): /api/info aggregator + frontend version footer (#40)
Some checks failed
CI/CD Pipeline / Build Docker Cache (push) Successful in 9s
CI/CD Pipeline / CI Pipeline (push) Failing after 4m48s
CI/CD Pipeline / Trigger Docker Push (push) Has been skipped

Co-authored-by: Gabriel Radureau <arcodange@gmail.com>
Co-committed-by: Gabriel Radureau <arcodange@gmail.com>
This commit was merged in pull request #40.
This commit is contained in:
2026-05-05 08:29:26 +02:00
committed by arcodange
parent 4a3f1bb138
commit a2beadc458
16 changed files with 587 additions and 1 deletions

16
frontend/utils/uptime.ts Normal file
View File

@@ -0,0 +1,16 @@
// Convert a duration in seconds to a humanised string like "2h 13m" or "45m 12s".
// Returns "?" for non-finite or negative input so the UI never renders NaN/empty.
export function humaniseUptime(seconds: number | null | undefined): string {
if (seconds == null || !Number.isFinite(seconds) || seconds < 0) return '?'
const s = Math.floor(seconds)
const days = Math.floor(s / 86400)
const hours = Math.floor((s % 86400) / 3600)
const minutes = Math.floor((s % 3600) / 60)
const secs = s % 60
if (days > 0) return `${days}d ${hours}h`
if (hours > 0) return `${hours}h ${minutes}m`
if (minutes > 0) return `${minutes}m ${secs}s`
return `${secs}s`
}