Update dependencies and refactor SHA256 hash encoding

- Updated `crossterm` from version 0.28 to 0.29.
- Upgraded `reqwest` from version 0.12 to 0.13 and added "form" feature.
- Bumped `serde_yaml_ng` from version 0.9 to 0.10.
- Increased `dirs` version from 5 to 6.
- Updated `rusqlite` from version 0.32 to 0.40.
- Upgraded `infer` from version 0.16 to 0.19.
- Bumped `sha2` from version 0.10 to 0.11.
- Updated `rmcp` from version 1.8 to 2.2.
- Refactored SHA256 hash encoding in `rewind.rs`, `mod.rs`, and `rest.rs` to use `hex::encode` instead of formatting with `{:x}` for better clarity and consistency.
This commit is contained in:
asepharyana
2026-07-13 08:39:14 +07:00
parent 152b245f5e
commit 65647ce517
5 changed files with 399 additions and 267 deletions
Generated
+386 -255
View File
File diff suppressed because it is too large Load Diff
+9 -8
View File
@@ -23,9 +23,9 @@ pedantic = { level = "warn", priority = -2 }
[dependencies] [dependencies]
ratatui = "0.30.2" ratatui = "0.30.2"
crossterm = "0.28" crossterm = "0.29"
tokio = { version = "1", features = ["rt-multi-thread", "macros", "sync", "time", "net", "io-util", "signal"] } tokio = { version = "1", features = ["rt-multi-thread", "macros", "sync", "time", "net", "io-util", "signal"] }
reqwest = { version = "0.12", features = ["json", "stream", "blocking", "native-tls-vendored"] } reqwest = { version = "0.13", features = ["json", "stream", "blocking", "native-tls-vendored", "form"] }
dom_smoothie = "0.18.0" dom_smoothie = "0.18.0"
fast_html2md = "0.0.62" fast_html2md = "0.0.62"
scraper = "0.27.0" scraper = "0.27.0"
@@ -33,23 +33,24 @@ url = "2"
percent-encoding = "2" percent-encoding = "2"
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }
serde_json = "1" serde_json = "1"
serde_yaml_ng = "0.9" serde_yaml_ng = "0.10"
anyhow = "1" anyhow = "1"
include_dir = "0.7" include_dir = "0.7"
uuid = { version = "1", features = ["v4", "v5"] } uuid = { version = "1", features = ["v4", "v5"] }
dirs = "5" dirs = "6"
futures-util = "0.3" futures-util = "0.3"
pulldown-cmark = { version = "0.13", default-features = false } pulldown-cmark = { version = "0.13", default-features = false }
syntect = { version = "5", default-features = false, features = ["default-fancy"] } syntect = { version = "5", default-features = false, features = ["default-fancy"] }
rusqlite = { version = "0.32", features = ["bundled"] } rusqlite = { version = "0.40", features = ["bundled"] }
ignore = "0.4" ignore = "0.4"
regex = "1" regex = "1"
globset = "0.4" globset = "0.4"
infer = "0.16" infer = "0.19"
base64 = "0.22" base64 = "0.22"
sha2 = "0.10" sha2 = "0.11"
hex = "0.4"
libc = "0.2" libc = "0.2"
rmcp = { version = "1.8", default-features = false, features = ["client", "transport-child-process", "transport-streamable-http-client-reqwest", "macros"] } rmcp = { version = "2.2", default-features = false, features = ["client", "transport-child-process", "transport-streamable-http-client-reqwest", "macros"] }
tracing = "0.1" tracing = "0.1"
chrono = { version = "0.4", features = ["serde"] } chrono = { version = "0.4", features = ["serde"] }
tracing-subscriber = { version = "0.3", features = ["env-filter"] } tracing-subscriber = { version = "0.3", features = ["env-filter"] }
+1 -1
View File
@@ -99,7 +99,7 @@ pub fn rewind_to(state: &mut AppStateRest, index: usize) {
tool: "rewind".to_string(), tool: "rewind".to_string(),
path: restore_path.to_string_lossy().to_string(), path: restore_path.to_string_lossy().to_string(),
reason: format!("rewind_to({index})"), reason: format!("rewind_to({index})"),
content_sha256: format!("{:x}", sha2::Sha256::digest(&bytes)), content_sha256: hex::encode(sha2::Sha256::digest(&bytes)),
bytes_delta: bytes.len() as i64, bytes_delta: bytes.len() as i64,
origin: crate::app::state::types::Origin::Main.tag(), origin: crate::app::state::types::Origin::Main.tag(),
session_id: state.session_id.clone(), session_id: state.session_id.clone(),
+2 -2
View File
@@ -1538,7 +1538,7 @@ fn execute_one_tool(
let hash = sha2::Sha256::digest( let hash = sha2::Sha256::digest(
content.and_then(|v| v.as_str()).unwrap_or("").as_bytes(), content.and_then(|v| v.as_str()).unwrap_or("").as_bytes(),
); );
format!("{hash:x}") hex::encode(hash)
}; };
let bytes_delta = if name == "write" { let bytes_delta = if name == "write" {
args.get("content") args.get("content")
@@ -1674,7 +1674,7 @@ fn run_oauth_flow(provider: &str) -> anyhow::Result<String> {
let verifier = CodeVerifier::new(); let verifier = CodeVerifier::new();
let challenge = verifier.challenge(); let challenge = verifier.challenge();
let state_token = format!("{:x}", sha2::Sha256::digest(rand_bytes(16))); let state_token = hex::encode(sha2::Sha256::digest(rand_bytes(16)));
let mut manager = OAuthManager::new(config.clone()); let mut manager = OAuthManager::new(config.clone());
let auth_url = manager.build_auth_url(&redirect_uri, &state_token, challenge.as_str()); let auth_url = manager.build_auth_url(&redirect_uri, &state_token, challenge.as_str());
+1 -1
View File
@@ -132,7 +132,7 @@ impl AppStateRest {
use sha2::Digest; use sha2::Digest;
let mut hasher = sha2::Sha256::new(); let mut hasher = sha2::Sha256::new();
hasher.update(abs_root.to_string_lossy().as_bytes()); hasher.update(abs_root.to_string_lossy().as_bytes());
let hash_hex = format!("{:x}", hasher.finalize()); let hash_hex = hex::encode(hasher.finalize());
let folder_name = abs_root.file_name().map_or_else(|| "root".to_string(), |n| n.to_string_lossy().to_string()); let folder_name = abs_root.file_name().map_or_else(|| "root".to_string(), |n| n.to_string_lossy().to_string());
let history_filename = format!("{}-{}.txt", folder_name, &hash_hex[..8]); let history_filename = format!("{}-{}.txt", folder_name, &hash_hex[..8]);
let history_dir = base_dir.join("history"); let history_dir = base_dir.join("history");