mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
feat(site): add webpush notification serviceworker (#17123)
* Improves tests for webpush notifications
* Sets subscriber correctly in web push payload (without this,
notifications do not work in Safari)
* NOTE: for now, I'm using the Coder Access URL. Some push messaging
service don't like it when you use a non-HTTPS URL, so dropping a warn
log about this.
* Adds a service worker and context for push notifications
* Adds a button beside "Inbox" to enable / disable push notifications
Notes:
* ✅ Tested in in Firefox and Safari, and Chrome.
This commit is contained in:
@ -284,7 +284,7 @@ func NewOptions(t testing.TB, options *Options) (func(http.Handler), context.Can
|
||||
|
||||
if options.WebpushDispatcher == nil {
|
||||
// nolint:gocritic // Gets/sets VAPID keys.
|
||||
pushNotifier, err := webpush.New(dbauthz.AsNotifier(context.Background()), options.Logger, options.Database)
|
||||
pushNotifier, err := webpush.New(dbauthz.AsNotifier(context.Background()), options.Logger, options.Database, "http://example.com")
|
||||
if err != nil {
|
||||
panic(xerrors.Errorf("failed to create web push notifier: %w", err))
|
||||
}
|
||||
|
Reference in New Issue
Block a user