From 5676477b1884c76513de82f06af423ff5f8919ad Mon Sep 17 00:00:00 2001 From: Justin Walrath Date: Sun, 11 May 2025 20:59:51 -0400 Subject: [PATCH] Updated the podcast rss feed to throw the full image url into imageUrl --- src/common/helpers/data.ts | 13 ++++++++++++- src/pages/api/[stream]/feed.ts | 4 ++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/common/helpers/data.ts b/src/common/helpers/data.ts index 083cedb..90bc8c0 100644 --- a/src/common/helpers/data.ts +++ b/src/common/helpers/data.ts @@ -38,9 +38,20 @@ export const preparePodcastItem = (podcast: PodcastDto) => { export const prepareStreamItem = (stream?: StreamDto) => { if (!stream) return undefined; + + const imageUrl = stream.imageUrl ? convertUrlToPublic(stream.imageUrl) : undefined; return { ...stream, - imageUrl: convertUrlToPublic(stream.imageUrl) + imageUrl//, + // customElements: [ + // { + // image: [ + // { url: imageUrl }, + // { title: stream.title }//, + // //{ link: stream.link } + // ] + // } + //] }; }; diff --git a/src/pages/api/[stream]/feed.ts b/src/pages/api/[stream]/feed.ts index d3cd161..4fb139a 100644 --- a/src/pages/api/[stream]/feed.ts +++ b/src/pages/api/[stream]/feed.ts @@ -1,14 +1,14 @@ import { NextApiRequest, NextApiResponse } from 'next'; import { Podcast } from 'podcast'; import { getPodcasts, getStream } from '../../../common/data/db'; -import { preparePodcastItem } from '../../../common/helpers/data'; +import { preparePodcastItem, prepareStreamItem } from '../../../common/helpers/data'; export default async function handler( req: NextApiRequest, res: NextApiResponse ) { const { stream } = req.query, - data = await getStream(stream as string), + data = prepareStreamItem(await getStream(stream as string)), items = (await getPodcasts(stream as string)).map(preparePodcastItem), feed = new Podcast(data);