Fixes server port writing issue.

This commit is contained in:
Andrew 2021-09-13 17:04:46 -04:00
parent c5bcf2f60d
commit 333cd33be3
2 changed files with 14 additions and 3 deletions

View File

@ -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))

View File

@ -60,7 +60,7 @@
<div class="d-flex">
<div class="wrapper">
<h5 class="mb-1 font-weight-medium text-primary">{{ translate('dashboard', 'players') }}</h5>
<h3 class="mb-0 font-weight-semibold">18</h3>
<h3 class="mb-0 font-weight-semibold">{{ data['num_players'] }}</h3>
</div>
<div class="wrapper my-auto ml-auto ml-lg-4">
@ -130,7 +130,7 @@
<a class="restart_button" data-id="{{server['server_data']['server_id']}}" data-toggle="tooltip" title={{ translate('dashboard', 'restart') }}> <i class="fas fa-sync"></i></a> &nbsp;
<a class="kill_button" data-id="{{server['server_data']['server_id']}}" class="kill_button" data-toggle="tooltip" title={{ translate('dashboard', 'kill') }}> <i class="fas fa-skull"></i></a> &nbsp;
{% elif server['stats']['updating']%}
<a data-id="{{server['server_data']['server_id']}}" class=""> UPDATING...</i></a>
<a data-id="{{server['server_data']['server_id']}}" class="">{{ translate('serverTerm', 'updating') }}</i></a>
{% else %}
<a data-id="{{server['server_data']['server_id']}}" class="play_button"><i class="fas fa-play" data-toggle="tooltip" title={{ translate('dashboard', 'start') }}></i></a> &nbsp;
<a data-id="{{server['server_data']['server_id']}}" class="clone_button"> <i class="fas fa-clone" data-toggle="tooltip" title={{ translate('dashboard', 'clone') }}></i></a>&nbsp;