diff options
-rw-r--r-- | lib/render.js | 13 | ||||
-rw-r--r-- | lib/serve.js | 30 | ||||
-rw-r--r-- | static/styles.css | 4 |
3 files changed, 35 insertions, 12 deletions
diff --git a/lib/render.js b/lib/render.js index 1777c88..0bcb78a 100644 --- a/lib/render.js +++ b/lib/render.js @@ -354,9 +354,6 @@ Render.prototype.idLink = function (link, cb) { return a } -// %NM8tXGBBDKKcpRbbyd/5uN1p/2OtBMFDylLMDPGoq8Q=.sha256 -var idRegex = /^[A-Za-z0-9._\-+=/]*[A-Za-z0-9_\-+=/]$/ - Render.prototype.idLinkCopyable = function (link, cb) { var self = this if (!self.app.copyableIds) return idLink(link, cb) @@ -365,15 +362,15 @@ Render.prototype.idLinkCopyable = function (link, cb) { self.prepareLink(link, function (err, link) { if (err) return cb(err) a.href = self.toUrl(link.link) - var name = link.name || String(link.link).substr(1, 8) + '…' - if (idRegex.test(name)) a.childNodes[0].textContent = '@' + name + var name = link.name || link.link + if (name != link.link) a.childNodes[0].textContent = '@' + name else { + var shortLink = String(link.link).substr(1, 8) + '…' a.className = 'id-copyable-link' a.innerHTML = h('span', [ h('span.id-deemphasize', '['), - h('span.id-name', '@' + link.name), - h('span.id-deemphasize', ']' - + '(', h('span.id-inner', link.link), ')'), + h('span.id-name', '@' + link.shortLink), + h('span.id-deemphasize', ']') ]).innerHTML } cb() diff --git a/lib/serve.js b/lib/serve.js index a9a3691..b61505b 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 = { @@ -587,6 +614,9 @@ Serve.prototype.public = function (ext) { pull( this.app.createLogStream(opts), + pull.filter(msg => { + return !msg.value.content.vote + }), this.renderThreadPaginated(opts, null, q), this.wrapMessages(), this.wrapPublic(), diff --git a/static/styles.css b/static/styles.css index 55592a9..6b86768 100644 --- a/static/styles.css +++ b/static/styles.css @@ -133,10 +133,6 @@ pre { text-decoration: underline; } -.id-inner { - letter-spacing: -1ex; -} - .msg-header { margin-bottom: .25ex; } |