diff options
author | TylerSchroederWM <75996872+TylerSchroederWM@users.noreply.github.com> | 2021-02-01 11:55:20 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-01 11:55:20 -0500 |
commit | e1743f3bb0bb6cb958d33b39a2670cd2b7c5b556 (patch) | |
tree | 3bc59a84fa9eb2b87102bd9bfa1ab69973cd011f /README.md | |
parent | 84070e4e68685b7741a0c376e9b0f2764ac63c63 (diff) | |
download | ssb-logbook-e1743f3bb0bb6cb958d33b39a2670cd2b7c5b556.tar.gz ssb-logbook-e1743f3bb0bb6cb958d33b39a2670cd2b7c5b556.zip |
patchfoo integration pt. 1
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 105 |
1 files changed, 105 insertions, 0 deletions
@@ -21,3 +21,108 @@ clientFactory(function(err, client) { }); }); ``` + +To integrate into Patchfoo: +``` +Serve.prototype.logbook = function (ext) { + var q = this.query + var opts = { + reverse: !q.forwards, + //sortByTimestamp: q.sort === 'claimed', + sortByTimestamp: q.sort || 'claimed', + lt: Number(q.lt) || Date.now(), + gt: Number(q.gt) || -Infinity, + filter: q.filter, + } + + logbook.getMessages(this.app.sbot, "logbook", this, function(messageStream, serve) { + pull(messageStream, + serve.renderThreadPaginated(opts, null, q), + serve.wrapMessages(), + serve.wrapPublic(), + serve.wrapPage('logbook'), + serve.respondSink(200, { + 'Content-Type': ctype(ext) + }) + //pull.drain(function(msg) { + //console.log(JSON.stringify(msg)); + //}) + ) + } + , hops=3) + + //this.renderThreadPaginated(opts, null, q), + //this.wrapMessages(), + //this.wrapPublic(), + //this.wrapPage('public'), + //this.respondSink(200, { + //'Content-Type': ctype(ext) + //}) + //) + //}); + + //pull( + //this.app.createLogStream(opts), + //pull.filter(msg => { + //return !msg.value.content.vote + //}), + //this.renderThreadPaginated(opts, null, q), + //this.wrapMessages(), + //this.wrapPublic(), + //this.wrapPage('public'), + //this.respondSink(200, { + //'Content-Type': ctype(ext) + //}) + //) +} +```Serve.prototype.logbook = function (ext) { + var q = this.query + var opts = { + reverse: !q.forwards, + //sortByTimestamp: q.sort === 'claimed', + sortByTimestamp: q.sort || 'claimed', + lt: Number(q.lt) || Date.now(), + gt: Number(q.gt) || -Infinity, + filter: q.filter, + } + + logbook.getMessages(this.app.sbot, "logbook", this, function(messageStream, serve) { + pull(messageStream, + serve.renderThreadPaginated(opts, null, q), + serve.wrapMessages(), + serve.wrapPublic(), + serve.wrapPage('logbook'), + serve.respondSink(200, { + 'Content-Type': ctype(ext) + }) + //pull.drain(function(msg) { + //console.log(JSON.stringify(msg)); + //}) + ) + } + , hops=3) + + //this.renderThreadPaginated(opts, null, q), + //this.wrapMessages(), + //this.wrapPublic(), + //this.wrapPage('public'), + //this.respondSink(200, { + //'Content-Type': ctype(ext) + //}) + //) + //}); + + //pull( + //this.app.createLogStream(opts), + //pull.filter(msg => { + //return !msg.value.content.vote + //}), + //this.renderThreadPaginated(opts, null, q), + //this.wrapMessages(), + //this.wrapPublic(), + //this.wrapPage('public'), + //this.respondSink(200, { + //'Content-Type': ctype(ext) + //}) + //) +} |