diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-10-13 13:54:34 -1000 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-10-13 13:54:34 -1000 |
commit | 42934b9b8952245a7d37b17ca0bb119e82ebd96c (patch) | |
tree | 294837485b9018642d1f709ca6dd00178297a2fc | |
parent | 4cdef510b17e915fb1c743293f81458e3b0bf8d9 (diff) | |
download | patchfoo-42934b9b8952245a7d37b17ca0bb119e82ebd96c.tar.gz patchfoo-42934b9b8952245a7d37b17ca0bb119e82ebd96c.zip |
Allow specifying default filter setting
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | lib/app.js | 6 |
2 files changed, 7 insertions, 3 deletions
@@ -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 @@ -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) |