From b487377d7b88b1afbbfe184cf2e81d680fcac8cd Mon Sep 17 00:00:00 2001 From: Gureumi Date: Tue, 29 Aug 2023 00:38:56 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9E=90=EB=8F=99=20=EC=97=85=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.toml | 6 +++--- src/main.rs | 32 +++++++++++++++++++++++++------- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7b6da14..6e60fb0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [package] -name = "anti-ripper" -version = "0.1.0" +name = "Anti-Ripper" +version = "1.0.0" edition = "2021" -build = "build.rs" +build = "src/build.rs" # icon = "icon.ico" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/main.rs b/src/main.rs index a200012..37385e7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -603,21 +603,39 @@ fn check_current_count(user_id: &str) -> bool { false } -shadow!(BUILD); +shadow!(build); fn print_author() { - println!("Anti-ripper 1.0"); - println!("빌드 시간: {}", BUILD.built_time_fmt("%Y-%m-%d %H:%M:%S")); - - println!("Anti-ripper 1.0"); + println!("Anti-ripper {} / {} / {}", build::PKG_VERSION, build::RUST_VERSION, build::BUILD_OS); + println!("빌드 날짜: {}", build::BUILD_TIME); println!(""); println!("제작자: 키에르"); + println!("Github: https://github.com/kieaer/Anti-Ripper"); +} + +fn auto_update() -> Result<(), Box> { + let response = reqwest::blocking::get("https://api.github.com/repos/kieaer/Anti-ripper/releases/latest")?; + + if response.status().is_success() { + let release: serde_json::Value = response.json()?; + let tag_name = release["tag_name"].as_str().unwrap_or("Unknown"); + let description = release["body"].as_str().unwrap_or("No description available"); + + if tag_name != build::PKG_VERSION { + println!("{} 버전이 나왔습니다. (현재 {} 버전)", tag_name, build::PKG_VERSION); + println!("== 업데이트 내용"); + println!("{}", description); + } + } else { + println!("Failed to fetch release information"); + } + + Ok(()) } fn main() -> Result<(), Box> { print_author(); - - Ok(()); + auto_update()?; fs::create_dir_all(config_dir().unwrap().join("VRCX/Anti-Ripper"))?;