mirror of
https://ghfast.top/https://github.com/StarCitizenToolBox/app.git
synced 2025-06-28 04:24:45 +08:00
bump: Flutter 3.32.1 Rust 1.87.0
fix: rsi launcher patch 2.4.0
This commit is contained in:
9
rust/Cargo.lock
generated
9
rust/Cargo.lock
generated
@ -897,9 +897,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "flutter_rust_bridge"
|
||||
version = "2.10.0"
|
||||
version = "2.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ff1d2ad18166cead8c1b92b1c00e64aacc32e6ebd1ac95f77089c276c9c6bd8c"
|
||||
checksum = "2f8c0dee6249225e815dcff3f3a39b98d9f66fdb3c392a432715b646bfa4da02"
|
||||
dependencies = [
|
||||
"allo-isolate",
|
||||
"android_logger",
|
||||
@ -926,9 +926,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "flutter_rust_bridge_macros"
|
||||
version = "2.10.0"
|
||||
version = "2.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "36cf75fba54902e67db5eef4a520df1c9f604db6f71f106fbc012477e2d81542"
|
||||
checksum = "8e88d604908d9eccb4ca9c26640ce41033165cbef041460e704ae28bd5208bce"
|
||||
dependencies = [
|
||||
"hex",
|
||||
"md-5",
|
||||
@ -2373,6 +2373,7 @@ dependencies = [
|
||||
"scopeguard",
|
||||
"tokio",
|
||||
"url",
|
||||
"walkdir",
|
||||
"win32job",
|
||||
"windows 0.61.1",
|
||||
]
|
||||
|
@ -11,7 +11,7 @@ strip = "debuginfo"
|
||||
crate-type = ["cdylib", "staticlib"]
|
||||
|
||||
[dependencies]
|
||||
flutter_rust_bridge = "=2.10.0"
|
||||
flutter_rust_bridge = "=2.9.0"
|
||||
tokio = { version = "1", features = ["rt", "rt-multi-thread", "macros", "process"] }
|
||||
futures = { version = "0.3", default-features = false, features = ["executor"] }
|
||||
url = "2.5"
|
||||
@ -19,10 +19,10 @@ once_cell = "1.20"
|
||||
reqwest = { version = "0.12", features = ["rustls-tls-webpki-roots", "cookies", "gzip", "json", "stream"] }
|
||||
hickory-resolver = { version = "0.25" }
|
||||
anyhow = "1.0"
|
||||
|
||||
scopeguard = "1.2"
|
||||
notify-rust = "4"
|
||||
asar = "0.3.0"
|
||||
walkdir = "2.5.0"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
windows = { version = "0.61.1", features = ["Win32_UI_WindowsAndMessaging"] }
|
||||
|
@ -2,6 +2,7 @@ use std::fs::File;
|
||||
|
||||
use asar::{AsarReader, AsarWriter};
|
||||
use tokio::fs;
|
||||
use walkdir::WalkDir;
|
||||
|
||||
pub struct RsiLauncherAsarData {
|
||||
pub asar_path: String,
|
||||
@ -11,18 +12,50 @@ pub struct RsiLauncherAsarData {
|
||||
|
||||
impl RsiLauncherAsarData {
|
||||
pub async fn write_main_js(&self, content: Vec<u8>) -> anyhow::Result<()> {
|
||||
println!("[RsiLauncherAsarData] write_main_js");
|
||||
let mut asar_writer = AsarWriter::new();
|
||||
let asar_mem_file = fs::read(self.asar_path.clone()).await?;
|
||||
let asar = AsarReader::new(&asar_mem_file, None)?;
|
||||
let symlink_path = format!("{}.unpacked", self.asar_path);
|
||||
asar.files().iter().for_each(|v| {
|
||||
let (path, file) = v;
|
||||
let path_string = path.clone().into_os_string().into_string().unwrap();
|
||||
if path_string == self.main_js_path {
|
||||
asar_writer.write_file(path, &content, true).unwrap();
|
||||
} else {
|
||||
asar_writer.write_file(path, file.data(), true).unwrap();
|
||||
// check file exists in symlink_dir
|
||||
let file_path = format!("{}/{}", symlink_path, path_string);
|
||||
if std::fs::metadata(&file_path).is_ok() {
|
||||
println!("[RsiLauncherAsarData] skip file: {}", path_string);
|
||||
} else {
|
||||
println!("[RsiLauncherAsarData] write_file: {}", path_string);
|
||||
asar_writer.write_file(path, file.data(), true).unwrap();
|
||||
}
|
||||
}
|
||||
});
|
||||
// check if symlink_dir exists
|
||||
if fs::metadata(&symlink_path).await.is_ok() {
|
||||
// loop symlink_dir
|
||||
for entry in WalkDir::new(symlink_path.clone())
|
||||
.follow_links(true)
|
||||
.into_iter()
|
||||
.filter_map(|e| e.ok())
|
||||
{
|
||||
let f_path = entry.path();
|
||||
if f_path.is_file() {
|
||||
let relative_path = f_path.strip_prefix(&symlink_path)?;
|
||||
let relative_path_str = relative_path.to_str().unwrap();
|
||||
asar_writer.write_file(relative_path, &fs::read(f_path).await?, true, )?;
|
||||
// asar_writer.write_symlink(relative_path_str, f_path)?;
|
||||
println!(
|
||||
"[RsiLauncherAsarData] write symlink file: {} -> {}",
|
||||
relative_path_str,
|
||||
f_path.to_str().unwrap_or("??")
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// rm old asar
|
||||
fs::remove_file(&self.asar_path).await?;
|
||||
// write new asar
|
||||
@ -49,4 +82,4 @@ pub async fn get_rsi_launcher_asar_data(asar_path: &str) -> anyhow::Result<RsiLa
|
||||
main_js_path,
|
||||
main_js_content,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user