added support for spotify playlist embeds

This commit is contained in:
hzrd149
2023-02-15 15:23:34 -06:00
parent 228c3435ee
commit ee34fd2470

View File

@@ -127,20 +127,23 @@ const embeds: EmbedType[] = [
// Spotify // Spotify
// note12xt2pjpwp6gec95p4cw0qzecy764f8wzgcl3z2ufkrkne4t5d2zse3ze78 // note12xt2pjpwp6gec95p4cw0qzecy764f8wzgcl3z2ufkrkne4t5d2zse3ze78
{ {
regexp: /https?:\/\/open\.spotify\.com\/(track|episode|album)\/(\w+)[^\s]*/im, regexp: /https?:\/\/open\.spotify\.com\/(track|episode|album|playlist)\/(\w+)[^\s]*/im,
render: (match) => ( render: (match) => {
<iframe const isList = match[1] === "album" || match[1] === "playlist";
style={{ borderRadius: "12px" }} return (
width="100%" <iframe
height={match[1] === "album" ? 400 : 152} style={{ borderRadius: "12px" }}
title="Spotify Embed: Beethoven - Fur Elise - Komuz Remix" width="100%"
frameBorder="0" height={isList ? 400 : 152}
allowFullScreen title="Spotify Embed: Beethoven - Fur Elise - Komuz Remix"
allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" frameBorder="0"
loading="lazy" allowFullScreen
src={`https://open.spotify.com/embed/${match[1]}/${match[2]}`} allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture"
></iframe> loading="lazy"
), src={`https://open.spotify.com/embed/${match[1]}/${match[2]}`}
></iframe>
);
},
name: "Spotify", name: "Spotify",
isMedia: true, isMedia: true,
}, },