git ssb

16+

Dominic / patchbay



Tree: 26ba1836edbcddea8eab8725913e63bc364f2eef

Files: 26ba1836edbcddea8eab8725913e63bc364f2eef / 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