diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-06-12 11:34:55 -1000 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-06-12 14:04:08 -1000 |
commit | 84af8d8b09c0f1fe8cf07171859be411e5f56670 (patch) | |
tree | 8538b9967fdc4d458075b4f0de5dc1d9959d2ea5 /lib/app.js | |
parent | 0d1706f6788075c581198d8ef130c5035aa7eab2 (diff) | |
download | patchfoo-84af8d8b09c0f1fe8cf07171859be411e5f56670.tar.gz patchfoo-84af8d8b09c0f1fe8cf07171859be411e5f56670.zip |
Use ssb-backlinks for channels/hashtags if it is available
Diffstat (limited to 'lib/app.js')
-rw-r--r-- | lib/app.js | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -471,3 +471,33 @@ App.prototype.streamEmojis = function () { pull.unique('link') ) } + +App.prototype.streamChannel = function (opts) { + if (this.sbot.backlinks) return this.sbot.backlinks.read(u.mergeOpts(opts, { + query: [{$filter: { + dest: '#' + opts.channel, + value: { + content: { + type: 'post' + } + }, + timestamp: { + $gt: opts.gt, + $lt: opts.lt, + } + }}] + })) + + if (this.sbot.query) return this.sbot.query.read(u.mergeOpts(opts, { + query: [{$filter: { + value: {content: {channel: opts.channel}}, + timestamp: { + $gt: opts.gt, + $lt: opts.lt, + } + }}] + })) + + return pull.error(new Error( + 'Viewing channels/tags requires the ssb-backlinks or ssb-query plugin')) +} |