From 4d7c8a2c7dc31561409d73031d181440ff983bad Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Sat, 20 Aug 2011 19:27:41 +0100 Subject: [PATCH] added ability to set a custom favicon --- node/server.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/node/server.js b/node/server.js index 4054dc62..6238ae0a 100644 --- a/node/server.js +++ b/node/server.js @@ -344,8 +344,16 @@ async.waterfall([ app.get('/favicon.ico', function(req, res) { res.header("Server", serverName); - var filePath = path.normalize(__dirname + "/../static/favicon.ico"); - res.sendfile(filePath, { maxAge: exports.maxAge }); + var filePath = path.normalize(__dirname + "/../static/custom/favicon.ico"); + res.sendfile(filePath, { maxAge: exports.maxAge }, function(err) + { + //there is no custom favicon, send the default favicon + if(err) + { + filePath = path.normalize(__dirname + "/../static/favicon.ico"); + res.sendfile(filePath, { maxAge: exports.maxAge }); + } + }); }); //let the server listen