Files: d6861e3a6c97728f151fbc42d87fe7b565358976 / bookmark / async / tags.js
833 bytesRaw
1 | const nest = require('depnest') |
2 | const pull = require('pull-stream') |
3 | |
4 | exports.gives = nest('bookmark.async.tags') |
5 | |
6 | exports.needs = nest({ |
7 | 'sbot.async.publish': 'first', |
8 | 'keys.sync.id': 'first' |
9 | }) |
10 | |
11 | exports.create = function(api) { |
12 | return nest('bookmark.async.tags', function(data, cb) { |
13 | console.log(data.tags) |
14 | pull( |
15 | pull.values(data.tags), |
16 | pull.asyncMap((tags, cb) => { |
17 | if (data.public) { |
18 | api.sbot.async.publish({ |
19 | type: 'about', |
20 | about: data.bookmark, |
21 | tags: tags |
22 | }, cb) |
23 | } else { |
24 | const id = api.keys.sync.id() |
25 | api.sbot.async.publish({ |
26 | type: 'about', |
27 | about: data.bookmark, |
28 | tags: tags, |
29 | recps: [ id ] |
30 | }, cb) |
31 | } |
32 | }), |
33 | pull.collect(cb) |
34 | ) |
35 | }) |
36 | } |
37 |
Built with git-ssb-web