Skip to content

Commit

Permalink
Fix setup (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
petrvecera committed Feb 27, 2024
1 parent 0ad0a22 commit 6c489f3
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 24 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "coh3-stats-desktop-app",
"private": true,
"version": "1.2.8",
"version": "1.2.9",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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 = ""
Expand Down
33 changes: 13 additions & 20 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand All @@ -73,6 +72,19 @@ fn main() {
fn setup(app: &mut tauri::App) -> Result<(), Box<dyn std::error::Error>> {
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());
Expand All @@ -94,25 +106,6 @@ fn setup(app: &mut tauri::App) -> Result<(), Box<dyn std::error::Error>> {
Ok(())
}

fn setup_web_server(app: &mut tauri::App) -> Result<(), Box<dyn std::error::Error>> {
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 {
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"package": {
"productName": "Coh3 Stats Desktop App",
"version": "1.2.8"
"version": "1.2.9"
},
"tauri": {
"allowlist": {
Expand Down

0 comments on commit 6c489f3

Please sign in to comment.