1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2025-09-02 01:55:14 +02:00

Small refactor

This commit is contained in:
binwiederhier 2023-06-08 12:20:12 -04:00
parent 2f5acee798
commit 75a4b5bd88
8 changed files with 98 additions and 113 deletions

View file

@ -467,15 +467,21 @@ type apiStripeSubscriptionDeletedEvent struct {
Customer string `json:"customer"`
}
// List of possible Web Push events
const (
webPushMessageEvent = "message"
webPushExpiringEvent = "subscription_expiring"
)
type webPushPayload struct {
Event string `json:"event"`
SubscriptionID string `json:"subscription_id"`
Message message `json:"message"`
Event string `json:"event"`
SubscriptionID string `json:"subscription_id"`
Message *message `json:"message"`
}
func newWebPushPayload(subscriptionID string, message message) webPushPayload {
func newWebPushPayload(subscriptionID string, message *message) webPushPayload {
return webPushPayload{
Event: "message",
Event: webPushMessageEvent,
SubscriptionID: subscriptionID,
Message: message,
}
@ -487,7 +493,7 @@ type webPushControlMessagePayload struct {
func newWebPushSubscriptionExpiringPayload() webPushControlMessagePayload {
return webPushControlMessagePayload{
Event: "subscription_expiring",
Event: webPushExpiringEvent,
}
}