mirror of
https://github.com/balzack/databag.git
synced 2025-03-13 09:00:06 +00:00
using repeater for new fcm endpoint
This commit is contained in:
parent
c8a743558f
commit
1554600a27
@ -121,9 +121,8 @@ func SendPushEvent(account store.Account, event string) {
|
||||
if pushToken == "" || pushToken == "null" {
|
||||
continue;
|
||||
}
|
||||
url := "https://fcm.googleapis.com/fcm/send"
|
||||
payload := Payload{ Title: messageTitle, Body: messageBody, Sound: "default" };
|
||||
message := Message{ Notification: payload, To: pushToken };
|
||||
url := "https://repeater.coredb.org/notify"
|
||||
message := PushMessage{ Title: messageTitle, Body: messageBody, Token: pushToken };
|
||||
|
||||
body, err := json.Marshal(message)
|
||||
if err != nil {
|
||||
@ -136,7 +135,6 @@ func SendPushEvent(account store.Account, event string) {
|
||||
continue
|
||||
}
|
||||
req.Header.Set("Content-Type", "application/json; charset=utf-8")
|
||||
req.Header.Set("Authorization", "key=AAAAkgDXt8c:APA91bEjH67QpUWU6uAfCIXLqm0kf6AdPNVICZPCcWbmgW9NGYIErAxMDTy4LEbe4ik93Ho4Z-AJNIhr6nXXKC9qKmyKkkYHJWAEVH47_FXBQV6rsoi9ZB_oiuV66XKKAy1V40GmvfaX")
|
||||
client := &http.Client{}
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
|
@ -619,3 +619,13 @@ type Ring struct {
|
||||
|
||||
IcePassword string `json:"icePassword"`
|
||||
}
|
||||
|
||||
type PushMessage struct {
|
||||
Title string `json:"title"`
|
||||
Body string `json:"body"`
|
||||
Token string `json:"token"`
|
||||
}
|
||||
|
||||
type PushResponse struct {
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user