Commit 0c1a712f22008dfdfcb1f0a58b8d58af09f0bc21
refactor sdash to use ssb-viewer
Ev Bogue committed on 12/25/2016, 7:28:20 PMParent: 34b07459e5b69b2cfc44f79d97b19f3432c6191d
Files changed
index.js | changed |
index.js | ||
---|---|---|
@@ -5,22 +5,13 @@ | ||
5 | 5 … | var client = require('ssb-client') |
6 | 6 … | var md = require('ssb-markdown') |
7 | 7 … | var avatar = require('ssb-avatar') |
8 | 8 … | var mo = require('moment') |
9 | -// var ref = require('ssb-ref') | |
10 | 9 … | |
11 | 10 … | var title = 'sdash' |
12 | 11 … | var me = '@8Qee0I/DwI5DHSCi3p5fsl6FyLGArrnDz3ox9qZr5Qc=.ed25519' |
13 | -var bloburl = 'https://evbogue.com/ws/blobs/get/' | |
12 … | +var viewerUrl = 'https://viewer.scuttlebot.io/' | |
14 | 13 … | |
15 | -client(function (err, sbot) { | |
16 | - avatar(sbot, me, me, function (err, avatar){ | |
17 | - if (err) throw err | |
18 | - name = avatar.name | |
19 | - image = avatar.image | |
20 | - }) | |
21 | -}) | |
22 | - | |
23 | 14 … | http.createServer(function (req, res){ |
24 | 15 … | if (req.url === '/') { |
25 | 16 … | client(function (err, sbot) { |
26 | 17 … | pull( |
@@ -34,17 +25,14 @@ | ||
34 | 25 … | function gotPost() { |
35 | 26 … | res.end( |
36 | 27 … | h('html', |
37 | 28 … | h('head', |
38 | - h('title', name + '\'s ' + title), | |
29 … | + h('title', title), | |
39 | 30 … | h('style', fs.readFileSync('style.css', 'utf8')) |
40 | 31 … | ), |
41 | 32 … | h('body', |
42 | - h('div.msg', | |
43 | - h('p.small.ri', mo(post.value.timestamp).fromNow()), | |
44 | - h('img.avatar', {src: bloburl + image}), | |
45 | - h('a', {href: me }, '@' + name), | |
46 | - h('div', {innerHTML: md.block(post.value.content.text)}) | |
33 … | + h('div.msg', | |
34 … | + h('script', {src: viewerUrl + encodeURI(post.key) + '.js'}) | |
47 | 35 … | ) |
48 | 36 … | ) |
49 | 37 … | ).outerHTML) |
50 | 38 … | } |
Built with git-ssb-web