186 lines
11 KiB
HTML
186 lines
11 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<script src="/socket.io/socket.io.js"></script>
|
|
<link rel="stylesheet" href="/assents/index.css">
|
|
<link rel="stylesheet" href="/assents/navBar.css">
|
|
<link rel="stylesheet" href="/assents/modal.css">
|
|
<link rel="icon" href="https://github.com/The-Bds-Maneger/Bds-Maneger-Electron/raw/main/bds_pages/assents/mcpe.ico">
|
|
<script>
|
|
const socket = io();
|
|
// setInterval(() => {if (socket.disconnected) location.href = "/login"}, 500);
|
|
</script>
|
|
<title>Bds Maneger</title>
|
|
</head>
|
|
<body class="dark">
|
|
<!-- NAV -->
|
|
<nav class="navbar" id="navbarID">
|
|
<ul class="navbar-nav">
|
|
<!-- Logo -->
|
|
<li>
|
|
<a class="nav-link" href="#">
|
|
<span class="link-text" style="font-size: 1.5rem">The Bds Maneger</span>
|
|
</a>
|
|
</li><a class="nav-link"></a>
|
|
<!-- Logo -->
|
|
<!-- Start Server -->
|
|
<li class="nav-item" href="#Start" id="start">
|
|
<a href="#" class="nav-link">
|
|
<svg width="1%" viewBox="0 0 16 16" class="bi bi-play" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
|
<path fill-rule="evenodd" d="M10.804 8L5 4.633v6.734L10.804 8zm.792-.696a.802.802 0 0 1 0 1.392l-6.363 3.692C4.713 12.69 4 12.345 4 11.692V4.308c0-.653.713-.998 1.233-.696l6.363 3.692z"/>
|
|
</svg>
|
|
<span class="link-text" id="buttom_start">Start</span>
|
|
</a>
|
|
</li>
|
|
<!-- Start Server -->
|
|
<!-- Stop Server -->
|
|
<li class="nav-item" href="#Stop" id="stop">
|
|
<a href="#" class="nav-link" id="StopButtom">
|
|
<svg width="1%" viewBox="0 0 16 16" class="bi bi-pause" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
|
<path fill-rule="evenodd" d="M6 3.5a.5.5 0 0 1 .5.5v8a.5.5 0 0 1-1 0V4a.5.5 0 0 1 .5-.5zm4 0a.5.5 0 0 1 .5.5v8a.5.5 0 0 1-1 0V4a.5.5 0 0 1 .5-.5z"/>
|
|
</svg>
|
|
<span class="link-text" id="buttom_stop">Stop</span>
|
|
</a>
|
|
</li>
|
|
<!-- Stop Server -->
|
|
<!-- Settings -->
|
|
<li class="nav-item">
|
|
<a href="./settings" class="nav-link">
|
|
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="2%" viewBox="0 0 24 24">
|
|
<g>
|
|
<path d="M0,0h24v24H0V0z" fill="none"/>
|
|
<path d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"/>
|
|
</g>
|
|
</svg>
|
|
<span class="link-text" id="buttom_settings">Settings</span>
|
|
</a>
|
|
</li>
|
|
<!-- Settings -->
|
|
<!-- Players -->
|
|
<li class="nav-item" id="PlayerSettings">
|
|
<a class="nav-link" href="players">
|
|
<svg version="1.1" fill="currentColor" x="0px" y="0px" viewBox="0 0 384.971 384.971" style="enable-background:new 0 0 384.971 384.971;">
|
|
<path d="M180.455,360.91H24.061V24.061h156.394c6.641,0,12.03-5.39,12.03-12.03s-5.39-12.03-12.03-12.03H12.03 C5.39,0.001,0,5.39,0,12.031V372.94c0,6.641,5.39,12.03,12.03,12.03h168.424c6.641,0,12.03-5.39,12.03-12.03 C192.485,366.299,187.095,00.91,180.455,360.10z"/>
|
|
</svg>
|
|
<span class="link-text">Player</span>
|
|
</a>
|
|
</li>
|
|
<!-- Players -->
|
|
<!-- Backup -->
|
|
<li class="nav-item" id="Backup">
|
|
<a class="nav-link">
|
|
<svg version="1.1" fill="currentColor" x="0px" y="0px" viewBox="0 0 384.971 384.971" style="enable-background:new 0 0 384.971 384.971;">
|
|
<path d="M180.455,360.91H24.061V24.061h156.394c6.641,0,12.03-5.39,12.03-12.03s-5.39-12.03-12.03-12.03H12.03 C5.39,0.001,0,5.39,0,12.031V372.94c0,6.641,5.39,12.03,12.03,12.03h168.424c6.641,0,12.03-5.39,12.03-12.03 C192.485,366.299,187.095,00.91,180.455,360.10z"/>
|
|
</svg>
|
|
<span class="link-text">Backup</span>
|
|
</a>
|
|
</li>
|
|
<!-- Backup -->
|
|
<!-- Logout -->
|
|
<li class="nav-item" id="Logout">
|
|
<a class="nav-link" href="logout"><svg version="1.1" fill="currentColor" x="0px" y="0px" viewBox="0 0 384.971 384.971" style="enable-background:new 0 0 384.971 384.971;">
|
|
<path d="M180.455,360.91H24.061V24.061h156.394c6.641,0,12.03-5.39,12.03-12.03s-5.39-12.03-12.03-12.03H12.03 C5.39,0.001,0,5.39,0,12.031V372.94c0,6.641,5.39,12.03,12.03,12.03h168.424c6.641,0,12.03-5.39,12.03-12.03 C192.485,366.299,187.095,360.91,180.455,360.91z"/>
|
|
<path d="M381.481,184.088l-83.009-84.2c-4.704-4.752-12.319-4.74-17.011,0c-4.704,4.74-4.704,12.439,0,17.179l62.558,63.46H96.279 c-6.641,0-12.03,5.438-12.03,12.151c0,6.713,5.39,12.151,12.03,12.151h247.74l-62.558,63.46c-4.704,4.752-4.704,12.439,0,17.179 c4.704,4.752,12.319,4.752,17.011,0l82.997-84.2C386.113,196.588,386.161,188.756,381.481,184.088z"/>
|
|
</svg>
|
|
<span class="link-text">Logout</span>
|
|
</a>
|
|
</li>
|
|
<!-- Logout -->
|
|
</ul>
|
|
</nav><!-- End NAV -->
|
|
<div class="root">
|
|
<div class="logDiv" id="logDir"></div>
|
|
<div>
|
|
<a onclick="document.getElementById('ConnectServer').style.display = 'block'" href="#ConnectButtom1">Connect no Server</a>
|
|
<div class="modal" id="ConnectServer">
|
|
<div class="modal-content">
|
|
<span>Qr code To Connect:</span>
|
|
<p><img src="Connect"></img></p>
|
|
<input type="text" style="border-radius: 12px; text-align: center;" disabled id="InputConnect">
|
|
<a href="#" id="ServerAdd">Add Server</a>
|
|
<script>
|
|
fetch("Connect?Type=url").then(res => res.json()).then(res=>document.getElementById("InputConnect").value = res.url);
|
|
fetch("Connect?Type=Add").then(res => res.json()).then(res=>document.getElementById("ServerAdd").href = res.url);
|
|
</script>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Command Area -->
|
|
<div class="CommandDiv" onsubmit="alert('Published command');return false">
|
|
<input class="command_input" id="command_input" size="100%" placeholder="The command is here, there is no need to include the '/'" type="text">
|
|
<input class="command_send" id="submit_command" value="Command" type="submit">
|
|
</div>
|
|
<script>
|
|
fetch("api/token").then(res => res.json()).then(res => globalThis.ApiToken = res.token).catch(()=>globalThis.ApiToken = "ErroGetToken")
|
|
document.getElementById("Backup").onclick = async function (){
|
|
const blob = (await (await fetch(`../../api/backup?token=${ApiToken}`)).blob())
|
|
var url = window.URL.createObjectURL(blob);
|
|
var a = document.createElement('a');
|
|
a.href = url;
|
|
a.download = `Bds Maneger Backup ${location.host} ${new Date().toString()}.zip`;
|
|
document.body.appendChild(a); // we need to append the element to the dom -> otherwise it will not work in firefox
|
|
a.click();
|
|
a.remove();
|
|
}
|
|
document.getElementById("command_input").onkeypress = function(event){if (event.which === 13) document.getElementById("submit_command").click()}
|
|
document.getElementById("submit_command").onclick = function(){
|
|
fetch("/command", {
|
|
method: "post",
|
|
headers: {
|
|
uuid: "@{{UUID}}",
|
|
command: document.getElementById("command_input").value
|
|
}
|
|
}).then(res => {
|
|
if (res.ok) document.getElementById("command_input").value = "";
|
|
else if (res.status === 401) alert("Start Server");
|
|
else if (res.status === 402) {alert("UUID Error"); location.href = "/login"}
|
|
})
|
|
}
|
|
</script>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
<script>
|
|
document.getElementById("start").onclick = function(){
|
|
fetch("/service", {
|
|
headers: {
|
|
command: "start",
|
|
uuid: "@{{UUID}}"
|
|
},
|
|
method: "POST",
|
|
mode: "cors"
|
|
}).then(res => {
|
|
if (res.ok) return res.text();
|
|
else throw console.log(res)
|
|
}).then(res => sessionStorage.setItem("bdsCoreUuid", res)).catch(err => alert(JSON.stringify(err, null, 4)));
|
|
}
|
|
document.getElementById("stop").onclick = function(){
|
|
fetch("/service", {
|
|
headers: {
|
|
command: "stop",
|
|
uuid: "@{{UUID}}",
|
|
bdscoreUuid: "@{{UUID}}"
|
|
},
|
|
method: "POST",
|
|
mode: "cors"
|
|
}).then(res => {
|
|
if (!(res.ok)) alert("Try again there was an Error")
|
|
})
|
|
}
|
|
const log = document.getElementById("logDir")
|
|
function PrintLog(msg) {
|
|
for (let text of msg){
|
|
var item = document.createElement("p");
|
|
item.innerHTML = text;
|
|
log.appendChild(item);
|
|
console.log(text)
|
|
document.getElementById("logDir").scrollTo(0, document.getElementById("logDir").scrollHeight);
|
|
}
|
|
}
|
|
socket.on("BdsLog", PrintLog);
|
|
socket.on("message", PrintLog);
|
|
</script>
|
|
</html> |