Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.
Rust downloadmanagerguihacktoberfesthomebrewlightweightlinuxlinux-distributionlocal-firstmacosmacos-packagemedia-toolboxopen-sourcerustsveltetauritrendingtrending-repositorieswindowswindows-desktopytdlp
add AppState struct for Hotmart session management and update Tauri command handler
Tonho417effefe9b5
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rsindex 43ff5b70..4bd5cd10 100644--- a/src-tauri/src/lib.rs+++ b/src-tauri/src/lib.rs@@ -1,9 +1,17 @@+use std::sync::Arc;++use platforms::hotmart::auth::HotmartSession;+pub mod commands;pub mod core;pub mod models;pub mod platforms;pub mod storage;+pub struct AppState {+ pub hotmart_session: Arc<tokio::sync::Mutex<Option<HotmartSession>>>,+}+#[tauri::command]fn greet(name: &str) -> String {format!("Hello, {}! You've been greeted from Rust!", name)@@ -11,13 +19,23 @@ fn greet(name: &str) -> String {#[cfg_attr(mobile, tauri::mobile_entry_point)]pub fn run() {+ tracing_subscriber::fmt::init();++ let state = AppState {+ hotmart_session: Arc::new(tokio::sync::Mutex::new(None)),+ };+tauri::Builder::default()+ .manage(state).plugin(tauri_plugin_shell::init()).plugin(tauri_plugin_store::Builder::default().build()).plugin(tauri_plugin_dialog::init()).plugin(tauri_plugin_notification::init()).plugin(tauri_plugin_fs::init())- .invoke_handler(tauri::generate_handler![greet])+ .invoke_handler(tauri::generate_handler![+ greet,+ commands::auth::hotmart_login,+ ]).run(tauri::generate_context!()).expect("error while running tauri application");}