modified: src/websrv.js

This commit is contained in:
Flummi 2016-09-10 18:13:40 +02:00
parent 235fd353c9
commit e33ec38318

View File

@ -27,17 +27,17 @@ function Websrv(tbot, tsql, tlib) {
var body = ''; var body = '';
req.on('data', (data) => { req.on('data', (data) => {
body += data; body += data;
if(body.length > 1e6) { if(body.length > 1e6)
req.connection.destroy(); req.connection.destroy();
}
}); });
req.on('end', () => { req.on('end', () => {
console.log(body); body = JSON.parse(body);
//lib.log(body.commits);
var eventname = body.event_name; var eventname = body.event_name;
var autor = body.user_name; var autor = body.user_name;
var commit = body.commits[body.commits[total_commits_count]-1].message; var commit = body.commits[body.commits.length-1].message.replace('\n','');
bot.log( eventname + ' from ' + autor + ' ('+commit+')' ); lib.log( eventname + ' from ' + autor + ' ('+commit+')' );
}); });
res.writeHead(200, { 'Content-Type': 'text/html' }); res.writeHead(200, { 'Content-Type': 'text/html' });
res.end('muh', 'utf-8'); res.end('muh', 'utf-8');