git ssb

3+

ev / starboard



Tree: ee66696629dc72e9da2c959f1baa0c55642d1aa4

Files: ee66696629dc72e9da2c959f1baa0c55642d1aa4 / seven.js

782 bytesRaw
1var pull = require('pull-stream')
2var paramap = require('pull-paramap')
3var ssbClient = require('ssb-client')
4var avatar = require('ssb-avatar')
5var render = require('./render')
6
7var listMessages = function () {
8 ssbClient(function (err, sbot) {
9 if (err) throw err
10 sbot.whoami(function getId(err, me) {
11 if (err) throw err
12 pull(sbot.messagesByType({
13 type: 'post',
14 limit: 7,
15 reverse: true
16 }),
17 paramap(function getAvatar(msg, cb) {
18 avatar(sbot, me.id, msg.value.author, function (err, avatar) {
19 if (err) throw err
20 msg.avatar = avatar;
21 cb(null, msg)
22 })
23 }),
24 pull.drain(function printMessage(msg) {
25 render(msg)
26 sbot.close();
27 })
28 )
29 })
30 })
31}
32
33listMessages();
34

Built with git-ssb-web