mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
adding virtual console ajax to actually send the command
This commit is contained in:
parent
e4cc400d20
commit
7657b77785
@ -74,4 +74,25 @@ class AjaxHandler(BaseHandler):
|
|||||||
logger.warning("Skipping Log Line due to error: {}".format(e))
|
logger.warning("Skipping Log Line due to error: {}".format(e))
|
||||||
pass
|
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)
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"last_refreshed": "09/17/2020, 18:43:17",
|
"last_refreshed": "09/21/2020, 21:59:31",
|
||||||
"servers": {
|
"servers": {
|
||||||
"nukkitx": [
|
"nukkitx": [
|
||||||
"1.14"
|
"1.14"
|
||||||
|
@ -75,6 +75,7 @@
|
|||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" class="form-control" id="server_command" name="server_command" placeholder="Enter your server command" autofocus="">
|
<input type="text" class="form-control" id="server_command" name="server_command" placeholder="Enter your server command" autofocus="">
|
||||||
<span class="input-group-btn ml-5">
|
<span class="input-group-btn ml-5">
|
||||||
|
<input type="hidden" value="" id="last_command"/>
|
||||||
<button id="submit" class="btn btn-sm btn-info" type="button">Send Command</button>
|
<button id="submit" class="btn btn-sm btn-info" type="button">Send Command</button>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user