updated web
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Successful in 10s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Successful in 15s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Successful in 12s

This commit is contained in:
wt committed 2025-08-30 12:24:57 +07:00
1 parent b0758c5499
commit 4c4f92e43b
5 files changed
+225 -110

No files matched your search

-1
View File
@@ -28,7 +28,6 @@
background-color: gray; background-color: gray;
backdrop-filter: blur(5px); backdrop-filter: blur(5px);
border-radius: 10px; border-radius: 10px;
/* box-shadow: -5px -5px 30px 30px gray; */
} }
.loginformheader { .loginformheader {
+23 -9
View File
@@ -1,19 +1,33 @@
.message { * {
width: 100%; transition: 0.3s;
}
.notificationsection {
width: max-content;
height: 100vh;
position: fixed;
top: 10px;
right: 0;
pointer-events: none;
z-index: 16;
}
.notification {
width: max-content;
height: 0; height: 0;
overflow: hidden; overflow: hidden;
pointer-events: none; pointer-events: none;
z-index: 10; z-index: 10;
border-radius: 10px; border-radius: 10px;
position: fixed;
top: 0; top: 0;
left: 0; right: 0;
transition: 0.3s;
cursor: pointer; cursor: pointer;
opacity: 0.8; opacity: 0.8;
margin: 10px;
padding: 0 10px;
} }
.messagetextbox { .notificationtextbox {
width: 100%; width: 100%;
height: 100%; height: 100%;
display: grid; display: grid;
@@ -22,19 +36,19 @@
pointer-events: none; pointer-events: none;
} }
.messagetext { .notificationtext {
width: 100%; width: 100%;
text-align: center; text-align: center;
pointer-events: none; pointer-events: none;
} }
.message.active.error { .notification.active.error {
pointer-events: all; pointer-events: all;
height: 10%; height: 10%;
background-color: rgb(233, 70, 70); background-color: rgb(233, 70, 70);
} }
.message.active.success { .notification.active.success {
pointer-events: all; pointer-events: all;
height: 10%; height: 10%;
background-color: rgb(76, 209, 76); background-color: rgb(76, 209, 76);
+106 -30
View File
@@ -1,11 +1,11 @@
<!DOCTYPE html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/css/loginform.css"> <link rel="stylesheet" href="/css/loginform.css" />
<link rel="stylesheet" href="/css/message.css"> <link rel="stylesheet" href="/css/message.css" />
<link rel="stylesheet" href="/css/bootstrap.min.css"> <link rel="stylesheet" href="/css/bootstrap.min.css" />
<title>admin</title> <title>admin</title>
</head> </head>
<body> <body>
@@ -14,8 +14,14 @@
<button class="btn btn-warning" id="adduserbutton">Adduser</button> <button class="btn btn-warning" id="adduserbutton">Adduser</button>
<h1 class="usernameheader"></h1> <h1 class="usernameheader"></h1>
<div class="form-check"> <div class="form-check">
<input type="checkbox" id="themecheckbox" class="form-check-input"> <input
<label for="themecheckbox" class="form-check-label">Dark theme</label> type="checkbox"
id="themecheckbox"
class="form-check-input"
/>
<label for="themecheckbox" class="form-check-label"
>Dark theme</label
>
</div> </div>
</div> </div>
@@ -23,11 +29,23 @@
<form class="formbody loginformbody" id="loginformbody"> <form class="formbody loginformbody" id="loginformbody">
<h1 class="loginformheader">Login</h1> <h1 class="loginformheader">Login</h1>
<div class="form-floating mb-3"> <div class="form-floating mb-3">
<input type="text" required id="loginforminputusername" class="form-control" placeholder="John"> <input
type="text"
required
id="loginforminputusername"
class="form-control"
placeholder="John"
/>
<label for="loginforminputusername">Username</label> <label for="loginforminputusername">Username</label>
</div> </div>
<div class="form-floating mb-3"> <div class="form-floating mb-3">
<input type="password" required id="loginforminputpassword" class="form-control" placeholder="***"> <input
type="password"
required
id="loginforminputpassword"
class="form-control"
placeholder="***"
/>
<label for="loginforminputpassword">Password</label> <label for="loginforminputpassword">Password</label>
</div> </div>
<div class="d-grid gap-2"> <div class="d-grid gap-2">
@@ -40,28 +58,56 @@
<form class="formbody adduserformbody"> <form class="formbody adduserformbody">
<h1 class="loginformheader">Add User</h1> <h1 class="loginformheader">Add User</h1>
<div class="form-floating mb-3"> <div class="form-floating mb-3">
<input type="text" required id="adduserformusername" class="form-control"> <input
type="text"
required
id="adduserformusername"
class="form-control"
/>
<label for="adduserformusername">Username</label> <label for="adduserformusername">Username</label>
</div> </div>
<div class="form-floating mb-3"> <div class="form-floating mb-3">
<input type="text" required id="adduserformemail" class="form-control"> <input
type="text"
required
id="adduserformemail"
class="form-control"
/>
<label for="adduserformemail">Email</label> <label for="adduserformemail">Email</label>
</div> </div>
<div class="form-floating mb-3"> <div class="form-floating mb-3">
<input type="password" required id="adduserformpassword" class="form-control"> <input
type="password"
required
id="adduserformpassword"
class="form-control"
/>
<label for="adduserformpassword">Password</label> <label for="adduserformpassword">Password</label>
</div> </div>
<div class="form-floating mb-3"> <div class="form-floating mb-3">
<input type="text" required id="adduserformgroup" class="form-control"> <input
type="text"
required
id="adduserformgroup"
class="form-control"
/>
<label for="adduserformgroup">Group</label> <label for="adduserformgroup">Group</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<input type="checkbox" id="adduserformissuperuser" class="form-check-input"> <input
<label for="adduserformissuperuser" class="form-check-label">Is Superuser</label> type="checkbox"
id="adduserformissuperuser"
class="form-check-input"
/>
<label for="adduserformissuperuser" class="form-check-label"
>Is Superuser</label
>
</div> </div>
<div class="d-grid gap-2"> <div class="d-grid gap-2">
<button class="btn btn-primary">Add</button> <button class="btn btn-primary">Add</button>
<button id="canceladduser" class="btn btn-primary">Cancel</button> <button id="canceladduser" class="btn btn-primary">
Cancel
</button>
</div> </div>
</form> </form>
</div> </div>
@@ -70,24 +116,50 @@
<form class="formbody changeuserformbody"> <form class="formbody changeuserformbody">
<h1 class="loginformheader">Change User Data</h1> <h1 class="loginformheader">Change User Data</h1>
<div class="form-floating mb-3"> <div class="form-floating mb-3">
<input type="text" required id="changeuserformusername" class="form-control" placeholder="Username"> <input
type="text"
required
id="changeuserformusername"
class="form-control"
placeholder="Username"
/>
<label for="changeuserformusername">Username</label> <label for="changeuserformusername">Username</label>
</div> </div>
<div class="form-floating mb-3"> <div class="form-floating mb-3">
<input type="text" id="changeuserformemail" class="form-control" placeholder="***"> <input
type="text"
id="changeuserformemail"
class="form-control"
placeholder="***"
/>
<label for="changeuserformemail">email</label> <label for="changeuserformemail">email</label>
</div> </div>
<div class="form-floating mb-3"> <div class="form-floating mb-3">
<input type="text" required id="changeuserformgroup" class="form-control"> <input
type="text"
required
id="changeuserformgroup"
class="form-control"
/>
<label for="changeuserformgroup">Group</label> <label for="changeuserformgroup">Group</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<input type="checkbox" id="changeuserformissuperuser" class="form-check-input"> <input
<label for="changeuserformissuperuser" class="form-check-label">Is Superuser</label> type="checkbox"
id="changeuserformissuperuser"
class="form-check-input"
/>
<label
for="changeuserformissuperuser"
class="form-check-label"
>Is Superuser</label
>
</div> </div>
<div class="d-grid gap-2"> <div class="d-grid gap-2">
<button class="btn btn-primary">Change</button> <button class="btn btn-primary">Change</button>
<button id="cancelchangeuser" class="btn btn-primary">Cancel</button> <button id="cancelchangeuser" class="btn btn-primary">
Cancel
</button>
</div> </div>
</form> </form>
</div> </div>
@@ -106,21 +178,25 @@
<form class="formbody changepasswordformbody"> <form class="formbody changepasswordformbody">
<h1 class="loginformheader">Change Password</h1> <h1 class="loginformheader">Change Password</h1>
<div class="form-floating mb-3"> <div class="form-floating mb-3">
<input type="text" required id="changepasswordnewpassword" class="form-control" placeholder="***"> <input
type="text"
required
id="changepasswordnewpassword"
class="form-control"
placeholder="***"
/>
<label for="changepasswordnewpassword">New password</label> <label for="changepasswordnewpassword">New password</label>
</div> </div>
<div class="d-grid gap-2"> <div class="d-grid gap-2">
<button class="btn btn-primary">Change</button> <button class="btn btn-primary">Change</button>
<button class="btn btn-primary" id="cancelchangepassword">Cancel</button> <button class="btn btn-primary" id="cancelchangepassword">
Cancel
</button>
</div> </div>
</form> </form>
</div> </div>
<div class="message"> <div class="notificationsection"></div>
<div class="messagetextbox">
<h3 class="messagetext"></h3>
</div>
</div>
<div class="table"> <div class="table">
<table class="table"> <table class="table">
+68 -58
View File
@@ -1,83 +1,93 @@
const loginform = document.querySelector('#loginform') const loginform = document.querySelector("#loginform");
const loginformbody = document.querySelector('#loginformbody') const loginformbody = document.querySelector("#loginformbody");
const loginforminputusername = document.querySelector('#loginforminputusername') const loginforminputusername = document.querySelector(
const loginforminputpassword = document.querySelector('#loginforminputpassword') "#loginforminputusername",
const exitbutton = document.querySelector('#exitbutton') );
const usernameheader = document.querySelector('.usernameheader') const loginforminputpassword = document.querySelector(
"#loginforminputpassword",
);
const exitbutton = document.querySelector("#exitbutton");
const usernameheader = document.querySelector(".usernameheader");
if (localStorage.getItem("token") === null) { if (localStorage.getItem("token") === null) {
loginform.classList.add("active") loginform.classList.add("active");
} }
loginformbody.addEventListener('submit', (e) => { loginformbody.addEventListener("submit", (e) => {
e.preventDefault() e.preventDefault();
hashPassword(loginforminputpassword.value).then(hashedpassword => { hashPassword(loginforminputpassword.value).then((hashedpassword) => {
login(loginforminputusername.value, hashedpassword) login(loginforminputusername.value, hashedpassword);
}) });
}) });
const login = async (username, password) => { const login = async (username, password) => {
const response = await fetch(routes.login(), { const response = await fetch(routes.login(), {
method: 'POST', method: "POST",
headers: { headers: {
Accept: 'application/json', Accept: "application/json",
// 'Access-Control-Allow-Origin': '*', "Content-Type": "application/json",
'Content-Type': 'application/json',
}, },
// mode: 'no-cors', body: `{"username":"${username}","password":"${password}"}`,
body: `{"username":"${username}","password":"${password}"}`
}).then(data => data.json()).then(jsondata => jsondata).catch((error) => {
if (error.message === "Unexpected end of JSON input") {
notification(`Ошибка на сервере: Создайте файл users.json и запишите в него первого пользователя`, "error")
} else {
notification(`Ошибка на сервере: ${error}`, "error")
}
}) })
.then((data) => data.json())
.then((jsondata) => jsondata)
.catch((error) => {
if (error.message === "Unexpected end of JSON input") {
notification(
`Ошибка на сервере: Создайте файл users.json и запишите в него первого пользователя`,
"error",
);
} else {
notification(`Ошибка на сервере: ${error}`, "error");
}
});
if (response.error) { if (response.error) {
loginforminputusername.classList.add('is-invalid') loginforminputusername.classList.add("is-invalid");
loginforminputpassword.classList.add('is-invalid') loginforminputpassword.classList.add("is-invalid");
notification("Неправильный логин или пароль", "error") notification("Неправильный логин или пароль", "error");
} }
if (response.token) { if (response.token) {
notification("Успешно", "success") notification("Успешно", "success");
loginform.classList.remove("active") loginform.classList.remove("active");
localStorage.setItem("token", response.token) localStorage.setItem("token", response.token);
await get_user_data() await get_user_data();
loginforminputusername.value = "" loginforminputusername.value = "";
loginforminputpassword.value = "" loginforminputpassword.value = "";
loginforminputusername.classList.remove('is-invalid') loginforminputusername.classList.remove("is-invalid");
loginforminputpassword.classList.remove('is-invalid') loginforminputpassword.classList.remove("is-invalid");
}
} }
};
const get_user_data = async () => { const get_user_data = async () => {
const response = await fetch(routes.user(), { const response = await fetch(routes.user(), {
method: "POST", method: "POST",
body: `{"token":"${localStorage.getItem("token")}"}` body: `{"token":"${localStorage.getItem("token")}"}`,
}).then(data => data.json()).then(jsondata => jsondata).catch((error) => {
notification(`Ошибка на сервере: ${error}`, "error")
}) })
.then((data) => data.json())
.then((jsondata) => jsondata)
.catch((error) => {
notification(`Ошибка на сервере: ${error}`, "error");
});
if (response.is_superuser) { if (response.is_superuser) {
await get_all_users() await get_all_users();
usernameheader.innerHTML = response.username usernameheader.innerHTML = response.username;
} else { } else {
document.querySelector('#alluserstablebody').innerHTML = "" document.querySelector("#alluserstablebody").innerHTML = "";
loginform.classList.add("active") loginform.classList.add("active");
notification("Вы не можете войти потому что не являетесь администратором", "error") notification(
localStorage.clear() "Вы не можете войти потому что не являетесь администратором",
"error",
);
localStorage.clear();
} }
if (response.id) { if (response.id) {
localStorage.setItem("userdata", JSON.stringify(response)) localStorage.setItem("userdata", JSON.stringify(response));
}
} }
};
message.addEventListener('click', () => { exitbutton.addEventListener("click", () => {
message.classList.remove("active") localStorage.removeItem("token");
}) localStorage.removeItem("userdata");
loginform.classList.add("active");
exitbutton.addEventListener('click', () => { notification("Вы вышли", "success");
localStorage.removeItem('token') });
localStorage.removeItem('userdata')
loginform.classList.add('active')
notification('Вы вышли', "success")
})
+28 -12
View File
@@ -1,18 +1,34 @@
const message = document.querySelector('.message') const notificationsection = document.querySelector(".notificationsection");
const messagetext = document.querySelector('.messagetext')
const notification = (text, type) => { const notification = (text, type) => {
const notificationbox = document.createElement("div");
const notificationtextbox = document.createElement("div");
const notificationtext = document.createElement("h3");
notificationtext.classList.add("notificationtext");
notificationtextbox.append(notificationtext);
notificationtextbox.classList.add("notificationtextbox");
notificationtextbox.classList.add("card-header");
notificationbox.append(notificationtextbox);
notificationbox.classList.add("notification");
notificationbox.addEventListener("click", () => {
notificationbox.classList.remove("active");
});
notificationsection.append(notificationbox);
if (type === "error") { if (type === "error") {
message.classList.remove('success') notificationbox.classList.remove("success");
message.classList.add('error') notificationbox.classList.add("error");
} else { } else {
message.classList.remove('error') notificationbox.classList.remove("error");
message.classList.add('success') notificationbox.classList.add("success");
} }
messagetext.innerHTML = text notificationtext.innerHTML = text;
message.classList.add('active')
setTimeout(() => { setTimeout(() => {
message.classList.remove('active') notificationbox.classList.add("active");
}, 2000) }, 300);
} setTimeout(() => {
notificationbox.classList.remove("active");
setTimeout(() => {
notificationsection.removeChild(notificationbox);
}, 200);
}, 3000);
};