{"id":274,"date":"2013-03-19T10:16:59","date_gmt":"2013-03-19T09:16:59","guid":{"rendered":"http:\/\/pusling.com\/blog\/?p=274"},"modified":"2016-07-10T15:19:05","modified_gmt":"2016-07-10T14:19:05","slug":"simple-libravatar-service","status":"publish","type":"post","link":"https:\/\/pusling.com\/blog\/?p=274","title":{"rendered":"Simple Libravatar service"},"content":{"rendered":"<p>So, since recently bugs.debian.org has started using libravatar avatars. Not yet the federated service, but that&#8217;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.<\/p>\n<p>So I did it.<\/p>\n<pre class=\"lang:default decode:true \" >_avatars._tcp.pusling.com. 43200 IN     SRV     10 10 80 static.pusling.com.<\/pre>\n<p>and in my root dir for that one I have source\/ and avatar\/<\/p>\n<pre class=\"lang:default decode:true \" >$ ls\r\navatar  source<\/pre>\n<p>In source, I have default.png which I&#8217;m serving and a series of avatars for various email addresses<\/p>\n<pre class=\"lang:default decode:true \" >$ ls source\/\r\ndebian@pusling.com  default.png<\/pre>\n<p>and then I have a simple script to generate the right file names:<\/p>\n<pre class=\"lang:default decode:true \" >#! \/bin\/sh\r\n\r\n(cd avatar;\r\nls | while read file ; do [ -L $file  ] && rm $file ; done\r\n)\r\nfor i in source\/*@* ; do ln -s ..\/$i avatar\/$(echo -n $(basename $i) | sha256sum | sed 's\/-\/\/') ; done\r\nfor i in source\/*@* ; do ln -s ..\/$i avatar\/$(echo -n $(basename $i) | md5sum | sed 's\/-\/\/') ; done<\/pre>\n<p>and the last piece of magic to get everything to work:<\/p>\n<pre class=\"lang:default decode:true \" >$ cat avatar\/.htaccess \r\nErrorDocument 404 \"\/source\/default.png\"\r\nForceType image\/png\r\n\r\n&lt;Files \"index.html\"&gt;\r\nForceType text\/html\r\n&lt;\/Files&gt;\r\n<\/pre>\n<p>and a set of index.html files created with &#8216;touch&#8217;.<\/p>\n<p>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.<\/p>\n<p>When will debian.org and kde.org start providing avatar services?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So, since recently bugs.debian.org has started using libravatar avatars. Not yet the federated service, but that&#8217;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 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,3,4,7,10],"tags":[],"class_list":["post-274","post","type-post","status-publish","format-standard","hentry","category-debian","category-english","category-kde","category-opensourcedays","category-pocket-projects"],"_links":{"self":[{"href":"https:\/\/pusling.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/274","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pusling.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pusling.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pusling.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/pusling.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=274"}],"version-history":[{"count":10,"href":"https:\/\/pusling.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/274\/revisions"}],"predecessor-version":[{"id":442,"href":"https:\/\/pusling.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/274\/revisions\/442"}],"wp:attachment":[{"href":"https:\/\/pusling.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=274"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pusling.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=274"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pusling.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=274"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}