From e724c1e7e87f2c329f406e1d6371de8c299e6911 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Acid=20Chicken=20=28=E7=A1=AB=E9=85=B8=E9=B6=8F=29?=
 <root@acid-chicken.com>
Date: Thu, 9 Aug 2018 03:32:09 +0900
Subject: [PATCH] Update url-preview.vue

---
 src/client/app/common/views/components/url-preview.vue | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/client/app/common/views/components/url-preview.vue b/src/client/app/common/views/components/url-preview.vue
index 1e625f69ed..2c265a9a71 100644
--- a/src/client/app/common/views/components/url-preview.vue
+++ b/src/client/app/common/views/components/url-preview.vue
@@ -2,6 +2,9 @@
 <iframe v-if="youtubeId" type="text/html" height="250"
 	:src="`https://www.youtube.com/embed/${youtubeId}?origin=${misskeyUrl}`"
 	frameborder="0"/>
+<iframe v-else-if="spotifyId"
+	:src="`https://open.spotify.com/embed/track/${spotifyId}`"
+	frameborder="0" allowtransparency="true" allow="encrypted-media" />
 <div v-else-if="tweetUrl && detail" class="twitter">
 	<blockquote ref="tweet" class="twitter-tweet" :data-theme="$store.state.device.darkmode ? 'dark' : null">
 		<a :href="url"></a>
@@ -60,6 +63,8 @@ export default Vue.extend({
 			this.youtubeId = url.searchParams.get('v');
 		} else if (url.hostname == 'youtu.be') {
 			this.youtubeId = url.pathname;
+		} else if (url.hostname == 'open.spotify.com') {
+			this.spotifyId = url.pathname.split('/').reverse().filter(x => x !== '')[0];
 		} else if (this.detail && url.hostname == 'twitter.com' && /^\/.+\/status(es)?\/\d+/.test(url.pathname)) {
 			this.tweetUrl = url;
 			const twttr = (window as any).twttr || {};