Mercurial > eldonilo > avatar
comparison avatar.js @ 17:32f7526da5fe
Remove the hardcoded index.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sun, 10 Jul 2011 15:39:48 +0200 |
parents | 27eaec05cfd0 |
children | 92d6e1b40df5 |
comparison
equal
deleted
inserted
replaced
16:27eaec05cfd0 | 17:32f7526da5fe |
---|---|
228 mime: 'application/ecmascript', | 228 mime: 'application/ecmascript', |
229 error: 'source code unavailable! oO' | 229 error: 'source code unavailable! oO' |
230 }, | 230 }, |
231 README: {}, | 231 README: {}, |
232 COPYING: {}, | 232 COPYING: {}, |
233 'index.xhtml': { | |
234 re: /\/(index.xhtml)?$/, | |
235 mime: 'application/xhtml+xml', | |
236 error: '<h1 xmlns="http://www.w3.org/1999/xhtml">Index file not available.</h1>' | |
237 } | |
233 }; | 238 }; |
234 | 239 |
235 req.setEncoding('utf-8'); | 240 req.setEncoding('utf-8'); |
236 | 241 |
237 for (var i in easterEggs) { | 242 for (var i in easterEggs) { |
249 } | 254 } |
250 } | 255 } |
251 | 256 |
252 var jid = unescape(req.url.replace(new RegExp(config.webRoot), '')); | 257 var jid = unescape(req.url.replace(new RegExp(config.webRoot), '')); |
253 | 258 |
254 if (jid === '') { | |
255 res.writeHead(200, {'Content-Type': 'application/xhtml+xml'}); | |
256 fs.readFile('index.xhtml', function(err, data) { | |
257 if (err) | |
258 throw err; | |
259 | |
260 res.end(data); | |
261 }); | |
262 return; | |
263 } | |
264 | |
265 if (jid === 'redirect') { | 259 if (jid === 'redirect') { |
266 if (req.method !== 'POST') { | 260 if (req.method !== 'POST') { |
267 res.writeHead(404, {'Content-Type': 'text/plain'}); | 261 res.writeHead(404, {'Content-Type': 'text/plain'}); |
268 res.end('Error: redirect unavailable.'); | 262 res.end('Error: redirect unavailable.'); |
269 return; | 263 return; |