mirror of
https://github.com/alterware/alterware-launcher.git
synced 2025-12-04 07:17:50 +00:00
fully replace http_req with reqwest
close #43 Should also help to either resolve or at least investigate seemingly random TLS & IO errors #64 #77
This commit is contained in:
@@ -1,19 +1,21 @@
|
||||
use semver::Version;
|
||||
|
||||
pub fn latest_tag(owner: &str, repo: &str) -> String {
|
||||
let github_body = crate::http::get_body_string(
|
||||
pub async fn latest_tag(owner: &str, repo: &str) -> String {
|
||||
let github_body = crate::http_async::get_body_string(
|
||||
format!(
|
||||
"https://api.github.com/repos/{}/{}/releases/latest",
|
||||
owner, repo
|
||||
)
|
||||
.as_str(),
|
||||
);
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let github_json: serde_json::Value = serde_json::from_str(&github_body).unwrap();
|
||||
github_json["tag_name"].to_string().replace('"', "")
|
||||
}
|
||||
|
||||
pub fn latest_version(owner: &str, repo: &str) -> Version {
|
||||
let tag = latest_tag(owner, repo).replace('v', "");
|
||||
pub async fn latest_version(owner: &str, repo: &str) -> Version {
|
||||
let tag = latest_tag(owner, repo).await.replace('v', "");
|
||||
Version::parse(&tag).unwrap()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user