modified: Cargo.lock

modified:   Cargo.toml
	modified:   src/lib.rs
This commit is contained in:
Michael Wain 2025-03-18 22:47:00 +03:00
parent c55143440e
commit dfcdc18df8
3 changed files with 4 additions and 7 deletions

2
Cargo.lock generated
View File

@ -353,7 +353,7 @@ dependencies = [
[[package]]
name = "nicotine"
version = "0.1.16"
version = "0.1.17"
dependencies = [
"zip-extract",
]

View File

@ -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"]

View File

@ -24,15 +24,13 @@ fn recursively_find_classes(path: PathBuf) -> Vec<PathBuf> {
}
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<dyn Error + Sync + Send>> {
pub fn patch_jar(input_jar: &str, output_jar: &str, needle: &[u8], endpoint: &str) -> Result<(), Box<dyn Error + Sync + Send>> {
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")) {