mirror of
https://git.ethanthesleepy.one/ethanaobrien/ew.git
synced 2025-05-13 11:37:33 -05:00
Forgot to upload these files
This commit is contained in:
parent
a8f1550c94
commit
e9191150f9
3 changed files with 83 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,3 +6,4 @@ python/
|
||||||
webui/node_modules/
|
webui/node_modules/
|
||||||
webui/dist/
|
webui/dist/
|
||||||
Cargo.lock
|
Cargo.lock
|
||||||
|
config.json
|
||||||
|
|
36
webui/src/admin/Admin.css
Normal file
36
webui/src/admin/Admin.css
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
body {
|
||||||
|
background-color: #616161;
|
||||||
|
}
|
||||||
|
|
||||||
|
#home {
|
||||||
|
width: 90%;
|
||||||
|
margin: 50px auto;
|
||||||
|
background-color: #43A047;
|
||||||
|
border-radius: 10px;
|
||||||
|
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
|
||||||
|
font-family: "Poppins", sans-serif;
|
||||||
|
padding: 20px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#logout {
|
||||||
|
border: none;
|
||||||
|
text-align: center;
|
||||||
|
text-decoration: underline;
|
||||||
|
display: inline-block;
|
||||||
|
font-size: 16px;
|
||||||
|
transition-duration: 0.4s;
|
||||||
|
float: right;
|
||||||
|
background-color: yellow;
|
||||||
|
border-radius: 30px;
|
||||||
|
padding: 5px 20px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
#logout:hover {
|
||||||
|
background-color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
#error p {
|
||||||
|
color: orange;
|
||||||
|
grid-template-columns: auto auto auto;
|
||||||
|
}
|
46
webui/src/admin/Admin.jsx
Normal file
46
webui/src/admin/Admin.jsx
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
import { useState, useParams, useEffect } from 'react'
|
||||||
|
import './Admin.css'
|
||||||
|
import Request from '../Request.jsx'
|
||||||
|
|
||||||
|
function Admin() {
|
||||||
|
const [imp, setimp] = useState();
|
||||||
|
const [exp, setexp] = useState();
|
||||||
|
const ids = [setimp, setexp];
|
||||||
|
|
||||||
|
const handleSubmit = async (id, event) => {
|
||||||
|
ids[id](event.target.checked);
|
||||||
|
await Request(
|
||||||
|
"/api/webui/admin",
|
||||||
|
{
|
||||||
|
import: !!imp,
|
||||||
|
export: !!exp
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (imp === undefined) {
|
||||||
|
(async () => {
|
||||||
|
let resp = await Request("/api/webui/admin");
|
||||||
|
if (resp.result !== "OK") {
|
||||||
|
window.location.href = "/?message=" + encodeURIComponent(resp.message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setimp(resp.data.import);
|
||||||
|
setexp(resp.data.export);
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div id="home">
|
||||||
|
<h1>Admin</h1>
|
||||||
|
<div>
|
||||||
|
<input type="checkbox" id="import" name="import" checked={!!imp} onClick={(i)=>handleSubmit(0, i)} />
|
||||||
|
<label for="import">Allow account imports</label><br/><br/>
|
||||||
|
<input type="checkbox" id="exp" name="exp" checked={!!exp} onClick={(i)=>handleSubmit(1, i)} />
|
||||||
|
<label for="exp">Allow account exports</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Admin;
|
Loading…
Add table
Reference in a new issue