eleven / messenger Public

Fix Apple push 403: pass bare e-mail as VAPID subscriber

webpush-go prepends 'mailto:' to the Subscriber, so passing 'mailto:admin@luan.chat'
produced sub='mailto:mailto:...' — which Apple rejects as BadJwtToken (Mozilla
accepted it leniently, hence Firefox worked but Safari/iOS didn't). Pass the bare
e-mail so the JWT sub is well-formed.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Paul Campbell c868c78124ae1c7da427464d99b152841e26d837 parent f05053e
1 file changed, +3 −1
  • push.go +3 −1
diff --git a/push.go b/push.go
index 6f21e8f..62b84ca 100644
--- a/push.go
+++ b/push.go
@@ -109,7 +109,9 @@ func (s *Server) sendToAll(payload []byte, kind string) int {
Endpoint: sub.Endpoint,
Keys: webpush.Keys{P256dh: sub.P256dh, Auth: sub.Auth},
}, &webpush.Options{
- Subscriber: "mailto:admin@luan.chat",
+ // Pass the bare e-mail: webpush-go prepends "mailto:" itself. Passing
+ // "mailto:…" yields "mailto:mailto:…", which Apple rejects (BadJwtToken).
+ Subscriber: "admin@luan.chat",
VAPIDPublicKey: s.vapidPub,
VAPIDPrivateKey: s.vapidPriv,
TTL: 60,