silence cargo warnings.
we'll add back deleted code when we actually need them.
This commit is contained in:
@@ -1,4 +1,2 @@
|
|||||||
pub mod app_data;
|
pub mod app_data;
|
||||||
pub mod interaction;
|
pub mod interaction;
|
||||||
|
|
||||||
pub use interaction::*;
|
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ pub enum RemoteError {
|
|||||||
Http(#[from] reqwest::Error),
|
Http(#[from] reqwest::Error),
|
||||||
#[error("JSON parse error: {0}")]
|
#[error("JSON parse error: {0}")]
|
||||||
Json(#[from] serde_json::Error),
|
Json(#[from] serde_json::Error),
|
||||||
#[error("{0}")]
|
|
||||||
Api(String),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, TS)]
|
#[derive(Default, Serialize, Deserialize, Clone, Debug, TS)]
|
||||||
|
|||||||
@@ -21,13 +21,6 @@ pub struct UserProfile {
|
|||||||
pub active_doll_id: Option<String>,
|
pub active_doll_id: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[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 struct UserRemote {
|
||||||
pub base_url: String,
|
pub base_url: String,
|
||||||
pub client: Client,
|
pub client: Client,
|
||||||
@@ -59,28 +52,6 @@ impl UserRemote {
|
|||||||
Ok(user)
|
Ok(user)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn update_user(
|
|
||||||
&self,
|
|
||||||
user_id: Option<&str>,
|
|
||||||
update: UpdateUserDto,
|
|
||||||
) -> Result<UserProfile, Error> {
|
|
||||||
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> {
|
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 url = format!("{}/users/me/active-doll/{}", self.base_url, doll_id);
|
||||||
let resp = with_auth(self.client.put(url)).await.send().await?;
|
let resp = with_auth(self.client.put(url)).await.send().await?;
|
||||||
|
|||||||
@@ -37,9 +37,6 @@ pub enum OAuthError {
|
|||||||
#[error("Failed to exchange code: {0}")]
|
#[error("Failed to exchange code: {0}")]
|
||||||
ExchangeFailed(String),
|
ExchangeFailed(String),
|
||||||
|
|
||||||
#[error("Invalid callback state - possible CSRF attack")]
|
|
||||||
InvalidState,
|
|
||||||
|
|
||||||
#[error("Missing callback parameter: {0}")]
|
#[error("Missing callback parameter: {0}")]
|
||||||
MissingParameter(String),
|
MissingParameter(String),
|
||||||
|
|
||||||
@@ -67,9 +64,6 @@ pub enum OAuthError {
|
|||||||
#[error("Failed to refresh token")]
|
#[error("Failed to refresh token")]
|
||||||
RefreshFailed,
|
RefreshFailed,
|
||||||
|
|
||||||
#[error("OAuth state expired or not initialized")]
|
|
||||||
StateExpired,
|
|
||||||
|
|
||||||
#[error("IO error: {0}")]
|
#[error("IO error: {0}")]
|
||||||
IoError(#[from] std::io::Error),
|
IoError(#[from] std::io::Error),
|
||||||
|
|
||||||
@@ -80,8 +74,6 @@ pub enum OAuthError {
|
|||||||
/// Parameters received from the OAuth callback.
|
/// Parameters received from the OAuth callback.
|
||||||
pub struct OAuthCallbackParams {
|
pub struct OAuthCallbackParams {
|
||||||
state: String,
|
state: String,
|
||||||
session_state: String,
|
|
||||||
iss: String,
|
|
||||||
code: String,
|
code: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -423,7 +415,10 @@ pub async fn logout_and_restart() -> Result<(), OAuthError> {
|
|||||||
|
|
||||||
let app_handle = get_app_handle();
|
let app_handle = get_app_handle();
|
||||||
app_handle.restart();
|
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.
|
/// 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 {
|
let callback_params = OAuthCallbackParams {
|
||||||
state: find_param("state")?,
|
state: find_param("state")?,
|
||||||
session_state: find_param("session_state")?,
|
|
||||||
iss: find_param("iss")?,
|
|
||||||
code: find_param("code")?,
|
code: find_param("code")?,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -66,11 +66,6 @@ fn on_connected(_payload: Payload, socket: RawClient) {
|
|||||||
emit_initialize(&socket);
|
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) {
|
fn on_initialized(payload: Payload, _socket: RawClient) {
|
||||||
match payload {
|
match payload {
|
||||||
Payload::Text(values) => {
|
Payload::Text(values) => {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use crate::{
|
|||||||
remotes::{dolls::DollsRemote, friends::FriendRemote, user::UserRemote},
|
remotes::{dolls::DollsRemote, friends::FriendRemote, user::UserRemote},
|
||||||
services::{
|
services::{
|
||||||
auth::{load_auth_pass, AuthPass},
|
auth::{load_auth_pass, AuthPass},
|
||||||
client_config_manager::{load_app_config, AppConfig, AuthConfig},
|
client_config_manager::{load_app_config, AppConfig},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use std::{
|
use std::{
|
||||||
|
|||||||
Reference in New Issue
Block a user