Update Wavlake embed URL, add support for album & artist links (#439)

* Update wavlake embed url

* Make regex more explicit, remove allow from iframe

* Prettify changes
This commit is contained in:
Michael Rhee
2023-03-14 12:07:59 -05:00
committed by GitHub
parent 877d018da3
commit 2b0cd75f98
3 changed files with 5 additions and 5 deletions

View File

@ -168,4 +168,5 @@ export const MagnetRegex = /(magnet:[\S]+)/i;
/**
* Wavlake embed regex
*/
export const WavlakeRegex = /player\.wavlake\.com\/(track)\/([.a-zA-Z0-9-]+)/;
export const WavlakeRegex =
/player\.wavlake\.com\/(?!feed\/)(track\/[.a-zA-Z0-9-]+|album\/[.a-zA-Z0-9-]+|[.a-zA-Z0-9-]+)/i;

View File

@ -1,14 +1,13 @@
const WavlakeEmbed = ({ link }: { link: string }) => {
const convertedUrl = link.replace(/\/(track)\/([a-zA-Z0-9]+)/, "/embed/$1/$2");
const convertedUrl = link.replace("player.wavlake.com", "embed.wavlake.com");
return (
<iframe
style={{ borderRadius: 12 }}
src={convertedUrl}
width="100%"
height="360"
height="380"
frameBorder="0"
allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture"
loading="lazy"></iframe>
);
};