using repeater for new fcm endpoint

This commit is contained in:
Roland Osborne 2024-09-15 21:32:40 -07:00
parent c8a743558f
commit 1554600a27
2 changed files with 12 additions and 4 deletions

View File

@ -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 {

View File

@ -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"`
}