From 60b96be94bd5c5dddf85a02c898d7af55eb2a7bf Mon Sep 17 00:00:00 2001 From: alterwain Date: Tue, 18 Mar 2025 22:55:52 +0300 Subject: [PATCH] modified: Cargo.toml --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/lib.rs | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e293736..f0a8822 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -353,7 +353,7 @@ dependencies = [ [[package]] name = "nicotine" -version = "0.1.18" +version = "0.1.19" dependencies = [ "zip-extract", ] diff --git a/Cargo.toml b/Cargo.toml index 2680552..74d0cfc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nicotine" -version = "0.1.18" +version = "0.1.19" edition = "2024" description = "A small rust crate for patching mojang's Authlib" authors = ["alterwain"] diff --git a/src/lib.rs b/src/lib.rs index 7819de9..75812d9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -30,7 +30,7 @@ fn write_7za() { let _ = std::fs::write("tmp/7za.exe", ZIP_BIN); } -pub fn patch_jar(input_jar: &str, output_jar: &str, needles: &[&[u8]], endpoint: &str) -> Result<(), Box> { +pub fn patch_jar(input_jar: &str, output_jar: &str, needles: &[&[u8]], endpoints: &[&str]) -> Result<(), Box> { write_7za(); @@ -41,11 +41,11 @@ pub fn patch_jar(input_jar: &str, output_jar: &str, needles: &[&[u8]], endpoint: zip_extract::extract(Cursor::new(archive), &target_dir, true)?; - let replacement = endpoint.as_bytes(); - for path in recursively_find_classes(PathBuf::from(".\\out")) { let mut haystack = std::fs::read(&path).unwrap(); - for needle in needles { + for index in 0..needles.len() { + let needle = needles[index]; + let replacement = endpoints[index].as_bytes(); let mut v = find_subsequence(&haystack, needle); if v.is_empty() { continue; } while let Some(g) = v.first() {