git ssb

1+

Daan Patchwork / patchwork



Tree: 2aba282967b6a030aeb637a4592a0572ac1451b7

Files: 2aba282967b6a030aeb637a4592a0572ac1451b7 / 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