Archived
Private
Public Access
1
0

Initial commit

This commit is contained in:
2022-09-04 12:45:01 +02:00
commit f4a01d6a69
11601 changed files with 4206660 additions and 0 deletions

5
Plugins/CloudNetWebinterface/htdocs/.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,5 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="PROJECT_FILES" />
<option name="description" value="" />
</component>
</project>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/htdocs.iml" filepath="$PROJECT_DIR$/.idea/htdocs.iml" />
</modules>
</component>
</project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 KiB

View File

@@ -0,0 +1,62 @@
<div id="navigation">
<img src="/assets/images/server-icon.png" alt="Server Icon" id="navigation-logo" draggable="false">
<h1 id="navigation-title">Serververwaltung</h1>
<div id="navigation-buttons">
<input type="button" class="navigation-button" value="Startseite" id="navigation-">
<input type="button" class="navigation-button" value="Server" id="navigation-/server/">
<input type="button" class="navigation-button" value="Spieler" id="navigation-/players/">
</div>
</div>
<!--Styling-->
<style>
#navigation {
position: relative;
width: 100vw;
height: 50px;
background-color: #4a4c4d;
}
#navigation-logo {
width: 40px;
height: 40px;
margin: 5px 5px 5px 10px;
}
#navigation-title {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: white;
}
#navigation-buttons {
position: absolute;
top: 50%;
left: 100%;
transform: translate(-105%, -50%);
width: 370px;
height: 50px;
}
.navigation-button {
width: 100px;
height: 30px;
color: white;
margin: 10px;
background: none;
transition: all 200ms;
border: 2px solid #2094c2;
border-radius: 15px;
}
.navigation-button:hover {
background-color: #2094c2;
cursor: pointer;
}
</style>

View File

@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Admin Panel</title>
<link rel="stylesheet" type="text/css" href="/styles.css">
<link rel="stylesheet" type="text/css" href="/style.css">
<script src="/main.js"></script>
<script src="/script.js" defer></script>
</head>
<body>
<nav class="component unselectable" id="component-navigation"></nav>
<main id="container">
<section id="left" class="unselectable">
<div id="buttons">
<input type="button" value="Stop" id="stop" class="buttons">
<input type="button" value="Reload" id="reload" class="buttons">
</div>
<span id="playerTitle">Spieler</span>
<div id="players"></div>
</section>
<section id="right">
<div id="console"></div>
<div id="console-input">
<input type="text" placeholder=">" id="command">
<input type="button" value="Senden" id="send">
</div>
</section>
</main>
</body>
</html>

View File

@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<title>Login</title>
<script src="../main.js"></script>
<link rel="stylesheet" type="text/css" href="/styles.css">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<form class="login">
<h1>Einloggen</h1>
<div class="box">
<input type="text" class="input" id="username" placeholder="Benutzername" autocomplete="off" required>
<input type="password" class="input" id="password" placeholder="Passwort" required>
<input type="button" id="submit" value="Login">
</div>
</form>
<div id="snackbar">Login fehlgeschlagen!</div>
<script src="script.js"></script>
</body>
</html>

View File

@@ -0,0 +1,21 @@
const submit = document.getElementById("submit");
submit.onclick = async function() {
const username = document.getElementById("username").value;
const password = document.getElementById("password").value;
const response = await sendGetRequest(hostname + "/api/users/login?username=" + username + "&password=" + password);
if (response !== "false") {
sessionStorage.setItem("sessionKey", response);
sessionKey = response;
location.href = hostname;
}else {
showSnackbar();
}
}
function showSnackbar() {
document.getElementById('snackbar')?.classList.add('show');
setTimeout(() => {document.getElementById('snackbar')?.classList.remove('show');}, 5000);
}

View File

