mirror of
https://github.com/binwiederhier/ntfy.git
synced 2025-06-11 23:29:06 +02:00
Simplify web push UX and updates
- Use a single endpoint - Use a declarative web push sync hook. This thus handles all edge cases that had to be manually handled before: logout, login, account sync, etc. - Simplify UX: browser notifications are always enabled (unless denied), web push toggle only shows up if permissions are already granted.
This commit is contained in:
parent
4944e3ae4b
commit
47ad024ec7
20 changed files with 294 additions and 427 deletions
server
|
@ -1,12 +1,13 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"heckel.io/ntfy/log"
|
||||
"heckel.io/ntfy/user"
|
||||
"net/http"
|
||||
"net/netip"
|
||||
"time"
|
||||
|
||||
"heckel.io/ntfy/log"
|
||||
"heckel.io/ntfy/user"
|
||||
|
||||
"github.com/SherClockHolmes/webpush-go"
|
||||
"heckel.io/ntfy/util"
|
||||
)
|
||||
|
@ -476,10 +477,7 @@ type webPushSubscription struct {
|
|||
UserID string
|
||||
}
|
||||
|
||||
type webPushSubscribePayload struct {
|
||||
type webPushSubscriptionPayload struct {
|
||||
BrowserSubscription webpush.Subscription `json:"browser_subscription"`
|
||||
}
|
||||
|
||||
type webPushUnsubscribePayload struct {
|
||||
Endpoint string `json:"endpoint"`
|
||||
Topics []string `json:"topics"`
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue