# HG changeset patch # User Emmanuel Gil Peyrot # Date 1307151764 -7200 # Node ID 6689cc444617cd52832a044a2ccc98e4e9358f89 # Parent 7fdae201c1e22da2e8301160f9756ee394f719c0 Use an external XHTML file. diff --git a/avatar.js b/avatar.js --- a/avatar.js +++ b/avatar.js @@ -200,7 +200,7 @@ var showImage = function(jid, res) { } var last = new Date(stats.mtime); - var now = new Date(); + var now = new Date; if (now - last > 24*60*60*1000) getVCard(jid, res); @@ -253,24 +253,12 @@ http.createServer(function (req, res) { if (jid === '') { res.writeHead(200, {'Content-Type': 'application/xhtml+xml'}); - res.write('\n'); - res.write('\n'); - res.write('\n'); - res.write('\t\n'); - res.write('\t\tJavaScript XMPP Avatar Retriever\n'); - res.write('\t\n'); - res.write('\t\n'); - res.write('\t\t

JavaScript XMPP Avatar Retriever

\n'); - res.write('\t\t

Put any JID and get its avatar. :)

\n'); - res.write('\t\t
\n'); - res.write('\t\t\t

\n'); - res.write('\t\t\t\t\n'); - res.write('\t\t\t\t\n'); - res.write('\t\t\t

\n'); - res.write('\t\t
\n'); - res.write('\t\t\n'); - res.write('\t\n'); - res.end('\n'); + fs.readFile('index.xhtml', function(err, data) { + if (err) + throw err; + + res.end(data); + }); return; } @@ -282,7 +270,6 @@ http.createServer(function (req, res) { } req.on('data', function(content) { - console.log(content); var jid = unescape(content.toString()).replace(/^jid=/, ''); res.writeHead(301, {'Location': jid}); res.end(); diff --git a/index.xhtml b/index.xhtml new file mode 100644 --- /dev/null +++ b/index.xhtml @@ -0,0 +1,27 @@ + + + + + JavaScript XMPP Avatar Retriever + + +

JavaScript XMPP Avatar Retriever

+ +

Put any JID and get its avatar. :)

+ +
+

+ + +

+
+ + + +