mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-25 00:54:05 +01:00
feat(api): add GET /v2/server/info endpoint for launcher compatibility
Exposes the server's configured client mode in a form that mhf-outpost and other launcher tools can consume to warn users when their local game version does not match what the server expects. Returns clientMode (raw, e.g. "G9.1") and manifestId (normalized for mhf-outpost: lowercase, dots stripped, e.g. "g91"). No auth required.
This commit is contained in:
@@ -156,6 +156,32 @@ func (s *APIServer) Version(w http.ResponseWriter, r *http.Request) {
|
||||
_ = json.NewEncoder(w).Encode(resp)
|
||||
}
|
||||
|
||||
// ServerInfoResponse is the JSON payload returned by GET /v2/server/info.
|
||||
// It exposes the server's configured game version in a form that launcher
|
||||
// tools (e.g. mhf-outpost) can use to check version compatibility.
|
||||
type ServerInfoResponse struct {
|
||||
// ClientMode is the version string as configured in Erupe (e.g. "ZZ", "G10.1").
|
||||
ClientMode string `json:"clientMode"`
|
||||
// ManifestID is the normalized form of ClientMode (lowercase, dots removed)
|
||||
// matching mhf-outpost manifest IDs (e.g. "zz", "g101").
|
||||
ManifestID string `json:"manifestId"`
|
||||
// Name is the server software name.
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// ServerInfo handles GET /v2/server/info, returning the server's configured
|
||||
// game version in a format compatible with mhf-outpost manifest IDs.
|
||||
func (s *APIServer) ServerInfo(w http.ResponseWriter, r *http.Request) {
|
||||
clientMode := s.erupeConfig.ClientMode
|
||||
resp := ServerInfoResponse{
|
||||
ClientMode: clientMode,
|
||||
ManifestID: strings.ToLower(strings.ReplaceAll(clientMode, ".", "")),
|
||||
Name: "Erupe-CE",
|
||||
}
|
||||
w.Header().Set("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