2020-09-04 04:02:03 +00:00
|
|
|
{% extends ../base.html %}
|
|
|
|
|
|
|
|
{% block meta %}
|
|
|
|
<!-- <meta http-equiv="refresh" content="60">-->
|
|
|
|
{% end %}
|
|
|
|
|
2021-09-29 02:25:47 +00:00
|
|
|
{% block title %}Crafty Controller - {{ translate('serverDetails', 'serverDetails', data['lang']) }}{% end %}
|
2020-09-04 04:02:03 +00:00
|
|
|
|
|
|
|
{% block content %}
|
|
|
|
|
|
|
|
<div class="content-wrapper">
|
|
|
|
|
|
|
|
<!-- Page Title Header Starts-->
|
|
|
|
<div class="row page-title-header">
|
|
|
|
<div class="col-12">
|
|
|
|
<div class="page-header">
|
|
|
|
<h4 class="page-title">
|
2021-09-29 02:25:47 +00:00
|
|
|
{{ translate('serverDetails', 'serverDetails', data['lang']) }} - {{ data['server_stats']['server_id']['server_name'] }}
|
2020-09-04 04:02:03 +00:00
|
|
|
<br />
|
2021-03-22 04:02:18 +00:00
|
|
|
<small>UUID: {{ data['server_stats']['server_id']['server_uuid'] }}</small>
|
2020-09-04 04:02:03 +00:00
|
|
|
</h4>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<!-- Page Title Header Ends-->
|
|
|
|
|
|
|
|
{% include "parts/details_stats.html %}
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
|
|
|
|
<div class="col-sm-12 grid-margin">
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-body pt-0">
|
2021-08-21 08:44:03 +00:00
|
|
|
{% include "parts/server_controls_list.html %}
|
2020-09-04 04:02:03 +00:00
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-6 col-sm-12">
|
2020-09-04 18:05:42 +00:00
|
|
|
<form class="forms-sample" method="post" action="/panel/server_detail">
|
|
|
|
{% raw xsrf_form_html() %}
|
2021-03-22 04:02:18 +00:00
|
|
|
<input type="hidden" name="id" value="{{ data['server_stats']['server_id']['server_id'] }}">
|
2020-09-04 18:05:42 +00:00
|
|
|
<input type="hidden" name="subpage" value="config">
|
|
|
|
|
|
|
|
<div class="form-group">
|
2021-09-29 02:25:47 +00:00
|
|
|
<label for="server_name">{{ translate('serverConfig', 'serverName', data['lang']) }} <small class="text-muted ml-1"> - {{ translate('serverConfig', 'serverNameDesc', data['lang']) }}</small> </label>
|
|
|
|
<input type="text" class="form-control" name="server_name" id="server_name" value="{{ data['server_stats']['server_id']['server_name'] }}" placeholder="{{ translate('serverConfig', 'serverName', data['lang']) }}" >
|
2020-09-04 18:05:42 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group">
|
2021-09-29 02:25:47 +00:00
|
|
|
<label for="server_path">{{ translate('serverConfig', 'serverPath', data['lang']) }} <small class="text-muted ml-1"> - {{ translate('serverConfig', 'serverPathDesc', data['lang']) }}</small> </label>
|
|
|
|
<input type="text" class="form-control" name="server_path" id="server_path" value="{{ data['server_stats']['server_id']['path'] }}" placeholder="{{ translate('serverConfig', 'serverPath', data['lang']) }}" >
|
2020-09-04 18:05:42 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group">
|
2021-09-29 02:25:47 +00:00
|
|
|
<label for="log_path">{{ translate('serverConfig', 'serverLogLocation', data['lang']) }} <small class="text-muted ml-1"> - {{ translate('serverConfig', 'serverLogLocationDesc', data['lang']) }}</small> </label>
|
|
|
|
<input type="text" class="form-control" name="log_path" id="log_path" value="{{ data['server_stats']['server_id']['log_path'] }}" placeholder="{{ translate('serverConfig', 'serverLogLocation', data['lang']) }}" >
|
2020-09-04 18:05:42 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group">
|
2021-09-29 02:25:47 +00:00
|
|
|
<label for="executable">{{ translate('serverConfig', 'serverExecutable', data['lang']) }} <small class="text-muted ml-1"> - {{ translate('serverConfig', 'serverExecutableDesc', data['lang']) }}</small> </label>
|
|
|
|
<input type="text" class="form-control" name="executable" id="executable" value="{{ data['server_stats']['server_id']['executable'] }}" placeholder="{{ translate('serverConfig', 'serverExecutable', data['lang']) }}" >
|
2020-09-04 18:05:42 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group">
|
2021-09-29 02:25:47 +00:00
|
|
|
<label for="execution_command">{{ translate('serverConfig', 'serverExecutionCommand', data['lang']) }} <small class="text-muted ml-1"> - {{ translate('serverConfig', 'serverExecutionCommandDesc', data['lang']) }}</small> </label>
|
|
|
|
<input type="text" class="form-control" name="execution_command" id="execution_command" value="{{ data['server_stats']['server_id']['execution_command'] }}" placeholder="{{ translate('serverConfig', 'serverExecutionCommand', data['lang']) }}" >
|
2020-09-04 18:05:42 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group">
|
2021-09-29 02:25:47 +00:00
|
|
|
<label for="stop_command">{{ translate('serverConfig', 'serverStopCommand', data['lang']) }} <small class="text-muted ml-1"> - {{ translate('serverConfig', 'serverStopCommandDesc', data['lang']) }}</small> </label>
|
|
|
|
<input type="text" class="form-control" name="stop_command" id="stop_command" value="{{ data['server_stats']['server_id']['stop_command'] }}" placeholder="{{ translate('serverConfig', 'serverStopCommand', data['lang']) }}" >
|
2020-09-04 18:05:42 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group">
|
2021-09-29 02:25:47 +00:00
|
|
|
<label for="auto_start_delay">{{ translate('serverConfig', 'serverAutostartDelay', data['lang']) }} <small class="text-muted ml-1"> - {{ translate('serverConfig', 'serverAutostartDelayDesc', data['lang']) }}</small> </label>
|
2021-03-22 04:02:18 +00:00
|
|
|
<input type="number" class="form-control" name="auto_start_delay" id="auto_start_delay" value="{{ data['server_stats']['server_id']['auto_start_delay'] }}" step="1" max="999" min="10" >
|
2020-09-04 18:05:42 +00:00
|
|
|
</div>
|
|
|
|
|
2021-07-25 01:09:39 +00:00
|
|
|
<div class="form-group">
|
2021-09-29 02:25:47 +00:00
|
|
|
<label for="executable_update_url">{{ translate('serverConfig', 'exeUpdateURL', data['lang']) }} <small class="text-muted ml-1"> - {{ translate('serverConfig', 'exeUpdateURLDesc', data['lang']) }}</small> </label>
|
|
|
|
<input type="text" class="form-control" name="executable_update_url" id="executable_update_url" value="{{ data['server_stats']['server_id']['executable_update_url'] }}" placeholder="{{ translate('serverConfig', 'exeUpdateURL', data['lang']) }}" >
|
2021-07-25 01:09:39 +00:00
|
|
|
</div>
|
|
|
|
|
2020-09-04 18:05:42 +00:00
|
|
|
<div class="form-group">
|
2021-09-29 02:25:47 +00:00
|
|
|
<label for="server_ip">{{ translate('serverConfig', 'serverIP', data['lang']) }} <small class="text-muted ml-1"> - {{ translate('serverConfig', 'serverPortDesc', data['lang']) }}</small> </label>
|
2021-03-22 04:02:18 +00:00
|
|
|
<input type="text" class="form-control" name="server_ip" id="server_ip" value="{{ data['server_stats']['server_id']['server_ip'] }}">
|
2020-09-22 16:11:16 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group">
|
2021-09-29 02:25:47 +00:00
|
|
|
<label for="server_port">{{ translate('serverConfig', 'serverPort', data['lang']) }} <small class="text-muted ml-1"> - {{ translate('serverConfig', 'serverIPDesc', data['lang']) }}</small> </label>
|
2021-03-22 04:02:18 +00:00
|
|
|
<input type="number" class="form-control" name="server_port" id="server_port" value="{{ data['server_stats']['server_id']['server_port'] }}" step="1" max="65566" min="1" >
|
2020-09-04 18:05:42 +00:00
|
|
|
</div>
|
|
|
|
|
2021-01-20 15:20:42 +00:00
|
|
|
<div class="form-group">
|
2021-09-29 02:25:47 +00:00
|
|
|
<label for="logs_delete_after">{{ translate('serverConfig', 'removeOldLogsAfter', data['lang']) }} <small class="text-muted ml-1"> - {{ translate('serverConfig', 'removeOldLogsAfterDesc', data['lang']) }}</small> </label>
|
2021-03-22 04:02:18 +00:00
|
|
|
<input type="number" class="form-control" name="logs_delete_after" id="logs_delete_after" value="{{ data['server_stats']['server_id']['logs_delete_after'] }}" step="1" max="365" min="0" >
|
2021-01-20 15:20:42 +00:00
|
|
|
</div>
|
|
|
|
|
2020-09-04 18:05:42 +00:00
|
|
|
<div class="form-check-flat">
|
|
|
|
<label for="auto_start" class="form-check-label ml-4 mb-4">
|
2021-03-22 04:02:18 +00:00
|
|
|
{% if data['server_stats']['server_id']['auto_start'] %}
|
2021-09-29 02:25:47 +00:00
|
|
|
<input type="checkbox" class="form-check-input" id="auto_start" name="auto_start" checked="" value="1">{{ translate('serverConfig', 'serverAutoStart', data['lang']) }}
|
2020-09-04 18:05:42 +00:00
|
|
|
{% else %}
|
2021-09-29 02:25:47 +00:00
|
|
|
<input type="checkbox" class="form-check-input" id="auto_start" name="auto_start" value="1">{{ translate('serverConfig', 'serverAutoStart', data['lang']) }}
|
2020-09-04 18:05:42 +00:00
|
|
|
{% end %}
|
|
|
|
</label>
|
|
|
|
|
|
|
|
<label for="crash_detection" class="form-check-label ml-4 mb-4">
|
2021-03-22 04:02:18 +00:00
|
|
|
{% if data['server_stats']['server_id']['crash_detection'] %}
|
2021-09-29 02:25:47 +00:00
|
|
|
<input type="checkbox" class="form-check-input" id="crash_detection" name="crash_detection" checked="" value="1">{{ translate('serverConfig', 'serverCrashDetection', data['lang']) }}
|
2020-09-04 18:05:42 +00:00
|
|
|
{% else %}
|
2021-09-29 02:25:47 +00:00
|
|
|
<input type="checkbox" class="form-check-input" id="crash_detection" name="crash_detection" value="1" >{{ translate('serverConfig', 'serverCrashDetection', data['lang']) }}
|
2020-09-04 18:05:42 +00:00
|
|
|
{% end %}
|
|
|
|
</label>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
2021-09-29 02:25:47 +00:00
|
|
|
<button type="submit" class="btn btn-success mr-2"><i class="fas fa-save"></i> {{ translate('serverConfig', 'save', data['lang']) }}</button>
|
|
|
|
<button type="reset" class="btn btn-light"><i class="fas fa-times"></i> {{ translate('serverConfig', 'cancel', data['lang']) }}</button>
|
2020-09-04 18:05:42 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
2020-09-04 04:02:03 +00:00
|
|
|
|
2020-09-04 18:05:42 +00:00
|
|
|
<div class="col-md-6 col-sm-12">
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-body">
|
2021-09-29 02:25:47 +00:00
|
|
|
<h4 class="card-title">{{ translate('serverConfigHelp', 'title', data['lang']) }}</h4>
|
|
|
|
<p class="card-description"> {{ translate('serverConfigHelp', 'desc', data['lang']) }}</p>
|
2020-09-04 18:05:42 +00:00
|
|
|
<blockquote class="blockquote">
|
|
|
|
<p class="mb-0">
|
2021-09-29 02:25:47 +00:00
|
|
|
{% raw translate('serverConfigHelp', 'perms', data['lang']) %}
|
2020-09-04 18:05:42 +00:00
|
|
|
</p>
|
|
|
|
</blockquote>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="text-center">
|
2021-03-22 04:02:18 +00:00
|
|
|
{% if data['server_stats']['running'] %}
|
2021-09-29 02:25:47 +00:00
|
|
|
<button onclick="send_command(server_id, 'update_executable');" id="update_executable" style="max-width: 7rem;" class="btn btn-warning m-1 flex-grow-1 disabled">{{ translate('serverConfig', 'update', data['lang']) }}</button>
|
|
|
|
<a class="btn btn-sm btn-danger disabled">{{ translate('serverConfig', 'deleteServer', data['lang']) }}</a><br />
|
|
|
|
<small>{{ translate('serverConfig', 'stopBeforeDeleting', data['lang']) }}</small>
|
2020-09-04 04:02:03 +00:00
|
|
|
{% else %}
|
2021-09-29 02:25:47 +00:00
|
|
|
<button onclick="send_command(server_id, 'update_executable');" id="update_executable" style="max-width: 7rem;" class="btn btn-warning m-1 flex-grow-1">{{ translate('serverConfig', 'update', data['lang']) }}</button>
|
|
|
|
<button onclick="deleteConfirm()" class="btn btn-sm btn-danger">{{ translate('serverConfig', 'deleteServer', data['lang']) }}</button>
|
2020-09-04 04:02:03 +00:00
|
|
|
{% end %}
|
|
|
|
|
2020-09-04 18:05:42 +00:00
|
|
|
</div>
|
2020-09-04 04:02:03 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2020-09-04 18:05:42 +00:00
|
|
|
|
|
|
|
|
2020-09-04 04:02:03 +00:00
|
|
|
</div>
|
|
|
|
<!-- content-wrapper ends -->
|
|
|
|
|
|
|
|
{% end %}
|
|
|
|
|
|
|
|
{% block js %}
|
|
|
|
<script>
|
|
|
|
|
|
|
|
|
|
|
|
//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;
|
|
|
|
}
|
|
|
|
|
|
|
|
$( document ).ready(function() {
|
|
|
|
console.log( "ready!" );
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2021-08-18 22:50:53 +00:00
|
|
|
function deleteServerE(callback) {
|
|
|
|
var token = getCookie("_xsrf")
|
|
|
|
$.ajax({
|
|
|
|
type: "DELETE",
|
|
|
|
headers: {'X-XSRFToken': token},
|
|
|
|
url: '/ajax/delete_server?id={{ data['server_stats']['server_id']['server_id'] }}',
|
|
|
|
data: {
|
|
|
|
},
|
|
|
|
success: function(data){
|
|
|
|
console.log("got response:");
|
|
|
|
console.log(data);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
function deleteServerFilesE(path, callback) {
|
|
|
|
var token = getCookie("_xsrf")
|
|
|
|
$.ajax({
|
|
|
|
type: "DELETE",
|
|
|
|
headers: {'X-XSRFToken': token},
|
|
|
|
url: '/ajax/delete_server_files?id={{ data['server_stats']['server_id']['server_id'] }}',
|
|
|
|
data: {
|
|
|
|
},
|
|
|
|
success: function(data){
|
|
|
|
console.log("got response:");
|
|
|
|
console.log(data);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-07-25 01:09:39 +00:00
|
|
|
let server_id = '{{ data['server_stats']['server_id']['server_id'] }}';
|
|
|
|
|
|
|
|
function send_command (server_id, command){
|
|
|
|
<!-- this getCookie function is in base.html-->
|
|
|
|
var token = getCookie("_xsrf");
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
headers: {'X-XSRFToken': token},
|
|
|
|
url: '/server/command?command=' + command + '&id=' + server_id,
|
|
|
|
success: function(data){
|
|
|
|
console.log("got response:");
|
|
|
|
console.log(data);
|
|
|
|
setTimeout(function(){ location.reload(); }, 10000);
|
|
|
|
|
|
|
|
}
|
2021-08-10 02:16:13 +00:00
|
|
|
});
|
|
|
|
if(command != "delete_server" && command != "delete_server_files"){
|
|
|
|
bootbox.alert({
|
2021-07-25 01:09:39 +00:00
|
|
|
backdrop: true,
|
2021-09-29 02:25:47 +00:00
|
|
|
title: '{% raw translate("serverConfig", "sendingRequest", data['lang']) %}',
|
|
|
|
message: '<div align="center"><i class="fas fa-spin fa-spinner"></i> {% raw translate("serverConfig", "bePatientUpdate", data['lang']) %} </div>'
|
2021-07-25 01:09:39 +00:00
|
|
|
});
|
2021-08-10 02:16:13 +00:00
|
|
|
}
|
2021-07-25 01:09:39 +00:00
|
|
|
}
|
2020-09-04 04:02:03 +00:00
|
|
|
|
2021-08-10 00:48:22 +00:00
|
|
|
function deleteServer (){
|
|
|
|
path = "{{data['server_stats']['server_id']['path']}}";
|
|
|
|
name = "{{data['server_stats']['server_id']['server_name']}}";
|
|
|
|
bootbox.confirm({
|
|
|
|
size: "",
|
2021-09-29 02:25:47 +00:00
|
|
|
title: "{% raw translate('serverConfig', 'deleteFilesQuestion', data['lang']) %}",
|
2021-08-10 00:48:22 +00:00
|
|
|
closeButton: false,
|
2021-09-29 02:25:47 +00:00
|
|
|
message: "{% raw translate('serverConfig', 'deleteFilesQuestionMessage', data['lang']) %}",
|
2021-08-10 00:48:22 +00:00
|
|
|
buttons: {
|
|
|
|
confirm: {
|
2021-09-29 02:25:47 +00:00
|
|
|
label: "{{ translate('serverConfig', 'yesDeleteFiles', data['lang']) }}",
|
2021-08-10 00:48:22 +00:00
|
|
|
className: 'btn-danger',
|
|
|
|
},
|
|
|
|
cancel: {
|
2021-09-29 02:25:47 +00:00
|
|
|
label: "{{ translate('serverConfig', 'noDeleteFiles', data['lang']) }}",
|
2021-08-10 00:48:22 +00:00
|
|
|
className: 'btn-link',
|
|
|
|
}
|
|
|
|
},
|
|
|
|
callback: function(result) {
|
|
|
|
if (!result){
|
2021-08-18 22:50:53 +00:00
|
|
|
deleteServerE()
|
2021-08-10 00:48:22 +00:00
|
|
|
setTimeout(function(){ window.location = '/panel/dashboard'; }, 5000);
|
|
|
|
bootbox.dialog({
|
|
|
|
backdrop: true,
|
2021-09-29 02:25:47 +00:00
|
|
|
title: '{% raw translate("serverConfig", "sendingDelete", data['lang']) %}',
|
|
|
|
message: '<div align="center"><i class="fas fa-spin fa-spinner"></i> {% raw translate("serverConfig", "bePatientDelete", data['lang']) %} </div>',
|
2021-08-10 02:16:13 +00:00
|
|
|
closeButton: false
|
|
|
|
})
|
2021-08-10 00:48:22 +00:00
|
|
|
|
|
|
|
return;}
|
|
|
|
else{
|
2021-08-18 22:50:53 +00:00
|
|
|
deleteServerFilesE();
|
2021-08-10 00:48:22 +00:00
|
|
|
setTimeout(function(){ window.location = '/panel/dashboard'; }, 5000);
|
|
|
|
bootbox.dialog({
|
|
|
|
backdrop: true,
|
2021-09-29 02:25:47 +00:00
|
|
|
title: '{% raw translate("serverConfig", "sendingDelete", data['lang']) %}',
|
|
|
|
message: '<div align="center"><i class="fas fa-spin fa-spinner"></i> {% raw translate("serverConfig", "bePatientDeleteFiles", data['lang']) %} </div>',
|
2021-08-10 02:16:13 +00:00
|
|
|
closeButton: false
|
|
|
|
})
|
2021-08-10 00:48:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
function deleteConfirm (){
|
|
|
|
path = "{{data['server_stats']['server_id']['path']}}";
|
|
|
|
name = "{{data['server_stats']['server_id']['server_name']}}";
|
|
|
|
bootbox.confirm({
|
|
|
|
size: "",
|
2021-09-29 02:25:47 +00:00
|
|
|
title: "{% raw translate('serverConfig', 'deleteServerQuestion', data['lang']) %}",
|
2021-08-10 00:48:22 +00:00
|
|
|
closeButton: false,
|
2021-09-29 02:25:47 +00:00
|
|
|
message: "{% raw translate('serverConfig', 'deleteServerQuestionMessage', data['lang']) %}",
|
2021-08-10 00:48:22 +00:00
|
|
|
buttons: {
|
|
|
|
confirm: {
|
2021-09-29 02:25:47 +00:00
|
|
|
label: "{{ translate('serverConfig', 'yesDelete', data['lang']) }}",
|
2021-08-10 00:48:22 +00:00
|
|
|
className: 'btn-danger',
|
|
|
|
},
|
|
|
|
cancel: {
|
2021-09-29 02:25:47 +00:00
|
|
|
label: "{{ translate('serverConfig', 'noDelete', data['lang']) }}",
|
2021-08-10 00:48:22 +00:00
|
|
|
className: 'btn-link',
|
|
|
|
}
|
|
|
|
},
|
|
|
|
callback: function(result) {
|
|
|
|
if (!result){
|
|
|
|
return;
|
|
|
|
return;}
|
|
|
|
else{
|
|
|
|
deleteServer();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-09-04 04:02:03 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
{% end %}
|