Compare commits

...

6 Commits

Author SHA1 Message Date
a77bacc22f modified: Cargo.lock
modified:   Cargo.toml
2025-04-01 02:53:09 +03:00
a5a5b59719 Small fix for release builds (disable right-click menu)
modified:   src/main.rs
2025-04-01 02:23:39 +03:00
77db075915 modified: README.md 2025-03-26 02:28:43 +03:00
d1c48a8f7a Readme changes
modified:   README.md
2025-03-26 02:24:11 +03:00
dda1ecc9be modified: Cargo.lock
modified:   Cargo.toml
2025-03-25 01:26:02 +03:00
c64d8729e3 modified: src/main.rs
modified:   src/util.rs
2025-03-25 01:25:30 +03:00
5 changed files with 47 additions and 10 deletions

2
Cargo.lock generated

@ -4,7 +4,7 @@ version = 4
[[package]]
name = "CraftX"
version = "0.1.0"
version = "0.1.3"
dependencies = [
"base64 0.22.1",
"dirs",

@ -1,6 +1,6 @@
[package]
name = "CraftX"
version = "0.1.0"
version = "0.1.3"
edition = "2024"
build = "build.rs"

@ -1,4 +1,18 @@
# XCraft - A Modern Minecraft Launcher
<img align="left" width="100" height="100" src="https://w0n.zip/file/bWJVJa">
### XCraft
A Modern Minecraft Launcher
#
<div align="center">
<img src="https://w0n.zip/file/Xe0zXb">
<p>
<small>
Screenshot from Windows 10
</small>
</p>
</div>
XCraft is a custom Minecraft launcher written in Rust, designed to provide enhanced flexibility and customization. It supports a custom online mode, skin and cape editing, and seamless integration with MultiMC instances.
@ -13,8 +27,8 @@ XCraft is a custom Minecraft launcher written in Rust, designed to provide enhan
## Installation
### Download Stable Build
You can download the latest stable build of XCraft from our Jenkins CI server:
[Download from Jenkins](https://jenkins.awain.net/job/XCraft/lastStableBuild/).
You can download the latest stable build of XCraft from releases section:
[Download from Gitea](https://gitea.awain.net/alterwain/XCraft/releases/latest).
### Build from Source
@ -42,6 +56,7 @@ To make your Minecraft server compatible with XCraft, install the [**XCraftAuth*
## Roadmap
- [ ] Cross-platform support improvements
- [ ] Fabric integration
## License
This project is licensed under the MIT License.

@ -38,7 +38,7 @@ struct App {
impl ApplicationHandler for App {
fn resumed(&mut self, event_loop: &ActiveEventLoop) {
let window = event_loop.create_window(Window::default_attributes().with_inner_size(LogicalSize::new(900, 600)).with_min_inner_size(LogicalSize::new(900, 600)).with_title("XCraft")).unwrap();
let webview = WebViewBuilder::new()
let mut webview_builder = WebViewBuilder::new()
.with_asynchronous_custom_protocol("xcraft".into(), move |_wid, request, responder| {
let uri = request.uri().to_string();
if let Ok(msg) = serde_json::from_slice(request.body()) {
@ -47,9 +47,17 @@ impl ApplicationHandler for App {
}
let _ = SENDER.lock().unwrap().as_ref().unwrap().send((uri, None, responder));
})
.with_url("xcraft://custom/ui")
.build(&window)
.unwrap();
.with_url("xcraft://custom/ui");
if !cfg!(debug_assertions) {
webview_builder = webview_builder.with_initialization_script(r#"
document.addEventListener("contextmenu", event => event.preventDefault());
"#);
}
let webview = webview_builder
.build(&window)
.unwrap();
self.window = Some(window);
self.webview = Some(webview);
@ -344,8 +352,15 @@ async fn main() {
"check_updates" => {
//
if let Ok(Some(file_url)) = launcher::check_updates().await {
responder.respond(Response::new(serde_json::to_vec(&UIMessage { params: vec!["sidebar_off".to_string(), "show_loading".to_string(), "update_downloads".to_string(), "Updating launcher...".to_string(), "100".to_string()] }).unwrap()));
let current_exe = std::env::current_exe().unwrap();
let mut downloaded_file = std::env::current_dir().unwrap();
downloaded_file.push("launcher_new.exe");
util::simple_download(&file_url, downloaded_file.to_str().unwrap()).await.unwrap();
let _ = std::fs::rename(&current_exe, "old_launcher.bak");
let _ = std::fs::rename(downloaded_file, current_exe);
let _ = std::fs::remove_file("old_launcher.bak");
std::process::exit(0);
}
}
_ => {}

@ -21,6 +21,13 @@ pub async fn get_image(url: &str) -> Result<String, Box<dyn Error + Send + Sync>
Ok(format!("data:image/png;base64,{}", base64_string))
}
pub async fn simple_download(url: &str, file_path: &str) -> Result<(), Box<dyn Error + Send + Sync>> {
let bytes = surf::get(url).recv_bytes().await?;
let mut f = File::create(file_path).await?;
f.write_all(&bytes).await?;
Ok(())
}
pub async fn download_file(url: &str, file_path: &str, sender: UnboundedSender<(usize, String)>, status: &str, join: bool) -> Result<(), Box<dyn std::error::Error>> {
let url = url.to_string();
let file_path = file_path.to_string();