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

This commit is contained in:
Anders Rune Jensen
2018-04-16 09:52:22 +02:00
+34 -22
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, {
@@ -235,7 +238,7 @@ exports.init = function (sbot, config) {
paramap(addAuthorAbout, 8), paramap(addAuthorAbout, 8),
paramap(addVoteMessage, 8), paramap(addVoteMessage, 8),
pull(renderThread(defaultOpts, '', pull(renderThread(defaultOpts, '',
renderShowAll(showAll, req.url)), renderShowAll(showAll, req.url)),
wrapPage('#' + channelId)), wrapPage('#' + channelId)),
toPull(res, function (err) { toPull(res, function (err) {
if (err) console.error('[viewer]', err) if (err) console.error('[viewer]', err)
@@ -279,28 +282,37 @@ 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 }), var etag = hash(sort.heads(links).concat(appHash, ext, qs))
includeRoot && prepend(getMsg, id), if (req.headers['if-none-match'] === etag) return respond(res, 304)
pull.unique('key'), res.writeHead(200, {
pull.collect(function (err, links) { 'Content-Type': ctype(ext),
if (err) return respond(res, 500, err.stack || err) 'etag': etag
var etag = hash(sort.heads(links).concat(appHash, ext, qs))
if (req.headers['if-none-match'] === etag) return respond(res, 304)
res.writeHead(200, {
'Content-Type': ctype(ext),
'etag': etag
})
pull(
pull.values(sort(links)),
paramap(addAuthorAbout, 8),
format,
toPull(res, function (err) {
if (err) console.error('[viewer]', err)
})
)
}) })
) pull(
pull.values(sort(links)),
paramap(addAuthorAbout, 8),
format,
toPull(res, function (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) {