From 3210283ae2783952c3724be188f2db8132885a38 Mon Sep 17 00:00:00 2001
From: dtluna <dtluna@openmailbox.org>
Date: Tue, 22 Nov 2016 21:45:18 +0300
Subject: [PATCH] Add audio player

---
 src/components/attachment/attachment.js  | 4 ++++
 src/components/attachment/attachment.vue | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/src/components/attachment/attachment.js b/src/components/attachment/attachment.js
index 99958589..47ca03de 100644
--- a/src/components/attachment/attachment.js
+++ b/src/components/attachment/attachment.js
@@ -23,6 +23,10 @@ const Attachment = {
         type = 'video'
       };
 
+      if (this.attachment.mimetype.match(/ogg|audio/)) {
+        type = 'audio'
+      }
+
       return type
     }
   },
diff --git a/src/components/attachment/attachment.vue b/src/components/attachment/attachment.vue
index 0e2a228a..4e8c1407 100644
--- a/src/components/attachment/attachment.vue
+++ b/src/components/attachment/attachment.vue
@@ -8,6 +8,8 @@
 
     <video v-if="type === 'video' && !nsfw" :src="attachment.url" controls></video>
 
+    <audio v-if="type === 'audio'" :src="attachment.url" controls></audio>
+
     <span v-if="type === 'unknown'">Don't know how to display this...</span>
 
     <div v-if="type === 'html' && attachment.oembed" class="oembed">
@@ -42,6 +44,10 @@
               width: 100%;
           }
 
+          audio {
+              width: 100%;
+          }
+
           img.media-upload {
               width: 100%;
               height: 100%;