@@ -0,0 +1,122 @@
* {
text-decoration: none;
}
body {
background-image: url(../assets/images/moon.jpg);
background-size: cover;
}
.login {
width: 460px;
background: snow;
height: 480px;
padding: 80px 40px;
border-radius: 10px;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
.login h1 {
text-align: center;
margin-bottom: 60px;
text-transform: uppercase;
font-weight: 500;
}
.box {
border-bottom: 2px solid #adadad;
position: relative;
margin: 30px 0;
}
.input {
font-size: 15px;
height: 40px;
border: 0;
background: none;
display: block;
margin: 20px auto;
text-align: center;
border: 2px solid #4a4c4d;
padding: 14px 10px;
width: 350px;
outline: none;
color: black;
border-radius: 10px;
transition: 0.25s;
}
.input:focus {
width: 380px;
border-color: #2094c2;
}
#submit {
border: 0;
background: none;
display: block;
margin: 20px auto;
text-align: center;
border: 2px solid #2094c2;
padding: 14px 40px;
outline: none;
border-radius: 10px;
transition: 0.25s;
cursor: pointer;
height: 50px;
}
#submit:hover {
background: #2094c2;
color: snow;
}
#snackbar {
visibility: hidden; /* Hidden by default. Visible on click */
width: 290px; /* Set a default minimum width */
margin-left: -145px; /* Hälfte von width */
background-color:#f44336; /* Black background color */
color: #fff; /* White text color */
text-align: center; /* Centered text */
border-radius: 2px; /* Rounded borders */
padding: 20px; /* Padding */
left: 50%;
position: fixed; /* Sit on top of the screen */
z-index: 1; /* Add a z-index if needed */
bottom: 30px; /* 30px from the bottom */
}
#snackbar.show {
visibility: visible; /* Show the snackbar */
-webkit-animation: fadein 0.5s, fadeout 0.5s 4.5s;
animation: fadein 0.5s, fadeout 0.5s 4.5s;
}
@-webkit-keyframes fadein {
from {bottom: 0; opacity: 0;}
to {bottom: 30px; opacity: 1;}
}
@keyframes fadein {
from {bottom: 0; opacity: 0;}
to {bottom: 30px; opacity: 1;}
}
@-webkit-keyframes fadeout {
from {bottom: 30px; opacity: 1;}
to {bottom: 0; opacity: 0;}
}
@keyframes fadeout {
from {bottom: 30px; opacity: 1;}
to {bottom: 0; opacity: 0;}
}

View File

@@ -0,0 +1,66 @@
const hostname = location.protocol + "//" + location.host;
if (!location.href.replace(hostname, "").includes(".") && !location.href.endsWith("/")) location.href += "/";
let sessionKey;
window.onload = async function () {
sessionKey = sessionStorage.getItem("sessionKey");
const valid = await sendGetRequest(hostname + "/api/users/validate");
if (valid === "false" && !location.href.includes("login")) location.href = hostname + "/login/";
else {
const componentClients = document.getElementsByClassName("component");
for (let element of componentClients) {
const componentName = element.id.replace("component-", "");
element.innerHTML = await sendGetRequest(hostname + "/components/" + componentName + ".html");
}
await initialize();
initializeNavBar();
}
}
async function sendHttpRequest(url, body = "", method = "GET") {
return await fetch(url, {
method: method,
mode: 'cors',
cache: 'no-cache',
credentials: 'same-origin',
headers: {
'Content-Type': 'application/json',
'Authorization': sessionKey
},
redirect: 'follow',
referrerPolicy: 'no-referrer',
body: body
});
}
async function sendGetRequest(url, asJson = false) {
const response = await sendHttpRequest(url, null, "GET");
return asJson ? await response.json() : await response.text();
}
async function sendPutRequest(url, body, asJson = false) {
const response = await sendHttpRequest(url, body, "PUT");
return asJson ? await response.json() : await response.text();
}
async function sendPostRequest(url, body, asJson = false) {
const response = await sendHttpRequest(url, body, "POST");
return asJson ? await response.json() : await response.text();
}
async function sendDeleteRequest(url, asJson = false) {
const response = await sendHttpRequest(url, null, "DELETE");
return asJson ? await response.json() : await response.text();
}
function initializeNavBar() {
const buttons = document.getElementsByClassName("navigation-button");
for (let button of buttons) {
button.onclick = function () {
location.href = hostname + button.id.replace("navigation-", "");
}
}
}
let initialize = function () {}

View File

