Get client id and url prefix from config in main.eta
parent
bf89c6956d
commit
18ff4c9d1f
12
src/app.ts
12
src/app.ts
|
@ -136,9 +136,17 @@ app.get("/", async (request, response) => {
|
||||||
throw new Error ("Missing request.session")
|
throw new Error ("Missing request.session")
|
||||||
}
|
}
|
||||||
if (!request.session.user) {
|
if (!request.session.user) {
|
||||||
response.render('main.eta', { loggedIn: false });
|
response.render('main.eta', {
|
||||||
|
loggedIn: false,
|
||||||
|
clientId: config.twitchClientId,
|
||||||
|
urlPrefix: config.urlPrefix
|
||||||
|
});
|
||||||
} else {
|
} 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
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<div id="nav-username"><%= it.userName %></div>
|
<div id="nav-username"><%= it.userName %></div>
|
||||||
<div id="nav-logout"><a href="/logout">Logout</a></div>
|
<div id="nav-logout"><a href="/logout">Logout</a></div>
|
||||||
<%- } else { // Not logged in -%>
|
<%- } 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>
|
||||||
<div id="main">
|
<div id="main">
|
||||||
|
|
Loading…
Reference in New Issue