fixed crash detection / auto start checkboxes - found huge issue with crash detection. putting on bug list for later

This commit is contained in:
Phillip Tarrant 2020-09-04 14:05:42 -04:00
parent 568e1e8f41
commit d7fabb3da8
4 changed files with 101 additions and 84 deletions

View File

@ -235,6 +235,7 @@ class Server:
try:
running = psutil.pid_exists(self.PID)
logger.info("Checking if PID: {} is running".format(self.PID))
except Exception as e:
logger.error("Unable to find if server PID exists: {}".format(self.PID))

View File

@ -113,10 +113,10 @@ class PanelHandler(BaseHandler):
executable = self.get_argument('executable', None)
execution_command = self.get_argument('execution_command', None)
stop_command = self.get_argument('stop_command', None)
auto_start_delay = self.get_argument('auto_start_delay', None)
auto_start_delay = self.get_argument('auto_start_delay', '10')
server_port = self.get_argument('server_port', None)
auto_start = self.get_argument('auto_start', '0')
crash_detection = self.get_argument('crash_detection', '0')
auto_start = int(float(self.get_argument('auto_start', '0')))
crash_detection = int(float(self.get_argument('crash_detection', '0')))
subpage = self.get_argument('subpage', None)
if server_id is None:
@ -143,4 +143,11 @@ class PanelHandler(BaseHandler):
Servers.crash_detection: crash_detection,
}).where(Servers.server_id == server_id).execute()
user_data = json.loads(self.get_secure_cookie("user_data"))
db_helper.add_to_audit_log(user_data['user_id'],
"Edited server {} named {}".format(server_id, server_name),
server_id,
self.get_remote_ip())
self.redirect("/panel/server_detail?id={}&subpage=config".format(server_id))

View File

@ -110,23 +110,23 @@
<div class="form-check-flat">
<label for="auto_start" class="form-check-label ml-4 mb-4">
{% if data['server_stats'][0]['server_id']['auto_start'] %}
<input type="checkbox" class="form-check-input" id="auto_start" name="auto_start" checked="" >Server Auto Start
<input type="checkbox" class="form-check-input" id="auto_start" name="auto_start" checked="" value="1">Server Auto Start
{% else %}
<input type="checkbox" class="form-check-input" id="auto_start" name="auto_start" >Server Auto Start
<input type="checkbox" class="form-check-input" id="auto_start" name="auto_start" value="1">Server Auto Start
{% end %}
</label>
<label for="crash_detection" class="form-check-label ml-4 mb-4">
{% if data['server_stats'][0]['server_id']['auto_start'] %}
<input type="checkbox" class="form-check-input" id="crash_detection" name="crash_detection" checked="" >Server Crash Detection
{% if data['server_stats'][0]['server_id']['crash_detection'] %}
<input type="checkbox" class="form-check-input" id="crash_detection" name="crash_detection" checked="" value="1">Server Crash Detection
{% else %}
<input type="checkbox" class="form-check-input" id="crash_detection" name="crash_detection" >Server Crash Detection
<input type="checkbox" class="form-check-input" id="crash_detection" name="crash_detection" value="1" >Server Crash Detection
{% end %}
</label>
</div>
<button type="submit" class="btn btn-success mr-2">Submit</button>
<button type="submit" class="btn btn-success mr-2">Save</button>
<button type="reset" class="btn btn-light">Cancel</button>
</form>
</div>
@ -151,10 +151,17 @@
sudo chown crafty:crafty /path/to/your/server -R<br />
sudo chmod 2775 /path/to/your/server -R<br />
</code>
</p>
</blockquote>
</div>
</div>
<div class="text-center">
{% if data['server_stats'][0]['running'] %}
<a href="/panel/command" class="btn btn-sm btn-danger disabled">Delete Server</a><br />
<small>Please stop the server before deleting it</small>
{% else %}
<a class="btn btn-sm btn-danger">Delete Server</a>
{% end %}
</div>
</div>
@ -165,6 +172,8 @@
</div>
</div>
</div>
<!-- content-wrapper ends -->

View File

@ -7,7 +7,7 @@
"cookie_secret": "random",
"show_errors": true,
"history_max_age": 7,
"stats_update_frequency": 60,
"stats_update_frequency": 30,
"max_stats_count": 1000,
"delete_default_json": false,
"show_contribute_link": true,