From 893c329b431da9d5926bdae74479d8359e1bb187 Mon Sep 17 00:00:00 2001 From: Juliette Cordor Date: Tue, 12 Nov 2024 10:55:46 +1100 Subject: [PATCH 1/3] bump lockfile --- Cargo.lock | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index af51415d..5e757a5b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3678,7 +3678,7 @@ dependencies = [ "sprinkles-rs", "tokio", "toml_edit", - "which 6.0.3", + "which", "windows", "windows-version", "winreg", @@ -3870,7 +3870,7 @@ dependencies = [ "tokio-util", "url", "urlencoding", - "which 7.0.0", + "which", "windows", "winreg", ] @@ -4546,18 +4546,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "which" -version = "6.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ee928febd44d98f2f459a4a79bd4d928591333a494a10a868418ac1b39cf1f" -dependencies = [ - "either", - "home", - "rustix", - "winsafe", -] - [[package]] name = "which" version = "7.0.0" From f6503eb4ef5021e29b89ce9280b290fca89f487a Mon Sep 17 00:00:00 2001 From: Juliette Cordor Date: Tue, 12 Nov 2024 10:56:45 +1100 Subject: [PATCH 2/3] remove async_vt3 dependency --- Cargo.lock | 53 ++++++++++++++--------------------------------------- Cargo.toml | 2 +- 2 files changed, 15 insertions(+), 40 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5e757a5b..2f688c21 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -170,7 +170,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0cb8f1d480b0ea3783ab015936d2a55c87e219676f0c0b7dec61494043f21857" dependencies = [ "brotli", - "bzip2", "flate2", "futures-core", "memchr", @@ -178,22 +177,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "async_vt3" -version = "0.8.0" -source = "git+https://github.com/winpax/vt3.git#4a46acb91d9baa9d2a98488874394cbc57c49704" -dependencies = [ - "async-compression", - "base64", - "futures", - "reqwest", - "serde", - "serde_json", - "thiserror", - "tokio", - "tokio-util", -] - [[package]] name = "atomic-waker" version = "1.1.2" @@ -355,27 +338,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e368af43e418a04d52505cf3dbc23dda4e3407ae2fa99fd0e4f308ce546acc" -[[package]] -name = "bzip2" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" -dependencies = [ - "bzip2-sys", - "libc", -] - -[[package]] -name = "bzip2-sys" -version = "0.1.11+1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" -dependencies = [ - "cc", - "libc", - "pkg-config", -] - [[package]] name = "cassowary" version = "0.3.0" @@ -3645,7 +3607,6 @@ name = "sfsu" version = "1.15.0" dependencies = [ "anyhow", - "async_vt3", "bat", "cfg-if", "chrono", @@ -3678,6 +3639,7 @@ dependencies = [ "sprinkles-rs", "tokio", "toml_edit", + "vt3", "which", "windows", "windows-version", @@ -4431,6 +4393,19 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +[[package]] +name = "vt3" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5798cdbd57cb56b40cf519b1ae197f5382263663c0d15798e9ef2e0bc8a6785" +dependencies = [ + "base64", + "reqwest", + "serde", + "serde_json", + "thiserror", +] + [[package]] name = "walkdir" version = "2.5.0" diff --git a/Cargo.toml b/Cargo.toml index 324e44a5..293bccb3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -100,7 +100,7 @@ sfsu-macros = { version = "0.1.0", path = "./macros" } shadow-rs = "0.35" sprinkles-rs.workspace = true tokio = { version = "1.37", features = ["full"] } -vt3 = { git = "https://github.com/winpax/vt3.git", version = "0.8", package = "async_vt3" } +vt3 = "0.7.3" which = "7.0" windows = { version = "0.58", features = ["Win32_Storage_FileSystem"] } windows-version = "0.1" From 6ff1d60808805e3372d3c6a3141a143cfdaaeaec Mon Sep 17 00:00:00 2001 From: Juliette Cordor Date: Tue, 12 Nov 2024 10:58:17 +1100 Subject: [PATCH 3/3] replace async_vt3 with spawn_blocking closures --- src/commands/virustotal.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/commands/virustotal.rs b/src/commands/virustotal.rs index 29d32324..bb0db0f1 100644 --- a/src/commands/virustotal.rs +++ b/src/commands/virustotal.rs @@ -197,7 +197,11 @@ impl super::Command for Args { let result = match search_type { SearchType::FileHash(hash) => { - let result = client.file_info(&hash.to_string()).await.recoverable(); + let result = tokio::task::spawn_blocking(move || { + client.file_info(&hash.to_string()) + }) + .await? + .recoverable(); if let Some(result) = result { serde_json::to_value(result?)? @@ -206,7 +210,9 @@ impl super::Command for Args { } } SearchType::Url(url) => { - let result = client.url_info(&url).await.recoverable(); + let result = tokio::task::spawn_blocking(move || client.url_info(&url)) + .await? + .recoverable(); if let Some(result) = result { serde_json::to_value(result?)?