cargo fmt
This commit is contained in:
@@ -3,7 +3,9 @@ use crate::{
|
|||||||
models::app_data::UserData,
|
models::app_data::UserData,
|
||||||
services::{
|
services::{
|
||||||
app_data::{init_app_data_scoped, AppDataRefreshScope},
|
app_data::{init_app_data_scoped, AppDataRefreshScope},
|
||||||
friends, presence_modules::models::ModuleMetadata, sprite,
|
friends,
|
||||||
|
presence_modules::models::ModuleMetadata,
|
||||||
|
sprite,
|
||||||
},
|
},
|
||||||
state::FDOLL,
|
state::FDOLL,
|
||||||
};
|
};
|
||||||
@@ -38,8 +40,8 @@ pub fn get_active_doll_sprite_base64() -> Result<Option<String>, String> {
|
|||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
#[specta::specta]
|
#[specta::specta]
|
||||||
pub fn get_friend_active_doll_sprites_base64(
|
pub fn get_friend_active_doll_sprites_base64() -> Result<friends::FriendActiveDollSpritesDto, String>
|
||||||
) -> Result<friends::FriendActiveDollSpritesDto, String> {
|
{
|
||||||
friends::sync_active_doll_sprites_from_app_data();
|
friends::sync_active_doll_sprites_from_app_data();
|
||||||
Ok(friends::get_active_doll_sprites_snapshot())
|
Ok(friends::get_active_doll_sprites_snapshot())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
lock_w,
|
lock_w,
|
||||||
services::client_config::{
|
services::client_config::{load_app_config, open_config_window, save_app_config, AppConfig},
|
||||||
load_app_config, open_config_window, save_app_config, AppConfig,
|
|
||||||
},
|
|
||||||
state::FDOLL,
|
state::FDOLL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
commands::{is_active_doll, refresh_app_data, refresh_app_data_conditionally},
|
commands::{is_active_doll, refresh_app_data, refresh_app_data_conditionally},
|
||||||
models::dolls::{CreateDollDto, DollDto, UpdateDollDto},
|
models::dolls::{CreateDollDto, DollDto, UpdateDollDto},
|
||||||
remotes::{
|
remotes::{dolls::DollsRemote, user::UserRemote},
|
||||||
dolls::DollsRemote,
|
|
||||||
user::UserRemote,
|
|
||||||
},
|
|
||||||
services::app_data::AppDataRefreshScope,
|
services::app_data::AppDataRefreshScope,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -53,7 +50,8 @@ pub async fn update_doll(id: String, dto: UpdateDollDto) -> Result<DollDto, Stri
|
|||||||
refresh_app_data_conditionally(
|
refresh_app_data_conditionally(
|
||||||
&[AppDataRefreshScope::Dolls],
|
&[AppDataRefreshScope::Dolls],
|
||||||
is_active.then_some(&[AppDataRefreshScope::User, AppDataRefreshScope::Friends]),
|
is_active.then_some(&[AppDataRefreshScope::User, AppDataRefreshScope::Friends]),
|
||||||
).await;
|
)
|
||||||
|
.await;
|
||||||
|
|
||||||
Ok(result)
|
Ok(result)
|
||||||
}
|
}
|
||||||
@@ -72,7 +70,8 @@ pub async fn delete_doll(id: String) -> Result<(), String> {
|
|||||||
refresh_app_data_conditionally(
|
refresh_app_data_conditionally(
|
||||||
&[AppDataRefreshScope::Dolls],
|
&[AppDataRefreshScope::Dolls],
|
||||||
is_active.then_some(&[AppDataRefreshScope::User, AppDataRefreshScope::Friends]),
|
is_active.then_some(&[AppDataRefreshScope::User, AppDataRefreshScope::Friends]),
|
||||||
).await;
|
)
|
||||||
|
.await;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
use crate::remotes::friends::FriendRemote;
|
use crate::commands::refresh_app_data;
|
||||||
use crate::models::friends::{
|
use crate::models::friends::{
|
||||||
FriendRequestResponseDto, FriendshipResponseDto, SendFriendRequestDto, UserBasicDto,
|
FriendRequestResponseDto, FriendshipResponseDto, SendFriendRequestDto, UserBasicDto,
|
||||||
};
|
};
|
||||||
use crate::commands::refresh_app_data;
|
use crate::remotes::friends::FriendRemote;
|
||||||
use crate::services::app_data::AppDataRefreshScope;
|
use crate::services::app_data::AppDataRefreshScope;
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
init::{
|
init::{lifecycle::validate_server_health, tracing::init_logging},
|
||||||
lifecycle::validate_server_health,
|
|
||||||
tracing::init_logging,
|
|
||||||
},
|
|
||||||
services::{
|
services::{
|
||||||
auth::get_session_token,
|
auth::get_session_token,
|
||||||
cursor::init_cursor_tracking,
|
cursor::init_cursor_tracking,
|
||||||
|
|||||||
@@ -27,12 +27,11 @@ use tauri::async_runtime;
|
|||||||
use tauri_specta::{collect_commands, collect_events, Builder as SpectaBuilder, ErrorHandlingMode};
|
use tauri_specta::{collect_commands, collect_events, Builder as SpectaBuilder, ErrorHandlingMode};
|
||||||
|
|
||||||
use crate::services::app_events::{
|
use crate::services::app_events::{
|
||||||
ActiveDollSpriteChanged, AppDataRefreshed, AuthFlowUpdated, CreateDoll, CursorMoved,
|
ActiveDollSpriteChanged, AppDataRefreshed, AuthFlowUpdated, CreateDoll, CursorMoved, EditDoll,
|
||||||
EditDoll, FriendActiveDollChanged, FriendActiveDollSpritesUpdated,
|
FriendActiveDollChanged, FriendActiveDollSpritesUpdated, FriendCursorPositionsUpdated,
|
||||||
FriendCursorPositionsUpdated, FriendDisconnected,
|
FriendDisconnected, FriendRequestAccepted, FriendRequestDenied, FriendRequestReceived,
|
||||||
FriendRequestAccepted, FriendRequestDenied, FriendRequestReceived, FriendUserStatusChanged,
|
FriendUserStatusChanged, InteractionDeliveryFailed, InteractionReceived,
|
||||||
InteractionDeliveryFailed, InteractionReceived, SceneInteractiveChanged, SetInteractionOverlay,
|
SceneInteractiveChanged, SetInteractionOverlay, Unfriended, UserStatusChanged,
|
||||||
Unfriended, UserStatusChanged,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static APP_HANDLE: std::sync::OnceLock<tauri::AppHandle<tauri::Wry>> = std::sync::OnceLock::new();
|
static APP_HANDLE: std::sync::OnceLock<tauri::AppHandle<tauri::Wry>> = std::sync::OnceLock::new();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use reqwest::Client;
|
use reqwest::Client;
|
||||||
|
|
||||||
use crate::{lock_r, services::auth::with_auth, state::FDOLL, models::dolls::*};
|
|
||||||
use crate::models::remote_error::RemoteError;
|
use crate::models::remote_error::RemoteError;
|
||||||
|
use crate::{lock_r, models::dolls::*, services::auth::with_auth, state::FDOLL};
|
||||||
|
|
||||||
pub struct DollsRemote {
|
pub struct DollsRemote {
|
||||||
pub base_url: String,
|
pub base_url: String,
|
||||||
@@ -19,7 +19,8 @@ impl DollsRemote {
|
|||||||
.expect("App configuration error")
|
.expect("App configuration error")
|
||||||
.clone(),
|
.clone(),
|
||||||
client: guard
|
client: guard
|
||||||
.network.clients
|
.network
|
||||||
|
.clients
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.expect("App configuration error")
|
.expect("App configuration error")
|
||||||
.http_client
|
.http_client
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use reqwest::Client;
|
use reqwest::Client;
|
||||||
|
|
||||||
use crate::{lock_r, services::auth::with_auth, state::FDOLL, models::friends::*};
|
|
||||||
use crate::models::remote_error::RemoteError;
|
use crate::models::remote_error::RemoteError;
|
||||||
|
use crate::{lock_r, models::friends::*, services::auth::with_auth, state::FDOLL};
|
||||||
|
|
||||||
pub struct FriendRemote {
|
pub struct FriendRemote {
|
||||||
pub base_url: String,
|
pub base_url: String,
|
||||||
@@ -19,7 +19,8 @@ impl FriendRemote {
|
|||||||
.expect("App configuration error")
|
.expect("App configuration error")
|
||||||
.clone(),
|
.clone(),
|
||||||
client: guard
|
client: guard
|
||||||
.network.clients
|
.network
|
||||||
|
.clients
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.expect("App configuration error")
|
.expect("App configuration error")
|
||||||
.http_client
|
.http_client
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use reqwest::Client;
|
use reqwest::Client;
|
||||||
|
|
||||||
use crate::{lock_r, state::FDOLL, models::health::*};
|
use crate::{lock_r, models::health::*, state::FDOLL};
|
||||||
|
|
||||||
pub struct HealthRemote {
|
pub struct HealthRemote {
|
||||||
pub base_url: String,
|
pub base_url: String,
|
||||||
@@ -18,7 +18,8 @@ impl HealthRemote {
|
|||||||
.ok_or(HealthError::ConfigMissing("api_base_url"))?;
|
.ok_or(HealthError::ConfigMissing("api_base_url"))?;
|
||||||
|
|
||||||
let client = guard
|
let client = guard
|
||||||
.network.clients
|
.network
|
||||||
|
.clients
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|c| c.http_client.clone())
|
.map(|c| c.http_client.clone())
|
||||||
.ok_or(HealthError::ConfigMissing("http_client"))?;
|
.ok_or(HealthError::ConfigMissing("http_client"))?;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use reqwest::{Client, Error};
|
use reqwest::{Client, Error};
|
||||||
|
|
||||||
use crate::{lock_r, services::auth::with_auth, state::FDOLL, models::user::*};
|
use crate::{lock_r, models::user::*, services::auth::with_auth, state::FDOLL};
|
||||||
|
|
||||||
pub struct UserRemote {
|
pub struct UserRemote {
|
||||||
pub base_url: String,
|
pub base_url: String,
|
||||||
@@ -18,7 +18,8 @@ impl UserRemote {
|
|||||||
.expect("App configuration error")
|
.expect("App configuration error")
|
||||||
.clone(),
|
.clone(),
|
||||||
client: guard
|
client: guard
|
||||||
.network.clients
|
.network
|
||||||
|
.clients
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.expect("App configuration error")
|
.expect("App configuration error")
|
||||||
.http_client
|
.http_client
|
||||||
|
|||||||
@@ -63,7 +63,10 @@ pub async fn init_app_data_scoped(scope: AppDataRefreshScope) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if matches!(scope, AppDataRefreshScope::All | AppDataRefreshScope::Friends) {
|
if matches!(
|
||||||
|
scope,
|
||||||
|
AppDataRefreshScope::All | AppDataRefreshScope::Friends
|
||||||
|
) {
|
||||||
match friend_remote.get_friends().await {
|
match friend_remote.get_friends().await {
|
||||||
Ok(friends_list) => {
|
Ok(friends_list) => {
|
||||||
let mut guard = lock_w!(FDOLL);
|
let mut guard = lock_w!(FDOLL);
|
||||||
|
|||||||
@@ -96,7 +96,11 @@ pub async fn start_sso(provider: &str, redirect_uri: &str) -> Result<StartSsoRes
|
|||||||
.send()
|
.send()
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
ensure_success(response).await?.json().await.map_err(AuthError::from)
|
ensure_success(response)
|
||||||
|
.await?
|
||||||
|
.json()
|
||||||
|
.await
|
||||||
|
.map_err(AuthError::from)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn exchange_sso_code(code: &str) -> Result<AuthPass, AuthError> {
|
pub async fn exchange_sso_code(code: &str) -> Result<AuthPass, AuthError> {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use tauri_specta::Event as _;
|
|
||||||
use tauri_plugin_opener::OpenerExt;
|
use tauri_plugin_opener::OpenerExt;
|
||||||
|
use tauri_specta::Event as _;
|
||||||
use tokio::io::{AsyncReadExt, AsyncWriteExt};
|
use tokio::io::{AsyncReadExt, AsyncWriteExt};
|
||||||
use tokio::net::{TcpListener, TcpStream};
|
use tokio::net::{TcpListener, TcpStream};
|
||||||
use tokio_util::sync::CancellationToken;
|
use tokio_util::sync::CancellationToken;
|
||||||
@@ -90,7 +90,9 @@ pub async fn start_browser_auth_flow(provider: &str) -> Result<(), AuthError> {
|
|||||||
|
|
||||||
if callback.params.state != expected_state {
|
if callback.params.state != expected_state {
|
||||||
error!("SSO state mismatch");
|
error!("SSO state mismatch");
|
||||||
if let Err(err) = write_html_response(&mut callback.stream, AUTH_FAILED_HTML).await {
|
if let Err(err) =
|
||||||
|
write_html_response(&mut callback.stream, AUTH_FAILED_HTML).await
|
||||||
|
{
|
||||||
warn!("Failed to write auth failure response: {}", err);
|
warn!("Failed to write auth failure response: {}", err);
|
||||||
}
|
}
|
||||||
emit_auth_flow_event(
|
emit_auth_flow_event(
|
||||||
@@ -109,7 +111,8 @@ pub async fn start_browser_auth_flow(provider: &str) -> Result<(), AuthError> {
|
|||||||
Err(err) => {
|
Err(err) => {
|
||||||
error!("Failed to exchange SSO code: {}", err);
|
error!("Failed to exchange SSO code: {}", err);
|
||||||
if let Err(write_err) =
|
if let Err(write_err) =
|
||||||
write_html_response(&mut callback.stream, AUTH_FAILED_HTML).await
|
write_html_response(&mut callback.stream, AUTH_FAILED_HTML)
|
||||||
|
.await
|
||||||
{
|
{
|
||||||
warn!("Failed to write auth failure response: {}", write_err);
|
warn!("Failed to write auth failure response: {}", write_err);
|
||||||
}
|
}
|
||||||
@@ -127,7 +130,8 @@ pub async fn start_browser_auth_flow(provider: &str) -> Result<(), AuthError> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if !is_auth_flow_active(flow_id) {
|
if !is_auth_flow_active(flow_id) {
|
||||||
let _ = write_html_response(&mut callback.stream, AUTH_CANCELLED_HTML).await;
|
let _ = write_html_response(&mut callback.stream, AUTH_CANCELLED_HTML)
|
||||||
|
.await;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,7 +186,9 @@ pub async fn start_browser_auth_flow(provider: &str) -> Result<(), AuthError> {
|
|||||||
} else {
|
} else {
|
||||||
AUTH_FAILED_HTML
|
AUTH_FAILED_HTML
|
||||||
};
|
};
|
||||||
if let Err(err) = write_html_response(&mut callback.stream, response_html).await {
|
if let Err(err) =
|
||||||
|
write_html_response(&mut callback.stream, response_html).await
|
||||||
|
{
|
||||||
warn!("Failed to write auth callback response: {}", err);
|
warn!("Failed to write auth callback response: {}", err);
|
||||||
}
|
}
|
||||||
emit_auth_flow_event(
|
emit_auth_flow_event(
|
||||||
@@ -294,7 +300,8 @@ async fn parse_callback(stream: &mut TcpStream) -> Result<Option<OAuthCallbackPa
|
|||||||
(Some("GET"), Some(path)) if path.starts_with("/callback") => {
|
(Some("GET"), Some(path)) if path.starts_with("/callback") => {
|
||||||
let parsed = url::Url::parse(&format!("http://localhost{}", path))
|
let parsed = url::Url::parse(&format!("http://localhost{}", path))
|
||||||
.map_err(|e| AuthError::RequestFailed(e.to_string()))?;
|
.map_err(|e| AuthError::RequestFailed(e.to_string()))?;
|
||||||
let params: std::collections::HashMap<_, _> = parsed.query_pairs().into_owned().collect();
|
let params: std::collections::HashMap<_, _> =
|
||||||
|
parsed.query_pairs().into_owned().collect();
|
||||||
|
|
||||||
let state = params
|
let state = params
|
||||||
.get("state")
|
.get("state")
|
||||||
@@ -372,7 +379,10 @@ fn oauth_error_message(error_code: &str, description: Option<&String>) -> String
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn is_oauth_cancellation(error_code: &str) -> bool {
|
fn is_oauth_cancellation(error_code: &str) -> bool {
|
||||||
matches!(error_code, "access_denied" | "user_cancelled" | "authorization_cancelled")
|
matches!(
|
||||||
|
error_code,
|
||||||
|
"access_denied" | "user_cancelled" | "authorization_cancelled"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn write_html_response(stream: &mut TcpStream, html: &str) -> Result<(), AuthError> {
|
async fn write_html_response(stream: &mut TcpStream, html: &str) -> Result<(), AuthError> {
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
use tracing::info;
|
|
||||||
use tokio::time::{timeout, Duration};
|
use tokio::time::{timeout, Duration};
|
||||||
|
use tracing::info;
|
||||||
|
|
||||||
use crate::get_app_handle;
|
use crate::get_app_handle;
|
||||||
use crate::services::{scene::close_splash_window, session::construct_user_session, welcome::close_welcome_window};
|
use crate::services::{
|
||||||
|
scene::close_splash_window, session::construct_user_session, welcome::close_welcome_window,
|
||||||
|
};
|
||||||
use crate::state::auth::get_auth_pass_with_refresh;
|
use crate::state::auth::get_auth_pass_with_refresh;
|
||||||
use crate::{lock_w, state::FDOLL};
|
use crate::{lock_w, state::FDOLL};
|
||||||
|
|
||||||
@@ -26,7 +28,12 @@ pub async fn logout() -> Result<(), AuthError> {
|
|||||||
clear_auth_pass()?;
|
clear_auth_pass()?;
|
||||||
|
|
||||||
if let Some(refresh_token) = refresh_token {
|
if let Some(refresh_token) = refresh_token {
|
||||||
match timeout(Duration::from_secs(5), super::api::logout_remote(&refresh_token)).await {
|
match timeout(
|
||||||
|
Duration::from_secs(5),
|
||||||
|
super::api::logout_remote(&refresh_token),
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
{
|
||||||
Ok(Ok(())) => {}
|
Ok(Ok(())) => {}
|
||||||
Ok(Err(err)) => info!("Failed to revoke refresh token on server: {}", err),
|
Ok(Err(err)) => info!("Failed to revoke refresh token on server: {}", err),
|
||||||
Err(_) => info!("Timed out while revoking refresh token on server"),
|
Err(_) => info!("Timed out while revoking refresh token on server"),
|
||||||
|
|||||||
@@ -7,12 +7,7 @@ use std::time::Duration;
|
|||||||
use tokio::sync::mpsc;
|
use tokio::sync::mpsc;
|
||||||
use tracing::{debug, error, info, warn};
|
use tracing::{debug, error, info, warn};
|
||||||
|
|
||||||
use crate::{
|
use crate::{get_app_handle, lock_r, services::app_events::CursorMoved, state::FDOLL};
|
||||||
get_app_handle,
|
|
||||||
lock_r,
|
|
||||||
services::app_events::CursorMoved,
|
|
||||||
state::FDOLL,
|
|
||||||
};
|
|
||||||
use tauri_specta::Event as _;
|
use tauri_specta::Event as _;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, Type)]
|
#[derive(Debug, Clone, Serialize, Deserialize, Type)]
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
init::lifecycle::validate_server_health,
|
init::lifecycle::validate_server_health, lock_w, services::session::handle_disastrous_failure,
|
||||||
lock_w,
|
services::ws::client::establish_websocket_connection, state::FDOLL,
|
||||||
services::session::handle_disastrous_failure,
|
|
||||||
services::ws::client::establish_websocket_connection,
|
|
||||||
state::FDOLL,
|
|
||||||
};
|
};
|
||||||
use tokio::time::{self, Duration};
|
use tokio::time::{self, Duration};
|
||||||
use tokio_util::sync::CancellationToken;
|
use tokio_util::sync::CancellationToken;
|
||||||
@@ -13,7 +10,7 @@ use tracing::{info, warn};
|
|||||||
/// and attempts to recover WebSocket connection if health checks fail.
|
/// and attempts to recover WebSocket connection if health checks fail.
|
||||||
pub async fn start_health_monitor() {
|
pub async fn start_health_monitor() {
|
||||||
stop_health_monitor();
|
stop_health_monitor();
|
||||||
|
|
||||||
let cancel_token = CancellationToken::new();
|
let cancel_token = CancellationToken::new();
|
||||||
{
|
{
|
||||||
let mut guard = lock_w!(FDOLL);
|
let mut guard = lock_w!(FDOLL);
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
use tracing::warn;
|
use tracing::warn;
|
||||||
|
|
||||||
use crate::{models::interaction::SendInteractionDto, services::ws::{ws_emit_soft, WS_EVENT}};
|
use crate::{
|
||||||
|
models::interaction::SendInteractionDto,
|
||||||
|
services::ws::{ws_emit_soft, WS_EVENT},
|
||||||
|
};
|
||||||
|
|
||||||
pub async fn send_interaction(dto: SendInteractionDto) -> Result<(), String> {
|
pub async fn send_interaction(dto: SendInteractionDto) -> Result<(), String> {
|
||||||
ws_emit_soft(WS_EVENT::CLIENT_SEND_INTERACTION, dto)
|
ws_emit_soft(WS_EVENT::CLIENT_SEND_INTERACTION, dto)
|
||||||
|
|||||||
@@ -23,9 +23,11 @@ pub async fn establish_websocket_connection() {
|
|||||||
return; // Success
|
return; // Success
|
||||||
} else {
|
} else {
|
||||||
// Connection failed, trigger disaster recovery
|
// Connection failed, trigger disaster recovery
|
||||||
crate::services::session::handle_disastrous_failure(
|
crate::services::session::handle_disastrous_failure(Some(
|
||||||
Some("WebSocket connection failed. Please check your network and try again.".to_string())
|
"WebSocket connection failed. Please check your network and try again."
|
||||||
).await;
|
.to_string(),
|
||||||
|
))
|
||||||
|
.await;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -34,9 +36,10 @@ pub async fn establish_websocket_connection() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If we exhausted retries without valid token
|
// If we exhausted retries without valid token
|
||||||
crate::services::session::handle_disastrous_failure(
|
crate::services::session::handle_disastrous_failure(Some(
|
||||||
Some("Failed to authenticate. Please restart and sign in again.".to_string())
|
"Failed to authenticate. Please restart and sign in again.".to_string(),
|
||||||
).await;
|
))
|
||||||
|
.await;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn init_ws_client() -> bool {
|
pub async fn init_ws_client() -> bool {
|
||||||
|
|||||||
@@ -2,7 +2,10 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
lock_w,
|
lock_w,
|
||||||
models::app_data::UserData,
|
models::app_data::UserData,
|
||||||
services::{app_data::update_display_dimensions_for_scene_state, presence_modules::models::ModuleMetadata},
|
services::{
|
||||||
|
app_data::update_display_dimensions_for_scene_state,
|
||||||
|
presence_modules::models::ModuleMetadata,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
use std::sync::{Arc, LazyLock, RwLock};
|
use std::sync::{Arc, LazyLock, RwLock};
|
||||||
use tauri::tray::TrayIcon;
|
use tauri::tray::TrayIcon;
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ pub struct NetworkState {
|
|||||||
pub health_monitor_token: Option<tokio_util::sync::CancellationToken>,
|
pub health_monitor_token: Option<tokio_util::sync::CancellationToken>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub fn init_network_state() -> NetworkState {
|
pub fn init_network_state() -> NetworkState {
|
||||||
let http_client = reqwest::ClientBuilder::new()
|
let http_client = reqwest::ClientBuilder::new()
|
||||||
.timeout(std::time::Duration::from_secs(30))
|
.timeout(std::time::Duration::from_secs(30))
|
||||||
|
|||||||
Reference in New Issue
Block a user