Skip to content

Commit a527e7c

Browse files
committed
i dont care about if it is unstable
1 parent d1031c0 commit a527e7c

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

src/softwares.rs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use std::{fs, io::Write};
2-
use colored::Colorize;
32

43
fn download_jar(res: reqwest::blocking::Response) -> Result<(), Box<dyn std::error::Error>> {
54
let mut file = fs::File::create("server.jar")?;
@@ -34,28 +33,25 @@ pub fn get_other(software: String, version: String) -> Result<(), Box<dyn std::e
3433

3534
if let Ok(res) = res {
3635
let builds: serde_json::Value = res.json()?;
37-
38-
let builds_array = builds.as_array()
36+
37+
let builds_array = builds
38+
.as_array()
3939
.ok_or("Invalid response format: expected array of builds")?;
40-
40+
4141
if builds_array.is_empty() {
4242
return Err(format!("No builds available for {} version {}", software, version).into());
4343
}
44-
44+
4545
let latest_build = &builds_array[0];
46-
46+
4747
// Extract the download URL from the build object
4848
let download_url = latest_build["downloads"]["server:default"]["url"]
4949
.as_str()
5050
.ok_or("Download URL not found in build response")?;
51-
52-
if latest_build["channel"] != "STABLE" && latest_build["channel"] != "RECOMMENDED" {
53-
println!("You are downloading an {} build, {} use it in production environment!", "unstable".red(), "DON'T".red());
54-
}
55-
51+
5652
// Download the jar file directly using the provided URL
5753
let res = client.get(download_url).send();
58-
54+
5955
if let Ok(res) = res {
6056
download_jar(res)?;
6157
Ok(())
@@ -72,4 +68,4 @@ pub fn get(name: String, version: String) -> Result<(), Box<dyn std::error::Erro
7268
"purpur" => get_purpur(version),
7369
_ => get_other(name, version),
7470
}
75-
}
71+
}

0 commit comments

Comments
 (0)