start on login

This commit is contained in:
Joseph Montanaro
2023-04-27 14:24:08 -07:00
parent ebc00a5df6
commit 741169d807
9 changed files with 101 additions and 27 deletions

View File

@ -21,7 +21,7 @@ use state::AppState;
pub static APP: OnceCell<AppHandle> = OnceCell::new();
fn main() {
let initial_state = match rt::block_on(state::AppState::load()) {
let initial_state = match rt::block_on(AppState::load()) {
Ok(state) => state,
Err(e) => {eprintln!("{}", e); return;}
};
@ -42,6 +42,8 @@ fn main() {
APP.set(app.handle()).unwrap();
let state = app.state::<AppState>();
let config = state.config.read().unwrap();
config::set_auto_launch(config.start_on_login)?;
let addr = std::net::SocketAddrV4::new(config.listen_addr, config.listen_port);
tauri::async_runtime::spawn(server::serve(addr, app.handle()));