index.jsView |
---|
115 | 115 … | }) |
116 | 116 … | pull( |
117 | 117 … | pull.values(logs), |
118 | 118 … | paramap(addAuthorAbout, 8), |
| 119 … | + paramap(addBlog, 8), |
119 | 120 … | paramap(addFollowAbout, 8), |
120 | 121 … | paramap(addVoteMessage, 8), |
121 | 122 … | paramap(addGitLinks, 8), |
122 | 123 … | render(), |
200 | 201 … | }) |
201 | 202 … | pull( |
202 | 203 … | pull.values(logs), |
203 | 204 … | paramap(addAuthorAbout, 8), |
| 205 … | + paramap(addBlog, 8), |
204 | 206 … | paramap(addFollowAbout, 8), |
205 | 207 … | paramap(addVoteMessage, 8), |
206 | 208 … | paramap(addGitLinks, 8), |
207 | 209 … | pull(renderThread(feedOpts), wrapPage(name)), |
230 | 232 … | }) |
231 | 233 … | pull( |
232 | 234 … | pull.values(logs), |
233 | 235 … | paramap(addAuthorAbout, 8), |
| 236 … | + paramap(addBlog, 8), |
234 | 237 … | paramap(addVoteMessage, 8), |
235 | 238 … | pull(renderThread(defaultOpts, '', renderShowAll(req.url)), |
236 | 239 … | wrapPage('#' + channelId)), |
237 | 240 … | toPull(res, function (err) { |
293 | 296 … | }) |
294 | 297 … | pull( |
295 | 298 … | pull.values(sort(links)), |
296 | 299 … | paramap(addAuthorAbout, 8), |
| 300 … | + paramap(addBlog, 8), |
297 | 301 … | format, |
298 | 302 … | toPull(res, function (err) { |
|
299 | 303 … | if (err) console.error('[viewer]', err) |
300 | 304 … | }) |
315 | 319 … | cb(null, msg) |
316 | 320 … | } |
317 | 321 … | |
318 | 322 … | function addVoteMessage(msg, cb) { |
319 | | - if (msg.value.content.type == 'vote' && msg.value.content.vote.link[0] == '%') |
| 323 … | + if (msg.value.content.type == 'vote' && msg.value.content.vote && msg.value.content.vote.link[0] == '%') |
320 | 324 … | getMsg(msg.value.content.vote.link, function (err, linkedMsg) { |
321 | 325 … | if (linkedMsg) |
322 | 326 … | msg.value.content.vote.linkedText = linkedMsg.value.content.text |
323 | 327 … | cb(null, msg) |
325 | 329 … | else |
326 | 330 … | cb(null, msg) |
327 | 331 … | } |
328 | 332 … | |
| 333 … | + function addBlog(msg, cb) { |
| 334 … | + if (msg.value && msg.value.content.type == "blog") { |
| 335 … | + pull( |
| 336 … | + sbot.blobs.get(msg.value.content.blog), |
| 337 … | + pull.collect(function(err, blob) { |
| 338 … | + msg.value.content.blogContent = blob |
| 339 … | + cb(null, msg) |
| 340 … | + }) |
| 341 … | + ) |
| 342 … | + } else |
| 343 … | + cb(null, msg) |
| 344 … | + } |
| 345 … | + |
329 | 346 … | function addAuthorAbout(msg, cb) { |
330 | 347 … | getAbout(msg.value.author, function (err, about) { |
331 | 348 … | if (err) return cb(err) |
332 | 349 … | msg.author = about |