mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-22 07:32:32 +01:00
feat(api): add GET /version endpoint
Returns the server name and configured client mode as JSON, enabling clients like MHBridge to display server version info.
This commit is contained in:
@@ -123,6 +123,22 @@ func (s *APIServer) newAuthData(userID uint32, userRights uint32, userTokenID ui
|
||||
return resp
|
||||
}
|
||||
|
||||
// VersionResponse is the JSON payload returned by the /version endpoint.
|
||||
type VersionResponse struct {
|
||||
ClientMode string `json:"clientMode"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// Version handles GET /version and returns the server name and client mode.
|
||||
func (s *APIServer) Version(w http.ResponseWriter, r *http.Request) {
|
||||
resp := VersionResponse{
|
||||
ClientMode: s.erupeConfig.ClientMode,
|
||||
Name: "Erupe-CE",
|
||||
}
|
||||
w.Header().Add("Content-Type", "application/json")
|
||||
_ = json.NewEncoder(w).Encode(resp)
|
||||
}
|
||||
|
||||
// Launcher handles GET /launcher and returns banners, messages, and links for the launcher UI.
|
||||
func (s *APIServer) Launcher(w http.ResponseWriter, r *http.Request) {
|
||||
var respData LauncherResponse
|
||||
|
||||
Reference in New Issue
Block a user