import React, { useEffect, useState } from "react"; import { apiFetch } from "../api"; import { useAuth } from "../state"; function formatUptime(seconds) { const total = Math.max(0, Number(seconds || 0)); const d = Math.floor(total / 86400); const h = Math.floor((total % 86400) / 3600); const m = Math.floor((total % 3600) / 60); const s = total % 60; if (d > 0) return `${d}d ${h}h ${m}m`; if (h > 0) return `${h}h ${m}m ${s}s`; return `${m}m ${s}s`; } export function ServiceInfoPage() { const { tokens, refresh, serviceInfo } = useAuth(); const [info, setInfo] = useState(null); const [message, setMessage] = useState(""); const [error, setError] = useState(""); const [busy, setBusy] = useState(false); const load = async () => { setError(""); const data = await apiFetch("/service/info", {}, tokens, refresh); setInfo(data); }; useEffect(() => { load().catch((e) => setError(String(e.message || e))); }, []); useEffect(() => { if (serviceInfo) setInfo(serviceInfo); }, [serviceInfo]); const checkNow = async () => { try { setBusy(true); setError(""); setMessage(""); const result = await apiFetch("/service/info/check", { method: "POST" }, tokens, refresh); await load(); if (result.last_check_error) { setMessage(`Version check finished with warning: ${result.last_check_error}`); } else if (result.update_available) { setMessage(`Update available: ${result.latest_version}`); } else { setMessage("Version check completed. No update detected."); } } catch (e) { setError(String(e.message || e)); } finally { setBusy(false); } }; if (!info) { return
Loading service information...
; } return (

Service Information

Runtime details, installed version, and update check status for this NexaPG instance.

{error &&
{error}
} {message &&
{message}
}
{info.update_available ? `Update available: ${info.latest_version}` : "Service is up to date"}

Automatic release checks run every 30 seconds. Source: official NexaPG upstream releases.

Application

App Name {info.app_name} Environment {info.environment} API Prefix {info.api_prefix}

Runtime

Host {info.hostname} Python {info.python_version} Uptime {formatUptime(info.uptime_seconds)}

Version Status

Current NexaPG Version {info.app_version} Latest Known Version {info.latest_version || "-"} Update Status {info.update_available ? "Update available" : "Up to date"} Last Check {info.last_checked_at ? new Date(info.last_checked_at).toLocaleString() : "never"}

Release Source

Update checks run against the official NexaPG repository. This source is fixed in code and cannot be changed via UI.

Source Repository {info.update_source} Latest Reference Type {info.latest_ref || "-"}

Version Control Policy

Version and update-source settings are not editable in the app. Only code maintainers of the official NexaPG repository can change that behavior.

); }