#![cfg_attr( all(not(debug_assertions), target_os = "windows"), windows_subsystem = "windows" )] use std::str::FromStr; mod errors; mod ipc; mod state; mod server; mod storage; fn main() { let initial_state = match state::AppState::new(state::SessionStatus::Locked, None) { Ok(state) => state, Err(e) => {eprintln!("{}", e); return;} }; tauri::Builder::default() .manage(initial_state) .invoke_handler(tauri::generate_handler![ipc::unlock, ipc::respond]) .setup(|app| { let addr = std::net::SocketAddrV4::from_str("127.0.0.1:12345").unwrap(); tauri::async_runtime::spawn(server::serve(addr, app.handle())); Ok(()) }) .run(tauri::generate_context!()) .expect("error while running tauri application"); // let addr = std::net::SocketAddrV4::from_str("127.0.0.1:12345").unwrap(); // let rt = Runtime::new().unwrap(); // rt.block_on(http::serve(addr)).unwrap(); // let creds = std::fs::read_to_string("credentials.json").unwrap(); // storage::save(&creds, "correct horse battery staple"); }