Skip to content

Commit

Permalink
using repeater for new fcm endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
rolandosborne committed Sep 16, 2024
1 parent c8a7435 commit 1554600
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 2 additions & 4 deletions net/server/internal/api_setPushEvent.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
10 changes: 10 additions & 0 deletions net/server/internal/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}

0 comments on commit 1554600

Please sign in to comment.