add fan page notify, add twitch route, todo: twitch webhook reg
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user