So, since recently bugs.debian.org has started using libravatar avatars. Not yet the federated service, but that’s supposedly in the works. But for that, one of course need to run each own service. Which I wanted to do. In a simple way.
So I did it.
_avatars._tcp.pusling.com. 43200 IN SRV 10 10 80 static.pusling.com.
and in my root dir for that one I have source/ and avatar/
$ ls
avatar source
In source, I have default.png which I’m serving and a series of avatars for various email addresses
$ ls source/
debian@pusling.com default.png
and then I have a simple script to generate the right file names:
#! /bin/sh
(cd avatar;
ls | while read file ; do [ -L $file ] && rm $file ; done
)
for i in source/*@* ; do ln -s ../$i avatar/$(echo -n $(basename $i) | sha256sum | sed ‘s/-//’) ; done
for i in source/*@* ; do ln -s ../$i avatar/$(echo -n $(basename $i) | md5sum | sed ‘s/-//’) ; done
and the last piece of magic to get everything to work:
$ cat avatar/.htaccess
ErrorDocument 404 “/source/default.png”
ForceType image/png
<Files “index.html”>
ForceType text/html
</Files>
and a set of index.html files created with ‘touch’.
So there you go. A simple libravatar service, ignoring some pieces of the spec, but it should be good enough for most people. I might save my rants about the libravatar spec for another day. But it involves implementing a complete redirecting service and scaling of images.
When will debian.org and kde.org start providing avatar services?