diff --git a/index.js b/index.js index 49e9729..e29f56b 100644 --- a/index.js +++ b/index.js @@ -184,13 +184,13 @@ exports.init = function (sbot, config) { function serveFeeds(req, res, following, channelSubscriptions, feedId, name) { pull( - sbot.createLogStream({ reverse: true, limit: 2500 }), + sbot.createLogStream({ reverse: true, limit: 5000 }), pull.filter((msg) => { return !msg.value || (msg.value.author in following || msg.value.content.channel in channelSubscriptions) }), - pull.take(100), + pull.take(150), pull.collect(function (err, logs) { if (err) return respond(res, 500, err.stack || err) res.writeHead(200, { @@ -273,7 +273,7 @@ exports.init = function (sbot, config) { if (format === null) return respond(res, 415, 'Invalid format') pull( - sbot.links({dest: id, values: true, rel: 'root'}), + sbot.links({dest: id, values: true }), includeRoot && prepend(getMsg, id), pull.unique('key'), pull.collect(function (err, links) { diff --git a/render.js b/render.js index b21878a..e604ddb 100644 --- a/render.js +++ b/render.js @@ -32,6 +32,7 @@ MdRenderer.prototype.urltransform = function(href) { case "%": return this.opts.msg_base + encodeURIComponent(href); case "@": + href = this.opts.mentions[href.substr(1)] || href; return this.opts.feed_base + encodeURIComponent(href); case "&": return this.opts.blob_base + encodeURIComponent(href); @@ -56,11 +57,14 @@ MdRenderer.prototype.image = function(href, title, text) { function renderEmoji(emoji) { var opts = this.renderer.opts; - return emoji in emojis + var mentions = opts.mentions; + var url = mentions[emoji] + ? opts.blob_base + encodeURIComponent(mentions[emoji]) + : emoji in emojis && opts.emoji_base + escape(emoji) + '.png'; + return url ? ':' +
         escape(emoji) +
         ':" + msg.author.name + "" + - msgTimestamp(msg, name) + + msgTimestamp(msg, opts.base + name) + '' + '' + '' + @@ -446,13 +450,13 @@ function renderRss(opts, msg) { ); } -function msgTimestamp(msg, name) { +function msgTimestamp(msg, link) { var date = new Date(msg.value.timestamp); var isoStr = date.toISOString(); return ( '' @@ -561,6 +565,10 @@ function render(opts, c) { } function renderPost(opts, c) { + opts.mentions = {}; + if (Array.isArray(c.mentions)) c.mentions.forEach(function (link) { + if (link && link.name && link.link) opts.mentions[link.name] = link.link; + }); return '
' + marked(String(c.text), opts.marked) + "
"; }