This commit is contained in:
SavaletDev
2022-09-07 00:20:48 +02:00
parent 3cbe1f8ad8
commit d1f30326f3

View File

@@ -252,7 +252,7 @@ if (url.searchParams.get('id')) {
document.getElementById("restart-button").classList.remove("disabled")
document.getElementById("stop-button").classList.remove("disabled")
document.getElementById("kill-button").classList.remove("disabled")
term.writeUtf8("Votre serveur est démarrer.\r\n")
term.writeUtf8("Votre serveur est démarré.\r\n")
}
if (data_parse.args[0] == "stopping") {
document.getElementById("restart-button").classList.add("disabled")
@@ -317,13 +317,20 @@ if (url.searchParams.get('id')) {
}
});
var commands_history = []
var terminal_input = document.getElementById("terminal-input");
terminal_input.addEventListener("keypress", function (event) {
terminal_input.addEventListener("keydown", function (event) {
if (event.key === "Enter") {
socket.send(`{"event":"send command","args":["${terminal_input.value}"]}`);
commands_history.push(terminal_input.value)
if (commands_history.length > 100) { commands_history.shift() }
terminal_input.value = ""
}
if (event.key === "ArrowUp") {
if (commands_history[commands_history.length - 1] != undefined) {
terminal_input.value = commands_history[commands_history.length - 1]
}
}
});
socket.onclose = function (event) {
@@ -355,4 +362,4 @@ if (url.searchParams.get('id')) {
})
} else {
window.location.replace("/dashboard/errors/error404.html");
}
}