diff --git a/src/http.ts b/src/http.ts index 6338ccd..0ed254b 100644 --- a/src/http.ts +++ b/src/http.ts @@ -317,7 +317,19 @@ async function initSite(openReg) { }); app.get('/profile', (req, res) => { if(tryDecode(req.cookies.Authorization)) { - res.render('profile.njk', Object.assign({auth: {is: true, name: JWT.decode(req.cookies.Authorization)['username']}}, njkconf)); + db.query('select * from user_meta where username='+db.raw.escape(JWT.decode(req.cookies.Authorization)['username'])).then((result) => { + res.render('profile.njk', Object.assign({meta: result[0]}, {auth: {is: true, name: JWT.decode(req.cookies.Authorization)['username']}}, njkconf)); + }); + //res.render('profile.njk', Object.assign({auth: {is: true, name: JWT.decode(req.cookies.Authorization)['username']}}, njkconf)); + } + else res.redirect('/login'); + }); + app.get('/profile/chat', (req, res) => { + if(tryDecode(req.cookies.Authorization)) { + db.query('select * from chat_integration where username='+db.raw.escape(JWT.decode(req.cookies.Authorization)['username'])).then((result) => { + res.render('chat_integ.njk', Object.assign({integ: result[0]}, {auth: {is: true, name: JWT.decode(req.cookies.Authorization)['username']}}, njkconf)); + }); + //res.render('chat_integ.njk', Object.assign({auth: {is: true, name: JWT.decode(req.cookies.Authorization)['username']}}, njkconf)); } else res.redirect('/login'); }); diff --git a/templates/chat_integ.njk b/templates/chat_integ.njk new file mode 100644 index 0000000..01537d1 --- /dev/null +++ b/templates/chat_integ.njk @@ -0,0 +1,14 @@ +{% extends "base.njk" %} +{% block content %} +