mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-04 22:27:10 -04:00
Merge 95c9310be0
into a9540cb8b7
This commit is contained in:
commit
5510ad1c90
1 changed files with 29 additions and 0 deletions
|
@ -317,6 +317,35 @@ async.waterfall([
|
||||||
apiHandler.handle(req.params.func, req.query, req, res);
|
apiHandler.handle(req.params.func, req.query, req, res);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//This is a api call, collect all post informations and pass it to the apiHandler
|
||||||
|
app.post('/api/1/:func', function(req, res)
|
||||||
|
{
|
||||||
|
res.header("Server", serverName);
|
||||||
|
res.header("Content-Type", "application/json; charset=utf-8");
|
||||||
|
|
||||||
|
new formidable.IncomingForm().parse(req, function(err, fields, files)
|
||||||
|
{
|
||||||
|
apiLogger.info("REQUEST, " + req.params.func + ", " + JSON.stringify(fields));
|
||||||
|
|
||||||
|
//wrap the send function so we can log the response
|
||||||
|
res._send = res.send;
|
||||||
|
res.send = function(response)
|
||||||
|
{
|
||||||
|
response = JSON.stringify(response);
|
||||||
|
apiLogger.info("RESPONSE, " + req.params.func + ", " + response);
|
||||||
|
|
||||||
|
//is this a jsonp call, if yes, add the function call
|
||||||
|
if(req.query.jsonp)
|
||||||
|
response = req.query.jsonp + "(" + response + ")";
|
||||||
|
|
||||||
|
res._send(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
//call the api handler
|
||||||
|
apiHandler.handle(req.params.func, fields, req, res);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
//The Etherpad client side sends information about how a disconnect happen
|
//The Etherpad client side sends information about how a disconnect happen
|
||||||
app.post('/ep/pad/connection-diagnostic-info', function(req, res)
|
app.post('/ep/pad/connection-diagnostic-info', function(req, res)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue