Files: 735a21fa879fddd250e0fe6224dbb269061f32d6 / modules_extra / dns.js
864 bytesRaw
1 | var h = require('hyperscript') |
2 | |
3 | function array(obj) { |
4 | return !obj ? [] : Array.isArray(obj) ? obj : [obj] |
5 | } |
6 | |
7 | function idLink(id) { |
8 | return h('a', {href: '#'+id}, id.substring(0, 10)+'…') |
9 | } |
10 | |
11 | exports.gives = 'message_content' |
12 | |
13 | exports.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