aboutsummaryrefslogtreecommitdiff
path: root/lib/serve.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/serve.js')
-rw-r--r--lib/serve.js19
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/serve.js b/lib/serve.js
index 448b18b..3c9334f 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -3027,6 +3027,16 @@ Serve.prototype.wrapMyChannels = function (opts) {
})
}
+var blobPrefixesByType = {
+ audio: 'audio:',
+ video: 'video:',
+}
+
+var blobPrefixesByExt = {
+ mp3: 'audio:',
+ mp4: 'video:',
+}
+
Serve.prototype.composer = function (opts, cb) {
var self = this
opts = opts || {}
@@ -3078,10 +3088,13 @@ Serve.prototype.composer = function (opts, cb) {
var href = data.upload.link
+ (data.upload.key ? '?unbox=' + data.upload.key + '.boxs': '')
// TODO: be able to change the content-type
- var isImage = /^image\//.test(data.upload.type)
+ var blobType = String(data.upload.type).split('/')[0]
+ var blobExt = String(data.upload.name).split('.').pop()
+ var blobPrefix = blobPrefixesByType[blobType] || blobPrefixesByExt[blobExt] || ''
+ var isMedia = blobPrefix || blobType === 'image'
data.text = (data.text ? data.text + '\n' : '')
- + (isImage ? '!' : '')
- + '[' + data.upload.name + '](' + href + ')'
+ + (isMedia ? '!' : '')
+ + '[' + blobPrefix + data.upload.name + '](' + href + ')'
}
// get bare feed names