diff options
author | TylerSchroederWM <75996872+TylerSchroederWM@users.noreply.github.com> | 2021-02-07 23:23:21 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-07 23:23:21 -0500 |
commit | 8377d1f8f0fe2cd9b3058aedd53597fa78ef6502 (patch) | |
tree | 5b09abdf941924e793ef13ee2f983289b28796cf /README.md | |
parent | f680936ae51a48dc7a5811e42c3804b890d4dc96 (diff) | |
download | ssb-logbook-8377d1f8f0fe2cd9b3058aedd53597fa78ef6502.tar.gz ssb-logbook-8377d1f8f0fe2cd9b3058aedd53597fa78ef6502.zip |
updated patchfoo integration
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 89 |
1 files changed, 7 insertions, 82 deletions
@@ -24,7 +24,8 @@ clientFactory(function(err, client) { To integrate into Patchfoo: ``` -Serve.prototype.logbook = function (ext) { +Serve.prototype.logbook2 = function (ext) { + var channelName = "logbook" var q = this.query var opts = { reverse: !q.forwards, @@ -33,96 +34,20 @@ Serve.prototype.logbook = function (ext) { lt: Number(q.lt) || Date.now(), gt: Number(q.gt) || -Infinity, filter: q.filter, + channel: channelName } - logbook.getMessages(this.app.sbot, "logbook", this, function(messageStream, serve) { + channels.getMessages(this.app.sbot, channelName, this, function(messageStream, serve) { pull(messageStream, serve.renderThreadPaginated(opts, null, q), serve.wrapMessages(), - serve.wrapPublic(), - serve.wrapPage('logbook'), + serve.wrapChannel(channelName), + serve.wrapPage("#" + channelName), 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) - //}) - //) } +``` |