diff --git a/app/classes/web/ajax_handler.py b/app/classes/web/ajax_handler.py index 0591ecf7..1b422848 100644 --- a/app/classes/web/ajax_handler.py +++ b/app/classes/web/ajax_handler.py @@ -74,4 +74,25 @@ class AjaxHandler(BaseHandler): logger.warning("Skipping Log Line due to error: {}".format(e)) pass + def post(self, page): + user_data = json.loads(self.get_secure_cookie("user_data")) + error = bleach.clean(self.get_argument('error', "WTF Error!")) + + page_data = { + 'user_data': user_data, + 'error': error + } + + if page == "send_command": + command = bleach.clean(self.get_body_argument('command', default=None, strip=True)) + server_id = bleach.clean(self.get_argument('id')) + + if server_id is None: + logger.warning("Server ID not found in send_command ajax call") + + srv_obj = controller.get_server_obj(server_id) + + if command: + if srv_obj.check_running(): + srv_obj.send_command(command) diff --git a/app/config/serverjars.json b/app/config/serverjars.json index 45343a2c..736bef8a 100644 --- a/app/config/serverjars.json +++ b/app/config/serverjars.json @@ -1,5 +1,5 @@ { - "last_refreshed": "09/17/2020, 18:43:17", + "last_refreshed": "09/21/2020, 21:59:31", "servers": { "nukkitx": [ "1.14" diff --git a/app/frontend/templates/panel/server_term.html b/app/frontend/templates/panel/server_term.html index 95283193..488e08bb 100644 --- a/app/frontend/templates/panel/server_term.html +++ b/app/frontend/templates/panel/server_term.html @@ -75,6 +75,7 @@
+