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:
+1
-1
@@ -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
@@ -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…" />
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user