Formatting + Added Home Page

This commit is contained in:
IM23a-spirgif
2025-04-17 13:21:17 +02:00
parent 69f48379bd
commit 0d7ecb6528
7 changed files with 73 additions and 15 deletions
+1 -1
View File
@@ -105,7 +105,7 @@ app.get("/", authenticateToken, (request, response) => {
/* #swagger.security = [{
"bearerAuth": []
}] */
response.sendFile(path.join(__dirname, "structure.png"));
response.sendFile(path.join(__dirname, ".\\public\\home.html"));
});
app.post("/balance", authenticateToken, (request, response) => {
@@ -1,5 +1,4 @@
const TokenHeader = new Headers();
document.addEventListener("DOMContentLoaded", () => {
document.addEventListener("DOMContentLoaded", () => {
const form = document.querySelector("form");
form.addEventListener("submit", async (e) => {
@@ -20,6 +19,7 @@ document.addEventListener("DOMContentLoaded", () => {
const loginData = await loginRes.json();
alert(`Welcome back, ${loginData.username}!`);
document.cookie = `authorization=${loginData.token}`
window.location.href = "/";
return;
}
@@ -33,6 +33,7 @@ document.addEventListener("DOMContentLoaded", () => {
const registerData = await registerRes.json();
alert(`Account created! Welcome, ${registerData.username}`);
document.cookie = `authorization=${registerData.token}`
window.location.href = "/";
} else {
const error = await registerRes.json();
alert("Register failed: " + (error.error || "Unknown error"));
+16
View File
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Home</title>
<link rel="stylesheet" href="styles_home.css">
</head>
<body>
<button class="logout">
Logout
</button>
<button class="balance">
Check Balance
</button>
</body>
</html>
+2 -2
View File
@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>Login</title>
<link rel="stylesheet" href="styles.css">
<link rel="stylesheet" href="styles_login.css">
</head>
<body>
<form method="post" action="/login">
@@ -12,5 +12,5 @@
<button type="submit">Login</button>
</form>
</body>
<script src="frontend.js"></script>
<script src="frontend_login.js"></script>
</html>
-10
View File
@@ -1,10 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>I am a Nogger Glace</title>
</head>
<body>
</body>
</html>
+51
View File
@@ -0,0 +1,51 @@
body {
background: radial-gradient(circle at top, #111, #000);
color: #0f0;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
margin: 0;
height: 100vh;
position: relative;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
body::before {
content: "♠ ♥ Welcome to Gambling API ♦ ♣";
font-size: 24px;
color: #0f0;
margin-bottom: 40px;
display: block;
text-shadow: 0 0 5px #0f0, 0 0 10px #0f0;
}
button {
background-color: #0f0;
color: #000;
border: none;
padding: 15px 30px;
font-size: 16px;
font-weight: bold;
border-radius: 12px;
cursor: pointer;
box-shadow: 0 0 10px #0f0, 0 0 5px #0f0 inset;
transition: background 0.2s ease-in-out, transform 0.2s;
}
button:hover {
background-color: #1f1;
transform: scale(1.05);
}
button.logout {
position: absolute;
top: 20px;
right: 20px;
padding: 10px 20px;
font-size: 14px;
}
button.balance {
margin-top: 20px;
}