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:
sysops
2026-03-31 01:12:51 +02:00
parent 64433aa847
commit 4f7a7d6946
5 changed files with 57 additions and 5 deletions
+12 -3
View File
@@ -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))
+12
View File
@@ -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,
})
}