git ssb

1+

Daan Patchwork / patchwork



Tree: 770fe5e2a3d5973a5c9b7d0945b214c3b2ea6793

Files: 770fe5e2a3d5973a5c9b7d0945b214c3b2ea6793 / lib / plugins / recent-feeds.js

596 bytesRaw
1const pull = require('pull-stream')
2const pullCat = require('pull-cat')
3
4module.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