mirror of
https://github.com/binwiederhier/ntfy.git
synced 2025-09-02 01:55:14 +02:00
Small refactor
This commit is contained in:
parent
2f5acee798
commit
75a4b5bd88
8 changed files with 98 additions and 113 deletions
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue