Whitespace-only alignment from gofmt; removes a stray BOM in web.go. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -19,6 +19,10 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); version
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
- ci: gofmt on eight files that failed the formatting workflow check (panel
|
||||||
|
config, DNS check, domain transfer export, rate-limit tests, auth principal,
|
||||||
|
domain and delivery handlers, web package doc comment).
|
||||||
|
|
||||||
- docs: full-tree review plan ([docs/plans/code-review.md](docs/plans/code-review.md))
|
- docs: full-tree review plan ([docs/plans/code-review.md](docs/plans/code-review.md))
|
||||||
— architecture, quality, GUI, tests, licence; P0 is domain-admin send-log
|
— architecture, quality, GUI, tests, licence; P0 is domain-admin send-log
|
||||||
authorization. Roadmap queues that plan ahead of inbound-relay and records
|
authorization. Roadmap queues that plan ahead of inbound-relay and records
|
||||||
|
|||||||
+10
-10
@@ -53,16 +53,16 @@ type config struct {
|
|||||||
mailLog string
|
mailLog string
|
||||||
retentionDays int
|
retentionDays int
|
||||||
|
|
||||||
dataDir string
|
dataDir string
|
||||||
dbPath string
|
dbPath string
|
||||||
manifestPath string
|
manifestPath string
|
||||||
setupTokenPath string
|
setupTokenPath string
|
||||||
hostname string
|
hostname string
|
||||||
cookieSecure bool
|
cookieSecure bool
|
||||||
submissionEnabled bool
|
submissionEnabled bool
|
||||||
trustedProxies []*net.IPNet
|
trustedProxies []*net.IPNet
|
||||||
sessionIdleDays int
|
sessionIdleDays int
|
||||||
dnsResolvers []string
|
dnsResolvers []string
|
||||||
rateLimitMessagesPerIP int
|
rateLimitMessagesPerIP int
|
||||||
rateLimitWindowSeconds int
|
rateLimitWindowSeconds int
|
||||||
|
|
||||||
|
|||||||
@@ -70,12 +70,12 @@ type Domain struct {
|
|||||||
// compares DNS against the key this server actually signs with. Hostname and
|
// compares DNS against the key this server actually signs with. Hostname and
|
||||||
// ServerIPs identify this server and come from a preceding Server check.
|
// ServerIPs identify this server and come from a preceding Server check.
|
||||||
type Query struct {
|
type Query struct {
|
||||||
Name string
|
Name string
|
||||||
Selector string
|
Selector string
|
||||||
ExpectedDKIM string
|
ExpectedDKIM string
|
||||||
Hostname string
|
Hostname string
|
||||||
ServerIPs []string
|
ServerIPs []string
|
||||||
DMARCReportEmail string // resolved rua= destination; empty = policy-only template
|
DMARCReportEmail string // resolved rua= destination; empty = policy-only template
|
||||||
}
|
}
|
||||||
|
|
||||||
// resolver is the slice of *net.Resolver this package uses, as an interface so
|
// resolver is the slice of *net.Resolver this package uses, as an interface so
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ type DomainExport struct {
|
|||||||
Version string `json:"version"`
|
Version string `json:"version"`
|
||||||
Domain string `json:"domain"`
|
Domain string `json:"domain"`
|
||||||
DKIMSelector string `json:"dkim_selector"`
|
DKIMSelector string `json:"dkim_selector"`
|
||||||
DKIMPrivateKey string `json:"dkim_private_key"` // PKCS#1 PEM
|
DKIMPrivateKey string `json:"dkim_private_key"` // PKCS#1 PEM
|
||||||
DMARCRua *string `json:"dmarc_rua,omitempty"` // nil = inherit profile; set = override ("" = none)
|
DMARCRua *string `json:"dmarc_rua,omitempty"` // nil = inherit profile; set = override ("" = none)
|
||||||
Applications []AppExport `json:"applications"`
|
Applications []AppExport `json:"applications"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,9 +152,9 @@ func TestDeleteRateLimitsForDomain(t *testing.T) {
|
|||||||
func TestRateLimitActiveAndAllowsIP(t *testing.T) {
|
func TestRateLimitActiveAndAllowsIP(t *testing.T) {
|
||||||
inactive := []RateLimit{
|
inactive := []RateLimit{
|
||||||
{},
|
{},
|
||||||
{Scope: RateLimitScopeDomain, AllowedIPs: []string{"203.0.113.1"}}, // no ceiling
|
{Scope: RateLimitScopeDomain, AllowedIPs: []string{"203.0.113.1"}}, // no ceiling
|
||||||
{Scope: RateLimitScopeDomain, MaxMessages: 5}, // no window
|
{Scope: RateLimitScopeDomain, MaxMessages: 5}, // no window
|
||||||
{Scope: RateLimitScopeApp, MaxMessages: 5, WindowSeconds: 60}, // app needs IPs
|
{Scope: RateLimitScopeApp, MaxMessages: 5, WindowSeconds: 60}, // app needs IPs
|
||||||
{Scope: RateLimitScopeApp, AllowedIPs: []string{"203.0.113.1"}, MaxMessages: 5}, // no window
|
{Scope: RateLimitScopeApp, AllowedIPs: []string{"203.0.113.1"}, MaxMessages: 5}, // no window
|
||||||
}
|
}
|
||||||
for i, rl := range inactive {
|
for i, rl := range inactive {
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import (
|
|||||||
type ctxKey int
|
type ctxKey int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
usernameKey ctxKey = 0
|
usernameKey ctxKey = 0
|
||||||
principalKey ctxKey = 1
|
principalKey ctxKey = 1
|
||||||
)
|
)
|
||||||
|
|
||||||
// Role is a panel user's access level.
|
// Role is a panel user's access level.
|
||||||
|
|||||||
@@ -124,10 +124,10 @@ func (h *Handlers) HandleDeleteConfirm(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
h.view.Render(w, http.StatusOK, "domain_delete", map[string]any{
|
h.view.Render(w, http.StatusOK, "domain_delete", map[string]any{
|
||||||
"Title": "SelfPost — delete " + d.Name,
|
"Title": "SelfPost — delete " + d.Name,
|
||||||
"User": auth.CurrentUser(r),
|
"User": auth.CurrentUser(r),
|
||||||
"Active": "domains",
|
"Active": "domains",
|
||||||
"Domain": d,
|
"Domain": d,
|
||||||
"IsGlobal": true,
|
"IsGlobal": true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,11 +107,11 @@ func (h *Handlers) HandleDelivery(w http.ResponseWriter, r *http.Request) {
|
|||||||
row.Subject = mailhdr.DecodeSubject(row.Subject)
|
row.Subject = mailhdr.DecodeSubject(row.Subject)
|
||||||
logRows, logNote := h.deliveryLog(row)
|
logRows, logNote := h.deliveryLog(row)
|
||||||
h.view.Render(w, http.StatusOK, "delivery", map[string]any{
|
h.view.Render(w, http.StatusOK, "delivery", map[string]any{
|
||||||
"Title": "SelfPost — delivery",
|
"Title": "SelfPost — delivery",
|
||||||
"User": auth.CurrentUser(r),
|
"User": auth.CurrentUser(r),
|
||||||
"Active": "deliveries",
|
"Active": "deliveries",
|
||||||
"IsGlobal": p.IsGlobal(),
|
"IsGlobal": p.IsGlobal(),
|
||||||
"Row": row,
|
"Row": row,
|
||||||
// The status in the panel's own badge vocabulary, so the headline reads
|
// The status in the panel's own badge vocabulary, so the headline reads
|
||||||
// the same way as every other health signal in the panel.
|
// the same way as every other health signal in the panel.
|
||||||
"Level": deliveryLevel(row.Status),
|
"Level": deliveryLevel(row.Status),
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
// Package web implements the SelfPost control panel's HTTP surface: the
|
// Package web implements the SelfPost control panel's HTTP surface: the
|
||||||
// one-time administrator setup flow (security.md), login/session handling
|
// one-time administrator setup flow (security.md), login/session handling
|
||||||
// (security.md) and the authenticated shell the later phases build on.
|
// (security.md) and the authenticated shell the later phases build on.
|
||||||
package web
|
package web
|
||||||
|
|||||||
Reference in New Issue
Block a user