feat: App-Version 0.9.1 + Modulversionsnummern
- version.go: AppVersion + Modules-Map (pro Modul interne Versionsnummer) - GET /api/version: liefert App- und Modulversionen (ohne Auth) - archivmail version: zeigt App- und Modulversionen in CLI - version-Konstante aus cmd_import.go entfernt (war falsche Stelle) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+12
-3
@@ -73,11 +73,13 @@ type Server struct {
|
||||
pop3Store *pop3store.Store
|
||||
pop3Importer *pop3store.Importer
|
||||
uploadJobs sync.Map // jobID → *UploadJob
|
||||
labels *labelstore.Store // PROJ-9: label management
|
||||
labels *labelstore.Store
|
||||
ldapStore *ldapcfg.Store
|
||||
tenantStore *tenantstore.Store
|
||||
tenantLdapStore *ldapcfg.TenantStore // PROJ-23: per-tenant LDAP config
|
||||
idxMgr *index.TenantIndexManager // PROJ-21 Phase 4: per-tenant Xapian index
|
||||
tenantLdapStore *ldapcfg.TenantStore
|
||||
idxMgr *index.TenantIndexManager
|
||||
appVersion string
|
||||
moduleVersions map[string]string
|
||||
}
|
||||
|
||||
// SetSMTPDaemon wires the SMTP daemon into the API server after construction.
|
||||
@@ -103,6 +105,12 @@ func (s *Server) SetIndexManager(mgr *index.TenantIndexManager) {
|
||||
s.idxMgr = mgr
|
||||
}
|
||||
|
||||
// SetVersion wires app version and module versions into the API server.
|
||||
func (s *Server) SetVersion(appVersion string, modules map[string]string) {
|
||||
s.appVersion = appVersion
|
||||
s.moduleVersions = modules
|
||||
}
|
||||
|
||||
// New creates and wires up a new API server.
|
||||
func New(
|
||||
cfg config.APIConfig,
|
||||
@@ -139,6 +147,7 @@ func (s *Server) authAdmin(h http.HandlerFunc) http.HandlerFunc {
|
||||
|
||||
func (s *Server) routes() {
|
||||
s.mux.HandleFunc("GET /api/health", s.handleHealth)
|
||||
s.mux.HandleFunc("GET /api/version", s.handleVersion)
|
||||
s.mux.HandleFunc("POST /api/auth/login", s.handleLogin)
|
||||
s.mux.HandleFunc("GET /api/auth/me", s.auth(s.handleMe))
|
||||
s.mux.HandleFunc("POST /api/auth/logout", s.auth(s.handleLogout))
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package api
|
||||
|
||||
import "net/http"
|
||||
|
||||
// handleVersion liefert App- und Modulversionen.
|
||||
// GET /api/version — öffentlich (kein Auth erforderlich).
|
||||
func (s *Server) handleVersion(w http.ResponseWriter, r *http.Request) {
|
||||
writeJSON(w, http.StatusOK, map[string]interface{}{
|
||||
"version": s.appVersion,
|
||||
"modules": s.moduleVersions,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user