git ssb

9+

cel / ssb-viewer



Commit f41ee2c2c804f38dab9cbe2f218bc8d429e0e5cc

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

Anders Rune Jensen committed on 4/16/2018, 7:52:22 AM
Parent: f09e7259ef382ed0b8862e0631cc1f157bbc101a
Parent: 728dd36ef62070f884bb5a7854652d466aaf5fe2

Files changed

index.jschanged
index.jsView
@@ -119,8 +119,11 @@
119119 }
120120
121121 pull(
122122 sbot.createUserStream({ id: feedId, reverse: true, limit: showAll ? -1 : (ext == 'rss' ? 25 : 10) }),
123 + pull.filter(function (data) {
124 + return 'object' === typeof data.value.content
125 + }),
123126 pull.collect(function (err, logs) {
124127 if (err) return respond(res, 500, err.stack || err)
125128 res.writeHead(200, {
126129 'Content-Type': ctype(ext)
@@ -234,9 +237,9 @@
234237 pull.values(logs),
235238 paramap(addAuthorAbout, 8),
236239 paramap(addVoteMessage, 8),
237240 pull(renderThread(defaultOpts, '',
238- renderShowAll(showAll, req.url)),
241 + renderShowAll(showAll, req.url)),
239242 wrapPage('#' + channelId)),
240243 toPull(res, function (err) {
241244 if (err) console.error('[viewer]', err)
242245 })
@@ -278,30 +281,39 @@
278281
279282 var format = formatMsgs(id, ext, opts)
280283 if (format === null) return respond(res, 415, 'Invalid format')
281284
282- pull(
283- sbot.links({dest: id, values: true }),
284- includeRoot && prepend(getMsg, id),
285- pull.unique('key'),
286- pull.collect(function (err, links) {
287- if (err) return respond(res, 500, err.stack || err)
288- var etag = hash(sort.heads(links).concat(appHash, ext, qs))
289- if (req.headers['if-none-match'] === etag) return respond(res, 304)
290- res.writeHead(200, {
291- 'Content-Type': ctype(ext),
292- 'etag': etag
285 + function render (links) {
286 + var etag = hash(sort.heads(links).concat(appHash, ext, qs))
287 + if (req.headers['if-none-match'] === etag) return respond(res, 304)
288 + res.writeHead(200, {
289 + 'Content-Type': ctype(ext),
290 + 'etag': etag
291 + })
292 + pull(
293 + pull.values(sort(links)),
294 + paramap(addAuthorAbout, 8),
295 + format,
296 + toPull(res, function (err) {
297 + if (err) console.error('[viewer]', err)
293298 })
294- pull(
295- pull.values(sort(links)),
296- paramap(addAuthorAbout, 8),
297- format,
298- toPull(res, function (err) {
299- if (err) console.error('[viewer]', err)
300- })
301- )
302- })
303- )
299 + )
300 + }
301 +
302 + getMsgWithValue(sbot, id, function (err, root) {
303 + if (err) return respond(res, 500, err.stack || err)
304 + if('string' === typeof root.value.content)
305 + return render([root])
306 +
307 + pull(
308 + sbot.links({dest: id, values: true, rel: 'root' }),
309 + pull.unique('key'),
310 + pull.collect(function (err, links) {
311 + if (err) return respond(res, 500, err.stack || err)
312 + render(links)
313 + })
314 + )
315 + })
304316 }
305317
306318 function addFollowAbout(msg, cb) {
307319 if (msg.value.content.contact)

Built with git-ssb-web