diff --git a/Cargo.lock b/Cargo.lock index a182bc8..e788f0a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -439,10 +439,11 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chase" version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "131975ff6fb4111a42e7a6a62fd649203ee8d0fb9b0fe49efd47a667c0474984" +source = "git+https://github.com/fenhl/chase-rs?branch=dev-fenhl#5f0811e9948c7f7e3feb50b853541beaf19c93e2" dependencies = [ "futures 0.1.31", + "thiserror", + "windows 0.52.0", ] [[package]] @@ -1110,7 +1111,7 @@ dependencies = [ "libc", "log", "rustversion", - "windows", + "windows 0.48.0", ] [[package]] @@ -2123,9 +2124,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.75" +version = "1.0.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "907a61bd0f64c2f29cd1cf1dc34d05176426a3f504a78010f08416ddb7b13708" +checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" dependencies = [ "unicode-ident", ] @@ -2679,18 +2680,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.194" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b114498256798c94a0689e1a15fec6005dee8ac1f41de56404b67afc2a4b773" +checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.194" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3385e45322e8f9931410f01b3031ec534c3947d0e94c18049af4d9f9907d4e0" +checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" dependencies = [ "proc-macro2", "quote", @@ -4109,6 +4110,16 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "windows" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" +dependencies = [ + "windows-core", + "windows-targets 0.52.0", +] + [[package]] name = "windows-core" version = "0.52.0" diff --git a/crate/wurstminebot-cli/src/main.rs b/crate/wurstminebot-cli/src/main.rs index 8c2063d..86d8cfe 100644 --- a/crate/wurstminebot-cli/src/main.rs +++ b/crate/wurstminebot-cli/src/main.rs @@ -58,11 +58,11 @@ use { cal, config::Config, http, + log, minecraft::tellraw, twitch, }, }; -#[cfg(unix)] use wurstminebot::log; enum UserListExporter {} @@ -464,16 +464,11 @@ async fn main() -> Result { notify_thread_crash(format!("HTTP server"), Box::new(e), None).await; } }) - .task(|#[cfg_attr(not(unix), allow(unused))] ctx_fut, #[cfg_attr(not(unix), allow(unused))] notify_thread_crash| async move { - #[cfg(unix)] { - // follow the Minecraft log - if let Err(e) = log::handle(ctx_fut).await { - eprintln!("{}", e); - notify_thread_crash(format!("log"), Box::new(e), None).await; - } - } - #[cfg(not(unix))] { - eprintln!("warning: Minecraft log analysis is only supported on cfg(unix) because of https://github.com/lloydmeta/chase-rs/issues/6"); + .task(|ctx_fut, notify_thread_crash| async move { + // follow the Minecraft log + if let Err(e) = log::handle(ctx_fut).await { + eprintln!("{}", e); + notify_thread_crash(format!("log"), Box::new(e), None).await; } }) .task(|ctx_fut, notify_thread_crash| async move { diff --git a/crate/wurstminebot/Cargo.toml b/crate/wurstminebot/Cargo.toml index 274593b..60de84e 100644 --- a/crate/wurstminebot/Cargo.toml +++ b/crate/wurstminebot/Cargo.toml @@ -16,25 +16,43 @@ warnings = "deny" [dependencies] chrono = "0.4" -futures = "0.3" ics = "0.5" itertools = "0.12" lazy-regex = "3" rcon = "0.6" +regex = "1" rocket = "0.5" serde_json = "1" #TODO make sure enabling the arbitrary_precision feature doesn't break anything serenity = "0.12" thiserror = "1" +[dependencies.async_zip] +version = "0.0.16" +features = ["full"] + +[dependencies.chase] +git = "https://github.com/fenhl/chase-rs" +branch = "dev-fenhl" +features = ["stream"] + [dependencies.derive_more] version = "0.99" default-features = false features = ["from"] +[dependencies.futures] +version = "0.3" +features = ["compat"] + [dependencies.minecraft] git = "https://github.com/wurstmineberg/rust-minecraft-types" branch = "main" +[dependencies.reqwest] +version = "0.11" +default-features = false +features = ["rustls-tls", "trust-dns"] + [dependencies.rocket-util] git = "https://github.com/fenhl/rocket-util" branch = "main" @@ -62,6 +80,14 @@ package = "minecraft" version = "1.3" features = ["fs", "macros", "parking_lot", "sync", "rt-multi-thread"] +[dependencies.tokio-stream] +version = "0.1" +features = ["io-util"] + +[dependencies.tokio-util] +version = "0.7" +features = ["io"] + [dependencies.twitch-irc] version = "5" default-features = false @@ -71,39 +97,11 @@ features = ["transport-tcp-rustls-webpki-roots"] git = "https://github.com/fenhl/rust-twitch-helix" #TODO publish to crates.io branch = "main" -[target.'cfg(unix)'.dependencies] -regex = "1" - -[target.'cfg(unix)'.dependencies.async_zip] -version = "0.0.16" -features = ["full"] - -[target.'cfg(unix)'.dependencies.chase] -version = "0.1" -features = ["stream"] - -[target.'cfg(unix)'.dependencies.futures] -version = "0.3" -features = ["compat"] - -[target.'cfg(unix)'.dependencies.reqwest] -version = "0.11" -default-features = false -features = ["rustls-tls", "trust-dns"] - -[target.'cfg(unix)'.dependencies.tokio-stream] -version = "0.1" -features = ["io-util"] - -[target.'cfg(unix)'.dependencies.tokio-util] -version = "0.7" -features = ["io"] - -[target.'cfg(unix)'.dependencies.url] +[dependencies.url] version = "2" features = ["serde"] -[target.'cfg(unix)'.dependencies.wheel] +[dependencies.wheel] git = "https://github.com/fenhl/wheel" branch = "main" features = ["reqwest", "serde", "serde_json"] diff --git a/crate/wurstminebot/src/lib.rs b/crate/wurstminebot/src/lib.rs index 8787c55..86cab8c 100644 --- a/crate/wurstminebot/src/lib.rs +++ b/crate/wurstminebot/src/lib.rs @@ -17,7 +17,7 @@ pub mod cal; pub mod config; pub mod http; pub mod ipc; -#[cfg(unix)] pub mod log; +pub mod log; pub mod minecraft; pub mod parse; pub mod people; @@ -47,7 +47,7 @@ pub enum Error { #[error(transparent)] Ipc(#[from] crate::ipc::Error), #[error(transparent)] Join(#[from] tokio::task::JoinError), #[error(transparent)] Json(#[from] serde_json::Error), - #[cfg(unix)] #[error(transparent)] Log(#[from] log::Error), + #[error(transparent)] Log(#[from] log::Error), #[error(transparent)] Minecraft(#[from] systemd_minecraft::Error), #[error(transparent)] Serenity(#[from] serenity::Error), #[error(transparent)] Sql(#[from] sqlx::Error), diff --git a/crate/wurstminebot/src/log.rs b/crate/wurstminebot/src/log.rs index ffb28ec..fe1f992 100644 --- a/crate/wurstminebot/src/log.rs +++ b/crate/wurstminebot/src/log.rs @@ -290,7 +290,7 @@ fn follow(http_client: reqwest::Client, world: &World) -> impl Stream