mirror of
https://github.com/paricafe/misskey.git
synced 2024-11-25 03:56:44 -06:00
[Server] Fix bug
This commit is contained in:
parent
5149c4cea8
commit
e0703e0a50
1 changed files with 2 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
||||||
import * as EventEmitter from 'events';
|
import * as EventEmitter from 'events';
|
||||||
import * as express from 'express';
|
import * as express from 'express';
|
||||||
|
const crypto = require('crypto');
|
||||||
import User from '../models/user';
|
import User from '../models/user';
|
||||||
import config from '../../conf';
|
import config from '../../conf';
|
||||||
|
|
||||||
|
@ -20,7 +21,7 @@ module.exports = async (app: express.Application) => {
|
||||||
const handler = new EventEmitter();
|
const handler = new EventEmitter();
|
||||||
|
|
||||||
app.post('/hooks/github', (req, res, next) => {
|
app.post('/hooks/github', (req, res, next) => {
|
||||||
if (req.headers['x-hub-signature'] == config.github_bot.hook_secret) {
|
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);
|
||||||
} else {
|
} else {
|
||||||
res.sendStatus(400);
|
res.sendStatus(400);
|
||||||
|
|
Loading…
Reference in a new issue