Browse Source

Fix gitea repo release API url

master
NGnius (Graham) 3 years ago
parent
commit
45037f8672
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      src/gitea.rs

+ 4
- 3
src/gitea.rs View File

@@ -6,13 +6,14 @@ pub const GITEA_API_URL: &str = "https://git.exmods.org/api/v1";
// API endpoints
pub fn get_releases(owner: &str, repo: &str) -> Result<Vec<Release>, String> {
let client = blocking::Client::new();
let url = format!("{}/{}/{}/releases", GITEA_API_URL, owner, repo);
let url = format!("{}/repos/{}/{}/releases", GITEA_API_URL, owner, repo);
let result = client.get(&url).send();
if let Ok(resp) = result {
if let Ok(data) = resp.json::<Vec<Release>>() {
let result = resp.json::<Vec<Release>>();
if let Ok(data) = result {
return Ok(data);
} else {
return Err("Invalid JSON payload".to_string());
return Err(format!("Invalid JSON payload {}", result.err().unwrap()));
}
}
Err("Invalid Result".to_string())


Loading…
Cancel
Save