mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Merge branch 'clear-comms' into 'dev'
Add unexecuted clear. Add option to compress backups See merge request crafty-controller/crafty-commander!179
This commit is contained in:
commit
5efc3c6dac
@ -389,5 +389,12 @@ class helpers_management:
|
||||
else:
|
||||
logger.debug(f"Not removing {dir_to_del} from excluded directories - not in the excluded directory list for server ID {server_id}")
|
||||
|
||||
@staticmethod
|
||||
def clear_unexecuted_commands():
|
||||
Commands.update({
|
||||
Commands.executed: True
|
||||
#pylint: disable=singleton-comparison
|
||||
}).where(Commands.executed == False).execute()
|
||||
|
||||
|
||||
management_helper = helpers_management()
|
||||
|
@ -481,8 +481,8 @@ class Helpers:
|
||||
data = json.loads(file_data)
|
||||
pid = data.get('pid')
|
||||
started = data.get('started')
|
||||
console.critical(f"Another Crafty Controller agent seems to be running...\npid: {pid} \nstarted on: {started}")
|
||||
if psutil.pid_exists(pid):
|
||||
console.critical(f"Another Crafty Controller agent seems to be running...\npid: {pid} \nstarted on: {started}")
|
||||
logger.critical("Found running crafty process. Exiting.")
|
||||
sys.exit(1)
|
||||
else:
|
||||
|
@ -594,3 +594,6 @@ class Controller:
|
||||
self.servers_list.pop(counter)
|
||||
|
||||
counter += 1
|
||||
@staticmethod
|
||||
def clear_unexecuted_commands():
|
||||
helpers_management.clear_unexecuted_commands()
|
||||
|
@ -306,6 +306,11 @@ class AjaxHandler(BaseHandler):
|
||||
self.controller.users.update_server_order(exec_user['user_id'], bleach.clean(self.get_argument('order')))
|
||||
return
|
||||
|
||||
elif page == "clear_comms":
|
||||
if exec_user['superuser']:
|
||||
self.controller.clear_unexecuted_commands()
|
||||
return
|
||||
|
||||
elif page == "kill":
|
||||
if not permissions['Commands'] in user_perms:
|
||||
if not superuser:
|
||||
|
@ -141,6 +141,21 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% if data['superuser'] %}
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-12 grid-margin stretch-card">
|
||||
<div class="card">
|
||||
<div class="card-header header-sm d-flex justify-content-between align-items-center">
|
||||
<h4 class="card-title"><i class="fas fa-user-tag"></i> {{ translate('panelConfig', 'adminControls', data['lang']) }}</h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<button type="button" class="btn btn-outline-danger clear-comm">{{ translate('panelConfig', 'clearComms', data['lang']) }}</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% end %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -206,6 +221,17 @@ $( document ).ready(function() {
|
||||
message: api_key,
|
||||
});
|
||||
});
|
||||
|
||||
$('.clear-comm').click(function () {
|
||||
var token = getCookie("_xsrf")
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
headers: {'X-XSRFToken': token},
|
||||
url: '/ajax/clear_comm',
|
||||
success: function (data) {
|
||||
},
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
{% end %}
|
@ -357,7 +357,9 @@
|
||||
"cancel": "Cancel",
|
||||
"delete": "Delete",
|
||||
"superConfirmTitle": "Enable superuser? Are you sure?",
|
||||
"superConfirm": "Proceed only if you want this user to have access to EVERYTHING (all user accounts, servers, panel settings, etc.). They can even revoke your superuser rights."
|
||||
"superConfirm": "Proceed only if you want this user to have access to EVERYTHING (all user accounts, servers, panel settings, etc.). They can even revoke your superuser rights.",
|
||||
"adminControls": "Admin Controls",
|
||||
"clearComms": "Clear Un-executed Commands"
|
||||
},
|
||||
"userConfig": {
|
||||
"pageTitle": "Edit User",
|
||||
|
Loading…
Reference in New Issue
Block a user