aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcel <cel@lOUVT+Phkvai9a/cCS/RKo+S9hnPAQdVixms/7ldpPA=.ed25519>2020-05-27 15:23:23 -0400
committercel <cel@lOUVT+Phkvai9a/cCS/RKo+S9hnPAQdVixms/7ldpPA=.ed25519>2020-05-27 15:23:23 -0400
commit891dd8e960425e52c64fecf78668cd115d9251f7 (patch)
tree745d836b191976c233d959618ccba8f60644aa1f
parente537f08964e2fcfe94f3777ef75c82f928b65121 (diff)
downloadpatchfoo-891dd8e960425e52c64fecf78668cd115d9251f7.tar.gz
patchfoo-891dd8e960425e52c64fecf78668cd115d9251f7.zip
Support channel prefixes (wildcard)
-rw-r--r--lib/app.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/app.js b/lib/app.js
index b312506..814bfb6 100644
--- a/lib/app.js
+++ b/lib/app.js
@@ -874,11 +874,15 @@ App.prototype.filterMessages = function (opts) {
App.prototype.streamChannel = function (opts) {
// prefer ssb-backlinks to ssb-query because it also handles hashtag mentions
if (this.sbot.backlinks) return this.filter(this.sbot.backlinks, opts, {
- dest: '#' + opts.channel,
+ dest: /\*$/.test(opts.channel)
+ ? {$prefix: '#' + opts.channel.replace(/\*$/, '')}
+ : '#' + opts.channel
})
if (this.sbot.query) return this.filter(this.sbot.query, opts, {
- value: {content: {channel: opts.channel}},
+ value: {content: {channel: /\*$/.test(opts.channel)
+ ? {$prefix: opts.channel.replace(/\*$/, '')}
+ : opts.channel}},
})
return pull.error(new Error(