Files: 55fc93a9190c25f467ead205ab8d676b5191dbd4 / lib / plugins / recent-feeds.js
596 bytesRaw
1 | const pull = require('pull-stream') |
2 | const pullCat = require('pull-cat') |
3 | |
4 | module.exports = function (sbot) { |
5 | return { |
6 | stream: function ({ live = null, since = null } = {}) { |
7 | const pipe = [ |
8 | pull( |
9 | sbot.createFeedStream({ reverse: true, gt: since }), |
10 | pull.map(msg => msg.value.author), |
11 | pull.unique() |
12 | ) |
13 | ] |
14 | |
15 | if (live) { |
16 | pipe.push(pull.values([{ sync: true }])) |
17 | pipe.push(pull(sbot.createFeedStream({ old: false }), |
18 | pull.map(msg => msg.value.author) |
19 | )) |
20 | } |
21 | return pullCat(pipe) |
22 | } |
23 | } |
24 | } |
25 |
Built with git-ssb-web