changeset 10:360186772aa3

Don’t hardcode avatars URL.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 02 Nov 2011 10:00:01 -0700
parents 42d3f454d4b4
children f4422eafb0f8
files atom.js configuration.js server.js
diffstat 3 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/atom.js
+++ b/atom.js
@@ -67,7 +67,7 @@ parsers[ns.atom] = function(id, xml) {
 				cite.appendChild(a);
 
 				var img = document.createElementNS(ns.xhtml, 'img');
-				img.src = 'http://eldonilo.linkmauve.fr/avatar/' + atomJID.bare;
+				img.src = config.avatarRoot + atomJID.bare;
 				aside.appendChild(img);
 			} else
 				cite.appendChild(document.createTextNode(atomName));
--- a/configuration.js
+++ b/configuration.js
@@ -30,6 +30,7 @@ config.defaultNode = 'psgxs.linkmauve.fr
 // Root of the webservice, and Atom HTTP service.
 config.webRoot = '/blog/';
 config.atomRoot = '/atom/';
+config.avatarRoot = '/avatar/';
 
 // These are the host and the port on which the web service will
 // listen.  If you want IPv4 connection only, instead of both IPv4 and
--- a/server.js
+++ b/server.js
@@ -171,7 +171,8 @@ var parseAtom = function(atom, id, jid) 
 		try{
 			var uri = author.getChild('uri', ns.atom).getText();
 			footer.c('cite').c('a', {href: uri}).t(name).up();
-			avatar.attrs.src = '/avatar/' + uri.substring(5);
+			avatar.attrs.src = config.avatarRoot + uri.substring(5);
+			avatar.attrs.alt = uri.substring(5);
 		} catch (e) {
 			footer.c('cite').t(name);
 		}