git ssb

16+

Dominic / patchbay



Tree: 627bb1ceef39b5cccd4915b82591d2b085d4716e

Files: 627bb1ceef39b5cccd4915b82591d2b085d4716e / 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