Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
Bacon_Space authored Oct 7, 2023
1 parent 396b9bd commit cda8cc1
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>StreamStats</title>
<link rel="icon" type="image/x-icon" href="default-favicon.ico" id="favicon">
<link rel="icon" type="image/x-icon" href="default-favicon.ico" id="favicon">
<meta name="og:image" content="default-image-url.png" id="og-image">
<meta name="twitter:image" content="default-image-url.png" id="twitter-image">
<!-- Include Bootstrap CSS -->
Expand All @@ -22,6 +22,11 @@ <h2>User Information</h2>
<p><strong>Followers:</strong> <span id="followers"></span></p>
<!-- You can display more user information here -->
</div>
<div id="alert-section" style="display: none;">
<div class="alert alert-danger" role="alert">
You are banned from this channel!
</div>
</div>
</div>
<footer>
&copy; <span id="current-year"></span> Bacon_Space <!-- Update the year here too -->
Expand All @@ -32,6 +37,7 @@ <h2>User Information</h2>
<script>
// Replace with your Twitch Client ID
const clientId = "5i1dxwe52zbj0tra8evwmm4m1b7clz1";
const bannedUsers = ["user1", "user2", "user3"]; // Replace with actual banned usernames

// Initialize the Twitch Embed SDK
const options = {
Expand All @@ -44,7 +50,7 @@ <h2>User Information</h2>
// Function to handle the login button click
document.getElementById("login-button").addEventListener("click", () => {
// Replace with your redirect URL
const redirectUrl = "https://streamstats.github.io/twitch";
const redirectUrl = window.location.href;

// Redirect the user to Twitch for authentication
window.location.href = `https://id.twitch.tv/oauth2/authorize?client_id=${clientId}&redirect_uri=${redirectUrl}&response_type=token&scope=user:read:follows`;
Expand All @@ -70,9 +76,15 @@ <h2>User Information</h2>
// You can fetch and display more user data here if needed
document.getElementById("followers").textContent = user.followers_count;

// Show the user information section
document.getElementById("user-info").style.display = "block";
document.getElementById("login-section").style.display = "none";
// Check if the user is banned
if (bannedUsers.includes(user.display_name.toLowerCase())) {
document.getElementById("alert-section").style.display = "block";
document.getElementById("login-section").style.display = "none";
} else {
// Show the user information section
document.getElementById("user-info").style.display = "block";
document.getElementById("login-section").style.display = "none";
}
})
.catch(error => console.error("Error fetching user data:", error));
}
Expand All @@ -84,7 +96,7 @@ <h2>User Information</h2>
}
</script>
<script>
// Fetch TheBaconSpace user's avatar from GitHub API
// Fetch TheBaconSpace user's avatar from GitHub API
fetch('https://api.github.com/users/StreamStats')
.then(response => response.json())
.then(data => {
Expand Down

0 comments on commit cda8cc1

Please sign in to comment.