reorganized files
This commit is contained in:
@@ -3,9 +3,9 @@ use tauri_plugin_positioner::WindowExt;
|
|||||||
use tracing::{error, info};
|
use tracing::{error, info};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
core::services::{auth::get_tokens, preferences::create_preferences_window},
|
|
||||||
get_app_handle,
|
get_app_handle,
|
||||||
services::overlay::{overlay_fullscreen, SCENE_WINDOW_LABEL},
|
services::overlay::{overlay_fullscreen, SCENE_WINDOW_LABEL},
|
||||||
|
services::{auth::get_tokens, preferences::create_preferences_window},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub async fn start_fdoll() {
|
pub async fn start_fdoll() {
|
||||||
@@ -21,7 +21,7 @@ pub async fn init_session() {
|
|||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
info!("No active session, user needs to authenticate");
|
info!("No active session, user needs to authenticate");
|
||||||
crate::core::services::auth::init_auth_code_retrieval(|| {
|
crate::services::auth::init_auth_code_retrieval(|| {
|
||||||
info!("Authentication successful, creating scene...");
|
info!("Authentication successful, creating scene...");
|
||||||
tauri::async_runtime::spawn(async {
|
tauri::async_runtime::spawn(async {
|
||||||
info!("Creating scene after auth success...");
|
info!("Creating scene after auth success...");
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
pub mod models;
|
|
||||||
pub mod services;
|
|
||||||
pub mod state;
|
|
||||||
pub mod utilities;
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
pub mod auth;
|
|
||||||
pub mod preferences;
|
|
||||||
pub mod ws;
|
|
||||||
@@ -5,8 +5,10 @@ use tracing_subscriber;
|
|||||||
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();
|
||||||
|
|
||||||
mod app;
|
mod app;
|
||||||
mod core;
|
mod models;
|
||||||
mod services;
|
mod services;
|
||||||
|
mod state;
|
||||||
|
mod utilities;
|
||||||
|
|
||||||
/// Tauri app handle
|
/// Tauri app handle
|
||||||
pub fn get_app_handle<'a>() -> &'a tauri::AppHandle<tauri::Wry> {
|
pub fn get_app_handle<'a>() -> &'a tauri::AppHandle<tauri::Wry> {
|
||||||
@@ -24,7 +26,7 @@ fn setup_fdoll() -> Result<(), tauri::Error> {
|
|||||||
.with_line_number(true)
|
.with_line_number(true)
|
||||||
.init();
|
.init();
|
||||||
|
|
||||||
core::state::init_fdoll_state();
|
state::init_fdoll_state();
|
||||||
async_runtime::spawn(async move { app::start_fdoll().await });
|
async_runtime::spawn(async move { app::start_fdoll().await });
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use crate::{core::state::FDOLL, lock_r, lock_w, APP_HANDLE};
|
use crate::{lock_r, lock_w, state::FDOLL, APP_HANDLE};
|
||||||
use base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine};
|
use base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine};
|
||||||
use flate2::{read::GzDecoder, write::GzEncoder, Compression};
|
use flate2::{read::GzDecoder, write::GzEncoder, Compression};
|
||||||
use keyring::Entry;
|
use keyring::Entry;
|
||||||
@@ -18,7 +18,7 @@ use url::form_urlencoded;
|
|||||||
static REFRESH_LOCK: once_cell::sync::Lazy<Mutex<()>> =
|
static REFRESH_LOCK: once_cell::sync::Lazy<Mutex<()>> =
|
||||||
once_cell::sync::Lazy::new(|| Mutex::new(()));
|
once_cell::sync::Lazy::new(|| Mutex::new(()));
|
||||||
|
|
||||||
static AUTH_SUCCESS_HTML: &str = include_str!("../../assets/auth-success.html");
|
static AUTH_SUCCESS_HTML: &str = include_str!("../assets/auth-success.html");
|
||||||
const SERVICE_NAME: &str = "friendolls";
|
const SERVICE_NAME: &str = "friendolls";
|
||||||
|
|
||||||
/// Errors that can occur during OAuth authentication flow.
|
/// Errors that can occur during OAuth authentication flow.
|
||||||
@@ -586,7 +586,7 @@ where
|
|||||||
error!("Failed to save auth pass: {}", e);
|
error!("Failed to save auth pass: {}", e);
|
||||||
} else {
|
} else {
|
||||||
info!("Authentication successful!");
|
info!("Authentication successful!");
|
||||||
crate::core::services::ws::init_ws_client().await;
|
crate::services::ws::init_ws_client().await;
|
||||||
on_success();
|
on_success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -139,7 +139,7 @@ async fn init_cursor_tracking() -> Result<(), String> {
|
|||||||
// Report to server (existing functionality)
|
// Report to server (existing functionality)
|
||||||
let mapped_for_ws = mapped.clone();
|
let mapped_for_ws = mapped.clone();
|
||||||
tauri::async_runtime::spawn(async move {
|
tauri::async_runtime::spawn(async move {
|
||||||
crate::core::services::ws::report_cursor_data(mapped_for_ws).await;
|
crate::services::ws::report_cursor_data(mapped_for_ws).await;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Broadcast to ALL windows using events
|
// Broadcast to ALL windows using events
|
||||||
|
|||||||
@@ -1,2 +1,5 @@
|
|||||||
|
pub mod auth;
|
||||||
pub mod cursor;
|
pub mod cursor;
|
||||||
pub mod overlay;
|
pub mod overlay;
|
||||||
|
pub mod preferences;
|
||||||
|
pub mod ws;
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ use tauri::async_runtime;
|
|||||||
use tracing::{error, info};
|
use tracing::{error, info};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
core::{models::app_config::AppConfig, state::FDOLL},
|
|
||||||
lock_r, lock_w,
|
lock_r, lock_w,
|
||||||
services::cursor::CursorPosition,
|
services::cursor::CursorPosition,
|
||||||
|
{models::app_config::AppConfig, state::FDOLL},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Define a callback for handling incoming messages (e.g., 'pong')
|
// Define a callback for handling incoming messages (e.g., 'pong')
|
||||||
@@ -61,7 +61,7 @@ pub async fn init_ws_client() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn build_ws_client(app_config: &AppConfig) -> rust_socketio::client::Client {
|
pub async fn build_ws_client(app_config: &AppConfig) -> rust_socketio::client::Client {
|
||||||
let token = crate::core::services::auth::get_access_token()
|
let token = crate::services::auth::get_access_token()
|
||||||
.await
|
.await
|
||||||
.expect("No access token available for WebSocket connection");
|
.expect("No access token available for WebSocket connection");
|
||||||
|
|
||||||
@@ -1,10 +1,8 @@
|
|||||||
// in app-core/src/state.rs
|
// in app-core/src/state.rs
|
||||||
use crate::{
|
use crate::{
|
||||||
core::{
|
lock_w,
|
||||||
models::app_config::{AppConfig, AuthConfig},
|
models::app_config::{AppConfig, AuthConfig},
|
||||||
services::auth::{load_auth_pass, AuthPass},
|
services::auth::{load_auth_pass, AuthPass},
|
||||||
},
|
|
||||||
lock_w,
|
|
||||||
};
|
};
|
||||||
use std::{
|
use std::{
|
||||||
env,
|
env,
|
||||||
@@ -81,7 +79,7 @@ pub fn init_fdoll_state() {
|
|||||||
|
|
||||||
if has_auth {
|
if has_auth {
|
||||||
async_runtime::spawn(async move {
|
async_runtime::spawn(async move {
|
||||||
crate::core::services::ws::init_ws_client().await;
|
crate::services::ws::init_ws_client().await;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user