diff --git a/app/classes/web/panel_handler.py b/app/classes/web/panel_handler.py index dbb739ba..9ef79984 100644 --- a/app/classes/web/panel_handler.py +++ b/app/classes/web/panel_handler.py @@ -12,7 +12,7 @@ from tornado import iostream from app.classes.shared.console import console from app.classes.shared.models import Users, installer from app.classes.web.base_handler import BaseHandler -from app.classes.shared.models import db_helper, server_permissions, Servers, Enum_Permissions_Server, crafty_permissions, Enum_Permissions_Crafty +from app.classes.shared.models import db_helper, server_permissions, Servers, Enum_Permissions_Server, crafty_permissions, Enum_Permissions_Crafty, Server_Stats from app.classes.shared.helpers import helper logger = logging.getLogger(__name__) @@ -122,6 +122,10 @@ class PanelHandler(BaseHandler): elif page == 'dashboard': if exec_user['superuser'] == 1: page_data['servers'] = db_helper.get_all_servers_stats() + total_players = 0 + for server in db_helper.get_all_defined_servers(): + total_players += len(self.controller.stats.get_server_players(server['server_id'])) + page_data['num_players'] = total_players else: user_auth = db_helper.get_authorized_servers_stats(exec_user_id) logger.debug("ASFR: {}".format(user_auth)) @@ -618,12 +622,19 @@ class PanelHandler(BaseHandler): Servers.logs_delete_after: logs_delete_after, }).where(Servers.server_id == server_id).execute() + Server_Stats.update({ + Server_Stats.server_port: server_port, + }).where(Server_Stats.server_id == server_id).execute() + self.controller.refresh_server_settings(server_id) db_helper.add_to_audit_log(exec_user['user_id'], "Edited server {} named {}".format(server_id, server_name), server_id, self.get_remote_ip()) + + svr = self.controller.get_server_obj(server_id) + svr.reload_server_settings() self.redirect("/panel/server_detail?id={}&subpage=config".format(server_id)) diff --git a/app/frontend/templates/panel/dashboard.html b/app/frontend/templates/panel/dashboard.html index 51cbd64f..2621dc4e 100644 --- a/app/frontend/templates/panel/dashboard.html +++ b/app/frontend/templates/panel/dashboard.html @@ -60,7 +60,7 @@