aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2021-01-23 12:15:56 -0500
committerEugeniy E. Mikhailov <evgmik@gmail.com>2021-01-23 12:15:56 -0500
commit1eeb202272fd2411123b980aa782f457c6835d76 (patch)
tree71053c0456bdb2425b099da0404fed95b3104e8d /lib
parentb3a2799231fec0ef26b842e7d652c81b41d1c804 (diff)
downloadpatchfoo-1eeb202272fd2411123b980aa782f457c6835d76.tar.gz
patchfoo-1eeb202272fd2411123b980aa782f457c6835d76.zip
added logbook action, with filter according to date of publishing
Diffstat (limited to 'lib')
-rw-r--r--lib/serve.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/serve.js b/lib/serve.js
index f7e8330..7237a88 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -517,6 +517,7 @@ Serve.prototype.path = function (url) {
switch (m[1]) {
case '/new': return this.new(m[2])
case '/public': return this.public(m[2])
+ case '/logbook': return this.logbook(m[2])
case '/threads': return this.threads(m[2])
case '/private': return this.private(m[2])
case '/mentions': return this.mentions(m[2])
@@ -575,6 +576,32 @@ Serve.prototype.home = function () {
)
}
+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,
+ }
+
+ 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.public = function (ext) {
var q = this.query
var opts = {