From 7f6f734dbc2e571a20ea9c046e0a1161a486a562 Mon Sep 17 00:00:00 2001 From: Wikinaut Date: Tue, 7 Feb 2012 09:43:48 +0100 Subject: [PATCH] nice pad urls --- node/server.js | 78 +++++++++++++++++++++++++------------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/node/server.js b/node/server.js index 40ca2cf05..69813bc8c 100644 --- a/node/server.js +++ b/node/server.js @@ -199,7 +199,46 @@ async.waterfall([ res.send('Authentication required', 401); } } + + //The Etherpad client side sends information about client side javscript errors + app.post('/jserror', function(req, res) + { + new formidable.IncomingForm().parse(req, function(err, fields, files) + { + console.error("CLIENT SIDE JAVASCRIPT ERROR: " + fields.errorInfo); + res.end("OK"); + }); + }); + //serve index.html under / + app.get('/', function(req, res) + { + var filePath = path.normalize(__dirname + "/../static/index.html"); + res.sendfile(filePath, { maxAge: exports.maxAge }); + }); + + //serve robots.txt + app.get('/robots.txt', function(req, res) + { + var filePath = path.normalize(__dirname + "/../static/robots.txt"); + res.sendfile(filePath, { maxAge: exports.maxAge }); + }); + + //serve favicon.ico + app.get('/favicon.ico', function(req, res) + { + 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 }); + } + }); + }); + //serve read only pad app.get('/ro/:id', function(req, res) { @@ -367,45 +406,6 @@ async.waterfall([ }); }); - //The Etherpad client side sends information about client side javscript errors - app.post('/jserror', function(req, res) - { - new formidable.IncomingForm().parse(req, function(err, fields, files) - { - console.error("CLIENT SIDE JAVASCRIPT ERROR: " + fields.errorInfo); - res.end("OK"); - }); - }); - - //serve index.html under / - app.get('/', function(req, res) - { - var filePath = path.normalize(__dirname + "/../static/index.html"); - res.sendfile(filePath, { maxAge: exports.maxAge }); - }); - - //serve robots.txt - app.get('/robots.txt', function(req, res) - { - var filePath = path.normalize(__dirname + "/../static/robots.txt"); - res.sendfile(filePath, { maxAge: exports.maxAge }); - }); - - //serve favicon.ico - app.get('/favicon.ico', function(req, res) - { - 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 app.listen(settings.port, settings.ip); console.log("Server is listening at " + settings.ip + ":" + settings.port);