add fan page notify, add twitch route, todo: twitch webhook reg

This commit is contained in:
Jay
2018-06-27 00:59:53 +08:00
parent f409e6ff61
commit 1f3057df69
15 changed files with 377 additions and 51 deletions
+31
View File
@@ -0,0 +1,31 @@
const Router = require('koa-router')
const r = new Router()
const {
getRaw
} = require('../../libs/middleware')
const config = require('../../config')
r.get('/', async (c, n) => {
let mode = c.query['hub.mode']
let token = c.query['hub.secret']
let challenge = c.query['hub.challenge']
console.log(mode, token, challenge)
console.log(c.headers)
if (mode) {
if (mode === 'subscribe') {
c.status = 200
c.body = challenge
} else {
c.status = 403
c.body = ''
}
}
})
r.post('/', getRaw, async (c, n) => {
console.log(JSON.stringify(c.request.body, null, 2))
c.body = 'success'
c.status = 200
})
module.exports = r