diff --git a/app/classes/models/management.py b/app/classes/models/management.py index 8cd6e527..49a67fc0 100644 --- a/app/classes/models/management.py +++ b/app/classes/models/management.py @@ -388,6 +388,12 @@ class helpers_management: self.set_backup_config(server_id=server_id, excluded_dirs=excluded_dirs) 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 + }).where(Commands.executed == False).execute() management_helper = helpers_management() diff --git a/app/classes/shared/helpers.py b/app/classes/shared/helpers.py index c9777346..738ac1a0 100644 --- a/app/classes/shared/helpers.py +++ b/app/classes/shared/helpers.py @@ -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: diff --git a/app/classes/shared/main_controller.py b/app/classes/shared/main_controller.py index 42e77600..b2f82941 100644 --- a/app/classes/shared/main_controller.py +++ b/app/classes/shared/main_controller.py @@ -594,3 +594,6 @@ class Controller: self.servers_list.pop(counter) counter += 1 + @staticmethod + def clear_unexecuted_commands(): + helpers_management.clear_unexecuted_commands() \ No newline at end of file diff --git a/app/classes/web/ajax_handler.py b/app/classes/web/ajax_handler.py index c06e6a78..70678b8c 100644 --- a/app/classes/web/ajax_handler.py +++ b/app/classes/web/ajax_handler.py @@ -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: diff --git a/app/frontend/templates/panel/panel_config.html b/app/frontend/templates/panel/panel_config.html index 957a5e3d..1fadb840 100644 --- a/app/frontend/templates/panel/panel_config.html +++ b/app/frontend/templates/panel/panel_config.html @@ -141,6 +141,21 @@ + {% if data['superuser'] %} +