2021-03-05 08:58:38 +00:00
|
|
|
{% extends ../base.html %}
|
|
|
|
|
|
|
|
{% block meta %}
|
|
|
|
{% end %}
|
|
|
|
|
2021-09-29 02:25:47 +00:00
|
|
|
{% block title %}Crafty Controller - {{ translate('serverDetails', 'serverDetails', data['lang']) }}{% end %}
|
2021-03-05 08:58:38 +00:00
|
|
|
|
|
|
|
{% block content %}
|
|
|
|
|
|
|
|
<div class="content-wrapper">
|
|
|
|
|
2022-03-26 22:37:08 +00:00
|
|
|
<!-- Page Title Header Starts-->
|
2021-03-05 08:58:38 +00:00
|
|
|
<div class="row page-title-header">
|
|
|
|
<div class="col-12">
|
|
|
|
<div class="page-header">
|
|
|
|
<h4 class="page-title">
|
2023-03-02 18:24:07 +00:00
|
|
|
{{ translate('serverDetails', 'serverDetails', data['lang']) }} - {{
|
|
|
|
data['server_stats']['server_id']['server_name'] }}
|
2022-03-26 22:37:08 +00:00
|
|
|
<br />
|
2023-11-01 17:44:56 +00:00
|
|
|
<small>UUID: {{ data['server_stats']['server_id']['server_id'] }}</small>
|
2021-03-05 08:58:38 +00:00
|
|
|
</h4>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<!-- Page Title Header Ends-->
|
|
|
|
|
2022-03-26 22:37:08 +00:00
|
|
|
{% include "parts/details_stats.html %}
|
2021-03-05 08:58:38 +00:00
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
|
|
|
|
<div class="col-sm-12 grid-margin">
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-body pt-0">
|
2022-03-26 22:37:08 +00:00
|
|
|
<span class="d-none d-sm-block">
|
2021-08-21 08:44:03 +00:00
|
|
|
{% include "parts/server_controls_list.html %}
|
2022-03-26 22:37:08 +00:00
|
|
|
</span>
|
|
|
|
<span class="d-block d-sm-none">
|
|
|
|
{% include "parts/m_server_controls_list.html %}
|
|
|
|
</span>
|
|
|
|
|
|
|
|
<div class="row">
|
2023-04-15 18:47:35 +00:00
|
|
|
{% include "parts/server_players.html %}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<hr />
|
|
|
|
|
2021-03-05 08:58:38 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<!-- content-wrapper ends -->
|
|
|
|
|
|
|
|
{% end %}
|
|
|
|
|
|
|
|
{% block js %}
|
|
|
|
<script>
|
2022-04-03 02:44:40 +00:00
|
|
|
const serverId = new URLSearchParams(document.location.search).get('id')
|
2021-03-05 08:58:38 +00:00
|
|
|
|
2022-03-26 22:37:08 +00:00
|
|
|
//used to get cookies from browser - this is part of tornados xsrf protection - it's for extra security
|
|
|
|
function getCookie(name) {
|
|
|
|
var r = document.cookie.match("\\b" + name + "=([^;]*)\\b");
|
|
|
|
return r ? r[1] : undefined;
|
|
|
|
}
|
2021-03-05 08:58:38 +00:00
|
|
|
|
2022-03-26 22:37:08 +00:00
|
|
|
function htmlDecode(input) {
|
|
|
|
var e = document.createElement('textarea');
|
|
|
|
e.innerHTML = input;
|
|
|
|
// handle case of empty input
|
|
|
|
return e.childNodes.length === 0 ? "" : e.childNodes[0].nodeValue;
|
|
|
|
}
|
2021-03-05 08:58:38 +00:00
|
|
|
|
2022-03-26 22:37:08 +00:00
|
|
|
$(document).ready(function () {
|
|
|
|
console.log("ready!");
|
2021-03-05 08:58:38 +00:00
|
|
|
|
2023-04-15 18:47:35 +00:00
|
|
|
var bannedPlayers = `{{ data['banned_players_html'] }}`;
|
2021-03-05 08:58:38 +00:00
|
|
|
|
2022-03-26 22:37:08 +00:00
|
|
|
var bannedPlayersDecoded = htmlDecode(bannedPlayers);
|
2021-03-05 08:58:38 +00:00
|
|
|
|
2022-03-26 22:37:08 +00:00
|
|
|
$("#bannedPlayers").html(bannedPlayersDecoded)
|
2021-03-05 08:58:38 +00:00
|
|
|
|
2022-03-26 22:37:08 +00:00
|
|
|
});
|
2021-03-05 08:58:38 +00:00
|
|
|
|
2023-03-02 18:24:07 +00:00
|
|
|
async function send_command_to_server(command) {
|
2022-03-26 22:37:08 +00:00
|
|
|
console.log(command)
|
2023-09-04 23:22:11 +00:00
|
|
|
const token = getCookie("_xsrf")
|
2022-03-26 22:37:08 +00:00
|
|
|
console.log('sending command: ' + command)
|
|
|
|
|
2023-03-02 18:24:07 +00:00
|
|
|
let res = await fetch(`/api/v2/servers/${serverId}/stdin`, {
|
|
|
|
method: 'POST',
|
|
|
|
headers: {
|
|
|
|
'X-XSRFToken': token
|
2022-03-26 22:37:08 +00:00
|
|
|
},
|
2023-03-02 18:24:07 +00:00
|
|
|
body: command,
|
2022-03-26 22:37:08 +00:00
|
|
|
});
|
2023-03-02 18:24:07 +00:00
|
|
|
|
|
|
|
let responseData = await res.text();
|
|
|
|
console.log("got response:");
|
|
|
|
console.log(responseData);
|
2022-03-26 22:37:08 +00:00
|
|
|
}
|
2021-03-05 08:58:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
{% end %}
|