mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-05 06:37:10 -04:00
checked to make sure init is passed a function
This commit is contained in:
parent
7e522eaf85
commit
a7d9e6b9a3
1 changed files with 24 additions and 20 deletions
|
@ -451,6 +451,8 @@ function gotoPadCombinator(checkPadName, padManager){
|
||||||
}
|
}
|
||||||
|
|
||||||
function init(additionalSetup){
|
function init(additionalSetup){
|
||||||
|
if("function" != typeof additionalSetup)
|
||||||
|
additionalSetup = function(){};
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
//initalize the database
|
//initalize the database
|
||||||
setupDb,
|
setupDb,
|
||||||
|
@ -485,6 +487,7 @@ function init(additionalSetup){
|
||||||
var httpLogger = log4js.getLogger("http");
|
var httpLogger = log4js.getLogger("http");
|
||||||
var apiLogger = log4js.getLogger("API");
|
var apiLogger = log4js.getLogger("API");
|
||||||
|
|
||||||
|
|
||||||
//checks for padAccess
|
//checks for padAccess
|
||||||
function hasPadAccess(req, res, callback)
|
function hasPadAccess(req, res, callback)
|
||||||
{
|
{
|
||||||
|
@ -561,27 +564,28 @@ function init(additionalSetup){
|
||||||
};
|
};
|
||||||
|
|
||||||
var posts = {
|
var posts = {
|
||||||
|
'/p/:pad/import': postImportPadCombinator(
|
||||||
//handle import requests
|
goToPad, settings, serverName, hasPadAccess, importHandler
|
||||||
'/p/:pad/import': postImportPadCombinator(goToPad, settings, serverName, hasPadAccess, importHandler)
|
),
|
||||||
//This is a api POST call, collect all post informations and pass it to the apiHandler
|
'/api/1/:func': function(req, res){
|
||||||
'/api/1/:func': function(req, res)
|
new formidable.IncomingForm().parse(
|
||||||
{
|
req,
|
||||||
new formidable.IncomingForm().parse(req, function(err, fields, files)
|
function(err, fields, files)
|
||||||
{
|
{
|
||||||
apiCaller(req, res, fields)
|
apiCaller(req, res, fields)
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
'/ep/pad/connection-diagnostic-info': logOkPostCombinator(
|
||||||
//The Etherpad client side sends information about how a disconnect happen
|
"DIAGNOSTIC-INFO", "log", "diagnosticInfo"
|
||||||
'/ep/pad/connection-diagnostic-info': logOkPostCombinator("DIAGNOSTIC-INFO", "log", "diagnosticInfo"),
|
),
|
||||||
|
'/jserror': logOkPostCombinator(
|
||||||
//The Etherpad client side sends information about client side javscript errors
|
"CLIENT SIDE JAVASCRIPT ERROR", "error", "errorInfo"
|
||||||
'/jserror': logOkPostCombinator("CLIENT SIDE JAVASCRIPT ERROR", "error", "errorInfo")
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
additionalSetup(app, gets, posts);
|
additionalSetup(app, gets, posts, managers, handlers, db);
|
||||||
|
|
||||||
|
|
||||||
for(var key in gets) app.get(key, gets[key]);
|
for(var key in gets) app.get(key, gets[key]);
|
||||||
|
@ -602,4 +606,4 @@ function init(additionalSetup){
|
||||||
}
|
}
|
||||||
|
|
||||||
this.init = init;
|
this.init = init;
|
||||||
init(function(app, gets, posts){});
|
init(function(app, gets, posts, managers, handlers, db){});
|
Loading…
Add table
Add a link
Reference in a new issue