mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-05 06:37:10 -04:00
factored out static serve on goToPad
This commit is contained in:
parent
a4795eb88d
commit
fdcf1d4153
1 changed files with 13 additions and 39 deletions
|
@ -296,6 +296,16 @@ function getRoCombinator(serverName, managers, padAccessp, ERR, exporthtml){
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function sendStaticIfPad(goToPad, padManager, path, filename){
|
||||||
|
return function staticSender(req, res, next){
|
||||||
|
return goToPad(
|
||||||
|
req, res,
|
||||||
|
function goBack(){
|
||||||
|
return sendStatic(path, res, filename);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
//initalize the database
|
//initalize the database
|
||||||
setupDb,
|
setupDb,
|
||||||
|
@ -351,23 +361,6 @@ async.waterfall([
|
||||||
return ERR(err, callback);
|
return ERR(err, callback);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
/*
|
|
||||||
securityManager.checkAccess(req.params.pad, req.cookies.sessionid, req.cookies.token, req.cookies.password, function(err, accessObj)
|
|
||||||
{
|
|
||||||
if(ERR(err, callback)) return;
|
|
||||||
|
|
||||||
//there is access, continue
|
|
||||||
if(accessObj.accessStatus == "grant")
|
|
||||||
{
|
|
||||||
callback();
|
|
||||||
}
|
|
||||||
//no access
|
|
||||||
else
|
|
||||||
{
|
|
||||||
res.send("403 - Can't touch this", 403);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//checks for basic http auth
|
//checks for basic http auth
|
||||||
|
@ -417,30 +410,11 @@ async.waterfall([
|
||||||
}
|
}
|
||||||
|
|
||||||
//serve pad.html under /p
|
//serve pad.html under /p
|
||||||
app.get('/p/:pad', function(req, res, next)
|
app.get('/p/:pad', sendStaticIfPad(goToPad, padManager, path, "pad.html"));
|
||||||
{
|
|
||||||
goToPad(req, res, function() {
|
|
||||||
return sendStatic(path, res, "pad.html");
|
|
||||||
/*
|
|
||||||
res.header("Server", serverName);
|
|
||||||
var filePath = path.normalize(__dirname + "/../static/pad.html");
|
|
||||||
res.sendfile(filePath, { maxAge: exports.maxAge });
|
|
||||||
*/
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
//serve timeslider.html under /p/$padname/timeslider
|
//serve timeslider.html under /p/$padname/timeslider
|
||||||
app.get('/p/:pad/timeslider', function(req, res, next)
|
app.get('/p/:pad/timeslider', sendStaticIfPad(goToPad, padManager, path, "timeslider.html"));
|
||||||
{
|
|
||||||
goToPad(req, res, function() {
|
|
||||||
return sendStatic(path, res "timeslider.html");
|
|
||||||
/*
|
|
||||||
res.header("Server", serverName);
|
|
||||||
var filePath = path.normalize(__dirname + "/../static/timeslider.html");
|
|
||||||
res.sendfile(filePath, { maxAge: exports.maxAge });
|
|
||||||
*/
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
//serve timeslider.html under /p/$padname/timeslider
|
//serve timeslider.html under /p/$padname/timeslider
|
||||||
app.get('/p/:pad/:rev?/export/:type', function(req, res, next)
|
app.get('/p/:pad/:rev?/export/:type', function(req, res, next)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue