2012-02-24 20:50:55 +01:00
|
|
|
var path = require('path');
|
2012-03-13 18:24:45 +01:00
|
|
|
var eejs = require('ep_etherpad-lite/node/eejs');
|
2012-02-24 20:50:55 +01:00
|
|
|
|
2012-02-25 16:53:15 +01:00
|
|
|
exports.expressCreateServer = function (hook_name, args, cb) {
|
2012-02-24 20:50:55 +01:00
|
|
|
|
|
|
|
//serve index.html under /
|
|
|
|
args.app.get('/', function(req, res)
|
|
|
|
{
|
2012-04-04 17:41:03 +02:00
|
|
|
res.send(eejs.require("ep_etherpad-lite/templates/index.html"));
|
2012-02-24 20:50:55 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
//serve robots.txt
|
|
|
|
args.app.get('/robots.txt', function(req, res)
|
|
|
|
{
|
2012-02-25 17:23:44 +01:00
|
|
|
var filePath = path.normalize(__dirname + "/../../../static/robots.txt");
|
2012-04-04 17:41:03 +02:00
|
|
|
res.sendfile(filePath);
|
2012-02-24 20:50:55 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
//serve favicon.ico
|
|
|
|
args.app.get('/favicon.ico', function(req, res)
|
|
|
|
{
|
2012-02-25 17:23:44 +01:00
|
|
|
var filePath = path.normalize(__dirname + "/../../../static/custom/favicon.ico");
|
2012-04-04 17:41:03 +02:00
|
|
|
res.sendfile(filePath, function(err)
|
2012-02-24 20:50:55 +01:00
|
|
|
{
|
|
|
|
//there is no custom favicon, send the default favicon
|
|
|
|
if(err)
|
|
|
|
{
|
2012-02-25 17:23:44 +01:00
|
|
|
filePath = path.normalize(__dirname + "/../../../static/favicon.ico");
|
2012-04-04 17:41:03 +02:00
|
|
|
res.sendfile(filePath);
|
2012-02-24 20:50:55 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2012-02-24 20:53:42 +01:00
|
|
|
|
|
|
|
//serve pad.html under /p
|
|
|
|
args.app.get('/p/:pad', function(req, res, next)
|
|
|
|
{
|
2012-11-01 13:44:59 +01:00
|
|
|
res.send(eejs.require("ep_etherpad-lite/templates/pad.html", {req: req}));
|
2012-02-24 20:53:42 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
//serve timeslider.html under /p/$padname/timeslider
|
|
|
|
args.app.get('/p/:pad/timeslider', function(req, res, next)
|
|
|
|
{
|
2012-11-01 13:44:59 +01:00
|
|
|
res.send(eejs.require("ep_etherpad-lite/templates/timeslider.html", {req: req}));
|
2012-02-24 20:53:42 +01:00
|
|
|
});
|
|
|
|
|
2012-02-24 20:50:55 +01:00
|
|
|
}
|