git ssb

3+

ev / sdash



Commit 0c1a712f22008dfdfcb1f0a58b8d58af09f0bc21

refactor sdash to use ssb-viewer

Ev Bogue committed on 12/25/2016, 7:28:20 PM
Parent: 34b07459e5b69b2cfc44f79d97b19f3432c6191d

Files changed

index.jschanged
index.jsView
@@ -5,22 +5,13 @@
55 var client = require('ssb-client')
66 var md = require('ssb-markdown')
77 var avatar = require('ssb-avatar')
88 var mo = require('moment')
9-// var ref = require('ssb-ref')
109
1110 var title = 'sdash'
1211 var me = '@8Qee0I/DwI5DHSCi3p5fsl6FyLGArrnDz3ox9qZr5Qc=.ed25519'
13-var bloburl = 'https://evbogue.com/ws/blobs/get/'
12 +var viewerUrl = 'https://viewer.scuttlebot.io/'
1413
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-
2314 http.createServer(function (req, res){
2415 if (req.url === '/') {
2516 client(function (err, sbot) {
2617 pull(
@@ -34,17 +25,14 @@
3425 function gotPost() {
3526 res.end(
3627 h('html',
3728 h('head',
38- h('title', name + '\'s ' + title),
29 + h('title', title),
3930 h('style', fs.readFileSync('style.css', 'utf8'))
4031 ),
4132 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'})
4735 )
4836 )
4937 ).outerHTML)
5038 }

Built with git-ssb-web