package api import ( "arma3-web-server/internal/services" "github.com/gin-gonic/gin" ) type Handler struct { settings *services.SettingsManager configs *services.ConfigManager modlists *services.ModlistManager process *services.ProcessManager steamcmd *services.SteamCmdManager scheduler *services.Scheduler streamer *services.LogStreamer dataDir string serverfileDir string modsDir string cfgDir string profilesDir string } func New( settings *services.SettingsManager, configs *services.ConfigManager, modlists *services.ModlistManager, process *services.ProcessManager, steamcmd *services.SteamCmdManager, scheduler *services.Scheduler, streamer *services.LogStreamer, dataDir, serverfileDir, modsDir, cfgDir, profilesDir string, ) *Handler { return &Handler{ settings: settings, configs: configs, modlists: modlists, process: process, steamcmd: steamcmd, scheduler: scheduler, streamer: streamer, dataDir: dataDir, serverfileDir: serverfileDir, modsDir: modsDir, cfgDir: cfgDir, profilesDir: profilesDir, } } func (h *Handler) SetupRoutes(r *gin.Engine) { api := r.Group("/api") { api.GET("/server/settings", h.GetSettings) api.PUT("/server/settings", h.UpdateSettings) api.POST("/server/start", h.StartServer) api.POST("/server/stop", h.StopServer) api.POST("/server/restart", h.RestartServer) api.GET("/server/status", h.ServerStatus) api.GET("/server/steamcmd", h.SteamCMDSettings) api.POST("/server/steamcmd/update-game", h.SteamCMDUpdateGame) 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) api.GET("/configs", h.ListConfigs) api.POST("/configs", h.CreateConfig) api.GET("/configs/:name", h.GetConfig) api.PUT("/configs/:name", h.UpdateConfig) api.DELETE("/configs/:name", h.DeleteConfig) api.POST("/configs/:name/duplicate", h.DuplicateConfig) api.GET("/modlists", h.ListModlists) api.POST("/modlists", h.CreateModlist) api.GET("/modlists/:id", h.GetModlist) api.PUT("/modlists/:id", h.UpdateModlist) api.DELETE("/modlists/:id", h.DeleteModlist) api.POST("/modlists/:id/duplicate", h.DuplicateModlist) api.POST("/modlists/import", h.ImportModlist) api.GET("/modlists/:id/check", h.CheckModlistMods) api.POST("/modlists/:id/download-missing", h.DownloadMissingMods) api.POST("/modlists/:id/update-all", h.UpdateAllMods) api.GET("/modlists/:id/export", h.ExportModlist) api.GET("/mods", h.ListMods) api.DELETE("/mods", h.DeleteMod) api.POST("/mods/cleanup", h.CleanupMods) } r.GET("/ws/server/logs", h.StreamLogs) r.GET("/ws/steamcmd/logs", h.StreamSteamCMDLogs) r.GET("/ws/server/rpt", h.StreamRPTLogs) }