fix: auto-retry version fetch + add uptime/kill to exec allowlist

Layout.tsx: when versionError is true, automatically retry fetchVersion
after 5 s. This handles the case where the initial fetch runs during
the service-restart window after an upgrade (server not yet up), which
caused the sidebar footer to permanently show 'Version unavailable'
even though the server came back online shortly after.

exec.ts: add 'uptime' and 'kill' to ALLOWED_COMMANDS. 'uptime' was
missing, causing exec('uptime', ['-p']) in GET /api/nixserver/system/info
to throw 'Command not allowed', which rejected the entire Promise.all
and returned 500 — leaving Hostname and OS as '...' on the dashboard.
This commit is contained in:
NixReaper
2026-04-11 14:19:24 -05:00
parent 90dbf94c18
commit 4de2a7fa8e
2 changed files with 9 additions and 1 deletions
+8
View File
@@ -475,8 +475,16 @@ export default function Layout() {
}
}, [])
// Initial fetch
useEffect(() => { fetchVersion() }, [fetchVersion])
// Auto-retry every 5 s while in error state (handles the service-restart window after an upgrade)
useEffect(() => {
if (!versionError) return
const t = setTimeout(fetchVersion, 5_000)
return () => clearTimeout(t)
}, [versionError, fetchVersion])
const handleUpgrade = async () => {
if (upgradeState === 'confirm') {
setUpgradeState('running')
+1 -1
View File
@@ -24,7 +24,7 @@ const ALLOWED_COMMANDS = new Set([
// Network
'ss', 'ip', 'hostname',
// System
'uname', 'free', 'ps',
'uname', 'uptime', 'free', 'ps', 'kill',
// PHP
'php8.2', 'php8.3',
// Fail2ban