115 lines
No EOL
4.2 KiB
HTML
115 lines
No EOL
4.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Gamble</title>
|
|
<link rel="stylesheet" href="/static/css/styles.css">
|
|
</head>
|
|
<body>
|
|
<h1>ShoGambler</h1>
|
|
<p id="unclaimedPoints">Loading...</p>
|
|
<p>Click the button to claim unclaimed points</p>
|
|
<button id="claimPoints">Claim Points</button>
|
|
<p id="pointAmount">Loading...</p>
|
|
<a href="/bet">Go betting!</a>
|
|
<a href="/privacy">Privacy Policy</a>
|
|
<a href="/tos">Terms of Service</a>
|
|
<script>
|
|
async function main() {
|
|
function isUserInEU() {
|
|
// Updated list of time zones that are in the European Union
|
|
const euTimeZones = [
|
|
'Europe/Andorra',
|
|
'Europe/Belgrade',
|
|
'Europe/Berlin',
|
|
'Europe/Brussels',
|
|
'Europe/Bucharest',
|
|
'Europe/Budapest',
|
|
'Europe/Copenhagen',
|
|
'Europe/Dublin',
|
|
'Europe/Helsinki',
|
|
'Europe/Kiev',
|
|
'Europe/Lisbon',
|
|
'Europe/Ljubljana',
|
|
'Europe/Madrid',
|
|
'Europe/Malta',
|
|
'Europe/Monaco',
|
|
'Europe/Oslo',
|
|
'Europe/Paris',
|
|
'Europe/Prague',
|
|
'Europe/Rome',
|
|
'Europe/San_Marino',
|
|
'Europe/Stockholm',
|
|
'Europe/Tirane',
|
|
'Europe/Vaduz',
|
|
'Europe/Vienna',
|
|
'Europe/Vilnius',
|
|
'Europe/Zurich'
|
|
];
|
|
|
|
// Get the user's time zone
|
|
const userTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
|
|
// Check if the user's time zone is in the EU list
|
|
return euTimeZones.includes(userTimeZone);
|
|
}
|
|
|
|
// Warn EU users that this website is not GDPR-compliant (in the EU)
|
|
// I don't think we actually need to do this
|
|
// if (isUserInEU()) {
|
|
// if (!confirm("This website is not GDPR compliant in the EU (it is in the UK). It is compliant with every clause except the location one. If you use this service from within the EU, you are doing so at your own risk. Do you want to continue?")) {
|
|
// // Redirect the user to the EU website (haha)
|
|
// window.location.href = "https://europa.eu/"
|
|
// }
|
|
// }
|
|
|
|
await fetch("/api/loggedIn", {
|
|
method: "GET",
|
|
}).then(async (response) => {
|
|
if (!response.ok) {
|
|
window.location.href = "/link"
|
|
}
|
|
})
|
|
|
|
document.getElementById('claimPoints').addEventListener('click', async () => {
|
|
let response = await fetch('/api/claimUnclaimedPoints', {
|
|
"method": "GET"
|
|
})
|
|
if (response.ok) {
|
|
alert("Claimed " + data['points'] + " points")
|
|
window.location.reload()
|
|
} else {
|
|
alert("Error claiming points")
|
|
}
|
|
})
|
|
}
|
|
|
|
async function updatePoints() {
|
|
while (true) {
|
|
let response = await fetch('/api/getPoints', {
|
|
"method": "GET"
|
|
})
|
|
let data = await response.json()
|
|
document.getElementById('pointAmount').innerText = "You have " + data['points'] + " points"
|
|
|
|
response = await fetch('/api/getUnclaimedPoints', {
|
|
"method": "GET"
|
|
})
|
|
|
|
if (!response.ok) {
|
|
document.getElementById('unclaimedPoints').innerText = "Error getting unclaimed points"
|
|
return
|
|
}
|
|
|
|
data = await response.json()
|
|
document.getElementById('unclaimedPoints').innerText = "You have " + data['points'] + " unclaimed points"
|
|
|
|
// Wait for a second before updating the points again
|
|
await new Promise(r => setTimeout(r, 1000))
|
|
}
|
|
}
|
|
|
|
main()
|
|
updatePoints()
|
|
</script>
|
|
</body> |