mirror of
https://github.com/balzack/databag.git
synced 2025-03-13 00:50:03 +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" {
|
if pushToken == "" || pushToken == "null" {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
url := "https://fcm.googleapis.com/fcm/send"
|
url := "https://repeater.coredb.org/notify"
|
||||||
payload := Payload{ Title: messageTitle, Body: messageBody, Sound: "default" };
|
message := PushMessage{ Title: messageTitle, Body: messageBody, Token: pushToken };
|
||||||
message := Message{ Notification: payload, To: pushToken };
|
|
||||||
|
|
||||||
body, err := json.Marshal(message)
|
body, err := json.Marshal(message)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -136,7 +135,6 @@ func SendPushEvent(account store.Account, event string) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
req.Header.Set("Content-Type", "application/json; charset=utf-8")
|
req.Header.Set("Content-Type", "application/json; charset=utf-8")
|
||||||
req.Header.Set("Authorization", "key=AAAAkgDXt8c:APA91bEjH67QpUWU6uAfCIXLqm0kf6AdPNVICZPCcWbmgW9NGYIErAxMDTy4LEbe4ik93Ho4Z-AJNIhr6nXXKC9qKmyKkkYHJWAEVH47_FXBQV6rsoi9ZB_oiuV66XKKAy1V40GmvfaX")
|
|
||||||
client := &http.Client{}
|
client := &http.Client{}
|
||||||
resp, err := client.Do(req)
|
resp, err := client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -619,3 +619,13 @@ type Ring struct {
|
|||||||
|
|
||||||
IcePassword string `json:"icePassword"`
|
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