COrrection de nombreux bug, changement de font, réel username unique insensible à la casse...

This commit is contained in:
cherif
2023-01-17 00:30:39 +01:00
parent 8b365968ac
commit 796a8464b1
16 changed files with 95 additions and 83 deletions

View File

@@ -16,11 +16,11 @@ body {
}
@font-face {
font-family: "Bit5x3";
font-family: "PressStart2P";
src:
url("./fonts/Bit5x3.woff2") format("woff2"),
local("Bit5x3"),
url("./fonts/Bit5x3.woff") format("woff");
url("./fonts/PressStart2P.woff2") format("woff2"),
local("PressStart2P"),
url("./fonts/PressStart2P.woff") format("woff");
font-weight: normal;
font-style: normal;
font-display: swap;
@@ -42,8 +42,8 @@ a:visited {
.background-pages {
background-color: #333;
font-family: "Bit5x3";
font-size: 2vw;
font-family: "PressStart2P";
font-size: 1vw;
color: white;
}

View File

@@ -71,8 +71,8 @@
border-color: #071013;
border-width: 2px;
color: white;
font-family: "Bit5x3";
font-size: x-large;
font-family: "PressStart2P";
font-size: 1vw;
padding: 10px;
}
@@ -81,8 +81,8 @@
border-color: #071013;
border-width: 2px;
color: white;
font-family: "Bit5x3";
font-size: x-large;
font-family: "PressStart2P";
font-size: 1vw;
padding: 10px;
}

View File

@@ -88,7 +88,7 @@
.error {
font-weight: bold;
font-size: 0.8em;
font-size: 1vw;
color: red;
}
</style>

View File

