From 4c6b459b43b3b6d5cdea4b9880195d35737ad35d Mon Sep 17 00:00:00 2001 From: Andrew Date: Sat, 27 Nov 2021 19:28:53 -0500 Subject: [PATCH] Remove useless if in backups.i --- app/classes/shared/server.py | 11 +++++++---- app/classes/web/panel_handler.py | 3 +-- app/frontend/templates/panel/dashboard.html | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/classes/shared/server.py b/app/classes/shared/server.py index 4dc710cc..5193dd59 100644 --- a/app/classes/shared/server.py +++ b/app/classes/shared/server.py @@ -513,11 +513,14 @@ class Server: def list_backups(self): conf = management_helper.get_backup_config(self.server_id) - if helper.check_path_exists(helper.get_os_understandable_path(self.settings['backup_path'])): - files = helper.get_human_readable_files_sizes(helper.list_dir_by_date(helper.get_os_understandable_path(self.settings['backup_path']))) - return [{"path": os.path.relpath(f['path'], start=helper.get_os_understandable_path(conf['backup_path'])), "size": f["size"]} for f in files] + if self.settings['backup_path']: + if helper.check_path_exists(helper.get_os_understandable_path(self.settings['backup_path'])): + files = helper.get_human_readable_files_sizes(helper.list_dir_by_date(helper.get_os_understandable_path(self.settings['backup_path']))) + return [{"path": os.path.relpath(f['path'], start=helper.get_os_understandable_path(conf['backup_path'])), "size": f["size"]} for f in files] + else: + return [] else: - return [] + return[] def jar_update(self): servers_helper.set_update(self.server_id, True) diff --git a/app/classes/web/panel_handler.py b/app/classes/web/panel_handler.py index 1f15f349..d5e8d499 100644 --- a/app/classes/web/panel_handler.py +++ b/app/classes/web/panel_handler.py @@ -649,7 +649,7 @@ class PanelHandler(BaseHandler): server_obj = self.controller.servers.get_server_obj(server_id) server_settings = self.controller.get_server_data(server_id) stale_executable = server_obj.executable - #Compares old jar name to page data being passed. If they are different we replace the executable name in the execution string. + #Compares old jar name to page data being passed. If they are different we replace the executable name in the if str(stale_executable) != str(executable): execution_command = execution_command.replace(str(stale_executable), str(executable)) @@ -699,7 +699,6 @@ class PanelHandler(BaseHandler): self.redirect("/panel/error?error=Invalid Server ID") return - if backup_path is not None: if enabled == '0': #TODO Use Controller method server_obj = self.controller.servers.get_server_obj(server_id) diff --git a/app/frontend/templates/panel/dashboard.html b/app/frontend/templates/panel/dashboard.html index 17b7bffb..0b584423 100644 --- a/app/frontend/templates/panel/dashboard.html +++ b/app/frontend/templates/panel/dashboard.html @@ -366,7 +366,7 @@ dialog.init(function(){ } if (webSocket) { - webSocket.on('send_start_reload', function (start_error) { + webSocket.on('send_start_reload', function () { location.reload() }); }