1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2025-05-30 18:29:16 +02:00

Minor changes

This commit is contained in:
binwiederhier 2023-06-17 21:51:04 -04:00
parent 30a8f66db2
commit 020996ea04
7 changed files with 61 additions and 26 deletions

View file

@ -120,7 +120,6 @@ func (s *Server) pruneAndNotifyWebPushSubscriptionsInternal() error {
}
payload, err := json.Marshal(newWebPushSubscriptionExpiringPayload())
if err != nil {
log.Tag(tagWebPush).Err(err).Warn("Unable to marshal expiring payload")
return err
}
warningSent := make([]*webPushSubscription, 0)
@ -140,7 +139,14 @@ func (s *Server) pruneAndNotifyWebPushSubscriptionsInternal() error {
func (s *Server) sendWebPushNotification(sub *webPushSubscription, message []byte, contexters ...log.Contexter) error {
log.Tag(tagWebPush).With(sub).With(contexters...).Debug("Sending web push message")
resp, err := webpush.SendNotification(message, sub.ToSubscription(), &webpush.Options{
payload := &webpush.Subscription{
Endpoint: sub.Endpoint,
Keys: webpush.Keys{
Auth: sub.Auth,
P256dh: sub.P256dh,
},
}
resp, err := webpush.SendNotification(message, payload, &webpush.Options{
Subscriber: s.config.WebPushEmailAddress,
VAPIDPublicKey: s.config.WebPushPublicKey,
VAPIDPrivateKey: s.config.WebPushPrivateKey,