diff --git a/Cargo.lock b/Cargo.lock index e5ccab4..5fc9920 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -72,9 +72,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2faccea4cc4ab4a667ce676a30e8ec13922a692c99bb8f5b11f1502c72e04220" +checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" [[package]] name = "anstyle-parse" @@ -1901,9 +1901,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" +checksum = "d0c62115964e08cb8039170eb33c1d0e2388a256930279edca206fff675f82c3" [[package]] name = "hex" @@ -2566,9 +2566,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", "simd-adler32", @@ -4478,13 +4478,12 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.9.0" +version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" +checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" dependencies = [ "cfg-if", "fastrand 2.0.1", - "redox_syscall", "rustix 0.38.31", "windows-sys 0.52.0", ] @@ -4538,9 +4537,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.33" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b24b79b7a07f10209f19e683ca1e289d80b1e76ffa8c2b779718566a083679" +checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" dependencies = [ "deranged", "itoa 1.0.10", @@ -5538,19 +5537,19 @@ dependencies = [ [[package]] name = "xdg-home" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2769203cd13a0c6015d515be729c526d041e9cf2c0cc478d57faee85f40c6dcd" +checksum = "21e5a325c3cb8398ad6cf859c1135b25dd29e186679cf2da7581d9679f63b38e" dependencies = [ - "nix", + "libc", "winapi", ] [[package]] name = "zbus" -version = "3.14.1" +version = "3.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31de390a2d872e4cd04edd71b425e29853f786dc99317ed72d73d6fcf5ebb948" +checksum = "c45d06ae3b0f9ba1fb2671268b975557d8f5a84bb5ec6e43964f87e763d8bca8" dependencies = [ "async-broadcast", "async-executor", @@ -5589,9 +5588,9 @@ dependencies = [ [[package]] name = "zbus_macros" -version = "3.14.1" +version = "3.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d1794a946878c0e807f55a397187c11fc7a038ba5d868e7db4f3bd7760bc9d" +checksum = "b4a1ba45ed0ad344b85a2bb5a1fe9830aed23d67812ea39a586e7d0136439c7d" dependencies = [ "proc-macro-crate", "proc-macro2", diff --git a/src/main.rs b/src/main.rs index da6298f..97ce3e6 100755 --- a/src/main.rs +++ b/src/main.rs @@ -335,7 +335,7 @@ struct Account { google_auth_secret: String, } -#[derive(Savefile, Clone, Debug)] +#[derive(Savefile, Clone, Debug, Default)] struct SaveData { account: Option, runs_so_far: usize, @@ -343,17 +343,6 @@ struct SaveData { dialogs_displayed: bool, // It makes sense to display them only once per device, as this is how it works in serious applications. } -impl Default for SaveData { - fn default() -> Self { - Self { - account: None, - runs_so_far: 0, - last_update: SystemTime::now().duration_since(UNIX_EPOCH).expect("Damn bro what kinda system you running").as_secs(), - dialogs_displayed: false, - } - } -} - // These files are used to measure download speed. There are multiple // because there are actual server outages and I don't want people to miss // out on this one just because of such a tiny problem @@ -467,20 +456,19 @@ fn sillyness(save_data: &mut SaveData) { // } // } #[cfg(any(target_os = "linux", target_os = "windows"))] - { - jod_thread::spawn(|| { - tauri::Builder::default() - .any_thread() - .invoke_handler(tauri::generate_handler!(tauri_handler)) - .build(tauri::generate_context!()) - .expect("error while building tauri application") - .run(|_app_handle, event| { - if let tauri::RunEvent::ExitRequested { api, .. } = event { - api.prevent_exit(); - } - }); - }); - } + jod_thread::spawn(|| { + tauri::Builder::default() + .any_thread() + .invoke_handler(tauri::generate_handler!(tauri_handler)) + .build(tauri::generate_context!()) + .expect("error while building tauri application") + .run(|_app_handle, event| { + if let tauri::RunEvent::ExitRequested { api, .. } = event { + api.prevent_exit(); + } + }); + }) + .detach(); let has_internet = reqwest::blocking::get("https://google.com").is_ok(); // Googles servers are always up so I'm using them if !has_internet { @@ -496,27 +484,33 @@ fn sillyness(save_data: &mut SaveData) { if !save_data_clone.dialogs_displayed { let _ = native_dialog::MessageDialog::new() .set_type(native_dialog::MessageType::Warning) - .set_title(r#""BadLang™" wants to access your contacts. Allow?"#) + .set_title("BadLang™") + .set_text(r#""BadLang™" wants to access your contacts. Allow?"#) .show_confirm(); let _ = native_dialog::MessageDialog::new() .set_type(native_dialog::MessageType::Warning) - .set_title(r#""BadLang™" wants to access your location. Allow?"#) + .set_title("BadLang™") + .set_text(r#""BadLang™" wants to access your location. Allow?"#) .show_confirm(); let _ = native_dialog::MessageDialog::new() .set_type(native_dialog::MessageType::Warning) - .set_title(r#""BadLang™" wants to make and receive phone calls on your behalf. Allow?"#) + .set_title("BadLang™") + .set_text(r#""BadLang™" wants to make and receive phone calls on your behalf. Allow?"#) .show_confirm(); let _ = native_dialog::MessageDialog::new() .set_type(native_dialog::MessageType::Warning) - .set_title(r#""BadLang™" wants to manage incoming network connections. Allow?"#) + .set_title("BadLang™") + .set_text(r#""BadLang™" wants to manage incoming network connections. Allow?"#) .show_confirm(); let _ = native_dialog::MessageDialog::new() .set_type(native_dialog::MessageType::Warning) - .set_title(r#""BadLang™" wants to access your passwords. Allow?"#) + .set_title("BadLang™") + .set_text(r#""BadLang™" wants to access your passwords. Allow?"#) .show_confirm(); let _ = native_dialog::MessageDialog::new() .set_type(native_dialog::MessageType::Warning) - .set_title(r#""BadLang™" wants to access your liver. Allow?"#) + .set_title("BadLang™") + .set_text(r#""BadLang™" wants to access your liver. Allow?"#) .show_confirm(); } })