git ssb

0+

ev / microbay



forked from Dominic / patchbay

Commit d5fdd871022fae183005b8a90a5c4882e6688518

reliable avatar fallback

mix irving committed on 9/8/2016, 11:38:26 AM
Parent: dc36ded7d6547bbdb3fb82171fb5fc305edd2556

Files changed

modules/avatar-image.jschanged
modules/avatar_fallback.pngadded
modules/avatar-image.jsView
@@ -1,8 +1,9 @@
11
22 var getAvatar = require('ssb-avatar')
33 var h = require('hyperscript')
44 var ref = require('ssb-ref')
5+var path = require('path')
56
67 var plugs = require('../plugs')
78 var sbot_query = plugs.first(exports.sbot_query = [])
89 var blob_url = require('../plugs').first(exports.blob_url = [])
@@ -10,9 +11,9 @@
1011 var pull = require('pull-stream')
1112
1213 var id = require('../keys').id
1314
14-var default_avatar = '&qjeAs8+uMXLlyovT4JnEpMwTNDx/QXHfOl2nv2u0VCM=.sha256'
15+var default_avatar = path.join(__dirname, 'avatar_fallback.png')
1516
1617 var avatars = AVATARS = {}
1718
1819 function isFunction (f) {
@@ -77,9 +78,9 @@
7778 exports.avatar_image = function (author, classes) {
7879 classes = classes || ''
7980 if(classes && 'string' === typeof classes) classes = '.avatar--'+classes
8081
81- var img = h('img'+classes, {src: blob_url(default_avatar)})
82+ var img = h('img'+classes, {src: default_avatar})
8283 // getAvatar({links: sbot_links}, id, author, function (err, avatar) {
8384 // if (err) return console.error(err)
8485 // if(ref.isBlob(avatar.image))
8586 // img.src = blob_url(avatar.image)
modules/avatar_fallback.png
modules/avatar_fallback.png

Built with git-ssb-web