From 26f69851512febcf20ca5eb34d6ef70f47b417ec Mon Sep 17 00:00:00 2001 From: Wind-Explorer Date: Thu, 15 Jan 2026 16:22:16 +0800 Subject: [PATCH] silence cargo warnings. we'll add back deleted code when we actually need them. --- src-tauri/src/models/mod.rs | 2 -- src-tauri/src/remotes/dolls.rs | 2 -- src-tauri/src/remotes/user.rs | 29 ----------------------------- src-tauri/src/services/auth.rs | 15 ++++----------- src-tauri/src/services/ws.rs | 5 ----- src-tauri/src/state.rs | 2 +- 6 files changed, 5 insertions(+), 50 deletions(-) diff --git a/src-tauri/src/models/mod.rs b/src-tauri/src/models/mod.rs index 6d73636..992960a 100644 --- a/src-tauri/src/models/mod.rs +++ b/src-tauri/src/models/mod.rs @@ -1,4 +1,2 @@ pub mod app_data; pub mod interaction; - -pub use interaction::*; diff --git a/src-tauri/src/remotes/dolls.rs b/src-tauri/src/remotes/dolls.rs index f34d196..78f5bed 100644 --- a/src-tauri/src/remotes/dolls.rs +++ b/src-tauri/src/remotes/dolls.rs @@ -11,8 +11,6 @@ pub enum RemoteError { Http(#[from] reqwest::Error), #[error("JSON parse error: {0}")] Json(#[from] serde_json::Error), - #[error("{0}")] - Api(String), } #[derive(Default, Serialize, Deserialize, Clone, Debug, TS)] diff --git a/src-tauri/src/remotes/user.rs b/src-tauri/src/remotes/user.rs index 7fccc81..86f4aea 100644 --- a/src-tauri/src/remotes/user.rs +++ b/src-tauri/src/remotes/user.rs @@ -21,13 +21,6 @@ pub struct UserProfile { pub active_doll_id: Option, } -#[derive(Default, Serialize, Deserialize, Clone, Debug, TS)] -#[serde(rename_all = "camelCase")] -#[ts(export)] -pub struct UpdateUserDto { - // Empty as per API schema -} - pub struct UserRemote { pub base_url: String, pub client: Client, @@ -59,28 +52,6 @@ impl UserRemote { Ok(user) } - pub async fn update_user( - &self, - user_id: Option<&str>, - update: UpdateUserDto, - ) -> Result { - let url = format!("{}/users/{}", self.base_url, user_id.unwrap_or("me")); - let resp = with_auth(self.client.put(url)) - .await - .json(&update) - .send() - .await?; - let user = resp.json().await?; - Ok(user) - } - - pub async fn delete_user(&self, user_id: Option<&str>) -> Result<(), Error> { - let url = format!("{}/users/{}", self.base_url, user_id.unwrap_or("me")); - let resp = with_auth(self.client.delete(url)).await.send().await?; - resp.error_for_status()?; - Ok(()) - } - pub async fn set_active_doll(&self, doll_id: &str) -> Result<(), Error> { let url = format!("{}/users/me/active-doll/{}", self.base_url, doll_id); let resp = with_auth(self.client.put(url)).await.send().await?; diff --git a/src-tauri/src/services/auth.rs b/src-tauri/src/services/auth.rs index 6e5d556..45387f8 100644 --- a/src-tauri/src/services/auth.rs +++ b/src-tauri/src/services/auth.rs @@ -37,9 +37,6 @@ pub enum OAuthError { #[error("Failed to exchange code: {0}")] ExchangeFailed(String), - #[error("Invalid callback state - possible CSRF attack")] - InvalidState, - #[error("Missing callback parameter: {0}")] MissingParameter(String), @@ -67,9 +64,6 @@ pub enum OAuthError { #[error("Failed to refresh token")] RefreshFailed, - #[error("OAuth state expired or not initialized")] - StateExpired, - #[error("IO error: {0}")] IoError(#[from] std::io::Error), @@ -80,8 +74,6 @@ pub enum OAuthError { /// Parameters received from the OAuth callback. pub struct OAuthCallbackParams { state: String, - session_state: String, - iss: String, code: String, } @@ -423,7 +415,10 @@ pub async fn logout_and_restart() -> Result<(), OAuthError> { let app_handle = get_app_handle(); app_handle.restart(); - Ok(()) + //------------------ any code following this expression is unreachable + // Ok(()) + // ^^^^^^ unreachable expression + // leaving this here so the AI agent will stop adding this back } /// Helper to add authentication header to a request builder if tokens are available. @@ -869,8 +864,6 @@ async fn listen_for_callback( let callback_params = OAuthCallbackParams { state: find_param("state")?, - session_state: find_param("session_state")?, - iss: find_param("iss")?, code: find_param("code")?, }; diff --git a/src-tauri/src/services/ws.rs b/src-tauri/src/services/ws.rs index b6cc92a..6892c64 100644 --- a/src-tauri/src/services/ws.rs +++ b/src-tauri/src/services/ws.rs @@ -66,11 +66,6 @@ fn on_connected(_payload: Payload, socket: RawClient) { emit_initialize(&socket); } -fn on_reconnect(_payload: Payload, socket: RawClient) { - info!("WebSocket reconnected. Re-sending initialization request."); - emit_initialize(&socket); -} - fn on_initialized(payload: Payload, _socket: RawClient) { match payload { Payload::Text(values) => { diff --git a/src-tauri/src/state.rs b/src-tauri/src/state.rs index 9e23860..f2a087d 100644 --- a/src-tauri/src/state.rs +++ b/src-tauri/src/state.rs @@ -5,7 +5,7 @@ use crate::{ remotes::{dolls::DollsRemote, friends::FriendRemote, user::UserRemote}, services::{ auth::{load_auth_pass, AuthPass}, - client_config_manager::{load_app_config, AppConfig, AuthConfig}, + client_config_manager::{load_app_config, AppConfig}, }, }; use std::{