This commit is contained in:
brotoskyj
2026-01-12 12:36:15 -05:00
parent fcbe163d18
commit b2059a76c6
4 changed files with 79 additions and 56 deletions
+12 -8
View File
@@ -1,15 +1,22 @@
use std::thread;
use serde::Deserialize;
use semver::Version;
use reqwest;
use semver::Version;
use serde::Deserialize;
#[derive(Deserialize, Debug)]
struct Release {
tag_name: String,
}
pub async fn update() {
let body = reqwest::get("https://git.racooncity.org/api/v1/repos/brotoskyj/RhythmWorks/releases/latest").await.unwrap().text().await.unwrap();
let body = reqwest::get(
"https://git.racooncity.org/api/v1/repos/brotoskyj/RhythmWorks/releases/latest",
)
.await
.unwrap()
.text()
.await
.unwrap();
let release_info: Release = serde_json::from_str(&body).unwrap();
let latest_version = Version::parse(&release_info.tag_name).unwrap();
let current_version = Version::parse(env!("CARGO_PKG_VERSION")).unwrap();
@@ -18,9 +25,6 @@ pub async fn update() {
println!("URL: https://git.racooncity.org/brotoskyj/RhythmWorks/releases");
thread::sleep(std::time::Duration::from_secs(10));
std::process::exit(1);
} else {
}
else {
}
}
}