Commit efdbe6695ca3e1d666b87959bde8920385c38141
cache tracking for avatars
Dominic Tarr committed on 4/16/2019, 6:55:55 PMParent: 67bc0e39b23033f0246be22fa9eac7ce006fb712
Files changed
apis/avatar.js | changed |
apis/avatar.js | ||
---|---|---|
@@ -2,9 +2,9 @@ | ||
2 | 2 … | var h = require('../util').h |
3 | 3 … | var toUrl = require('../util').toUrl |
4 | 4 … | |
5 | 5 … | module.exports = function (sbot) { |
6 | - return function (opts) { | |
6 … | + return function (opts, apply) { | |
7 | 7 … | //accept feed directly, so you can do map(api.avatar) |
8 | 8 … | if(ref.isFeed(opts)) |
9 | 9 … | opts = {id: opts} |
10 | 10 … | if(ref.isFeed(opts.link)) |
@@ -21,9 +21,13 @@ | ||
21 | 21 … | |
22 | 22 … | sbot.names.getImageFor(opts.id, function (err, blobId) { |
23 | 23 … | sbot.names.getSignifier(opts.id, function (err, name) { |
24 | 24 … | 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 … | + ), | |
26 | 30 … | _image ? h('img', { |
27 | 31 … | className:'avatar', |
28 | 32 … | src: '/blobs/get/'+blobId, |
29 | 33 … | //getSignifier returns id as name if there isn't a name available. |
Built with git-ssb-web