@@ -393,7 +393,16 @@
</div> <!-- div "game_page" -->
<style>
@font-face {
font-family: "Bit5x3";
src:
url("/fonts/Bit5x3.woff2") format("woff2"),
local("Bit5x3"),
url("/fonts/Bit5x3.woff") format("woff");
font-weight: normal;
font-style: normal;
font-display: swap;
}
.dim_background {
background-color: #222;
}
@@ -423,15 +432,16 @@ canvas {
/* background-color: #ff0000; */
background-color: #333;
max-width: 75vw;
font-family: "Bit5x3";
/* max-height: 100vh; */
width: 80%;
}
.div_game {
text-align: center;
font-family: "Bit5x3";
font-family: "PressStart2P";
color: rgb(245, 245, 245);
font-size: x-large;
font-size: 1vw;
}
.div_game fieldset {
max-width: 50vw;
@@ -442,10 +452,10 @@ canvas {
padding: 10px;
}
.pong_button {
font-family: "Bit5x3";
font-family: "PressStart2P";
color: rgb(245, 245, 245);
background-color: #333333;
font-size: x-large;
font-size: 1vw;
padding: 10px;
}
.avatar {

View File

@@ -179,6 +179,16 @@
<!-- -->
<style>
@font-face {
font-family: "Bit5x3";
src:
url("/fonts/Bit5x3.woff2") format("woff2"),
local("Bit5x3"),
url("/fonts/Bit5x3.woff") format("woff");
font-weight: normal;
font-style: normal;
font-display: swap;
}
.dim_background {
background-color: #222;
@@ -203,15 +213,16 @@ canvas {
/* background-color: #ff0000; */
background-color: #333333;
max-width: 75vw;
font-family: "Bit5x3";
/* max-height: 100vh; */
width: 80%;
}
.div_game {
text-align: center;
font-family: "Bit5x3";
font-family: "PressStart2P";
color: rgb(245, 245, 245);
font-size: x-large;
font-size: 1vw;
}
.div_game fieldset {
max-width: 50vw;
@@ -222,15 +233,15 @@ canvas {
padding: 10px;
}
.pong_button {
font-family: "Bit5x3";
font-family: "PressStart2P";
color: rgb(245, 245, 245);
background-color: #333333;
font-size: x-large;
font-size: 1vw;
padding: 10px;
}
#match_list {
font-family: 'Courier New', Courier, monospace;
font-size: large;
font-size: 1vw;
}
.avatar {
min-height: 100px;

View File

@@ -70,7 +70,7 @@
.stats-table {
margin-left: auto;
margin-right: auto;
font-size: 0.9em;
font-size: 1vw;
min-width: 400px;
}

View File

@@ -6,6 +6,7 @@
import Button from '../../pieces/Button.svelte';
import { fetchAvatar } from "../../pieces/utils";
import { error } from '../game/client/message';
let user;
let avatar, newAvatar;
@@ -34,40 +35,40 @@
})
const settingsHandler = async() => {
// I don't really care which i use at this point...
// if (set.username === nameTmp) {
if ((set.username.trim() === '') && set.tfa === user.isEnabledTwoFactorAuth) {
errors.username = 'Invalid new username';
return;
set.username = user.username
}
else if ((set.username.trim() === '') && set.tfa !== user.isEnabledTwoFactorAuth) {
set.username = user.username
}
else {
errors.username = '';
errors.username = ''
await fetch(`http://${process.env.WEBSITE_HOST}:${process.env.WEBSITE_PORT}/api/v2/user`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
"username": set.username,
"isEnabledTwoFactorAuth": set.tfa
})
})
.then((response) => {
if (response.status === 200)
{
errors.username = ''
success.username = "Your changes have been saved"
}
else if (response.status === 201)
push("/2fa");
else if (response.status === 409)
{
success.username = ''
errors.username = `${set.username} is already in use, pick a different one.`;
}
else{
success.username = ''
errors.username = "Something went wrong";
}
}
await fetch(`http://${process.env.WEBSITE_HOST}:${process.env.WEBSITE_PORT}/api/v2/user`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
"username": set.username,
"isEnabledTwoFactorAuth": set.tfa
})
})
.then((response) => {
if (response.status === 200)
success.username = "Your changes have been saved"
else if (response.status === 201)
push("/2fa");
else if (response.status === 409)
errors.username = `${set.username} is already in use, pick a different one.`;
else
errors.username = "Something went wrong";
}
)
.catch((err) => errors.username = err)
)
.catch((err) => errors.username = err)
// .then((result) => console.log(result))
// .then(() => console.log('successful sub of new settings'))
@@ -198,13 +199,13 @@
.error{
font-size: 0.8em;
font-size: 1vw;
font-weight: bold;
color: red;
}
.success{
font-size: 0.8em;
font-size: 1vw;
font-weight: bold;
color: green;
}

View File

@@ -347,7 +347,7 @@
div.top-grid{
display: grid;
grid-template-columns: repeat(12, 1fr);
grid-template-columns: repeat(8, 1fr);
/* max-height: calc(100vh - 30vh); */
height: 85vh;
/* margin: 0; */
@@ -357,12 +357,15 @@
grid-column: 1 / span 2;
background: #FB8B24;
padding: 1vw;
font-size: smaller;
max-width: 100%;
max-height: 100%;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
border-right: 4px solid #071013;
border-bottom: 4px solid #071013;
overflow-wrap: break-word;
}
div.sidebar-item{

View File

@@ -153,7 +153,7 @@
}
.error{
font-size: 0.8em;
font-size: 1vw;
font-weight: bold;
color: red;
}

View File

@@ -43,9 +43,9 @@
background-color: #444;
border-color: #071013;
color: white;
font-family: "Bit5x3";
font-family: "PressStart2P";
border-width: 2px;
font-size: 2vw;
font-size: 1vw;
}
@@ -53,9 +53,9 @@
background-color: #008c8c;
border-color: #071013;
color: white;
font-family: "Bit5x3";
font-family: "PressStart2P";
border-width: 2px;
font-size: 2vw;
font-size: 1vw;
}
.header {