aboutsummaryrefslogtreecommitdiff
path: root/lib/serve.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/serve.js')
-rw-r--r--lib/serve.js35
1 files changed, 32 insertions, 3 deletions
diff --git a/lib/serve.js b/lib/serve.js
index d702ee6..810b887 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -3477,9 +3477,6 @@ Serve.prototype.composer = function (opts, cb) {
key: data.upload.key,
}
}
- if (data.blob_type && blobs[data.blob_link]) {
- blobs[data.blob_link].type = data.blob_type
- }
var channel = data.channel != null ? data.channel : opts.channel
var formNames = {}
@@ -3502,6 +3499,14 @@ Serve.prototype.composer = function (opts, cb) {
}
}
+ var blobIds = u.toArray(data.blob_id)
+ var blobTypes = u.toArray(data.blob_type)
+ for (var i = 0; i < blobIds.length && i < blobTypes.length; i++) {
+ var id = blobIds[i]
+ var blob = blobs[id] || (blobs[id] = {})
+ blob.type = blobTypes[i]
+ }
+
if (data.upload) {
var href = data.upload.link
+ (data.upload.key ? '?unbox=' + data.upload.key + '.boxs': '')
@@ -3551,6 +3556,17 @@ Serve.prototype.composer = function (opts, cb) {
return {name: name, id: id}
})
+ var blobMentions = mentions
+ .filter(function (mention) {
+ return mention
+ && typeof mention.link === 'string'
+ && mention.link[0] === '&'
+ })
+ blobMentions.forEach(function (mention) {
+ var blob = blobs[mention.link]
+ if (blob) mention.type = blob.type
+ })
+
// strip content other than names and feed ids from the recps field
if (data.recps) {
data.recps = recpsToFeedIds(data.recps)
@@ -3605,6 +3621,19 @@ Serve.prototype.composer = function (opts, cb) {
h('input', {type: 'file', name: 'emoji_upload_' + i}))
}))
] : '',
+ blobMentions.length > 0 ? [
+ h('div', h('em', 'blobs:')),
+ h('ul.mentions', blobMentions.map(function (link, i) {
+ var linkHref = self.app.render.toUrl(link.link)
+ return h('li',
+ h('a', {href: linkHref}, link.name || link.link), ': ',
+ h('input', {name: 'blob_id', type: 'hidden',
+ value: link.link}),
+ h('input', {name: 'blob_type', size: 24,
+ value: link.type, placeholder: 'application/octet-stream',
+ title: 'blob mime-type'}))
+ }))
+ ] : '',
h('table.ssb-msgs',
h('tr.msg-row',
h('td.msg-left', {colspan: 2},