aboutsummaryrefslogtreecommitdiff
path: root/lib/render-msg.js
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-04-14 20:02:43 -0700
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-04-14 20:05:56 -0700
commit684a05c5f4bc21386aa5f3a7f103836a60cc7f00 (patch)
treeaff92a4bf929116f3ef51b004642f61d34e0ddaf /lib/render-msg.js
parent7e028f14b513d58fa62cd82d8a0cbb5c19376aaf (diff)
downloadpatchfoo-684a05c5f4bc21386aa5f3a7f103836a60cc7f00.tar.gz
patchfoo-684a05c5f4bc21386aa5f3a7f103836a60cc7f00.zip
Render ssb-dns messages
Diffstat (limited to 'lib/render-msg.js')
-rw-r--r--lib/render-msg.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/render-msg.js b/lib/render-msg.js
index 711a759..1873128 100644
--- a/lib/render-msg.js
+++ b/lib/render-msg.js
@@ -201,6 +201,7 @@ RenderMsg.prototype.message = function (raw, cb) {
case 'issue': return this.issue(cb)
case 'issue-edit': return this.issueEdit(cb)
case 'music-release-cc': return this.musicRelease(cb)
+ case 'ssb-dns': return this.dns(cb)
case 'ferment/audio':
case 'robeson/audio':
return this.audio(cb)
@@ -302,6 +303,9 @@ RenderMsg.prototype.title = function (cb) {
else
cb(null, '%' + self.c.type + ': ' + (self.c.title || title(self.c.text)))
} else {
+ if (self.c.type === 'ssb-dns')
+ cb(null, self.c.record && JSON.stringify(self.c.record.data) || self.msg.key)
+ else
self.app.getAbout(self.msg.key, function (err, about) {
if (err) return cb(err)
if (about.name) return cb(null, about.name)
@@ -652,6 +656,31 @@ RenderMsg.prototype.musicRelease = function (cb) {
], cb)
}
+RenderMsg.prototype.dns = function (cb) {
+ var self = this
+ var record = self.c.record || {}
+ var done = multicb({pluck: 1, spread: true})
+ var elCb = done()
+ self.wrap([
+ h('div',
+ h('p',
+ h('ins', {title: 'name'}, record.name), ' ',
+ h('span', {title: 'ttl'}, record.ttl), ' ',
+ h('span', {title: 'class'}, record.class), ' ',
+ h('span', {title: 'type'}, record.type)
+ ),
+ h('pre', {title: 'data'},
+ JSON.stringify(record.data || record.value, null, 2)),
+ !self.c.branch ? null : h('div',
+ 'replaces: ', u.toArray(self.c.branch).map(function (id, i) {
+ return [self.link1(id, done()), i === 0 ? ', ' : '']
+ })
+ )
+ )
+ ], elCb)
+ done(cb)
+}
+
RenderMsg.prototype.wifiNetwork = function (cb) {
var net = this.c.network || {}
this.wrap([