From 8cd02ff64ceaa1190107430aa5d78b17d154e64a Mon Sep 17 00:00:00 2001 From: overtorment Date: Sun, 15 Dec 2024 14:15:56 +0000 Subject: [PATCH] FIX: FCM pushes fixed due to deprecation of legacy api --- README.md | 2 ++ src/class/GroundControlToMajorTom.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d308b0c..9a033dd 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,7 @@ Set them as env variables or put them into `.env` file in project root dir. - `BITCOIN_RPC` for example `http://username:password@host:8332` - `APNS_TOPIC` for example `io.bluewallet.bluewallet` - `GOOGLE_KEY_FILE` - json file with Google key for FCM, in hex +- `GOOGLE_PROJECT_ID` - acquired with the key file ### Getting certificates @@ -101,6 +102,7 @@ Set them as env variables or put them into `.env` file in project root dir. - outdated https://dev.to/jakubkoci/react-native-push-notifications-313i - https://stackoverflow.com/questions/44631803/ios-swift-how-to-create-p8-file/67533665#67533665 - get P8 hex `xxd -p file.p8 | tr -d '\n'` (google key file as well) +- https://firebase.google.com/docs/cloud-messaging/migrate-v1 ### License diff --git a/src/class/GroundControlToMajorTom.ts b/src/class/GroundControlToMajorTom.ts index 0f4cfe6..9556b77 100644 --- a/src/class/GroundControlToMajorTom.ts +++ b/src/class/GroundControlToMajorTom.ts @@ -309,7 +309,7 @@ export class GroundControlToMajorTom { } // @ts-ignore - const rawResponse = await fetch("https://fcm.googleapis.com/v1/projects/bluewallet-d7cd5/messages:send", { + const rawResponse = await fetch(`https://fcm.googleapis.com/v1/projects/${process.env.GOOGLE_PROJECT_ID}/messages:send`, { method: "POST", headers: { Authorization: `Bearer ${bearer}`,