Add server health endpoint and status page

Backend:
- New /api/server/health endpoint returning server, paths, disk,
  mods, steamcmd, and frontend status
- Health endpoint checks directory existence/writability, disk usage,
  server binary, and frontend dist availability

Frontend:
- New Status page (route /status) with sections for Server, SteamCMD,
  Mods, Frontend, Directories (with exists/writable badges), and
  Disk Usage (with size formatting and used-percent coloring)
- Paths are clickable to copy and use start-truncation (ellipsis on
  the left) with native hover tooltip
- Health API client integration with 10s auto-refresh

Misc:
- Update .gitignore and Makefile, minor Layout nav addition
This commit is contained in:
MrFastwind
2026-07-09 15:22:43 +02:00
parent 6f782af913
commit 2d301b95b6
10 changed files with 422 additions and 15 deletions

View File

@@ -14,10 +14,12 @@ type Handler struct {
steamcmd *services.SteamCmdManager
scheduler *services.Scheduler
streamer *services.LogStreamer
dataDir string
serverfileDir string
modsDir string
cfgDir string
profilesDir string
frontendDir string
}
func New(
@@ -28,7 +30,7 @@ func New(
steamcmd *services.SteamCmdManager,
scheduler *services.Scheduler,
streamer *services.LogStreamer,
serverfileDir, modsDir, cfgDir, profilesDir string,
dataDir, serverfileDir, modsDir, cfgDir, profilesDir, frontendDir string,
) *Handler {
return &Handler{
settings: settings,
@@ -38,10 +40,12 @@ func New(
steamcmd: steamcmd,
scheduler: scheduler,
streamer: streamer,
dataDir: dataDir,
serverfileDir: serverfileDir,
modsDir: modsDir,
cfgDir: cfgDir,
profilesDir: profilesDir,
frontendDir: frontendDir,
}
}
@@ -59,6 +63,7 @@ func (h *Handler) SetupRoutes(r *gin.Engine) {
api.POST("/server/steamcmd/download-mod", h.SteamCMDDownloadMod)
api.GET("/server/steamcmd/status", h.SteamCMDStatus)
api.GET("/server/paths", h.ServerPaths)
api.GET("/server/health", h.Health)
api.GET("/server/logs", h.ListLogs)
api.GET("/server/logs/:file", h.GetLog)