0
0
This commit is contained in:
syuilo 2017-02-01 00:12:49 +09:00
parent 740ef6a542
commit 2d78329860
4 changed files with 26 additions and 2 deletions

View File

@ -90,6 +90,7 @@
"file-type": "4.1.0", "file-type": "4.1.0",
"fuckadblock": "3.2.1", "fuckadblock": "3.2.1",
"git-last-commit": "0.2.0", "git-last-commit": "0.2.0",
"github-webhook-handler": "0.6.0",
"glob": "7.1.1", "glob": "7.1.1",
"gm": "1.23.0", "gm": "1.23.0",
"gulp": "3.9.1", "gulp": "3.9.1",

View File

@ -58,6 +58,7 @@ app.use((req, res, next) => {
next(); next();
}); });
require('./service/github')(app);
require('./service/twitter')(app); require('./service/twitter')(app);
module.exports = app; module.exports = app;

18
src/api/service/github.ts Normal file
View File

@ -0,0 +1,18 @@
import * as express from 'express';
const createHandler = require('github-webhook-handler');
import config from '../../conf';
module.exports = (app: express.Application) => {
if (config.github_bot == null) return;
const handler = createHandler({
path: '/hooks/github',
secret: config.github_bot.hook_secret
});
app.post('/hooks/github', handler);
handler.on('*', event => {
console.dir(event);
});
};

View File

@ -56,11 +56,15 @@ interface ISource {
siteKey: string; siteKey: string;
secretKey: string; secretKey: string;
}; };
accesslog: string; accesslog?: string;
twitter: { twitter?: {
consumer_key: string; consumer_key: string;
consumer_secret: string; consumer_secret: string;
}; };
github_bot?: {
hook_secret: string;
bot_token: string;
};
} }
/** /**