From 04dd8e58ba723e28f56cb5e480c594c8b8ccabdd Mon Sep 17 00:00:00 2001 From: ari melody Date: Mon, 14 Apr 2025 18:49:04 +0100 Subject: [PATCH] a little last-minute polish --- Cargo.lock | 2 +- Cargo.toml | 6 +++++- LICENSE | 22 ++++++++++++++++++++++ README.md | 13 +++++++++++++ src/main.rs | 8 +++----- 5 files changed, 44 insertions(+), 7 deletions(-) create mode 100644 LICENSE create mode 100644 README.md diff --git a/Cargo.lock b/Cargo.lock index d914905..7a04376 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -118,7 +118,7 @@ checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] name = "mcstatusface" -version = "0.1.0" +version = "1.0.0" dependencies = [ "chrono", "serde", diff --git a/Cargo.toml b/Cargo.toml index 52324b2..70db94f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,10 @@ [package] name = "mcstatusface" -version = "0.1.0" +authors = ["ari melody "] +repository = "https://git.arimelody.me/ari/mcstatusface" +license = "MIT" +keywords = ["minecraft", "server", "query", "web"] +version = "1.0.0" edition = "2024" [dependencies] diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..a168317 --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2025 ari melody + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/README.md b/README.md new file mode 100644 index 0000000..6ab3e2f --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +# Crafty McStatusFace + +A light application that serves Minecraft server query information in a +convenient format! + +## Usage + +McStatusFace can be run as a web server with `./mcstatusface serve`. This will +provide server information in JSON format to requests on `GET /?s=`. +(e.g. `curl -sS "127.0.0.1:8080?s=127.0.0.1:25565" | jq .`) + +Alternatively, you can simply run `./mcstatusface `, and the +tool will provide server details in plain-text format. diff --git a/src/main.rs b/src/main.rs index 91872d3..645fec8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,15 +14,13 @@ fn main() -> Result<()> { if args[1] != "serve" { let mut address = String::from(args[1].as_str()); - if !address.contains(":") { - address += ":25565"; - } - let mut addrs_iter = args[1].to_socket_addrs().unwrap(); + if !address.contains(":") { address.push_str(":25565"); } + let mut addrs_iter = address.to_socket_addrs().unwrap(); let address = addrs_iter.next().unwrap(); let status = MinecraftStatus::fetch(address).unwrap(); - println!("\nVersion: {} ({})", status.version.name, status.version.protocol); + println!("Version: {} ({})", status.version.name, status.version.protocol); println!("Players: {}/{}", status.players.online, status.players.max); println!("MOTD:"); println!("{}", status.parse_description());