From dc9d8d20d8d59a8553155ed60e996c27b3abc96a Mon Sep 17 00:00:00 2001 From: ih8js-git <141177946+ih8js-git@users.noreply.github.com> Date: Thu, 16 Jul 2026 15:34:02 -0500 Subject: [PATCH] added: rustls to reqwest --- Cargo.toml | 2 +- src/api/auth.rs | 5 ++++- src/app.rs | 2 +- src/ui/error.rs | 18 ++++++++++++------ 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4d58b56..ab224ae 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ dirs = "6.0.0" keyring-lib = { version = "1.0.3", features = ["tokio"] } ratatui = "0.30.2" -reqwest = { version = "0.13.4", default-features = false, features = ["json"] } +reqwest = { version = "0.13.4", default-features = false, features = ["json", "rustls"] } serde = { version = "1", features = ["derive"] } tokio = { version = "1.52.3", features = ["full"] } serde_json = "1.0.150" diff --git a/src/api/auth.rs b/src/api/auth.rs index 7d4c03a..6be4ff9 100644 --- a/src/api/auth.rs +++ b/src/api/auth.rs @@ -33,8 +33,11 @@ impl Auth { let err_msg = e.to_string(); if err_msg.contains("401") { "Invalid token. Please check your session token and try again.".to_string() - } else { + } else if err_msg.contains("API GET request") { err_msg + } else { + "Could not connect to the server. Please check your internet connection." + .to_string() } }) } diff --git a/src/app.rs b/src/app.rs index ea1741f..d85723c 100644 --- a/src/app.rs +++ b/src/app.rs @@ -36,7 +36,7 @@ impl App { client = authenticated_client; AppState::LoggedIn } - Err(e) => AppState::Error(format!("Stored token is invalid: {}", e)), + Err(e) => AppState::Error(e), } } else { AppState::InputToken diff --git a/src/ui/error.rs b/src/ui/error.rs index 19b7b7f..430b403 100644 --- a/src/ui/error.rs +++ b/src/ui/error.rs @@ -5,13 +5,19 @@ use ratatui::{ }; pub fn render(f: &mut Frame, message: &str) { - let error_text = format!("CRITICAL SYSTEM ERROR:\n\n{message}\n\nPress any key to return..."); + let title = if message.contains("keyring") || message.contains("Keyring") { + " Keyring Error " + } else if message.contains("connect") || message.contains("internet") { + " Connection Error " + } else if message.contains("Invalid token") { + " Authentication Error " + } else { + " Error " + }; + + let error_text = format!("{message}\n\nPress any key to return..."); let error_msg = Paragraph::new(error_text) .style(Style::default().fg(Color::Red)) - .block( - Block::default() - .title(" Keyring Failure ") - .borders(Borders::ALL), - ); + .block(Block::default().title(title).borders(Borders::ALL)); f.render_widget(error_msg, f.area()); }