Customize page with streamer username
parent
b06c425352
commit
249a5911b4
|
@ -113,3 +113,8 @@ CREATE OR REPLACE VIEW vote_score_all_vw AS
|
|||
UNION ALL SELECT * FROM vote_score_subscriber_vw
|
||||
) AS union_vote_score
|
||||
GROUP BY url;
|
||||
|
||||
CREATE OR REPLACE VIEW streamer_user_vw AS
|
||||
SELECT users.userid as userid, users.displayname as displayname, users.imageurl as imageurl FROM streamer
|
||||
LEFT JOIN users
|
||||
ON streamer.userid = users.userid;
|
||||
|
|
13
src/app.ts
13
src/app.ts
|
@ -233,17 +233,26 @@ app.get("/callback", async (request, response) => {
|
|||
// Frontend templates
|
||||
app.get("/", async (request, response) => {
|
||||
if (request.session) await validateApiToken(request.session);
|
||||
const getStreamerInfoQuery = {
|
||||
name: "getStreamerInfo",
|
||||
text: "SELECT displayname,imageurl FROM streamer_user_vw"
|
||||
}
|
||||
var streamerInfo = await db.query(getStreamerInfoQuery).then((result: pg.QueryResult) => result.rows[0]);;
|
||||
if (!request.session || !request.session.user) {
|
||||
response.render('main.eta', {
|
||||
loggedIn: false,
|
||||
clientId: config.twitchClientId,
|
||||
urlPrefix: config.urlPrefix
|
||||
urlPrefix: config.urlPrefix,
|
||||
streamerName: streamerInfo['displayname'],
|
||||
streamerProfilePicture: streamerInfo['imageurl']
|
||||
});
|
||||
} else {
|
||||
response.render('main.eta', {
|
||||
loggedIn: true,
|
||||
userName: request.session.user.display_name,
|
||||
userProfilePicture: request.session.user.profile_image_url
|
||||
userProfilePicture: request.session.user.profile_image_url,
|
||||
streamerName: streamerInfo['displayname'],
|
||||
streamerProfilePicture: streamerInfo['imageurl']
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
<html>
|
||||
<head>
|
||||
<link rel=stylesheet href=style.css />
|
||||
<title>Learn Request Queue</title>
|
||||
<title><%= it.streamerName %>'s Learn Request Queue</title>
|
||||
<script>window.loggedIn = <%= it.loggedIn %></script>
|
||||
<script src="main.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="topbar">
|
||||
<div id="logo">Learn Request Queue</div>
|
||||
<div id="logo"><%= it.streamerName %>'s Learn Request Queue</div>
|
||||
<div id="nav-requests"><a href="/">Requests</a></div>
|
||||
<%- if (it.loggedIn) { -%>
|
||||
<div id="nav-addrequest"><a href="#" onclick="openAddRequestModal()">Add Request</a></div>
|
||||
|
|
Loading…
Reference in New Issue