Remove useless if in backups.i

This commit is contained in:
Andrew 2021-11-27 19:28:53 -05:00
parent bfe6cabd9e
commit 4c6b459b43
3 changed files with 9 additions and 7 deletions

View File

@ -513,11 +513,14 @@ class Server:
def list_backups(self): def list_backups(self):
conf = management_helper.get_backup_config(self.server_id) conf = management_helper.get_backup_config(self.server_id)
if helper.check_path_exists(helper.get_os_understandable_path(self.settings['backup_path'])): if 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']))) if helper.check_path_exists(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] 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: else:
return [] return[]
def jar_update(self): def jar_update(self):
servers_helper.set_update(self.server_id, True) servers_helper.set_update(self.server_id, True)

View File

@ -649,7 +649,7 @@ class PanelHandler(BaseHandler):
server_obj = self.controller.servers.get_server_obj(server_id) server_obj = self.controller.servers.get_server_obj(server_id)
server_settings = self.controller.get_server_data(server_id) server_settings = self.controller.get_server_data(server_id)
stale_executable = server_obj.executable 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): if str(stale_executable) != str(executable):
execution_command = execution_command.replace(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") self.redirect("/panel/error?error=Invalid Server ID")
return return
if backup_path is not None:
if enabled == '0': if enabled == '0':
#TODO Use Controller method #TODO Use Controller method
server_obj = self.controller.servers.get_server_obj(server_id) server_obj = self.controller.servers.get_server_obj(server_id)

View File

@ -366,7 +366,7 @@ dialog.init(function(){
} }
if (webSocket) { if (webSocket) {
webSocket.on('send_start_reload', function (start_error) { webSocket.on('send_start_reload', function () {
location.reload() location.reload()
}); });
} }