git ssb

0+

ev / microbay



forked from Dominic / patchbay

Tree: 55b4b4ef06d51a129609282f85186a3f2a6e3237

Files: 55b4b4ef06d51a129609282f85186a3f2a6e3237 / modules / avatar-image.js

666 bytesRaw
1
2var getAvatar = require('ssb-avatar')
3var h = require('hyperscript')
4var ref = require('ssb-ref')
5
6var plugs = require('../plugs')
7var sbot_links = plugs.first(exports.sbot_links = [])
8var blob_url = require('../plugs').first(exports.blob_url = [])
9
10var id = require('../keys').id
11
12var default_avatar = '&qjeAs8+uMXLlyovT4JnEpMwTNDx/QXHfOl2nv2u0VCM=.sha256'
13
14exports.avatar_image = function (author) {
15 var img = h('img', {src: blob_url(default_avatar)})
16 getAvatar({links: sbot_links}, id, author, function (err, avatar) {
17 if (err) return console.error(err)
18 if(ref.isBlob(avatar.image))
19 img.src = blob_url(avatar.image)
20 })
21 return img
22}
23
24
25
26
27
28
29
30
31

Built with git-ssb-web