From c752a1f6b30f2e1e02086b4a275f7a05ae18f65a Mon Sep 17 00:00:00 2001 From: Xenorki Date: Thu, 5 Feb 2026 14:30:56 +0100 Subject: [PATCH 1/2] Dockerising tool --- .env | 3 ++ Dockerfile | 5 ++ LICENSE | 0 README.md | 44 +++++++++++++++++- config.php | 5 -- www/config.php | 6 +++ index.php => www/index.php | 0 {rcon => www/rcon}/index.php | 8 +--- {rcon => www/rcon}/rcon.php | 0 {samples => www/samples}/sample-mobile.png | Bin {samples => www/samples}/sample.png | Bin {static => www/static}/css/bootstrap.min.css | 0 {static => www/static}/css/style.css | 0 .../fonts/glyphicons-halflings-regular.eot | Bin .../fonts/glyphicons-halflings-regular.svg | 0 .../fonts/glyphicons-halflings-regular.ttf | Bin .../fonts/glyphicons-halflings-regular.woff | Bin .../fonts/glyphicons-halflings-regular.woff2 | Bin {static => www/static}/js/bootstrap.min.js | 0 .../static}/js/jquery-1.12.0.min.js | 0 .../static}/js/jquery-migrate-1.2.1.min.js | 0 .../static}/js/jquery-ui-1.12.0.min.js | 0 {static => www/static}/js/script.js | 0 23 files changed, 57 insertions(+), 14 deletions(-) create mode 100755 .env create mode 100755 Dockerfile mode change 100644 => 100755 LICENSE mode change 100644 => 100755 README.md delete mode 100644 config.php create mode 100755 www/config.php rename index.php => www/index.php (100%) mode change 100644 => 100755 rename {rcon => www/rcon}/index.php (58%) mode change 100644 => 100755 rename {rcon => www/rcon}/rcon.php (100%) mode change 100644 => 100755 rename {samples => www/samples}/sample-mobile.png (100%) mode change 100644 => 100755 rename {samples => www/samples}/sample.png (100%) mode change 100644 => 100755 rename {static => www/static}/css/bootstrap.min.css (100%) mode change 100644 => 100755 rename {static => www/static}/css/style.css (100%) mode change 100644 => 100755 rename {static => www/static}/fonts/glyphicons-halflings-regular.eot (100%) mode change 100644 => 100755 rename {static => www/static}/fonts/glyphicons-halflings-regular.svg (100%) mode change 100644 => 100755 rename {static => www/static}/fonts/glyphicons-halflings-regular.ttf (100%) mode change 100644 => 100755 rename {static => www/static}/fonts/glyphicons-halflings-regular.woff (100%) mode change 100644 => 100755 rename {static => www/static}/fonts/glyphicons-halflings-regular.woff2 (100%) mode change 100644 => 100755 rename {static => www/static}/js/bootstrap.min.js (100%) mode change 100644 => 100755 rename {static => www/static}/js/jquery-1.12.0.min.js (100%) mode change 100644 => 100755 rename {static => www/static}/js/jquery-migrate-1.2.1.min.js (100%) mode change 100644 => 100755 rename {static => www/static}/js/jquery-ui-1.12.0.min.js (100%) mode change 100644 => 100755 rename {static => www/static}/js/script.js (100%) mode change 100644 => 100755 diff --git a/.env b/.env new file mode 100755 index 0000000..0fe86e3 --- /dev/null +++ b/.env @@ -0,0 +1,3 @@ +RCON_HOST= +RCON_PASSWORD= +RCON_PORT=25575 diff --git a/Dockerfile b/Dockerfile new file mode 100755 index 0000000..6e99c49 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM php:8.2-apache +ENV APACHE_DOCUMENT_ROOT=/var/www/html +COPY www/ /var/www/html/ +RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" +EXPOSE 80 \ No newline at end of file diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 index 1979398..d5f545f --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Inspired by [Minecraft-RCON-Console](https://github.com/ekaomk/Minecraft-RCON-Co ![Sample Mobile](samples/sample-mobile.png) -## Configuration +## Configuration (Manual installation) 1. Edit your Minecraft server `server.properties` configuration file in order to enable RCON: ``` @@ -16,13 +16,53 @@ rcon.port=25575 rcon.password=xtMJsVtmx0XypuId7jIb ``` 2. Restart your Minecraft server. -3. Download/Clone the Minecraft RCON Web Console files and edit the `config.php` file. Use the same rcon password and port than the one set in `server.properties`: +3. Download/Clone the Minecraft RCON Web Console files and edit the `config.php` file in `www` folder. Use the same rcon password and port than the one set in `server.properties`: ``` $rconHost = "localhost"; $rconPort = 25575; $rconPassword = "xtMJsVtmx0XypuId7jIb"; ``` +## Configuration (Docker) + +1. Edit your Minecraft server `server.properties` configuration file in order to enable RCON: +``` +enable-rcon=true +rcon.port=25575 +rcon.password=xtMJsVtmx0XypuId7jIb +``` +2. Restart your Minecraft server. + +3. Run the docker image and fill the correct informations either with `docker run` or `docker compose` + +### Docker run: + +``` +docker run -d \ + --restart unless-stopped \ + -e RCON_HOST="" \ + -e RCON_PASSWORD="" \ + -e RCON_PORT="25575" \ + -p :80 \ + ghcr.io/xenorki/minecraft-web-rcon:1.1 +``` + + +### Docker compose: + +``` + rcon-web: + image:ghcr.io/xenorki/minecraft-web-rcon:1.1 + restart: unless-stopped + environment: + RCON_HOST: "" + RCON_PASSWORD: "" + RCON_PORT: "25575" + ports: + - ":80" +``` + + ## Warnings * Provided as it is, **this console has no authentication check**, so anybody with access to this console can run any commands on the Minecraft server. Please check at least the documentations below, about how to setup some basic http authentification on your web server, in order to restrict the access to the console: diff --git a/config.php b/config.php deleted file mode 100644 index 1bc9e5e..0000000 --- a/config.php +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/www/config.php b/www/config.php new file mode 100755 index 0000000..857b4c3 --- /dev/null +++ b/www/config.php @@ -0,0 +1,6 @@ + diff --git a/index.php b/www/index.php old mode 100644 new mode 100755 similarity index 100% rename from index.php rename to www/index.php diff --git a/rcon/index.php b/www/rcon/index.php old mode 100644 new mode 100755 similarity index 58% rename from rcon/index.php rename to www/rcon/index.php index 27fd8d4..1170477 --- a/rcon/index.php +++ b/www/rcon/index.php @@ -21,7 +21,7 @@ $rcon->send_command($_POST['cmd']); $response['status'] = 'success'; $response['command'] = $_POST['cmd']; - $response['response'] = parseMinecraftColors($rcon->get_response()); + $response['response'] = $rcon->get_response(); } else{ $response['status'] = 'error'; @@ -29,11 +29,5 @@ } } -function parseMinecraftColors($string) { - $string = utf8_decode(htmlspecialchars($string, ENT_QUOTES, "UTF-8")); - $string = preg_replace('/\xA7([0-9a-f])/i', '', $string, -1, $count) . str_repeat("", $count); - return utf8_encode(preg_replace('/\xA7([k-or])/i', '', $string, -1, $count) . str_repeat("", $count)); -} - echo json_encode($response); ?> diff --git a/rcon/rcon.php b/www/rcon/rcon.php old mode 100644 new mode 100755 similarity index 100% rename from rcon/rcon.php rename to www/rcon/rcon.php diff --git a/samples/sample-mobile.png b/www/samples/sample-mobile.png old mode 100644 new mode 100755 similarity index 100% rename from samples/sample-mobile.png rename to www/samples/sample-mobile.png diff --git a/samples/sample.png b/www/samples/sample.png old mode 100644 new mode 100755 similarity index 100% rename from samples/sample.png rename to www/samples/sample.png diff --git a/static/css/bootstrap.min.css b/www/static/css/bootstrap.min.css old mode 100644 new mode 100755 similarity index 100% rename from static/css/bootstrap.min.css rename to www/static/css/bootstrap.min.css diff --git a/static/css/style.css b/www/static/css/style.css old mode 100644 new mode 100755 similarity index 100% rename from static/css/style.css rename to www/static/css/style.css diff --git a/static/fonts/glyphicons-halflings-regular.eot b/www/static/fonts/glyphicons-halflings-regular.eot old mode 100644 new mode 100755 similarity index 100% rename from static/fonts/glyphicons-halflings-regular.eot rename to www/static/fonts/glyphicons-halflings-regular.eot diff --git a/static/fonts/glyphicons-halflings-regular.svg b/www/static/fonts/glyphicons-halflings-regular.svg old mode 100644 new mode 100755 similarity index 100% rename from static/fonts/glyphicons-halflings-regular.svg rename to www/static/fonts/glyphicons-halflings-regular.svg diff --git a/static/fonts/glyphicons-halflings-regular.ttf b/www/static/fonts/glyphicons-halflings-regular.ttf old mode 100644 new mode 100755 similarity index 100% rename from static/fonts/glyphicons-halflings-regular.ttf rename to www/static/fonts/glyphicons-halflings-regular.ttf diff --git a/static/fonts/glyphicons-halflings-regular.woff b/www/static/fonts/glyphicons-halflings-regular.woff old mode 100644 new mode 100755 similarity index 100% rename from static/fonts/glyphicons-halflings-regular.woff rename to www/static/fonts/glyphicons-halflings-regular.woff diff --git a/static/fonts/glyphicons-halflings-regular.woff2 b/www/static/fonts/glyphicons-halflings-regular.woff2 old mode 100644 new mode 100755 similarity index 100% rename from static/fonts/glyphicons-halflings-regular.woff2 rename to www/static/fonts/glyphicons-halflings-regular.woff2 diff --git a/static/js/bootstrap.min.js b/www/static/js/bootstrap.min.js old mode 100644 new mode 100755 similarity index 100% rename from static/js/bootstrap.min.js rename to www/static/js/bootstrap.min.js diff --git a/static/js/jquery-1.12.0.min.js b/www/static/js/jquery-1.12.0.min.js old mode 100644 new mode 100755 similarity index 100% rename from static/js/jquery-1.12.0.min.js rename to www/static/js/jquery-1.12.0.min.js diff --git a/static/js/jquery-migrate-1.2.1.min.js b/www/static/js/jquery-migrate-1.2.1.min.js old mode 100644 new mode 100755 similarity index 100% rename from static/js/jquery-migrate-1.2.1.min.js rename to www/static/js/jquery-migrate-1.2.1.min.js diff --git a/static/js/jquery-ui-1.12.0.min.js b/www/static/js/jquery-ui-1.12.0.min.js old mode 100644 new mode 100755 similarity index 100% rename from static/js/jquery-ui-1.12.0.min.js rename to www/static/js/jquery-ui-1.12.0.min.js diff --git a/static/js/script.js b/www/static/js/script.js old mode 100644 new mode 100755 similarity index 100% rename from static/js/script.js rename to www/static/js/script.js From ac4b5b9ac2330b158d8fd9764034f1ea8c1d185a Mon Sep 17 00:00:00 2001 From: Xenorki Date: Thu, 5 Feb 2026 14:57:41 +0100 Subject: [PATCH 2/2] Readded color parsing --- www/rcon/index.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/www/rcon/index.php b/www/rcon/index.php index 1170477..27fd8d4 100755 --- a/www/rcon/index.php +++ b/www/rcon/index.php @@ -21,7 +21,7 @@ $rcon->send_command($_POST['cmd']); $response['status'] = 'success'; $response['command'] = $_POST['cmd']; - $response['response'] = $rcon->get_response(); + $response['response'] = parseMinecraftColors($rcon->get_response()); } else{ $response['status'] = 'error'; @@ -29,5 +29,11 @@ } } +function parseMinecraftColors($string) { + $string = utf8_decode(htmlspecialchars($string, ENT_QUOTES, "UTF-8")); + $string = preg_replace('/\xA7([0-9a-f])/i', '', $string, -1, $count) . str_repeat("", $count); + return utf8_encode(preg_replace('/\xA7([k-or])/i', '', $string, -1, $count) . str_repeat("", $count)); +} + echo json_encode($response); ?>