added IMAP, LetsEncrypt, update layout

This commit is contained in:
2026-08-12 21:14:19 +01:00
parent 6e103959b0
commit 70fa1a5f2c
222 changed files with 42947 additions and 14038 deletions
+14 -28
View File
@@ -23,29 +23,17 @@ func (a *App) dashboard(w http.ResponseWriter, r *http.Request) {
a.Logger.Error("dashboard: %v", err)
}
var domainCount, senderCount, dkimCount int
if isGlobal {
domainCount, _ = a.DB.CountActiveDomains()
senderCount, _ = a.DB.CountActiveSenders()
dkimCount, _ = a.DB.CountActiveDKIMKeys()
} else {
domains, _ := a.DB.ListDomains()
for _, d := range domains {
if d.IsActive && scope.Allowed(d.ID) {
domainCount++
}
// Domain/sender/mailbox/DKIM counts are injected uniformly into every page by
// render() (see computeNavCounts) — only "near quota" is dashboard-specific,
// so it's the only mailbox stat still computed here.
var mailboxesNearQuota int
mailboxes, _ := a.DB.ListMailboxes()
for _, m := range mailboxes {
if !m.IsActive || (!isGlobal && !scope.Allowed(m.DomainID)) {
continue
}
senders, _ := a.DB.ListSenders()
for _, s := range senders {
if s.IsActive && scope.Allowed(s.DomainID) {
senderCount++
}
}
keys, _ := a.DB.ListActiveDKIMKeysWithDomain()
for _, k := range keys {
if scope.Allowed(k.DomainID) {
dkimCount++
}
if m.QuotaBytes > 0 && float64(m.UsedBytes)/float64(m.QuotaBytes)*100 >= 90 {
mailboxesNearQuota++
}
}
@@ -75,12 +63,10 @@ func (a *App) dashboard(w http.ResponseWriter, r *http.Request) {
}
a.render(w, r, "dashboard.html", M{
"active": "dashboard",
"domain_count": domainCount,
"sender_count": senderCount,
"dkim_count": dkimCount,
"recent_emails": recentEmails,
"recent_auths": recentAuths,
"active": "dashboard",
"mailboxes_near_quota": mailboxesNearQuota,
"recent_emails": recentEmails,
"recent_auths": recentAuths,
})
}