Make the server favicon load dynamically

This commit is contained in:
ElementG9 2020-07-09 09:56:40 -06:00
parent 8aa3a7d680
commit a979cc25c6
6 changed files with 39 additions and 48 deletions

7
Cargo.lock generated
View File

@ -4,6 +4,7 @@
name = "Composition"
version = "0.1.0"
dependencies = [
"base64",
"chrono",
"colorful",
"lazy_static",
@ -53,6 +54,12 @@ dependencies = [
"rustc-demangle",
]
[[package]]
name = "base64"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff"
[[package]]
name = "bitflags"
version = "1.2.1"

View File

@ -13,3 +13,4 @@ lazy_static = "1.4.0"
ozelot = "0.9.0" # Ozelot 0.9.0 supports protocol version 578 (1.15.2)
toml = "0.5.6"
serde = { version = "1.0.114", features = ["serde_derive"]}
base64 = "0.12.3"

View File

@ -1,4 +1,5 @@
port = 25565
protocol_version = 578
max_players = 420
motd = "ligma balls lol"
max_players = 20
motd = "Composition MOTD"
favicon = "composition_icon.png"

BIN
composition_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@ -37,6 +37,8 @@ pub struct Config {
pub port: u16,
pub protocol_version: u16,
pub max_players: u32,
pub motd: String,
pub favicon: Option<String>,
}
impl Config {
pub fn default() -> Config {
@ -44,6 +46,8 @@ impl Config {
port: 25565,
protocol_version: 578,
max_players: 250,
motd: "Hello world!".to_owned(),
favicon: None,
}
}
pub fn from_file(filename: &str) -> Config {

File diff suppressed because one or more lines are too long