aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTylerSchroederWM <75996872+TylerSchroederWM@users.noreply.github.com>2021-02-07 23:23:21 -0500
committerGitHub <noreply@github.com>2021-02-07 23:23:21 -0500
commit8377d1f8f0fe2cd9b3058aedd53597fa78ef6502 (patch)
tree5b09abdf941924e793ef13ee2f983289b28796cf
parentf680936ae51a48dc7a5811e42c3804b890d4dc96 (diff)
downloadssb-logbook-8377d1f8f0fe2cd9b3058aedd53597fa78ef6502.tar.gz
ssb-logbook-8377d1f8f0fe2cd9b3058aedd53597fa78ef6502.zip
updated patchfoo integration
-rw-r--r--README.md89
1 files changed, 7 insertions, 82 deletions
diff --git a/README.md b/README.md
index 3d0f89f..78d3f94 100644
--- a/README.md
+++ b/README.md
@@ -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)
- //})
- //)
}
+```