Commit ec173768e1fa3502173c3eec73ec2d7ea6c71742
Merge remote-tracking branch 'origin/dns'
Dominic Tarr committed on 11/28/2016, 11:15:03 PMParent: 23c609fe1f8d646c4994bb804762cd3aefaad28c
Parent: 043f0016a782ff805a586313f336b144a0ed3e3e
Files changed
modules_extra/index.js | changed |
modules_extra/dns.js | added |
modules_extra/index.js | ||
---|---|---|
@@ -2,8 +2,9 @@ | ||
2 | 2 … | "audio-mp3.js": require('./audio-mp3.js'), |
3 | 3 … | "channel.js": require('./channel.js'), |
4 | 4 … | "emoji.js": require('./emoji.js'), |
5 | 5 … | "suggest-emoji.js": require('./suggest-emoji.js'), |
6 … | + "dns.js": require('./dns.js'), | |
6 | 7 … | "git.js": require('./git.js'), |
7 | 8 … | "notifications.js": require('./notifications.js'), |
8 | 9 … | "meta-image.js": require('./meta-image.js'), |
9 | 10 … | "music-release-cc.js": require('./music-release-cc.js'), |
modules_extra/dns.js | |||
---|---|---|---|
@@ -1,0 +1,28 @@ | |||
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 … | +} |
Built with git-ssb-web