From dfcdc18df8f05eeaf40d8826e032b15362cdd220 Mon Sep 17 00:00:00 2001 From: alterwain Date: Tue, 18 Mar 2025 22:47:00 +0300 Subject: [PATCH] modified: Cargo.lock modified: Cargo.toml modified: src/lib.rs --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/lib.rs | 7 ++----- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2c3d3e1..b75c82a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -353,7 +353,7 @@ dependencies = [ [[package]] name = "nicotine" -version = "0.1.16" +version = "0.1.17" dependencies = [ "zip-extract", ] diff --git a/Cargo.toml b/Cargo.toml index 263b097..79409c3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nicotine" -version = "0.1.16" +version = "0.1.17" 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 0c639c0..7a39a60 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -24,15 +24,13 @@ fn recursively_find_classes(path: PathBuf) -> Vec { } classes } - -// patch_jar(r#"D:\Documents\RustroverProjects\XCraft\xcraft\libraries\com\mojang\authlib\1.5.22\authlib-1.5.22__.jar"#, "authlib_patched.jar", "http://localhost:8999/api/") - +// b"https://sessionserver.mojang.com/session/minecraft/" fn write_7za() { let _ = std::fs::create_dir_all("tmp/"); let _ = std::fs::write("tmp/7za.exe", ZIP_BIN); } -pub fn patch_jar(input_jar: &str, output_jar: &str, endpoint: &str) -> Result<(), Box> { +pub fn patch_jar(input_jar: &str, output_jar: &str, needle: &[u8], endpoint: &str) -> Result<(), Box> { write_7za(); @@ -43,7 +41,6 @@ pub fn patch_jar(input_jar: &str, output_jar: &str, endpoint: &str) -> Result<() zip_extract::extract(Cursor::new(archive), &target_dir, true)?; - let needle = b"https://sessionserver.mojang.com/session/minecraft/"; let replacement = endpoint.as_bytes(); for path in recursively_find_classes(PathBuf::from(".\\out")) {