From d7fabb3da883fe4af4003672d71e66d646e9159e Mon Sep 17 00:00:00 2001 From: Phillip Tarrant Date: Fri, 4 Sep 2020 14:05:42 -0400 Subject: [PATCH] fixed crash detection / auto start checkboxes - found huge issue with crash detection. putting on bug list for later --- app/classes/shared/server.py | 1 + app/classes/web/panel_handler.py | 13 +- .../templates/panel/server_config.html | 169 +++++++++--------- config.json | 2 +- 4 files changed, 101 insertions(+), 84 deletions(-) diff --git a/app/classes/shared/server.py b/app/classes/shared/server.py index 8a90c460..58e5a041 100644 --- a/app/classes/shared/server.py +++ b/app/classes/shared/server.py @@ -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)) diff --git a/app/classes/web/panel_handler.py b/app/classes/web/panel_handler.py index b2e2fc49..3f8da2d2 100644 --- a/app/classes/web/panel_handler.py +++ b/app/classes/web/panel_handler.py @@ -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)) diff --git a/app/frontend/templates/panel/server_config.html b/app/frontend/templates/panel/server_config.html index 55443ec8..03cc44c2 100644 --- a/app/frontend/templates/panel/server_config.html +++ b/app/frontend/templates/panel/server_config.html @@ -62,109 +62,118 @@
-
- {% raw xsrf_form_html() %} - - + + {% raw xsrf_form_html() %} + + -
- - -
+
+ + +
-
- - -
+
+ + +
-
- - -
+
+ + +
-
- - -
+
+ + +
-
- - -
+
+ + +
-
- - -
+
+ + +
-
- - -
+
+ + +
-
- - -
+
+ + +
-
- +
+ - + -
+
- - -
-
+ + + +
-
-
-

Server Config Area

-

Here is where you can change the configuration of your server

-
-

- It is recommended to NOT change the paths of a server managed by Crafty. - Changing paths CAN break things, especially on Linux type operating systems where - file permissions are more locked down. -

- If you feel you have to change a where a server is located - you may do so as long as you give the "Crafty" user permission to read / write to the server path. -
-
- On Linux this is best done by executing the following:
- - sudo chown crafty:crafty /path/to/your/server -R
- sudo chmod 2775 /path/to/your/server -R
-
- -

-
-
+
+
+

Server Config Area

+

Here is where you can change the configuration of your server

+
+

+ It is recommended to NOT change the paths of a server managed by Crafty. + Changing paths CAN break things, especially on Linux type operating systems where + file permissions are more locked down. +

+ If you feel you have to change a where a server is located + you may do so as long as you give the "Crafty" user permission to read / write to the server path. +
+
+ On Linux this is best done by executing the following:
+ + sudo chown crafty:crafty /path/to/your/server -R
+ sudo chmod 2775 /path/to/your/server -R
+
+

+
+
+
+
+ {% if data['server_stats'][0]['running'] %} + Delete Server
+ Please stop the server before deleting it + {% else %} + Delete Server + {% end %} +
- + + diff --git a/config.json b/config.json index 805ec51e..a5f43e5e 100644 --- a/config.json +++ b/config.json @@ -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,