Restore Spotify iframe on individual episode detail pages; v1.1.7

The per-episode player (chosen in /admin) reverts to the Spotify embed
iframe — only the /episodes listing page uses the new custom player.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
nmemmert
2026-07-22 14:37:25 -04:00
parent 1e24eaa9af
commit 939e7b9da4
2 changed files with 16 additions and 21 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "siteforge", "name": "siteforge",
"private": true, "private": true,
"version": "1.1.6", "version": "1.1.7",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
+15 -20
View File
@@ -1282,21 +1282,6 @@ function EpisodeDetailPage({ content }: { content: SiteContent }) {
const { id } = useParams<{ id: string }>() const { id } = useParams<{ id: string }>()
const episode = (content.podcastFeaturedLinks ?? []).find(e => e.id === id) const episode = (content.podcastFeaturedLinks ?? []).find(e => e.id === id)
const [resolvedEmbedUrl, setResolvedEmbedUrl] = useState('') const [resolvedEmbedUrl, setResolvedEmbedUrl] = useState('')
const [audioUrl, setAudioUrl] = useState('')
// Fetch the direct MP3 URL from the RSS-backed episodes list, matching by title
useEffect(() => {
if (!episode) return
fetch('/api/episodes')
.then(r => r.ok ? r.json() : Promise.reject())
.then((data: { episodes?: { title: string; audioUrl: string }[] }) => {
const match = (data.episodes ?? []).find(e =>
e.title?.trim().toLowerCase() === episode.title?.trim().toLowerCase()
)
if (match?.audioUrl) setAudioUrl(match.audioUrl)
})
.catch(() => {})
}, [episode])
useEffect(() => { useEffect(() => {
let cancelled = false let cancelled = false
@@ -1398,12 +1383,22 @@ function EpisodeDetailPage({ content }: { content: SiteContent }) {
<h1 className="episode-detail-title">{episode.title}</h1> <h1 className="episode-detail-title">{episode.title}</h1>
{episode.summary && <p className="episode-detail-summary">{episode.summary}</p>} {episode.summary && <p className="episode-detail-summary">{episode.summary}</p>}
{(episode.embedUrl || episode.url || audioUrl) && ( {(episode.embedUrl || episode.url) && (
<div className="episode-detail-embed"> <div className="episode-detail-embed">
{audioUrl ? ( {resolvedEmbedUrl ? (
<EpisodeAudioPlayer src={audioUrl} title={episode.title} size="full" spotifyUrl={episode.url || content.platformSpotifyUrl} /> resolvedEmbedUrl.includes('spotify.com') ? (
) : resolvedEmbedUrl ? ( <iframe
<EpisodeAudioPlayer src={resolvedEmbedUrl} title={episode.title} size="full" spotifyUrl={episode.url || content.platformSpotifyUrl} /> src={resolvedEmbedUrl}
title={episode.title}
width="100%"
height="152"
frameBorder="0"
allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture"
loading="lazy"
/>
) : (
<EpisodeAudioPlayer src={resolvedEmbedUrl} title={episode.title} size="full" spotifyUrl={episode.url || content.platformSpotifyUrl} />
)
) : ( ) : (
<div className="episode-embed-skeleton" aria-label="Loading player…" /> <div className="episode-embed-skeleton" aria-label="Loading player…" />
)} )}