Commit 17b07347cac60d6c6ad5588e2408644c177b2c9c
get images and name from sbot
Ev Bogue committed on 8/18/2016, 11:14:09 PMParent: 2dceaa4a1e9af879885c4b6a6b4a93d73ae64a65
Files changed
index.jade | changed |
index.js | changed |
package.json | changed |
index.jade | ||
---|---|---|
@@ -2,10 +2,10 @@ | ||
2 | 2 … | html |
3 | 3 … | head |
4 | 4 … | title= title |
5 | 5 … | meta(charset='utf8') |
6 | - link(rel='stylesheet' href='http://evbogue.com/reserva/reserva.css') | |
7 | - link(rel='stylesheet' href='http://evbogue.com/style.css') | |
6 … | + // link(rel='stylesheet' href='http://evbogue.com/reserva/reserva.css') | |
7 … | + // link(rel='stylesheet' href='http://evbogue.com/style.css') | |
8 | 8 … | body |
9 | - img(src='http://evbogue.com/2016ev-mar.jpg' class='profile' style='float: left; margin-right: .5ex; width: 75px;') | |
9 … | + img(src='http://localhost:8989/blobs/get/#{image}' class='profile' style='float: left; margin-right: .5ex; width: 75px;') | |
10 | 10 … | p(style='float: right;')<span style='float: right; font-size: .8em;'>#{date} on <a href='http://evbogue.com/patchbayinstall' target='_parent'>Patchbay</a> |
11 | - p <a href='http://evbogue.com/ev' target='_parent'>@ev</a> #{message} | |
11 … | + p <a href='http://evbogue.com/ev' target='_parent'>@#{name}</a> #{message} |
index.js | ||
---|---|---|
@@ -1,15 +1,13 @@ | ||
1 | 1 … | var client = require('ssb-client'); |
2 | 2 … | var pull = require('pull-stream'); |
3 … | +var avatar = require('ssb-avatar'); | |
3 | 4 … | var moment = require('moment'); |
4 | 5 … | var app = require('koa')(); |
5 | 6 … | var router = require('koa-router')(); |
6 | 7 … | var views = require('co-views'); |
7 | 8 … | |
8 | -var port = 4000; | |
9 | -var me = '@8Qee0I/DwI5DHSCi3p5fsl6FyLGArrnDz3ox9qZr5Qc=.ed25519' | |
10 | -var message = 'I said nothing'; | |
11 | -var date = 'Today!'; | |
9 … | +var me = '@8Qee0I/DwI5DHSCi3p5fsl6FyLGArrnDz3ox9qZr5Qc=.ed25519'; | |
12 | 10 … | |
13 | 11 … | app.use(router.routes()) |
14 | 12 … | |
15 | 13 … | var render = views(__dirname, { ext: 'jade'}); |
@@ -18,8 +16,15 @@ | ||
18 | 16 … | client(function (err, sbot) { |
19 | 17 … | if (err) { |
20 | 18 … | throw err; |
21 | 19 … | } |
20 … | + avatar(sbot, me, me, function (err, avatar){ | |
21 … | + if (err) { | |
22 … | + throw err; | |
23 … | + } | |
24 … | + name = avatar.name; | |
25 … | + image = avatar.image; | |
26 … | + }) | |
22 | 27 … | pull(sbot.createUserStream({ |
23 | 28 … | id: me, |
24 | 29 … | limit: 1, |
25 | 30 … | reverse: true |
@@ -43,10 +48,9 @@ | ||
43 | 48 … | } |
44 | 49 … | gotMessage(); |
45 | 50 … | })); |
46 | 51 … | }); |
47 | - function gotMessage() { | |
48 | - } | |
49 | - this.body = yield render('index', {title: 'sdash', message, date}); | |
52 … | + function gotMessage() {} | |
53 … | + this.body = yield render('index', {title: 'sdash', message, date, name, image}); | |
50 | 54 … | }); |
51 | -app.listen(port); | |
55 … | +app.listen(4000); | |
52 | 56 … |
Built with git-ssb-web