Get client id and url prefix from config in main.eta

master
Dessa Simpson 2020-07-06 22:02:19 -07:00
parent bf89c6956d
commit 18ff4c9d1f
2 changed files with 11 additions and 3 deletions

View File

@ -136,9 +136,17 @@ app.get("/", async (request, response) => {
throw new Error ("Missing request.session")
}
if (!request.session.user) {
response.render('main.eta', { loggedIn: false });
response.render('main.eta', {
loggedIn: false,
clientId: config.twitchClientId,
urlPrefix: config.urlPrefix
});
} else {
response.render('main.eta', { loggedIn: true, userName: request.session.user.display_name, userProfilePicture: request.session.user.profile_image_url });
response.render('main.eta', {
loggedIn: true,
userName: request.session.user.display_name,
userProfilePicture: request.session.user.profile_image_url
});
}
});

View File

@ -15,7 +15,7 @@
<div id="nav-username"><%= it.userName %></div>
<div id="nav-logout"><a href="/logout">Logout</a></div>
<%- } else { // Not logged in -%>
<div id="nav-login"><a href="https://id.twitch.tv/oauth2/authorize?client_id=di37tc1dr9rhvmpvzgn8rkmi7bdhkk&redirect_uri=https://localhost/callback&response_type=code">Login</a></div>
<div id="nav-login"><a href="https://id.twitch.tv/oauth2/authorize?client_id=<%=it.clientId%>&redirect_uri=<%=it.urlPrefix%>/callback&response_type=code">Login</a></div>
<%- } %>
</div>
<div id="main">