aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-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)
- //})
- //)
}
+```