From 190e61557e70b2003a1fede3b9e5d50ffd900f22 Mon Sep 17 00:00:00 2001 From: knotteye Date: Fri, 26 Jun 2020 05:32:05 -0500 Subject: [PATCH] Add templates for chat integration UI --- src/http.ts | 14 +++++++++++++- templates/chat_integ.njk | 14 ++++++++++++++ templates/profile.njk | 6 +++--- 3 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 templates/chat_integ.njk 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 %} +

Integrate your stream chat

Ask your instance administrator for the discord, xmpp, and irc servers you will be using. +

+
+ Discord Channel:

+ IRC Channel:

+ XMPP Room:

+ Twitch Channel:

+

+ +

+ +{% endblock %} \ No newline at end of file diff --git a/templates/profile.njk b/templates/profile.njk index a370a6c..3daebce 100644 --- a/templates/profile.njk +++ b/templates/profile.njk @@ -1,10 +1,10 @@ {% extends "base.njk" %} {% block content %} -

Update your profile on {{ sitename }}

Or, change your password. +

Update your profile on {{ sitename }}

Integrate your chat with other platforms.
Or, change your password.

- Stream Title:

- Bio:

+ Stream Title:

+ Bio:

Record VODs: Yes No