Bluesky app fork with some witchin' additions 💫

Fixed Apple Music song embeds. (#9220)

* Fixed Apple Music song embeds when using a direct song link (vs playlist or album).

* Fixed song embed test.

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Jason Ericson <jasonmarkericson@gmail.com>
Co-authored-by: Samuel Newman <mozzius@protonmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

authored by

Jason Ericson
Copilot
Jason Ericson
Samuel Newman
and committed by
GitHub
faa49fee 55b3474a

+17 -2
+6
__tests__/lib/string.test.ts
··· 378 378 'https://music.apple.com/us/playlist/playlistName/playlistId', 379 379 'https://music.apple.com/us/album/albumName/albumId', 380 380 'https://music.apple.com/us/album/albumName/albumId?i=songId', 381 + 'https://music.apple.com/us/song/songName/songId', 381 382 382 383 'https://vimeo.com/videoId', 383 384 'https://vimeo.com/videoId?autoplay=0', ··· 603 604 source: 'appleMusic', 604 605 playerUri: 605 606 'https://embed.music.apple.com/us/album/albumName/albumId?i=songId', 607 + }, 608 + { 609 + type: 'apple_music_song', 610 + source: 'appleMusic', 611 + playerUri: 'https://embed.music.apple.com/us/song/songName/songId', 606 612 }, 607 613 608 614 {
+11 -2
src/lib/strings/embed-player.ts
··· 239 239 const type = pathParams[2] 240 240 const songId = urlp.searchParams.get('i') 241 241 242 - if (pathParams.length === 5 && (type === 'playlist' || type === 'album')) { 242 + if ( 243 + pathParams.length === 5 && 244 + (type === 'playlist' || type === 'album' || type === 'song') 245 + ) { 243 246 // We want to append the songId to the end of the url if it exists 244 247 const embedUri = `https://embed.music.apple.com${urlp.pathname}${ 245 - urlp.search ? '?i=' + songId : '' 248 + songId ? `?i=${songId}` : '' 246 249 }` 247 250 248 251 if (type === 'playlist') { ··· 264 267 source: 'appleMusic', 265 268 playerUri: embedUri, 266 269 } 270 + } 271 + } else if (type === 'song') { 272 + return { 273 + type: 'apple_music_song', 274 + source: 'appleMusic', 275 + playerUri: embedUri, 267 276 } 268 277 } 269 278 }