Remove admin webui, move options to CLI args

This commit is contained in:
Ethan O'Brien
2024-11-02 12:22:16 -05:00
parent 7aaf22c923
commit 8bc07a6419
10 changed files with 20 additions and 167 deletions

View File

@ -1,36 +0,0 @@
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;
}

View File

@ -1,53 +0,0 @@
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 handleSubmit = async (event) => {
await Request(
"/api/webui/admin",
{
import: !imp
}
);
setimp(!imp);
};
const handleSubmit2 = async (event) => {
await Request(
"/api/webui/admin",
{
export: !exp
}
);
setexp(!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(i)} />
<label for="import">Allow account imports</label><br/><br/>
<input type="checkbox" id="exp" name="exp" checked={!!exp} onClick={(i)=>handleSubmit2(i)} />
<label for="exp">Allow account exports</label>
</div>
</div>
);
}
export default Admin;

View File

@ -71,7 +71,7 @@ function Bonus() {
/>
<button type="submit">Submit</button>
</form>
<p>You can find a list of available login bonus IDs <a href="https://github.com/ethanaobrien/ew/blob/main/src/router/databases/json/login_bonus.json">here</a>. You should input the <code>id</code> field</p>
<p>You can find a list of available login bonus IDs <a href="https://git.ethanthesleepy.one/ethanaobrien/ew/src/branch/main/src/router/databases/json/login_bonus.json">here</a>. You should input the <code>id</code> field</p>
</div>
);
}

View File

@ -45,11 +45,6 @@ function Login() {
e.preventDefault();
window.location.href = "/help/";
}
const adminPanel = (e) => {
e.preventDefault();
window.location.href = "/admin/";
}
return (
<div id="login-form">
@ -63,7 +58,6 @@ function Login() {
<div id="sub_div">
<button onClick={import_user}>Import User</button><br/><br/>
<button onClick={help}>Need help?</button><br/><br/>
<button hidden={!["127.0.0.1", "localhost"].includes(window.location.hostname)} onClick={adminPanel}>Admin panel</button>
{ error[0] ? <p>Error: { error[0] } </p> : <p></p> }
</div>
</form>

View File

@ -3,7 +3,6 @@ import ReactDOM from 'react-dom/client'
import Login from './login/Login.jsx'
import Home from './home/Home.jsx'
import Import from './import/Import.jsx'
import Admin from './admin/Admin.jsx'
import Help from './help/Help.jsx'
let Elem;
@ -17,9 +16,6 @@ switch (window.location.pathname) {
case "/import/":
Elem = Import;
break;
case "/admin/":
Elem = Admin;
break;
case "/help/":
Elem = Help;
break;