2022-08-14 20:27:41 +00:00
|
|
|
#![cfg_attr(
|
|
|
|
all(not(debug_assertions), target_os = "windows"),
|
|
|
|
windows_subsystem = "windows"
|
|
|
|
)]
|
|
|
|
|
|
|
|
use std::str::FromStr;
|
2022-11-28 06:03:15 +00:00
|
|
|
|
2022-11-29 00:16:33 +00:00
|
|
|
mod errors;
|
|
|
|
mod ipc;
|
|
|
|
mod state;
|
|
|
|
mod server;
|
2022-08-14 20:27:41 +00:00
|
|
|
mod storage;
|
|
|
|
|
|
|
|
|
|
|
|
fn main() {
|
2022-12-03 06:59:13 +00:00
|
|
|
let initial_state = match state::AppState::new(state::SessionStatus::Locked, None) {
|
|
|
|
Ok(state) => state,
|
|
|
|
Err(e) => {eprintln!("{}", e); return;}
|
|
|
|
};
|
2022-11-29 00:16:33 +00:00
|
|
|
|
2022-08-14 20:27:41 +00:00
|
|
|
tauri::Builder::default()
|
2022-11-29 00:16:33 +00:00
|
|
|
.manage(initial_state)
|
|
|
|
.invoke_handler(tauri::generate_handler![ipc::unlock, ipc::respond])
|
2022-08-14 20:27:41 +00:00
|
|
|
.setup(|app| {
|
|
|
|
let addr = std::net::SocketAddrV4::from_str("127.0.0.1:12345").unwrap();
|
2022-11-29 00:16:33 +00:00
|
|
|
tauri::async_runtime::spawn(server::serve(addr, app.handle()));
|
2022-08-14 20:27:41 +00:00
|
|
|
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");
|
2022-11-29 00:16:33 +00:00
|
|
|
}
|