From 8fffb6ea04c2a6b94009d8a62ba4423866e37109 Mon Sep 17 00:00:00 2001 From: strawberry Date: Sat, 25 Nov 2023 15:46:03 -0500 Subject: [PATCH] fix compilation with no zstd, use correct key, bump 2 deps Signed-off-by: strawberry --- Cargo.lock | 13 ++++++------- Cargo.toml | 8 ++++---- src/config/mod.rs | 1 - src/service/media/mod.rs | 4 ++-- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3be12933..c5ffd744 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -81,9 +81,9 @@ checksum = "5f093eed78becd229346bf859eec0aa4dd7ddde0757287b2b4107a1f09c80002" [[package]] name = "async-compression" -version = "0.4.3" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb42b2197bf15ccb092b62c74515dbd8b86d0effd934795f6687c93b6e679a2c" +checksum = "bc2d0cfb2a7388d34f590e76686704c494ed7aaceed62ee1ba35cbf363abc2a5" dependencies = [ "futures-core", "memchr", @@ -3555,20 +3555,19 @@ dependencies = [ [[package]] name = "zstd" -version = "0.12.4" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a27595e173641171fc74a1232b7b1c7a7cb6e18222c11e9dfb9888fa424c53c" +checksum = "bffb3309596d527cfcba7dfc6ed6052f1d39dfbd7c867aa2e865e4a449c10110" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "6.0.6" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee98ffd0b48ee95e6c5168188e44a54550b1564d9d530ee21d5f0eaed1069581" +checksum = "43747c7422e2924c11144d5229878b98180ef8b06cca4ab5af37afc8a8d8ea3e" dependencies = [ - "libc", "zstd-sys", ] diff --git a/Cargo.toml b/Cargo.toml index b4d9a9a1..4a2393b6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ rust-version = "1.70.0" axum = { version = "0.6.20", default-features = false, features = ["form", "headers", "http1", "http2", "json", "matched-path"], optional = true } axum-server = { version = "0.5.1", features = ["tls-rustls"] } tower = { version = "0.4.13", features = ["util"] } -tower-http = { version = "0.4.4", features = ["add-extension", "cors", "sensitive-headers", "trace", "util"] } +tower-http = { version = "0.4.4", features = ["add-extension", "cors", "sensitive-headers", "trace", "util", "compression-zstd"] } # Used for matrix spec type definitions and helpers #ruma = { version = "0.4.0", features = ["compat", "rand", "appservice-api-c", "client-api", "federation-api", "push-gateway-api-c", "state-res", "unstable-pre-spec", "unstable-exhaustive-types"] } @@ -84,11 +84,11 @@ lru-cache = "0.1.2" rusqlite = { version = "0.30.0", optional = true, features = ["bundled"] } parking_lot = { version = "0.12.1", optional = true } crossbeam = { version = "0.8.2", optional = true } -num_cpus = "1.15.0" +num_cpus = "1.16.0" threadpool = "1.8.1" heed = { git = "https://github.com/timokoesters/heed.git", rev = "f6f825da7fb2c758867e05ad973ef800a6fe1d5d", optional = true } # Used for ruma wrapper -serde_html_form = "0.2.0" +serde_html_form = "0.2.2" rocksdb = { git = "https://github.com/girlbossceo/rust-rocksdb", rev = "eaa2beedb1f36466a52ca01ffbf3a2118b2cb41b", default-features = false, features = ["multi-threaded-cf", "snappy", "lz4", "zstd", "io-uring"], optional = true } @@ -128,7 +128,7 @@ sqlite = ["rusqlite", "parking_lot", "tokio/signal"] conduit_bin = ["axum"] systemd = ["sd-notify"] #gzip_compression = ["tower-http/compression-gzip"] -zstd_compression = ["tower-http/compression-zstd"] +zstd_compression = [] #brotli_compression = ["tower-http/compression-br"] #compression = ["tower-http/compression-full"] sha256_media = [] diff --git a/src/config/mod.rs b/src/config/mod.rs index 9ba25632..a26b4714 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -106,7 +106,6 @@ pub struct Config { #[serde(default = "default_presence_offline_timeout_s")] pub presence_offline_timeout_s: u64, - #[cfg(feature = "zstd_compression")] #[serde(default = "false_fn")] pub zstd_compression: bool, diff --git a/src/service/media/mod.rs b/src/service/media/mod.rs index 179182cb..6007f10d 100644 --- a/src/service/media/mod.rs +++ b/src/service/media/mod.rs @@ -233,9 +233,9 @@ impl Service { let path: std::path::PathBuf; if cfg!(feature = "sha256_media") { - path = services().globals.get_media_file_new(&key); + path = services().globals.get_media_file_new(&thumbnail_key); } else { - path = services().globals.get_media_file(&key); + path = services().globals.get_media_file(&thumbnail_key); } let mut f = File::create(path).await?; f.write_all(&thumbnail_bytes).await?;