diff --git a/libs/line-message/commands/index.js b/libs/line-message/commands/index.js index 5064721..58e7340 100644 --- a/libs/line-message/commands/index.js +++ b/libs/line-message/commands/index.js @@ -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) diff --git a/route/api/index.js b/route/api/index.js index 1e96956..f41bd1b 100644 --- a/route/api/index.js +++ b/route/api/index.js @@ -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