Merge branch 'master' of ssb://%MeCTQrz9uszf9EZoTnKCeFeIedhnKWuB3JHW2l1g9NA=.sha256

This commit is contained in:
Anders Rune Jensen
2018-04-16 09:52:22 +02:00
+18 -6
View File
@@ -120,6 +120,9 @@ exports.init = function (sbot, config) {
pull( pull(
sbot.createUserStream({ id: feedId, reverse: true, limit: showAll ? -1 : (ext == 'rss' ? 25 : 10) }), sbot.createUserStream({ id: feedId, reverse: true, limit: showAll ? -1 : (ext == 'rss' ? 25 : 10) }),
pull.filter(function (data) {
return 'object' === typeof data.value.content
}),
pull.collect(function (err, logs) { pull.collect(function (err, logs) {
if (err) return respond(res, 500, err.stack || err) if (err) return respond(res, 500, err.stack || err)
res.writeHead(200, { res.writeHead(200, {
@@ -279,12 +282,7 @@ exports.init = function (sbot, config) {
var format = formatMsgs(id, ext, opts) var format = formatMsgs(id, ext, opts)
if (format === null) return respond(res, 415, 'Invalid format') if (format === null) return respond(res, 415, 'Invalid format')
pull( function render (links) {
sbot.links({dest: id, values: true }),
includeRoot && prepend(getMsg, id),
pull.unique('key'),
pull.collect(function (err, links) {
if (err) return respond(res, 500, err.stack || err)
var etag = hash(sort.heads(links).concat(appHash, ext, qs)) var etag = hash(sort.heads(links).concat(appHash, ext, qs))
if (req.headers['if-none-match'] === etag) return respond(res, 304) if (req.headers['if-none-match'] === etag) return respond(res, 304)
res.writeHead(200, { res.writeHead(200, {
@@ -299,8 +297,22 @@ exports.init = function (sbot, config) {
if (err) console.error('[viewer]', err) if (err) console.error('[viewer]', err)
}) })
) )
}
getMsgWithValue(sbot, id, function (err, root) {
if (err) return respond(res, 500, err.stack || err)
if('string' === typeof root.value.content)
return render([root])
pull(
sbot.links({dest: id, values: true, rel: 'root' }),
pull.unique('key'),
pull.collect(function (err, links) {
if (err) return respond(res, 500, err.stack || err)
render(links)
}) })
) )
})
} }
function addFollowAbout(msg, cb) { function addFollowAbout(msg, cb) {