diff --git a/main.go b/main.go index e01a0d4..2c6740a 100644 --- a/main.go +++ b/main.go @@ -27,7 +27,7 @@ func pushHandler(c *gin.Context) { if err := c.BindJSON(&form); err != nil { log.Println(err) - AbortWithError(c, http.StatusBadRequest, "Missing some parameters like token or platform or message") + AbortWithError(c, http.StatusBadRequest, "Bad input request, please refer to README guide.") return } diff --git a/notification.go b/notification.go index 438aaad..4ead808 100644 --- a/notification.go +++ b/notification.go @@ -34,6 +34,7 @@ type RequestPushNotification struct { ContentAvailable bool `json:"content_available,omitempty"` // Android + To string `json:"to,omitempty"` CollapseKey string `json:"collapse_key,omitempty"` DelayWhileIdle bool `json:"delay_while_idle,omitempty"` TimeToLive uint `json:"time_to_live,omitempty"` @@ -53,6 +54,7 @@ type RequestPushNotification struct { URLArgs []string `json:"url-args,omitempty"` Extend []ExtendJSON `json:"extend,omitempty"` Alert alert `json:"alert,omitempty"` + // meta IDs []uint64 `json:"seq_id,omitempty"` } @@ -192,8 +194,8 @@ func pushNotificationAndroid(req RequestPushNotification) bool { notification.RegistrationIds = req.Tokens - if len(req.Topic) > 0 { - notification.To = req.Topic + if len(req.To) > 0 { + notification.To = req.To } if len(req.Priority) > 0 && req.Priority == "high" {