9d4942aef6
Three HTMX-polled monitoring screens (spec 7.2.11-13): send log with server-side domain/application filters and pagination, Postfix queue (postqueue -p), and a mail.log tail. Fragment endpoints return HTML snippets, not JSON (spec 7.1); all output is auto-escaped via html/template (spec 7.6.7). Adds store.QuerySendLog/CountSendLog/ListApplicationLogins, postfix.Queue(), and logtail.TailLines (a point-in-time reverse read, independent of the background follow loop). Verified on the dev server: gofmt/vet/test green, docker build green, container e2e (filters, 60-row pagination, <script> escaping, real postqueue/mail.log output, existing Reload button unaffected). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
23 lines
691 B
Go
23 lines
691 B
Go
package postfix
|
|
|
|
import (
|
|
"fmt"
|
|
"os/exec"
|
|
"strings"
|
|
)
|
|
|
|
// Queue returns Postfix's own human-readable mail-queue listing (spec 7.2.11):
|
|
// active, deferred and held messages, exactly as an administrator would see
|
|
// via the CLI. The command takes a single fixed flag and no user input, so it
|
|
// never goes through a shell (spec 7.6.3). The panel is responsible for
|
|
// escaping the output before display (spec 7.6.7); this function returns it
|
|
// as-is.
|
|
func Queue() (string, error) {
|
|
cmd := exec.Command("postqueue", "-p")
|
|
out, err := cmd.CombinedOutput()
|
|
if err != nil {
|
|
return "", fmt.Errorf("postqueue -p: %w: %s", err, strings.TrimSpace(string(out)))
|
|
}
|
|
return string(out), nil
|
|
}
|