[Server] Fix bug

This commit is contained in:
syuilo⭐️ 2017-02-16 20:08:28 +09:00 committed by GitHub
parent 5817b79866
commit 508c1da792

View file

@ -23,6 +23,7 @@ module.exports = async (app: express.Application) => {
app.post('/hooks/github', (req, res, next) => { app.post('/hooks/github', (req, res, next) => {
if ((new Buffer(req.headers['x-hub-signature'])).equals(new Buffer('sha1=' + crypto.createHmac('sha1', config.github_bot.hook_secret).update(JSON.stringify(req.body)).digest('hex')))) { if ((new Buffer(req.headers['x-hub-signature'])).equals(new Buffer('sha1=' + crypto.createHmac('sha1', config.github_bot.hook_secret).update(JSON.stringify(req.body)).digest('hex')))) {
handler.emit(req.headers['x-github-event'], req.body); handler.emit(req.headers['x-github-event'], req.body);
res.sendStatus(200);
} else { } else {
res.sendStatus(400); res.sendStatus(400);
} }