fix: IMAP-Serveradresse dynamisch aus Backend laden

Hardcodierte 192.168.1.131 in settings/page.tsx ersetzt durch
dynamischen API-Call GET /api/system/info → {fqdn, imap_port}.
Fallback auf window.location.hostname wenn API nicht antwortet.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
sysops
2026-04-06 11:06:58 +02:00
parent 3b05e949dd
commit 2a91f6e249
5 changed files with 70 additions and 4 deletions
+1
View File
@@ -191,6 +191,7 @@ func (s *Server) routes() {
s.mux.HandleFunc("GET /api/health", s.handleHealth)
s.mux.HandleFunc("GET /metrics", s.handleMetrics)
s.mux.HandleFunc("GET /api/version", s.handleVersion)
s.mux.HandleFunc("GET /api/system/info", s.auth(s.handleSystemInfo))
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))
+18
View File
@@ -0,0 +1,18 @@
package api
import "net/http"
// handleSystemInfo liefert öffentliche System-Verbindungsdaten
// (FQDN, IMAP-Port). Wird im Frontend für die IMAP-Zugang-Karte
// auf der Settings-Seite verwendet.
//
// GET /api/system/info — auth required (Endpoint zeigt nur generische,
// nicht-sensitive Verbindungsdaten an, ist aber an Login gebunden, um
// öffentliches Profiling der Installation zu vermeiden).
func (s *Server) handleSystemInfo(w http.ResponseWriter, r *http.Request) {
writeJSON(w, http.StatusOK, map[string]interface{}{
"fqdn": s.fqdn,
"imap_port": 9993,
"imap_port_alt": 993,
})
}