Skip to content

Commit

Permalink
Merge pull request #767 from podverse/develop
Browse files Browse the repository at this point in the history
Release v4.16.26
  • Loading branch information
mitchdowney authored Sep 12, 2024
2 parents b85b9af + f476192 commit 44f3736
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "podverse-api",
"version": "4.16.25",
"version": "4.16.26",
"description": "Data API, database migration scripts, and backend services for all Podverse models.",
"private": true,
"contributors": [
Expand Down
9 changes: 0 additions & 9 deletions src/lib/notifications/fcmGoogleApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,13 @@ import { config } from '~/config';
const fs = require('fs');

const keyFilePath = config.fcmGoogleApiPathToAuthJson;
console.log('keyFilePath', keyFilePath)
const key = JSON.parse(fs.readFileSync(keyFilePath, 'utf8'));
console.log('key', key)

const fcmGoogleApiPath = `https://fcm.googleapis.com/v1/projects/${key.project_id}/messages:send`
console.log('fcmGoogleApiPath', fcmGoogleApiPath)

export const sendFcmNewEpisodeDetectedNotification = async (options: SendNotificationOptions) => {
console.log('sendFcmNewEpisodeDetectedNotification', options)
const { podcastId, podcastShrunkImageUrl, podcastFullImageUrl, episodeFullImageUrl, episodeId } = options
const fcmTokens = await getFCMTokensForPodcastId(podcastId)
console.log('sendFcmNewEpisodeDetectedNotification fcmTokens', fcmTokens.length)
const podcastTitle = options.podcastTitle || 'Untitled Podcast'
const episodeTitle = options.episodeTitle || 'Untitled Episode'
const title = podcastTitle
Expand All @@ -42,10 +37,8 @@ export const sendFcmNewEpisodeDetectedNotification = async (options: SendNotific
}

export const sendFcmLiveItemLiveDetectedNotification = async (options: SendNotificationOptions) => {
console.log('sendFcmLiveItemLiveDetectedNotification', options)
const { podcastId, podcastShrunkImageUrl, podcastFullImageUrl, episodeFullImageUrl, episodeId } = options
const fcmTokens = await getFCMTokensForPodcastId(podcastId)
console.log('sendFcmLiveItemLiveDetectedNotification fcmTokens', fcmTokens.length)
const podcastTitle = options.podcastTitle || 'Untitled Podcast'
const episodeTitle = options.episodeTitle || 'Livestream starting'
const title = `LIVE: ${podcastTitle}`
Expand Down Expand Up @@ -80,13 +73,11 @@ export const sendFCMGoogleApiNotification = async (
episodeImage?: string,
episodeId?: string
) => {
console.log('sendFCMGoogleApiNotification', fcmTokens.length, title, podcastId)
const accessToken = await generateAccessToken()

if (!fcmTokens || fcmTokens.length === 0) return

for (const fcmToken of fcmTokens) {
console.log('fcmToken', fcmToken)
const imageUrl = episodeImage || podcastImage
try {
await request(fcmGoogleApiPath, {
Expand Down

0 comments on commit 44f3736

Please sign in to comment.