@@ -0,0 +1,53 @@
initialize = async function () {
await loadPlayers();
await loadConsole();
const console = document.getElementById("console");
console.scrollTop = console.scrollHeight;
document.getElementById("send").onclick = async function () {
const cmd = document.getElementById("command");
await sendPostRequest(hostname + "/api/console/send?command=" + cmd.value, "");
cmd.value = "";
await loadConsole();
}
document.getElementById("stop").onclick = async function () {
await sendGetRequest(hostname + "/api/console/stop")
}
document.getElementById("reload").onclick = async function () {
await sendGetRequest(hostname + "/api/console/reload")
}
setInterval(async () => {
await loadConsole();
await loadPlayers();
}, 5000);
}
async function loadPlayers() {
const players = await sendGetRequest(hostname + "/api/players", true);
const playerContainer = document.getElementById("players");
let html = "";
for (const player of players) {
const name = player["name"];
const server = player["server"];
html += `
<div class="player">
<img src="https://minotar.net/avatar/${name}/200" alt="Player Head">
<span class="playerName">${name}</span>
<br>
<span class="playerServer">Server: ${server}</span>
</div>
`;
}
playerContainer.innerHTML = html;
}
async function loadConsole() {
const consoleLog = await sendGetRequest(hostname + "/api/console");
const console = document.getElementById("console");
console.innerText = consoleLog;
}

View File

@@ -0,0 +1,162 @@
#container {
position: relative;
margin: 80px;
height: calc(100% - 50px);
overflow: hidden;
border-radius: 30px;
}
#left {
position: absolute;
top: 0;
left: 0;
width: 20%;
height: calc(100% - 160px);
background-color: #4a4a4a;
border-bottom-left-radius: 30px;
overflow: hidden;
}
#right {
position: absolute;
top: 0;
left: 20%;
width: 80%;
height: calc(100% - 160px);
background-color: #151515;
border-bottom-right-radius: 30px;
overflow: hidden;
}
#buttons {
width: 100%;
height: 10%;
padding: 5%;
}
#players {
width: 100%;
height: 87%;
padding: 2%;
}
#console {
margin-top: 1.5%;
width: 100%;
height: 90%;
padding: 1.5%;
overflow-y: scroll;
color: white;
font-family: monospace;
}
#console::-webkit-scrollbar {
width: 10px;
}
#console::-webkit-scrollbar-track {
background: none;
}
#console::-webkit-scrollbar-thumb {
background: #888;
}
#console::-webkit-scrollbar-thumb:hover {
background: #555;
}
#console-input {
position: relative;
width: 100%;
height: 7%;
padding: 1%;
}
.buttons {
width: 45%;
height: 70%;
border-radius: 20px;
background: none;
border: 2px solid #2094c2;
color: white;
margin: 2%;
font-size: 150%;
transition: all 200ms;
}
.buttons:hover {
cursor: pointer;
background-color: #2094c2;
}
.player {
display: inline-block;
width: 47%;
height: 5%;
background-color: #252525;
margin: 1%;
position: relative;
padding: 2%;
border-radius: 20px;
overflow: hidden;
}
.player img {
display: inline-block;
width: auto;
height: 100%;
margin-left: 3%;
-webkit-user-drag: none;
}
.playerName {
position: absolute;
color: white;
top: 2%;
left: 30%;
}
.playerServer {
position: absolute;
color: white;
top: 55%;
left: 30%;
font-size: 70%;
}
#playerTitle {
display: block;
width: 100%;
height: 3%;
font-size: 170%;
text-align: center;
color: white;
text-decoration: underline;
}
#command {
top: 0;
width: 94%;
padding: 10px;
display: inline-block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
height: 100%;
}
#send {
width: 5%;
background-color: #039BE5;
color: white;
border: none;
border-radius: 4px;
transition: 200ms;
height: 100%;
}
#send:hover {
background-color: #03A9F4;
cursor: pointer;
}

View File

@@ -0,0 +1,23 @@
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300&display=swap');
* {
box-sizing: border-box;
margin: 0;
padding: 0;
font-family: 'Poppins', sans-serif;
}
.unselectable {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
body, html {
background-color: #2a2a2a;
height: 100%;
overflow: hidden;
}