diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2018-07-04 16:23:35 -1000 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2018-07-04 16:23:35 -1000 |
commit | bf146b14e02f6e1188a8c37b70a29f882f0c75e1 (patch) | |
tree | fdc29021cd6707e473bc96c51bbf533bf6cbcfe8 | |
parent | abfba3a58d8e9753bd2118c8cd92d95df683607e (diff) | |
download | patchfoo-bf146b14e02f6e1188a8c37b70a29f882f0c75e1.tar.gz patchfoo-bf146b14e02f6e1188a8c37b70a29f882f0c75e1.zip |
Add tags page
-rw-r--r-- | lib/app.js | 10 | ||||
-rw-r--r-- | lib/serve.js | 19 |
2 files changed, 28 insertions, 1 deletions
@@ -500,6 +500,16 @@ App.prototype.streamMyChannels = function (id, opts) { ) } +App.prototype.streamTags = function () { + return pull( + this.sbot.messagesByType({type: 'tag', reverse: true}), + this.unboxMessages(), + pull.filter(function (msg) { + return !msg.value.content.message + }) + ) +} + function compareVoted(a, b) { return b.value - a.value } diff --git a/lib/serve.js b/lib/serve.js index 3c9334f..db99b49 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -352,6 +352,7 @@ Serve.prototype.path = function (url) { case '/peers': return this.peers(m[2]) case '/status': return this.status(m[2]) case '/channels': return this.channels(m[2]) + case '/tags': return this.tags(m[2]) case '/friends': return this.friends(m[2]) case '/live': return this.live(m[2]) case '/compose': return this.compose(m[2]) @@ -849,7 +850,22 @@ Serve.prototype.channels = function (ext) { ) } -function renderFriendsList(app) { +Serve.prototype.tags = function (path) { + var self = this + var seen = {} + pull( + ph('section', [ + ph('h3', 'Tags'), + pull( + self.app.streamTags(), + pull.map(function (msg) { + return [self.phIdLink(msg.key), ' '] + }) + ) + ]), + this.wrapPage('tags'), + this.respondSink(200) + ) } Serve.prototype.contacts = function (path) { @@ -1508,6 +1524,7 @@ Serve.prototype.wrapPage = function (title, searchQ) { self.app.sbot.status ? [h('a', {href: render.toUrl('/status')}, 'status'), ' '] : '', h('a', {href: render.toUrl('/channels')}, 'channels') , ' ', + h('a', {href: render.toUrl('/tags')}, 'tags') , ' ', h('a', {href: render.toUrl('/friends')}, 'friends'), ' ', h('a', {href: render.toUrl('/advsearch')}, 'search'), ' ', h('a', {href: render.toUrl('/live')}, 'live'), ' ', |