git ssb

16+

Dominic / patchbay



Tree: 3003c7f2e378ab411b09eaa11adef56245af1868

Files: 3003c7f2e378ab411b09eaa11adef56245af1868 / 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