aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTylerSchroederWM <75996872+TylerSchroederWM@users.noreply.github.com>2021-02-01 11:55:20 -0500
committerGitHub <noreply@github.com>2021-02-01 11:55:20 -0500
commite1743f3bb0bb6cb958d33b39a2670cd2b7c5b556 (patch)
tree3bc59a84fa9eb2b87102bd9bfa1ab69973cd011f
parent84070e4e68685b7741a0c376e9b0f2764ac63c63 (diff)
downloadssb-logbook-e1743f3bb0bb6cb958d33b39a2670cd2b7c5b556.tar.gz
ssb-logbook-e1743f3bb0bb6cb958d33b39a2670cd2b7c5b556.zip
patchfoo integration pt. 1
-rw-r--r--README.md105
1 files changed, 105 insertions, 0 deletions
diff --git a/README.md b/README.md
index b14de57..34ecf10 100644
--- a/README.md
+++ b/README.md
@@ -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)
+ //})
+ //)
+}