Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions rustique-cli/src/updater/update_manager.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::env;
use std::sync::Arc;
use std::time::Duration;
use comfy_table::{Attribute, CellAlignment, Color};
use comfy_table::presets::UTF8_HORIZONTAL_ONLY;
Expand All @@ -17,18 +16,16 @@ use crate::updater::self_update::RustiqueUpdater;
const GITHUB_RUSTIQUE_URI: &str = "https://api.github.com/repos/Tekunogosu/Rustique/releases";

pub struct GithubApi {
agent: Arc<reqwest::Client>,
agent: reqwest::Client,
}

impl GithubApi {
pub fn new() -> Self {
Self {
agent: Arc::new(
Client::builder()
agent: Client::builder()
.timeout(Duration::from_secs(20))
.user_agent(RUSTIQUE_USER_AGENT)
.build().expect("Failed to build Github API client")
)
}
}

Expand Down
17 changes: 7 additions & 10 deletions rustique-core/src/api/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use crate::consts::FILE_MODINFO_JSON;
use owo_colors::OwoColorize;
use std::collections::{HashMap, HashSet};
use std::fmt::Display;
use std::sync::Arc;
use std::time::Duration;
use tracing::{debug, error, info};
use std::fmt::Write;
Expand All @@ -24,7 +23,7 @@ pub const RUSTIQUE_USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!(

#[derive(Debug, Clone)]
pub struct ApiClient {
agent: Arc<reqwest::Client>,
agent: reqwest::Client,
}

#[derive(Debug, Clone, ValueEnum)]
Expand Down Expand Up @@ -66,17 +65,15 @@ pub enum VSWinInstallerType {
impl ApiClient {
pub fn new() -> Self {
Self {
agent: Arc::new(
reqwest::Client::builder()
.timeout(Duration::from_secs(20))
.user_agent(RUSTIQUE_USER_AGENT)
.build()
.expect("Failed to build HTTP client")
),
agent: reqwest::Client::builder()
.timeout(Duration::from_secs(20))
.user_agent(RUSTIQUE_USER_AGENT)
.build()
.expect("Failed to build HTTP client"),
}
}

pub fn _with_agent(agent: Arc<reqwest::Client>) -> Self {
pub fn _with_agent(agent: reqwest::Client) -> Self {
Self { agent }
}

Expand Down