From 6c489f326255ce27276a7fe14299176d9a0f0d1b Mon Sep 17 00:00:00 2001 From: Petr Vecera Date: Tue, 27 Feb 2024 21:56:33 +0100 Subject: [PATCH] Fix setup (#72) --- package.json | 2 +- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/src/main.rs | 33 +++++++++++++-------------------- src-tauri/tauri.conf.json | 2 +- 5 files changed, 17 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index 8121d0b..f441855 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "coh3-stats-desktop-app", "private": true, - "version": "1.2.8", + "version": "1.2.9", "type": "module", "scripts": { "dev": "vite", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index a2402af..8fa617c 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -718,7 +718,7 @@ dependencies = [ [[package]] name = "coh3-stats-desktop-app" -version = "1.2.8" +version = "1.2.9" dependencies = [ "criterion", "keyring", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 7fc6b96..9fd7e0a 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "coh3-stats-desktop-app" -version = "1.2.8" +version = "1.2.9" description = "COH3 Stats Desktop App" authors = ["coh3stats team"] license = "" diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index f86e463..2979a6c 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -64,7 +64,6 @@ fn main() { )) .plugin(coh3_stats_desktop_app::plugins::cohdb::sync::init()) .setup(setup) - .setup(setup_web_server) .run(tauri::generate_context!()) .expect("error while running tauri application"); @@ -73,6 +72,19 @@ fn main() { fn setup(app: &mut tauri::App) -> Result<(), Box> { let handle = app.handle(); + if load_from_store(handle.clone(), "streamerOverlayEnabled").unwrap_or(false) { + info!("Streamer overlay server is enabled"); + let mut file_path = handle.path_resolver().app_data_dir().unwrap(); + file_path.push("streamerOverlay.html"); + info!("Expecting the streamerOverlay at {:?}", file_path); + + let _handle = thread::spawn(|| { + run_http_server(file_path); + }); + } else { + info!("Streamer overlay server is disabled"); + } + // Set up sync handling // This needs to happen here because it depends on other plugins cohdb::sync::setup(handle.clone()); @@ -94,25 +106,6 @@ fn setup(app: &mut tauri::App) -> Result<(), Box> { Ok(()) } -fn setup_web_server(app: &mut tauri::App) -> Result<(), Box> { - let app_handle = app.handle(); - - if load_from_store(app_handle.clone(), "streamerOverlayEnabled").unwrap_or(false) { - info!("Streamer overlay is enabled"); - let mut file_path = app_handle.path_resolver().app_data_dir().unwrap(); - file_path.push("streamerOverlay.html"); - info!("Expecting the streamerOverlay at {:?}", file_path); - - let _handle = thread::spawn(|| { - run_http_server(file_path); - }); - } else { - info!("Streamer overlay is disabled"); - } - - Ok(()) -} - /// returns the default expected log file path #[tauri::command] fn default_log_file_path() -> String { diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 5bb8134..90569dc 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -7,7 +7,7 @@ }, "package": { "productName": "Coh3 Stats Desktop App", - "version": "1.2.8" + "version": "1.2.9" }, "tauri": { "allowlist": {