git ssb

16+

Dominic / patchbay



Tree: 87c8074aa4e4204124daafeef1575b48aec817e2

Files: 87c8074aa4e4204124daafeef1575b48aec817e2 / modules / avatar-image.js

606 bytesRaw
1
2var getAvatar = require('ssb-avatar')
3var h = require('hyperscript')
4var ref = require('ssb-ref')
5
6var plugs = require('../plugs')
7var sbot_whoami = plugs.first(exports.sbot_whoami = [])
8var sbot_links = plugs.first(exports.sbot_links = [])
9
10exports.avatar_image = function (author) {
11 var img = h('img', {src: 'http://localhost:7777/img/fallback.png'})
12 sbot_whoami(function (err, me) {
13 getAvatar({links: sbot_links}, me.id, author, function (err, avatar) {
14 if(ref.isBlob(avatar.image))
15 img.src = 'http://localhost:7777/'+encodeURIComponent(avatar.image)
16 })
17 })
18 return img
19}
20
21
22

Built with git-ssb-web