git ssb

16+

Dominic / patchbay



Tree: 86ea5da17a73751facaa9e0d8540e9877b49f402

Files: 86ea5da17a73751facaa9e0d8540e9877b49f402 / modules_extra / dns.js

864 bytesRaw
1var h = require('hyperscript')
2
3function array(obj) {
4 return !obj ? [] : Array.isArray(obj) ? obj : [obj]
5}
6
7function idLink(id) {
8 return h('a', {href: '#'+id}, id.substring(0, 10)+'…')
9}
10
11exports.gives = 'message_content'
12
13exports.create = function () {
14 return function (msg, sbot) {
15 var c = msg.value.content
16
17 if(c.type === 'ssb-dns') {
18 var record = c.record || {}
19 return h('div',
20 h('p',
21 h('ins', {title: 'name'}, record.name), ' ',
22 h('em', {title: 'ttl'}, record.ttl), ' ',
23 h('span', {title: 'class'}, record.class), ' ',
24 h('span', {title: 'type'}, record.type),
25 h('pre', {title: 'data'},
26 JSON.stringify(record.data || record.value, null, 2)),
27 !c.branch ? null : h('div', h('span',
28 'replaces: ', array(c.branch).map(idLink)))
29 ))
30 }
31 }
32
33}
34

Built with git-ssb-web