aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/app.js10
-rw-r--r--lib/serve.js19
2 files changed, 28 insertions, 1 deletions
diff --git a/lib/app.js b/lib/app.js
index 31ef492..ca9b6b2 100644
--- a/lib/app.js
+++ b/lib/app.js
@@ -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'), ' ',