From 953877b0c23969c3334cbcdba79cecb9dc9ec42c Mon Sep 17 00:00:00 2001 From: Carlos <28845529+mesacarlos@users.noreply.github.com> Date: Thu, 15 Aug 2019 16:10:20 +0200 Subject: [PATCH] Now it is easier to add new servers to Web Interface. Updated README. --- README.md | 10 ++++--- client/index.html | 14 ++++++++-- client/scripts/WebConsoleJqueryHandler.js | 34 +++++++++++++++++++---- 3 files changed, 46 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 1b90c0d..d2343de 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,9 @@ WebConsole is a Spigot plugin for Minecraft 1.8-1.14 that enables you to view your server console and manage your server from anywhere. It creates a WebSocket server in the background used by the web interface to send commands, receive your console log and manage your server. -Dont worry about privacy or security: all data is stored in your browser offline and your PC will connect directly to your minecraft server. No intermediary web servers, just you and your server. +Dont worry about privacy or security: all data is stored in your browser offline and your PC will connect directly to your minecraft server. No intermediary web servers, just you and your MC server. + +![Screenshot](https://i.imgur.com/Zx1a8HG.png) ## Plugin installation @@ -19,7 +21,7 @@ Dont worry about privacy or security: all data is stored in your browser offline > port: 8080 > password: yourPasswordGoesHere -Fill `host`, `port` and `password` values. They are, respectively, the IP and port your server is listening at and the login password. Password will be asked every time you connect to your server. +Fill `host`, `port` and `password` values. They are, respectively, your server IP, a port where to run this plugin (cannot be the port you are using for Minecraft) and the login password. Password will be asked every time you connect to WebConsole. #### SSL Configuration @@ -58,9 +60,9 @@ WebConsole does not support PEM certificates, so you will need to convert it to ## Using web interface -1. Download web interface from [Releases](https://github.com/mesacarlos/WebConsole/releases) +1. Download web interface (client.zip) from [Releases](https://github.com/mesacarlos/WebConsole/releases) 2. If you want, you can host it in a web server, or use it offline. That's up to you. -3. To start adding servers, click on `Your servers`, and then `Add server`. Fill Server name and URI and you are ready to go. You will be prompted for password when connecting. +3. To start adding servers, click on `Your servers`, and then `Add server`. Fill Server name, IP and port, and you are ready to go. You will be prompted for password when connecting. ## Technical information diff --git a/client/index.html b/client/index.html index a4f4772..41589b7 100644 --- a/client/index.html +++ b/client/index.html @@ -119,8 +119,16 @@
- - + + +
+
+ + +
+
+ +
@@ -187,7 +195,7 @@ diff --git a/client/scripts/WebConsoleJqueryHandler.js b/client/scripts/WebConsoleJqueryHandler.js index 0444e6e..9879ed6 100644 --- a/client/scripts/WebConsoleJqueryHandler.js +++ b/client/scripts/WebConsoleJqueryHandler.js @@ -18,12 +18,21 @@ $(document).ready(function() { $("#saveAndConnectServerButton").click(function() { //Save server var name = $("#server-name").val(); - var uri = $("#server-uri").val(); + var wcIp = $("#server-ip").val(); + var wcPort = $("#server-port").val(); + var wcSsl = $("#server-ssl").prop('checked'); + var uri; + if(wcSsl){ + uri = "wss://" + wcIp + ":" + wcPort; + }else{ + uri = "ws://" + wcIp + ":" + wcPort; + } persistenceManager.saveServer(new WSServer(name, uri)); //Empty all modal values $("#server-name").val(""); - $("#server-uri").val(""); + $("#server-ip").val(""); + $("#server-port").val(""); //Update GUI serverlist updateServerList(); @@ -77,8 +86,24 @@ $('#passwordModal').on('hidden.bs.modal', function (e) { * On send command button click */ $("#sendCommandButton").click(function() { - connectionManager.sendConsoleCmd($('#commandInput').val()); - $('#commandInput').val(''); + connectionManager.sendConsoleCmd($("#commandInput").val()); + $("#commandInput").val(''); +}); + +/** +* Enter key on command input +*/ +$("#commandInput").on('keypress', function (e) { + if(e.which === 13){ + //Disable textbox to prevent multiple submit + $(this).attr("disabled", "disabled"); + + //Send command + sendCommandButton.click(); + + //Enable the textbox again. + $(this).removeAttr("disabled"); + } }); /** @@ -95,4 +120,3 @@ $("#navbarHomeLink").click(function() { backToHomepage(); }); -