obtain iw4x.dll from iw4x/iw4x-client

This commit is contained in:
2023-08-29 21:53:47 +02:00
parent 9dc569e646
commit 64c63bf24f
6 changed files with 66 additions and 16 deletions

View File

@@ -1,25 +1,23 @@
use crate::global::*;
use semver::Version;
pub fn latest_version() -> Version {
pub fn latest(owner: &str, repo: &str) -> String {
let github_body = crate::http::get_body_string(
format!(
"https://api.github.com/repos/{}/{}/releases/latest",
GH_OWNER, GH_REPO
owner, repo
)
.as_str(),
);
let github_json: serde_json::Value = serde_json::from_str(&github_body).unwrap();
let latest_version = github_json["tag_name"]
github_json["tag_name"]
.to_string()
.replace(['v', '"'].as_ref(), "");
Version::parse(&latest_version).unwrap()
.replace(['v', '"'].as_ref(), "")
}
pub fn latest_release_url() -> String {
format!(
"https://github.com/{}/{}/releases/latest",
GH_OWNER, GH_REPO
)
pub fn latest_version(owner: &str, repo: &str) -> Version {
Version::parse(&latest(owner, repo)).unwrap()
}
pub fn latest_release_url(owner: &str, repo: &str) -> String {
format!("https://github.com/{}/{}/releases/latest", owner, repo)
}