This commit is contained in:
Jay 2018-07-03 22:14:14 +08:00
parent 88e412e33a
commit 653dbe5fb6
2 changed files with 15 additions and 0 deletions

View File

@ -1,4 +1,5 @@
const Router = require('koa-router')
const xml2js = require('xml2js')
const r = new Router()
// const koaBody = require('koa-body')
const {
@ -9,6 +10,19 @@ const {
} = require('../../libs/line-message')
r.get('/youtube/webhook', async (c, n) => {
let mode = c.query['hub.mode'] || ''
let verifyToken = c.query['hub.verify_token'] || ''
let challenge = c.query['hub.challenge']
if (mode) {
if (mode === 'subscribe') {
c.status = 200
c.body = challenge
} else {
c.status = 403
c.body = ''
}
}
})
r.post('/youtube/webhook', getRaw, async (c, n) => {

View File

@ -2,6 +2,7 @@ const Router = require('koa-router')
const r = new Router()
r.use('/line', require('./line').routes())
r.use('/google', require('./google').routes())
// r.use('/twitch', require('./twitch').routes())
module.exports = r