switch back to ureq from nyquest for http client

note: even if this raises binary size by a significant amount, it should in theory be more reliable, so it is a worthy sacrifice.
This commit is contained in:
2025-09-04 07:41:54 +01:00
parent b8c444dc5b
commit 06df466d24
4 changed files with 264 additions and 77 deletions
-2
View File
@@ -18,8 +18,6 @@ fn app_creator(
) -> Result<Box<dyn eframe::App>, Box<dyn std::error::Error + Send + Sync>> {
// use our own panic hook which logs all panics to a file
std::panic::set_hook(Box::new(panic_hook));
// initialize http client (nyquest) for windows
nyquest_backend_winrt::register();
// initialize App early to modify some things before returning it
let mut app = Box::new(App::default());
// load previously selected launch platform & settings from persistent state
+3 -6
View File
@@ -1,4 +1,3 @@
use nyquest::{ClientBuilder, blocking::Request};
use semver::Version;
use serde::Deserialize;
@@ -33,11 +32,9 @@ struct Asset {
pub fn get_latest_release() -> Result<Release, Box<dyn std::error::Error>> {
let request_url = format!("{CODEBERG_ENDPOINT_ROOT}/repos/futile/gta-tools/releases/latest");
let client = ClientBuilder::default()
.user_agent(APP_USER_AGENT)
.build_blocking()?;
let response = client.request(Request::get(request_url))?;
let json = response.json::<LatestRelease>()?;
let mut response = ureq::get(request_url).header("User-Agent", APP_USER_AGENT).call()?;
let body = response.body_mut();
let json = body.read_json::<LatestRelease>()?;
let tag_name = json.tag_name;
let browser_download_url = &json.assets[0].browser_download_url;
Ok(Release {