-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
717e143
commit 97e9634
Showing
12 changed files
with
1,507 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,208 @@ | ||
const currentURL = window.location.href; | ||
|
||
function redirectToDiscord() { | ||
const baseURL = window.location.origin; // Extract base URL | ||
const AuthUrl = `${baseURL}/oauth/discord/?callbackUrl=${encodeURIComponent(currentURL)}`; | ||
window.location.href = AuthUrl; | ||
} | ||
|
||
document.addEventListener("DOMContentLoaded", function () { | ||
const storedAccessToken = getCookie("accessToken"); | ||
displayContents(); | ||
// Redirect to login if access token is not found | ||
if (!storedAccessToken) { | ||
// window.location.href = `https://auth.scyted.tv/www.scyted.tv/discord?redirectUri=${currentURL}`; | ||
displayLoginButton(); | ||
} else { | ||
// Fetch user data from Discord API | ||
fetchDiscordUserData(storedAccessToken) | ||
.then(userData => { | ||
// Display bot info and user info on the dashboard | ||
|
||
displayUserInfo(userData); | ||
|
||
const loggedInUserId = userData.id; | ||
|
||
// Fetch the list of user IDs from the JSON file | ||
// fetch('https://api.scyted.tv/wave-development/dashboard/access/scytedtv-user-access.json') | ||
fetch('https://api.scyted.tv/website/dashboard/access/dashboard-access.json') | ||
.then(response => response.json()) | ||
.then(userIds => { | ||
// Check if the logged-in user's ID is in the list | ||
if (!userIds.includes(loggedInUserId)) { | ||
// Clear cookies | ||
// document.cookie = "accessToken=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; | ||
// Redirect to the specified page if the user's ID is not in the | ||
// window.location.href = `https://auth.scyted.tv/www.scyted.tv/discord?error=invalidAccess`; | ||
displayContents(); | ||
displayUserInfo(userData); | ||
} | ||
}) | ||
.catch(error => { | ||
console.error("Error fetching user IDs:", error); | ||
// Handle error | ||
}); | ||
}) | ||
.catch(error => { | ||
console.error("Error fetching user data:", error); | ||
// Clear cookies | ||
// document.cookie = "accessToken=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; | ||
// Handle error (e.g., redirect to login page) | ||
// window.location.href = `https://auth.scyted.tv/www.scyted.tv/discord?error=fetchingUserData`; | ||
}); | ||
} | ||
}); | ||
|
||
const urlParams = new URLSearchParams(window.location.hash.substring(1)); | ||
const accessToken = urlParams.get("access_token"); | ||
|
||
if (accessToken) { | ||
try { | ||
// Check if the access token is valid (add your validation logic here) | ||
if (isValidAccessToken(accessToken)) { | ||
// Store the access token in a cookie | ||
setCookie("accessToken", accessToken, 30); // Set cookie to expire in 30 days | ||
// Redirect to the dashboard | ||
window.location.href = "./"; | ||
} else { | ||
// Clear the accessToken cookie | ||
clearCookie("accessToken"); | ||
} | ||
} catch (error) { | ||
console.error("Error setting accessToken:", error); | ||
} | ||
} | ||
|
||
function isValidAccessToken(token) { | ||
// Add your validation logic here | ||
// Return true if the token is valid, otherwise return false | ||
return true; // Placeholder, replace with actual validation | ||
} | ||
|
||
function setCookie(name, value, days) { | ||
const date = new Date(); | ||
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); | ||
const expires = "expires=" + date.toUTCString(); | ||
document.cookie = name + "=" + value + ";" + expires + ";path=/"; | ||
} | ||
|
||
function clearCookie(name) { | ||
document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; | ||
} | ||
|
||
function fetchDiscordUserData(accessToken) { | ||
const apiUrl = 'https://discord.com/api/users/@me'; | ||
|
||
return fetch(apiUrl, { | ||
headers: { | ||
Authorization: `Bearer ${accessToken}`, | ||
}, | ||
}) | ||
.then(response => { | ||
if (!response.ok) { | ||
throw new Error(`Discord API Request Failed! Status: ${response.status}`); | ||
} | ||
return response.json(); | ||
}); | ||
} | ||
|
||
function logout() { | ||
// Clear cookies | ||
document.cookie = "accessToken=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; | ||
|
||
// Redirect to login page | ||
window.location.href = `${currentURL}`; | ||
} | ||
|
||
function backButton() { | ||
window.location.href = `../`; | ||
} | ||
|
||
function getCookie(name) { | ||
const cookies = document.cookie.split("; "); | ||
for (let i = 0; i < cookies.length; i++) { | ||
const cookie = cookies[i].split("="); | ||
if (cookie[0] === name) { | ||
return cookie[1]; | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
fetch('https://api.scyted.tv/resources/game-tracking/loyd-gtav.json') | ||
.then(response => response.json()) | ||
.then(data => { | ||
const achievementsDiv = document.getElementById('achievements'); | ||
const completedAchievements = []; | ||
const incompleteAchievements = []; | ||
|
||
// Separate completed and incomplete achievements | ||
data.achievements.forEach(achievement => { | ||
if (achievement.achieved) { | ||
completedAchievements.push(achievement); | ||
} else { | ||
incompleteAchievements.push(achievement); | ||
} | ||
}); | ||
|
||
// Sort completed achievements by date and time (newest to oldest) | ||
completedAchievements.sort((a, b) => { | ||
const dateA = new Date(a.date + ' ' + a.time); | ||
const dateB = new Date(b.date + ' ' + b.time); | ||
return dateB - dateA; | ||
}); | ||
|
||
// Concatenate completed achievements with incomplete ones | ||
const sortedAchievements = completedAchievements.concat(incompleteAchievements); | ||
|
||
// Display achievements | ||
sortedAchievements.forEach(achievement => { | ||
const achievementDiv = document.createElement('div'); | ||
achievementDiv.classList.add('achievement'); | ||
if (achievement.achieved) { | ||
achievementDiv.classList.add('achievement-unlocked'); | ||
} else { | ||
achievementDiv.classList.add('achievement-locked'); | ||
achievementDiv.classList.add('incomplete'); | ||
} | ||
const iconClass = achievement.achieved ? 'fas fa-check-circle' : 'far fa-circle'; | ||
achievementDiv.innerHTML = ` | ||
<div> | ||
<i class="${iconClass}" style="font-size: 24px; color: ${achievement.achieved ? '#4caf50' : '#f44336'};"></i> | ||
</div> | ||
<div class="achievement-details"> | ||
<h3>${achievement.name}</h3> | ||
<p>${achievement.description}</p> | ||
<p class="achievement-status">${achievement.achieved ? 'Achieved' : 'Not achieved'}</p> | ||
${achievement.achieved ? ` | ||
<div class="achievement-date-time date-time-box"> | ||
<i class="far fa-calendar-alt"></i> ${achievement.date} at ${achievement.time} | ||
</div> | ||
` : ''} | ||
${achievement.type === 'Progress' ? ` | ||
<div class="progress-bar"> | ||
<div class="progress" style="width: ${calculateProgress(achievement.progress)};"></div> | ||
<div class="progress-text">${achievement.progress}</div> | ||
</div> | ||
` : ''} | ||
</div> | ||
<img src="${achievement.image}" alt="${achievement.name}" class="achievement-image"> | ||
`; | ||
achievementsDiv.appendChild(achievementDiv); | ||
}); | ||
}) | ||
.catch(error => console.error('Error fetching data:', error)); | ||
|
||
function calculateProgress(progress) { | ||
const progressParts = progress.split('/'); | ||
const current = parseInt(progressParts[0]); | ||
const total = parseInt(progressParts[1]); | ||
return `${(current / total) * 100}%`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
--- | ||
title: Resource Directory | ||
layout: page | ||
type: resources | ||
--- | ||
<style> | ||
hr.has-background-black { | ||
display: none; | ||
} | ||
|
||
h1.title { | ||
display: none; | ||
} | ||
</style> | ||
<link rel="stylesheet" href="https://api.scyted.tv/wave-development/dashboard/scytedtv-resources-mobile.css"> | ||
<body> | ||
|
||
<div class="banner"> | ||
<img src="https://cdn.scyted.tv/website-assets/resource-portal/banner.jpg" alt="Banner Image" class="banner-image"> | ||
</div> | ||
|
||
<div class="resource-container"> | ||
|
||
<div class="resource-wrapper"> | ||
|
||
<div class="resource-back" onclick="backButton()"><p>← back</p></div> | ||
|
||
<div class="resource-info-box"> | ||
<img src="https://cdn.scyted.tv/website-assets/resource-portal/logos/loyd-gtav.jpg" alt="Resource Image" class="resource-image"> | ||
<h3>GTA V Achievements</h3> | ||
Loyd's Grand Theft Auto V achievement tracking.<br> | ||
</div> | ||
|
||
</div> | ||
|
||
<div class="resource-box"> | ||
|
||
<div id="login-container" class="login-container"> | ||
</div> | ||
|
||
<style> | ||
.user-info-box { | ||
flex: 1; | ||
padding: 20px; | ||
background-color: #fff; | ||
border-radius: 8px; | ||
margin-top: 10px; | ||
text-align: left; | ||
} | ||
</style> | ||
<style> | ||
.achievements-container body { | ||
font-family: Arial, sans-serif; | ||
background-color: #f2f2f2; | ||
color: #333; | ||
margin: 0; | ||
padding: 0; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
min-height: 100vh; | ||
} | ||
.achievements-container .container { | ||
max-width: 100%; | ||
width: 100%; | ||
padding: 10px; | ||
background-color: #fff; | ||
border-radius: 0; | ||
box-shadow: none; | ||
overflow-y: auto; | ||
} | ||
.achievements-container h1 { | ||
font-size: 20px; | ||
text-align: center; | ||
margin-bottom: 15px; | ||
color: #333; | ||
} | ||
.achievements-container .achievement { | ||
border-bottom: 1px solid #ddd; | ||
padding: 15px; | ||
display: block; | ||
} | ||
.achievements-container .achievement:last-child { | ||
border-bottom: none; | ||
} | ||
.achievements-container .achievement h3 { | ||
margin: 0; | ||
font-size: 16px; | ||
color: #333; | ||
margin-left: 0; | ||
} | ||
.achievements-container .achievement p { | ||
margin: 5px 0; | ||
font-size: 12px; | ||
color: #666; | ||
margin-left: 0; | ||
} | ||
.achievements-container .achievement-details { | ||
margin-right: 0; | ||
} | ||
.achievements-container .achievement-status { | ||
font-size: 14px; | ||
font-weight: bold; | ||
color: #4caf50; | ||
margin-left: 0; | ||
} | ||
.achievements-container .achievement-status.incomplete { | ||
color: #f44336; | ||
} | ||
.achievements-container .achievement-date-time { | ||
font-size: 12px; | ||
color: #888; | ||
margin-left: 0; | ||
} | ||
.achievements-container .date-time-box { | ||
border: 1px solid #ddd; | ||
border-radius: 5px; | ||
padding: 5px 10px; | ||
display: block; | ||
margin-bottom: 5px; | ||
} | ||
.achievements-container .progress-bar { | ||
width: calc(100% - 30px); | ||
height: 10px; | ||
background-color: #f2f2f2; | ||
border-radius: 5px; | ||
margin-top: 5px; | ||
overflow: hidden; | ||
border: 1px solid #ddd; | ||
margin-left: 0; | ||
position: relative; | ||
} | ||
.achievements-container .progress { | ||
height: 100%; | ||
background-color: #4caf50; | ||
border-radius: 5px; | ||
transition: width 0.5s ease-in-out; | ||
} | ||
.achievements-container .incomplete .progress { | ||
background-color: #f44336; | ||
} | ||
.achievements-container .progress-text { | ||
display: none; | ||
} | ||
|
||
</style> | ||
<div class="container"> | ||
|
||
<div class="user-info-box" id="userInfoBox"> | ||
|
||
<h3>Grand Theft Auto V Achievements</h3> | ||
|
||
I'm someone who really enjoys collecting achievements and trophies from games. Some games I am attempting to get every acahievement possible. This page specifically targets my progress on the PC (Steam) version of Grand Theft Auto V. Below is the entire list of all of my achievements on the game that I update periodically. | ||
|
||
<br><br> | ||
|
||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"> | ||
|
||
<div class="achievements-container"> | ||
<div id="achievements"></div> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<script src="https://api.scyted.tv/wave-development/dashboard/page-loading-script.js"></script> | ||
<script src="index-script.js"></script> | ||
<script src="insert-scripts.js"></script> | ||
<script src="https://api.scyted.tv/wave-development/dashboard/mobile-redirect.js"></script> | ||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-LF3ZTHGQHE"></script> | ||
|
||
</body> |
Oops, something went wrong.