diff options
author | 2025-01-31 06:57:32 -0800 | |
---|---|---|
committer | 2025-01-31 14:57:32 +0000 | |
commit | fc895ade0262e27aff6a49bf33a460158a744beb (patch) | |
tree | ed2def3e018c98237d46d04c4bc2ee7003a3802f /internal | |
parent | [bugfix] shut down LE server nicely (#3714) (diff) | |
download | gotosocial-fc895ade0262e27aff6a49bf33a460158a744beb.tar.xz |
[chore] Web Push: Use server URL for VAPID sub claim (#3716)
webpush-go now supports sending `https://` as well as `mailto:` URLs for VAPID sub claims, so we can revert 464d920cfd9d6e362afdbe7ebdbf87f90fb50e0d now and save fetching the instance contact email or making up a dummy email if there wasn't one configured.
Diffstat (limited to 'internal')
-rw-r--r-- | internal/webpush/realsender.go | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/internal/webpush/realsender.go b/internal/webpush/realsender.go index 4c4657957..4faf57fb2 100644 --- a/internal/webpush/realsender.go +++ b/internal/webpush/realsender.go @@ -81,18 +81,6 @@ func (r *realSender) Send( return gtserror.Newf("error getting VAPID key pair: %w", err) } - // Get contact email for this instance, if available. - domain := config.GetHost() - instance, err := r.state.DB.GetInstance(ctx, domain) - if err != nil { - return gtserror.Newf("error getting current instance: %w", err) - } - vapidSubjectEmail := instance.ContactEmail - if vapidSubjectEmail == "" { - // Instance contact email not configured. Use a dummy address. - vapidSubjectEmail = "admin@" + domain - } - // Get target account settings. targetAccountSettings, err := r.state.DB.GetAccountSettings(ctx, notification.TargetAccountID) if err != nil { @@ -111,7 +99,6 @@ func (r *realSender) Send( if err := r.sendToSubscription( ctx, vapidKeyPair, - vapidSubjectEmail, targetAccountSettings, subscription, notification, @@ -134,7 +121,6 @@ func (r *realSender) Send( func (r *realSender) sendToSubscription( ctx context.Context, vapidKeyPair *gtsmodel.VAPIDKeyPair, - vapidSubjectEmail string, targetAccountSettings *gtsmodel.AccountSettings, subscription *gtsmodel.WebPushSubscription, notification *gtsmodel.Notification, @@ -185,7 +171,7 @@ func (r *realSender) sendToSubscription( }, &webpushgo.Options{ HTTPClient: r.httpClient, - Subscriber: vapidSubjectEmail, + Subscriber: "https://" + config.GetHost(), VAPIDPublicKey: vapidKeyPair.Public, VAPIDPrivateKey: vapidKeyPair.Private, TTL: int(TTL.Seconds()), |