Downgrade Web Push urgency for unimportant messages
For instance TAGMSG and MARKREAD aren't really high urgency.
This commit is contained in:
parent
1ee5dc062d
commit
05a382ef16
10
server.go
10
server.go
@ -303,12 +303,20 @@ func (s *Server) sendWebPush(ctx context.Context, sub *webpush.Subscription, vap
|
|||||||
ctx, cancel := context.WithTimeout(ctx, 15*time.Second)
|
ctx, cancel := context.WithTimeout(ctx, 15*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
|
var urgency webpush.Urgency
|
||||||
|
switch msg.Command {
|
||||||
|
case "PRIVMSG", "NOTICE", "INVITE":
|
||||||
|
urgency = webpush.UrgencyHigh
|
||||||
|
default:
|
||||||
|
urgency = webpush.UrgencyNormal
|
||||||
|
}
|
||||||
|
|
||||||
options := webpush.Options{
|
options := webpush.Options{
|
||||||
VAPIDPublicKey: s.webPush.VAPIDKeys.Public,
|
VAPIDPublicKey: s.webPush.VAPIDKeys.Public,
|
||||||
VAPIDPrivateKey: s.webPush.VAPIDKeys.Private,
|
VAPIDPrivateKey: s.webPush.VAPIDKeys.Private,
|
||||||
Subscriber: "https://soju.im",
|
Subscriber: "https://soju.im",
|
||||||
TTL: 7 * 24 * 60 * 60, // seconds
|
TTL: 7 * 24 * 60 * 60, // seconds
|
||||||
Urgency: webpush.UrgencyHigh,
|
Urgency: urgency,
|
||||||
RecordSize: 2048,
|
RecordSize: 2048,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user