Files: c2865b1db3cc50c32ef351f6f877be6cafcf0381 / feed / pull / channel.js
660 bytesRaw
1 | const nest = require('depnest') |
2 | const extend = require('xtend') |
3 | |
4 | exports.gives = nest('feed.pull.channel') |
5 | exports.needs = nest({ |
6 | 'sbot.pull.backlinks': 'first' |
7 | }) |
8 | |
9 | exports.create = function (api) { |
10 | return nest('feed.pull.channel', function (channel) { |
11 | if (typeof channel !== 'string') throw new Error('a channel name be specified') |
12 | |
13 | return function (opts) { |
14 | var filter = {dest: `#${channel}`} |
15 | |
16 | // HACK: handle lt |
17 | if (opts.lt != null) { |
18 | filter.timestamp = {$lt: opts.lt, $gte: 0} |
19 | delete opts.lt |
20 | } |
21 | |
22 | return api.sbot.pull.backlinks(extend(opts, {query: [ |
23 | {$filter: filter} |
24 | ]})) |
25 | } |
26 | }) |
27 | } |
28 |
Built with git-ssb-web