aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/serve.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/serve.js b/lib/serve.js
index 87ecbb4..19b0ac8 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -281,6 +281,7 @@ Serve.prototype.path = function (url) {
case '/advsearch': return this.advsearch(m[2])
case '/vote': return this.vote(m[2])
case '/peers': return this.peers(m[2])
+ case '/status': return this.status(m[2])
case '/channels': return this.channels(m[2])
case '/friends': return this.friends(m[2])
case '/live': return this.live(m[2])
@@ -680,6 +681,34 @@ Serve.prototype.peers = function (ext) {
)
}
+Serve.prototype.status = function (ext) {
+ var self = this
+
+ if (!self.app.sbot.status) return pull(
+ pull.once('missing sbot status method'),
+ this.wrapPage('status'),
+ self.respondSink(400)
+ )
+
+ pull(
+ ph('section', [
+ ph('h3', 'Status'),
+ pull(
+ u.readNext(function (cb) {
+ self.app.sbot.status(function (err, status) {
+ cb(err, status && pull.once(status))
+ })
+ }),
+ pull.map(function (status) {
+ return h('pre', self.app.render.linkify(JSON.stringify(status, 0, 2))).outerHTML
+ })
+ )
+ ]),
+ this.wrapPage('status'),
+ this.respondSink(200)
+ )
+}
+
Serve.prototype.channels = function (ext) {
var self = this
var id = self.app.sbot.id
@@ -1291,6 +1320,8 @@ Serve.prototype.wrapPage = function (title, searchQ) {
h('a', {href: render.toUrl('/private')}, 'private') , ' ',
h('a', {href: render.toUrl('/mentions')}, 'mentions') , ' ',
h('a', {href: render.toUrl('/peers')}, 'peers') , ' ',
+ self.app.sbot.status ?
+ [h('a', {href: render.toUrl('/status')}, 'status'), ' '] : '',
h('a', {href: render.toUrl('/channels')}, 'channels') , ' ',
h('a', {href: render.toUrl('/friends')}, 'friends'), ' ',
h('a', {href: render.toUrl('/advsearch')}, 'search'), ' ',