2024-09-13 15:07:56 +02:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="de">
|
|
|
|
<head>
|
|
|
|
<script>
|
|
|
|
let termdiv;
|
|
|
|
|
2024-09-15 20:38:22 +02:00
|
|
|
function sendcommand(list) {
|
2024-09-13 15:07:56 +02:00
|
|
|
fetch("/term",{
|
|
|
|
method:"POST",
|
2024-09-15 20:38:22 +02:00
|
|
|
body: list,
|
2024-09-13 15:07:56 +02:00
|
|
|
headers: {"Content-type":"application/json; charset=UTF-8"}
|
|
|
|
});
|
2024-09-15 20:38:22 +02:00
|
|
|
getterm();
|
2024-09-13 15:07:56 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
function getterm() {
|
2024-09-15 20:38:22 +02:00
|
|
|
let tmpterm = "";
|
2024-09-13 15:07:56 +02:00
|
|
|
fetch("/term", { method: "GET" })
|
|
|
|
.then(response => response.json())
|
|
|
|
.then(termarray => {
|
|
|
|
console.log(termarray);
|
|
|
|
for (let line of termarray) {
|
2024-09-15 20:38:22 +02:00
|
|
|
tmpterm += `${line}<br>`;
|
2024-09-13 15:07:56 +02:00
|
|
|
}
|
2024-09-15 20:38:22 +02:00
|
|
|
termdiv.innerHTML = tmpterm;
|
|
|
|
})
|
|
|
|
.catch(termdiv.innerHTML = 'Fehler beim Abrufen der Daten');
|
2024-09-13 15:07:56 +02:00
|
|
|
}
|
|
|
|
|
2024-09-15 20:38:22 +02:00
|
|
|
|
2024-09-13 15:07:56 +02:00
|
|
|
function initstuff() {
|
|
|
|
termdiv = document.getElementById("terminal");
|
|
|
|
getterm();
|
|
|
|
setInterval(getterm,8000)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
window.onload = initstuff;
|
|
|
|
</script>
|
|
|
|
<link rel="stylesheet" href="/static/style.css">
|
|
|
|
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<title>Terradash</title>
|
|
|
|
</head>
|
2024-09-15 20:38:22 +02:00
|
|
|
<body style="background-size: cover; background-image: url({{ url_for('static', filename='background.png') }});">
|
|
|
|
<img src="{{ url_for('static', filename='logo.png') }}" alt="Terra-Dash">
|
2024-09-13 15:07:56 +02:00
|
|
|
<div id="dash">
|
|
|
|
<div id="buttons">
|
2024-09-15 20:38:22 +02:00
|
|
|
<button class="button" onclick="sendcommand([`start`])">start</button>
|
|
|
|
<button style="background-color: rgb(186, 0, 0);" class="button" onclick="sendcommand([`stop`])">stop</button>
|
2024-09-13 15:07:56 +02:00
|
|
|
</div>
|
|
|
|
<div id="terminal">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|