git ssb

2+

Dominic / yap



Commit efdbe6695ca3e1d666b87959bde8920385c38141

cache tracking for avatars

Dominic Tarr committed on 4/16/2019, 6:55:55 PM
Parent: 67bc0e39b23033f0246be22fa9eac7ce006fb712

Files changed

apis/avatar.jschanged
apis/avatar.jsView
@@ -2,9 +2,9 @@
22 var h = require('../util').h
33 var toUrl = require('../util').toUrl
44
55 module.exports = function (sbot) {
6- return function (opts) {
6 + return function (opts, apply) {
77 //accept feed directly, so you can do map(api.avatar)
88 if(ref.isFeed(opts))
99 opts = {id: opts}
1010 if(ref.isFeed(opts.link))
@@ -21,9 +21,13 @@
2121
2222 sbot.names.getImageFor(opts.id, function (err, blobId) {
2323 sbot.names.getSignifier(opts.id, function (err, name) {
2424 cb(null,
25- h('a.Avatar', {href: opts.href || toUrl('public', {author:opts.id})},
25 + h('a.Avatar',
26 + Object.assign(
27 + {href: opts.href || toUrl('public', {author:opts.id})},
28 + apply.cacheAttrs(toUrl('avatar', opts), opts.id)
29 + ),
2630 _image ? h('img', {
2731 className:'avatar',
2832 src: '/blobs/get/'+blobId,
2933 //getSignifier returns id as name if there isn't a name available.

Built with git-ssb-web