mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2025-01-19 09:45:28 +01:00
Fix port reminder
Add Server time zone to details
This commit is contained in:
parent
39ccb83008
commit
73c6c1b871
@ -144,6 +144,10 @@ class Servers_Controller:
|
||||
def get_waiting_start(server_id):
|
||||
return servers_helper.get_waiting_start(server_id)
|
||||
|
||||
@staticmethod
|
||||
def get_update_status(server_id):
|
||||
return servers_helper.get_update_status(server_id)
|
||||
|
||||
#************************************************************************************************
|
||||
# Servers Helpers Methods
|
||||
#************************************************************************************************
|
||||
|
@ -183,6 +183,11 @@ class helper_servers:
|
||||
with database.atomic():
|
||||
Server_Stats.update(updating=value).where(Server_Stats.server_id == server_id).execute()
|
||||
|
||||
@staticmethod
|
||||
def get_update_status(server_id):
|
||||
waiting_start = Server_Stats.select().where(Server_Stats.server_id == server_id).get()
|
||||
return waiting_start.waiting_start
|
||||
|
||||
@staticmethod
|
||||
def set_first_run(server_id):
|
||||
#Sets first run to false
|
||||
@ -193,6 +198,11 @@ class helper_servers:
|
||||
with database.atomic():
|
||||
Server_Stats.update(first_run=False).where(Server_Stats.server_id == server_id).execute()
|
||||
|
||||
@staticmethod
|
||||
def get_first_run(server_id):
|
||||
first_run = Server_Stats.select().where(Server_Stats.server_id == server_id).get()
|
||||
return first_run.first_run
|
||||
|
||||
@staticmethod
|
||||
def get_TTL_without_player(server_id):
|
||||
last_stat = Server_Stats.select().where(Server_Stats.server_id == server_id).order_by(Server_Stats.created.desc()).first()
|
||||
|
@ -117,7 +117,7 @@ class Server:
|
||||
self.crash_watcher_schedule = None
|
||||
self.stats = stats
|
||||
self.backup_thread = threading.Thread(target=self.a_backup_server, daemon=True, name=f"backup_{self.name}")
|
||||
self.is_backingup = False
|
||||
self.is_backingup = False,
|
||||
|
||||
def reload_server_settings(self):
|
||||
server_data = servers_helper.get_server_data_by_id(self.server_id)
|
||||
@ -278,13 +278,13 @@ class Server:
|
||||
check_internet_thread = threading.Thread(target=self.check_internet_thread, daemon=True, args=(user_id, user_lang, ), name="{self.name}_Internet")
|
||||
check_internet_thread.start()
|
||||
#Checks if this is the servers first run.
|
||||
if servers_helper.get_server_stats_by_id(self.server_id)['first_run']:
|
||||
if servers_helper.get_first_run(self.server_id):
|
||||
servers_helper.set_first_run(self.server_id)
|
||||
loc_server_port = servers_helper.get_server_stats_by_id(self.server_id)['server_port']
|
||||
#Sends port reminder message.
|
||||
websocket_helper.broadcast_user(user_id, 'send_start_error', {
|
||||
'error': translation.translate('error', 'portReminder', user_lang).format(self.name, loc_server_port)
|
||||
})
|
||||
servers_helper.set_first_run(self.server_id)
|
||||
else:
|
||||
websocket_helper.broadcast_user(user_id, 'send_start_reload', {
|
||||
})
|
||||
@ -545,8 +545,7 @@ class Server:
|
||||
update_thread.start()
|
||||
|
||||
def check_update(self):
|
||||
server_stats = servers_helper.get_server_stats_by_id(self.server_id)
|
||||
if server_stats['updating']:
|
||||
if servers_helper.get_update_status(self.server_id):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
@ -74,6 +74,7 @@ class PanelHandler(BaseHandler):
|
||||
page_data = {
|
||||
# todo: make this actually pull and compare version data
|
||||
'update_available': False,
|
||||
'serverTZ': time.tzname,
|
||||
'version_data': helper.get_version_string(),
|
||||
'user_data': exec_user_data,
|
||||
'user_role' : exec_user_role,
|
||||
|
@ -3,7 +3,7 @@
|
||||
<div class="card">
|
||||
<div class="card-body pt-3 pb-3">
|
||||
<div class="row">
|
||||
<div class="col-sm-3 mr-2">
|
||||
<div class="col-sm-4 mr-2">
|
||||
{% if data['server_stats']['running'] %}
|
||||
<b>{{ translate('serverStats', 'serverStatus', data['lang']) }}:</b> <span class="text-success">{{ translate('serverStats', 'online', data['lang']) }}</span><br />
|
||||
<b>{{ translate('serverStats', 'serverStarted', data['lang']) }}:</b> <span id="started">{{ data['server_stats']['started'] }} ({{ translate('serverStats', 'serverTime', data['lang']) }})</span><br />
|
||||
@ -13,6 +13,8 @@
|
||||
<b>{{ translate('serverStats', 'serverStarted', data['lang']) }}:</b> <span class="text-danger">{{ translate('serverStats', 'offline', data['lang']) }}</span><br />
|
||||
<b>{{ translate('serverStats', 'serverUptime', data['lang']) }}:</b> <span class="text-danger">{{ translate('serverStats', 'offline', data['lang']) }}</span>
|
||||
{% end %}
|
||||
<br>
|
||||
<b>{{ translate('serverStats', 'serverTimeZone', data['lang']) }}:</b> <span class="text-info">{{ data['serverTZ'] }}</span>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3 mr-2">
|
||||
|
@ -143,7 +143,8 @@
|
||||
"description": "Description",
|
||||
"errorCalculatingUptime": "Error Calculating Uptime",
|
||||
"serverTime": "UTC Time",
|
||||
"unableToConnect": "Unable To Connect"
|
||||
"unableToConnect": "Unable To Connect",
|
||||
"serverTimeZone": "Server Time Zone"
|
||||
},
|
||||
"serverDetails": {
|
||||
"serverDetails": "Server Details",
|
||||
|
Loading…
x
Reference in New Issue
Block a user