Merge branch 'master' into release

This commit is contained in:
Jay 2018-08-21 22:49:44 +08:00
commit a43ede311e
2 changed files with 7 additions and 1 deletions

View File

@ -73,7 +73,8 @@ const parseCMD = async (text = '', source = {}) => {
let txt = ''
console.log('obj ::: ', obj)
for (let i of obj) {
txt += (txt.length > 0 ? '|' : '') + i.key
let key = i.key.replace(/(\+|\[|\]|\*|\$|\^|\(|\))/g, '\\$1')
txt += (txt.length > 0 ? '|' : '') + key
}
regex = new RegExp(`^(${txt})$`)
console.log(regex)

View File

@ -55,6 +55,11 @@ r.post('/login', koaBody(), async (c, n) => {
c.obj = resObject('Success')
})
r.post('/logout', async (c, n) => {
c.session = null
c.obj = resObject('Success')
})
r.get('/session', checkSession, async (c, n) => {
c.obj = resObject('Success', {
user: c.state.loginUser