aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-04-27 09:38:57 -1000
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-04-27 09:38:57 -1000
commitdaead5ea28a14391aeacf75e094b39e65e933df7 (patch)
treec7ae8c581480e8d8ac28077b4d9e10fddae8df62 /lib
parent52cd6161b4597f85436f521a01c2c14c08bf2d95 (diff)
downloadpatchfoo-daead5ea28a14391aeacf75e094b39e65e933df7.tar.gz
patchfoo-daead5ea28a14391aeacf75e094b39e65e933df7.zip
Add live view
Diffstat (limited to 'lib')
-rw-r--r--lib/serve.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/serve.js b/lib/serve.js
index 05659e4..a377c04 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -232,6 +232,7 @@ Serve.prototype.path = function (url) {
case '/peers': return this.peers(m[2])
case '/channels': return this.channels(m[2])
case '/friends': return this.friends(m[2])
+ case '/live': return this.live(m[2])
}
m = /^(\/?[^\/]*)(\/.*)?$/.exec(url)
switch (m[1]) {
@@ -379,6 +380,20 @@ Serve.prototype.search = function (ext) {
)
}
+Serve.prototype.live = function (ext) {
+ var self = this
+
+ pull(
+ self.app.sbot.createLogStream({old: false}),
+ self.renderThread(),
+ self.wrapMessages(),
+ self.wrapPage('live'),
+ self.respondSink(200, {
+ 'Content-Type': ctype(ext),
+ })
+ )
+}
+
Serve.prototype.peers = function (ext) {
var self = this
if (self.data.action === 'connect') {
@@ -882,6 +897,7 @@ Serve.prototype.wrapPage = function (title, searchQ) {
h('a', {href: render.toUrl('/peers')}, 'peers') , ' ',
h('a', {href: render.toUrl('/channels')}, 'channels') , ' ',
h('a', {href: render.toUrl('/friends')}, 'friends'), ' ',
+ h('a', {href: render.toUrl('/live')}, 'live'), ' ',
render.idLink(self.app.sbot.id, done()), ' ',
h('input.search-input', {name: 'q', value: searchQ,
placeholder: 'search'})