git ssb

16+

Dominic / patchbay



Tree: 931ac024cad9b0e63311dd1a76de77d0490f8391

Files: 931ac024cad9b0e63311dd1a76de77d0490f8391 / modules_extra / dns.js

780 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.message_content = function (msg, sbot) {
12 var c = msg.value.content
13
14 if(c.type === 'ssb-dns') {
15 var record = c.record || {}
16 return h('div',
17 h('p',
18 h('ins', {title: 'name'}, record.name), ' ',
19 h('em', {title: 'ttl'}, record.ttl), ' ',
20 h('span', {title: 'class'}, record.class), ' ',
21 h('span', {title: 'type'}, record.type),
22 h('pre', {title: 'data'},
23 JSON.stringify(record.data || record.value, null, 2)),
24 !c.branch ? null : h('div', h('span',
25 'replaces: ', array(c.branch).map(idLink)))
26 ))
27 }
28}
29

Built with git-ssb-web