feat(system): health-Endpoint liefert jetzt hostname + OS + kernel
- /system/health gibt zusätzlich hostname, os (PRETTY_NAME aus /etc/os-release) und kernel (/proc/version, ohne Build-Details) zurück - Settings-Seite: SystemHealth-Interface erweitert, System-Info-Card zeigt Hostname, Betriebssystem und Kernel-Version an (conditional, nur wenn vorhanden) - Nützlich beim Verwalten mehrerer Boxen — ohne SSH sofort sehen welches System gerade geöffnet ist Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -752,10 +752,31 @@ func (h *SystemHandler) ConfigPreview(c *gin.Context) {
|
||||
}
|
||||
|
||||
func (h *SystemHandler) Health(c *gin.Context) {
|
||||
response.OK(c, gin.H{
|
||||
resp := gin.H{
|
||||
"status": "ok",
|
||||
"version": h.Version,
|
||||
})
|
||||
}
|
||||
if hn, err := os.Hostname(); err == nil {
|
||||
resp["hostname"] = hn
|
||||
}
|
||||
if data, err := os.ReadFile("/proc/version"); err == nil {
|
||||
// /proc/version: "Linux version 6.x.y (...)" — Kurzform: alles
|
||||
// bis zum ersten '(' kürzen.
|
||||
line := strings.TrimSpace(string(data))
|
||||
if idx := strings.Index(line, " ("); idx > 0 {
|
||||
line = strings.TrimSpace(line[:idx])
|
||||
}
|
||||
resp["kernel"] = line
|
||||
}
|
||||
if data, err := os.ReadFile("/etc/os-release"); err == nil {
|
||||
for _, line := range strings.Split(string(data), "\n") {
|
||||
if k, v, ok := strings.Cut(line, "="); ok && k == "PRETTY_NAME" {
|
||||
resp["os"] = strings.Trim(v, `"`)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
response.OK(c, resp)
|
||||
}
|
||||
|
||||
// PackageVersions reports installed and available versions for the
|
||||
|
||||
Reference in New Issue
Block a user