Files: 8cf292c13507a00dd6f025dfa662409737ba7dea / modules_extra / dns.js
780 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.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