Add templates for chat integration UI

merge-requests/8/head
knotteye 4 years ago
parent 717d63917c
commit 190e61557e
  1. 14
      src/http.ts
  2. 14
      templates/chat_integ.njk
  3. 6
      templates/profile.njk

@ -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');
});

@ -0,0 +1,14 @@
{% extends "base.njk" %}
{% block content %}
<h3>Integrate your stream chat</h3><span style="font-size: small;">Ask your instance administrator for the discord, xmpp, and irc servers you will be using.</span>
<p></p>
<form action="/api/user/update/chat" method="POST" target="responseFrame">
Discord Channel: </br><input type="text" name="discord" style="min-width: 300px" value="{{integ.discord}}"/></br>
IRC Channel: </br><input type="text" name="irc" style="min-width: 300px" value="{{integ.irc}}"/></br>
XMPP Room: </br><input type="text" name="xmpp" style="min-width: 300px" value="{{integ.xmpp}}"/></br>
Twitch Channel: </br><input type="text" name="twitch" style="min-width: 300px" value="{{integ.twitch}}"/></br>
<p></p>
<input type="submit" value="Update Chat">
</form></br>
<iframe name="responseFrame" border="0" frameborder="0" style="display: inline;"></iframe>
{% endblock %}

@ -1,10 +1,10 @@
{% extends "base.njk" %}
{% block content %}
<h3>Update your profile on {{ sitename }}</h3><span style="font-size: small;">Or, change your <a href="/changepwd">password</a>.</span>
<h3>Update your profile on {{ sitename }}</h3><span style="font-size: small;">Integrate your chat with other <a href="/profile/chat">platforms</a>.</br></span><span style="font-size: small;">Or, change your <a href="/changepwd">password</a>.</span>
<p></p>
<form action="/api/user/update" method="POST" target="responseFrame">
Stream Title: </br><input type="text" name="title" style="min-width: 300px"/></br>
Bio: </br><input type="text" name="bio" style="min-width: 300px; min-height: 150px;"/></br>
Stream Title: </br><input type="text" name="title" style="min-width: 300px" value="{{meta.title}}"/></br>
Bio: </br><input type="text" name="bio" style="min-width: 300px; min-height: 150px;" value="{{meta.about}}"/></br>
Record VODs: <input type="radio" name="record" value="true"> Yes<input type="radio" name="record" value="false" /> No</br></br>
<input type="submit" value="Update Profile">
</form></br>