a little last-minute polish
This commit is contained in:
parent
cf28e189cd
commit
04dd8e58ba
5 changed files with 44 additions and 7 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -118,7 +118,7 @@ checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
|
|||
|
||||
[[package]]
|
||||
name = "mcstatusface"
|
||||
version = "0.1.0"
|
||||
version = "1.0.0"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"serde",
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
[package]
|
||||
name = "mcstatusface"
|
||||
version = "0.1.0"
|
||||
authors = ["ari melody <ari@arimelody.me>"]
|
||||
repository = "https://git.arimelody.me/ari/mcstatusface"
|
||||
license = "MIT"
|
||||
keywords = ["minecraft", "server", "query", "web"]
|
||||
version = "1.0.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
|
|
22
LICENSE
Normal file
22
LICENSE
Normal file
|
@ -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.
|
||||
|
13
README.md
Normal file
13
README.md
Normal file
|
@ -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=<address[:port]>`.
|
||||
(e.g. `curl -sS "127.0.0.1:8080?s=127.0.0.1:25565" | jq .`)
|
||||
|
||||
Alternatively, you can simply run `./mcstatusface <address[:port]>`, and the
|
||||
tool will provide server details in plain-text format.
|
|
@ -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());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue