aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md4
-rw-r--r--lib/app.js6
2 files changed, 7 insertions, 3 deletions
diff --git a/README.md b/README.md
index 0e10c70..ef286ed 100644
--- a/README.md
+++ b/README.md
@@ -64,7 +64,8 @@ To make config options persistent, set them in `~/.ssb/config`, e.g.:
{
"patchfoo": {
"port": 8027,
- "host": "::"
+ "host": "::",
+ "filter": "all",
}
}
```
@@ -79,6 +80,7 @@ To make config options persistent, set them in `~/.ssb/config`, e.g.:
- `emoji_base`: base url for emoji images. default: same as `base`
- `encode_msgids`: whether to URL-encode message ids in local links. default: `true`
- `auth`: HTTP auth password. default: `null` (no password required)
+- `filter`: Filter setting. `"all"` to show all messages. `"invert"` to show messages that would be hidden by the default setting. Otherwise the default setting applies, which is so to only show messages authored or upvoted by yourself or by a feed that you you follow. Exceptions are that if you navigate to a user feed page, you will see messages authored by that feed, and if you navigate to a message page, you will see that message - regardless of the filter setting. The `filter` setting may also be specified per-request as a query string parameter.
## TODO
diff --git a/lib/app.js b/lib/app.js
index 3db24b8..71fd3f0 100644
--- a/lib/app.js
+++ b/lib/app.js
@@ -28,6 +28,7 @@ function App(sbot, config) {
var conf = config.patchfoo || {}
this.port = conf.port || 8027
this.host = conf.host || 'localhost'
+ this.filter = conf.filter
var base = conf.base || '/'
this.opts = {
@@ -678,8 +679,9 @@ App.prototype.filterMsg = function (msg, opts, cb) {
var self = this
var myId = self.sbot.id
var author = msg.value && msg.value.author
- var show = (opts.filter !== 'invert')
- if (opts.filter === 'all'
+ var filter = opts.filter || self.filter
+ var show = (filter !== 'invert')
+ if (filter === 'all'
|| author === myId
|| author === opts.feed
|| msg.key === opts.msgId) return cb(null, show)