Files: 93c43d5bdd6ca578eeb9cc8fd147cbd099c08175 / modules / avatar-image.js
666 bytesRaw
1 | |
2 | var getAvatar = require('ssb-avatar') |
3 | var h = require('hyperscript') |
4 | var ref = require('ssb-ref') |
5 | |
6 | var plugs = require('../plugs') |
7 | var sbot_links = plugs.first(exports.sbot_links = []) |
8 | var blob_url = require('../plugs').first(exports.blob_url = []) |
9 | |
10 | var id = require('../keys').id |
11 | |
12 | var default_avatar = '&qjeAs8+uMXLlyovT4JnEpMwTNDx/QXHfOl2nv2u0VCM=.sha256' |
13 | |
14 | exports.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