Files: adf8a7771064a6d9a18b6005e625fadbd6fb9846 / streams / private.js
618 bytesRaw
1 | const pull = require('pull-stream') |
2 | |
3 | exports.gives = { |
4 | streams: { |
5 | private: true |
6 | } |
7 | } |
8 | |
9 | exports.needs = { |
10 | sbot_log: 'first', |
11 | //message_unbox: true |
12 | } |
13 | |
14 | exports.create = function (api) { |
15 | return { |
16 | streams: { |
17 | 'private': function (opts) { |
18 | pull( |
19 | api.sbot_log(opts)//, |
20 | //unbox() |
21 | ) |
22 | } |
23 | } |
24 | } |
25 | |
26 | // scoped |
27 | |
28 | function unbox () { |
29 | return pull( |
30 | pull.filter(function (msg) { |
31 | return typeof msg.value.content === 'string' |
32 | }), |
33 | pull.map(function (msg) { |
34 | return api.message_unbox(msg) |
35 | }), |
36 | pull.filter(Boolean) |
37 | ) |
38 | } |
39 | } |
40 |
Built with git-ssb-web