From 1f4ecae7b9dd55f412c1e75645dbebf638f95474 Mon Sep 17 00:00:00 2001 From: Jason Panay Date: Thu, 21 Oct 2021 01:21:39 -0400 Subject: [PATCH 1/2] feat(EmbeddedLinkContent): spotify parsing added --- .../EmbeddedLinkContent/EmbeddedLinkContent.vue | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/components/ui/Embeds/EmbeddedLinkContent/EmbeddedLinkContent.vue b/components/ui/Embeds/EmbeddedLinkContent/EmbeddedLinkContent.vue index 9d644add4a..7011137c54 100644 --- a/components/ui/Embeds/EmbeddedLinkContent/EmbeddedLinkContent.vue +++ b/components/ui/Embeds/EmbeddedLinkContent/EmbeddedLinkContent.vue @@ -118,7 +118,19 @@ export default Vue.extend({ ref: this.setRefId( `https://player.twitch.tv/?${videoId}&parent=localhost&autoplay=false` ), - aspectRatioClass: 'iframe-container-16-9', + aspectRatioClass: 'iframe-container-9-16', + } + } + if (link.includes('spotify')) { + const videoID = link.split('track/')[1].split('?')[0] + + return { + src: `https://open.spotify.com/embed/track/${videoID}?utm_source=generator`, + type: 'iframe', + ref: this.setRefId( + `https://open.spotify.com/embed/track/${videoID}?utm_source=generator` + ), + aspectRatioClass: 'iframe-container-9-16', } } else { return {} From 3ecc7c9ba97b82e5a78d747d0a791dcde86085b6 Mon Sep 17 00:00:00 2001 From: Jason Panay Date: Thu, 21 Oct 2021 01:32:45 -0400 Subject: [PATCH 2/2] fix(EmbeddedLinkContent): stops spotify embed links from double posting --- .../ui/Embeds/EmbeddedLinkContent/EmbeddedLinkContent.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/ui/Embeds/EmbeddedLinkContent/EmbeddedLinkContent.vue b/components/ui/Embeds/EmbeddedLinkContent/EmbeddedLinkContent.vue index 7011137c54..5b64bdf329 100644 --- a/components/ui/Embeds/EmbeddedLinkContent/EmbeddedLinkContent.vue +++ b/components/ui/Embeds/EmbeddedLinkContent/EmbeddedLinkContent.vue @@ -121,7 +121,7 @@ export default Vue.extend({ aspectRatioClass: 'iframe-container-9-16', } } - if (link.includes('spotify')) { + if (link.includes('spotify') && !link.includes('embed')) { const videoID = link.split('track/')[1].split('?')[0] return { @@ -130,7 +130,7 @@ export default Vue.extend({ ref: this.setRefId( `https://open.spotify.com/embed/track/${videoID}?utm_source=generator` ), - aspectRatioClass: 'iframe-container-9-16', + aspectRatioClass: 'iframe-container-16-9', } } else { return {}