Add the Web Push sender for the push channel (Feature 19)
CI / ci (push) Successful in 5m23s
CI / ci (pull_request) Successful in 5m25s

push.Sender implements notify.Sender for the "push" channel with
webpush-go and the VAPID key pair: it sends {title, body, url, tag} to
every stored subscription with a TTL of 12 hours, one request each.
Per subscription, an accepted notification records last_success_at, any
failure increments failure_count, and a 404 or 410 deletes the
subscription. Send succeeds when one device accepted it or when there
are no subscriptions (logged as nothing to send); otherwise it returns
an error so the outbox retries. Errors and logs name subscriptions by
id; a transport *url.Error is unwrapped so the endpoint is never quoted.

A mailto: VAPID subject is passed to webpush-go as its bare address,
since webpush-go prefixes mailto: itself.

The server registers the sender with the notify service.

Maestro task 32a1a4ad-9221-46de-8468-3ffce19b108c.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-09 13:13:15 -04:00
co-authored by Claude Opus 5.5
parent 104396da55
commit 8fe68659bd
8 changed files with 910 additions and 0 deletions
+7
View File
@@ -149,6 +149,13 @@ func run(cfg config.Config, logger *slog.Logger) error {
if err != nil {
return err
}
pushSender, err := push.NewSender(db, logger, cfg.VAPID.PublicKey, cfg.VAPID.PrivateKey.Reveal(), cfg.VAPID.Subject)
if err != nil {
return err
}
if err := notifier.Register(notify.ChannelPush, pushSender); err != nil {
return err
}
sessions, err := auth.NewSessionManager(db, cfg.SessionIdle, cfg.SessionMax)
if err != nil {