diff --git a/app/classes/controllers/management_controller.py b/app/classes/controllers/management_controller.py index 1cb99808..6efe492a 100644 --- a/app/classes/controllers/management_controller.py +++ b/app/classes/controllers/management_controller.py @@ -104,8 +104,8 @@ class Management_Controller: return management_helper.get_backup_config(server_id) @staticmethod - def set_backup_config(server_id: int, backup_path: str = None, max_backups: int = None): - return management_helper.set_backup_config(server_id, backup_path, max_backups) + def set_backup_config(server_id: int, backup_path: str = None, max_backups: int = None, excluded_dirs: list = None): + return management_helper.set_backup_config(server_id, backup_path, max_backups, excluded_dirs) @staticmethod def get_excluded_backup_dirs(server_id: int): diff --git a/app/classes/models/management.py b/app/classes/models/management.py index f57abe11..e197add6 100644 --- a/app/classes/models/management.py +++ b/app/classes/models/management.py @@ -339,6 +339,9 @@ class helpers_management: new_row = True if max_backups is not None: conf['max_backups'] = max_backups + if excluded_dirs is not None: + dirs_to_exclude = ",".join(excluded_dirs) + conf['excluded_dirs'] = dirs_to_exclude if not new_row: with database.atomic(): if backup_path is not None: diff --git a/app/classes/web/ajax_handler.py b/app/classes/web/ajax_handler.py index b5be9826..46ff3372 100644 --- a/app/classes/web/ajax_handler.py +++ b/app/classes/web/ajax_handler.py @@ -166,7 +166,7 @@ class AjaxHandler(BaseHandler): output += \ f"""
  • \n
    - + @@ -180,7 +180,7 @@ class AjaxHandler(BaseHandler): class="tree-item tree-ctx-item tree-file" data-path="{dpath}" data-name="{filename}" - onclick=""> + onclick=""> {filename}
  • """ else: @@ -188,7 +188,7 @@ class AjaxHandler(BaseHandler): output += \ f"""
  • \n
    - + @@ -202,7 +202,7 @@ class AjaxHandler(BaseHandler): class="tree-item tree-ctx-item tree-file" data-path="{dpath}" data-name="{filename}" - onclick=""> + onclick=""> {filename}
  • """ self.write(helper.get_os_understandable_path(folder) + '\n' + output) @@ -261,7 +261,8 @@ class AjaxHandler(BaseHandler): class="tree-item tree-ctx-item tree-file" data-path="{dpath}" data-name="{filename}" - onclick="">{filename}""" + onclick=""> + {filename}""" self.write(helper.get_os_understandable_path(folder) + '\n' + output) diff --git a/app/classes/web/panel_handler.py b/app/classes/web/panel_handler.py index 5430e7ab..814379d9 100644 --- a/app/classes/web/panel_handler.py +++ b/app/classes/web/panel_handler.py @@ -17,6 +17,7 @@ from tornado.ioloop import IOLoop #TZLocal is set as a hidden import on win pipeline from tzlocal import get_localzone from cron_validator import CronValidator +from app.classes.controllers.management_controller import Management_Controller from app.classes.models.server_permissions import Enum_Permissions_Server from app.classes.models.crafty_permissions import Enum_Permissions_Crafty @@ -1027,6 +1028,7 @@ class PanelHandler(BaseHandler): logger.debug(self.request.arguments) server_id = self.get_argument('id', None) server_obj = self.controller.servers.get_server_obj(server_id) + checked = self.get_body_arguments('root_path') if superuser: backup_path = bleach.clean(self.get_argument('backup_path', None)) if helper.is_os_windows(): @@ -1052,7 +1054,7 @@ class PanelHandler(BaseHandler): server_obj = self.controller.servers.get_server_obj(server_id) server_obj.backup_path = backup_path self.controller.servers.update_server(server_obj) - self.controller.management.set_backup_config(server_id, max_backups=max_backups) + self.controller.management.set_backup_config(server_id, max_backups=max_backups, excluded_dirs=checked) self.controller.management.add_to_audit_log(exec_user['user_id'], f"Edited server {server_id}: updated backups", diff --git a/app/frontend/templates/panel/server_backup.html b/app/frontend/templates/panel/server_backup.html index a7d64f81..89a2c198 100644 --- a/app/frontend/templates/panel/server_backup.html +++ b/app/frontend/templates/panel/server_backup.html @@ -54,24 +54,16 @@ - -
    - +
    - +
    -
    -