aboutsummaryrefslogtreecommitdiff
path: root/lib/serve.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/serve.js')
-rw-r--r--lib/serve.js43
1 files changed, 31 insertions, 12 deletions
diff --git a/lib/serve.js b/lib/serve.js
index 810b887..61e34da 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -400,6 +400,7 @@ Serve.prototype.path = function (url) {
case '/highlight': return this.highlight(m[2])
case '/contacts': return this.contacts(m[2])
case '/about': return this.about(m[2])
+ case '/pub': return this.pub(m[2])
case '/git': return this.git(m[2])
case '/image': return this.image(m[2])
case '/npm': return this.npm(m[2])
@@ -1878,24 +1879,20 @@ Serve.prototype.wrapUserFeed = function (isScrolled, id) {
self.aboutDescription(id)
])
]),
- isScrolled ? '' : ph('tr', [
- ph('td'),
- ph('td', pull(
- self.app.getAddresses(id),
- pull.map(function (address) {
- return ph('div', [
- ph('code', address)
- ])
- })
- ))
- ]),
ph('tr', [
ph('td'),
ph('td', [
ph('a', {href: render.toUrl('/contacts/' + id)}, 'contacts'), ' ',
ph('a', {href: render.toUrl('/about/' + id)}, 'about'),
id === myId ? [' ',
- ph('a', {href: render.toUrl('/about-self')}, 'about-self')] : ''
+ ph('a', {href: render.toUrl('/about-self')}, 'about-self')] : '',
+ !isScrolled ? u.readNext(function (cb) {
+ self.app.isPub(id, function (err, isPub) {
+ if (err) return cb(err)
+ if (!isPub) return cb(null, pull.empty())
+ cb(null, ph('span', [' ', ph('a', {href: render.toUrl('/pub/' + id)}, 'pub')]))
+ })
+ }) : ''
])
]),
ph('tr', [
@@ -4126,3 +4123,25 @@ Serve.prototype.shard = function (url) {
)
})
}
+
+Serve.prototype.pub = function (path) {
+ var self = this
+ var id = String(path).substr(1)
+ try { id = decodeURIComponent(id) }
+ catch(e) {}
+ pull(
+ ph('section', [
+ ph('h3', ['Pub addresses: ', self.phIdLink(id)]),
+ pull(
+ self.app.getAddresses(id),
+ pull.map(function (address) {
+ return ph('div', [
+ ph('code', address)
+ ])
+ })
+ )
+ ]),
+ self.wrapPage('Block ' + id),
+ self.respondSink(200)
+ )
+}