1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2025-06-11 15:19:02 +02:00

Implement push subscription expiry

This commit is contained in:
nimbleghost 2023-06-02 14:45:05 +02:00
parent 47ad024ec7
commit 0f0074cbab
16 changed files with 272 additions and 102 deletions
server

View file

@ -468,10 +468,29 @@ type apiStripeSubscriptionDeletedEvent struct {
}
type webPushPayload struct {
Event string `json:"event"`
SubscriptionID string `json:"subscription_id"`
Message message `json:"message"`
}
func newWebPushPayload(subscriptionID string, message message) webPushPayload {
return webPushPayload{
Event: "message",
SubscriptionID: subscriptionID,
Message: message,
}
}
type webPushControlMessagePayload struct {
Event string `json:"event"`
}
func newWebPushSubscriptionExpiringPayload() webPushControlMessagePayload {
return webPushControlMessagePayload{
Event: "subscription_expiring",
}
}
type webPushSubscription struct {
BrowserSubscription webpush.Subscription
UserID string