mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Add unexecuted clear. Add option to compress backups
This commit is contained in:
parent
fec877db7b
commit
61ac97c02e
@ -388,6 +388,12 @@ class helpers_management:
|
|||||||
self.set_backup_config(server_id=server_id, excluded_dirs=excluded_dirs)
|
self.set_backup_config(server_id=server_id, excluded_dirs=excluded_dirs)
|
||||||
else:
|
else:
|
||||||
logger.debug(f"Not removing {dir_to_del} from excluded directories - not in the excluded directory list for server ID {server_id}")
|
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
|
||||||
|
}).where(Commands.executed == False).execute()
|
||||||
|
|
||||||
|
|
||||||
management_helper = helpers_management()
|
management_helper = helpers_management()
|
||||||
|
@ -481,8 +481,8 @@ class Helpers:
|
|||||||
data = json.loads(file_data)
|
data = json.loads(file_data)
|
||||||
pid = data.get('pid')
|
pid = data.get('pid')
|
||||||
started = data.get('started')
|
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):
|
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.")
|
logger.critical("Found running crafty process. Exiting.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
|
@ -594,3 +594,6 @@ class Controller:
|
|||||||
self.servers_list.pop(counter)
|
self.servers_list.pop(counter)
|
||||||
|
|
||||||
counter += 1
|
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')))
|
self.controller.users.update_server_order(exec_user['user_id'], bleach.clean(self.get_argument('order')))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
elif page == "clear_comms":
|
||||||
|
if exec_user['superuser']:
|
||||||
|
self.controller.clear_unexecuted_commands()
|
||||||
|
return
|
||||||
|
|
||||||
elif page == "kill":
|
elif page == "kill":
|
||||||
if not permissions['Commands'] in user_perms:
|
if not permissions['Commands'] in user_perms:
|
||||||
if not superuser:
|
if not superuser:
|
||||||
|
@ -141,6 +141,21 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -206,6 +221,17 @@ $( document ).ready(function() {
|
|||||||
message: api_key,
|
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>
|
</script>
|
||||||
|
|
||||||
{% end %}
|
{% end %}
|
@ -357,7 +357,9 @@
|
|||||||
"cancel": "Cancel",
|
"cancel": "Cancel",
|
||||||
"delete": "Delete",
|
"delete": "Delete",
|
||||||
"superConfirmTitle": "Enable superuser? Are you sure?",
|
"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": {
|
"userConfig": {
|
||||||
"pageTitle": "Edit User",
|
"pageTitle": "Edit User",
|
||||||
|
1
main.py
1
main.py
@ -150,6 +150,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
project_root = os.path.dirname(__file__)
|
project_root = os.path.dirname(__file__)
|
||||||
controller.set_project_root(project_root)
|
controller.set_project_root(project_root)
|
||||||
|
controller.clear_unexecuted_commands()
|
||||||
|
|
||||||
def sigterm_handler():
|
def sigterm_handler():
|
||||||
print() # for newline
|
print() # for newline
|
||||||
|
Loading…
Reference in New Issue
Block a user