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:
Houmgaor
2026-02-21 00:40:28 +01:00
parent f9d9260274
commit ad3fcbf908
3 changed files with 18 additions and 0 deletions

View File

@@ -55,6 +55,7 @@ func (s *APIServer) Start() error {
r.HandleFunc("/character/export", s.ExportSave)
r.HandleFunc("/api/ss/bbs/upload.php", s.ScreenShot)
r.HandleFunc("/api/ss/bbs/{id}", s.ScreenShotGet)
r.HandleFunc("/version", s.Version)
handler := handlers.CORS(handlers.AllowedHeaders([]string{"Content-Type"}))(r)
s.httpServer.Handler = handlers.LoggingHandler(os.Stdout, handler)
s.httpServer.Addr = fmt.Sprintf(":%d", s.erupeConfig.API.Port)