-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add simple http * Add simple http * Web server implmentation * Finish the server hosting * Add sentry config * Update actions * Fix main * Fix getting data from the store * Plugin load changes * Final cleanup
- Loading branch information
1 parent
952b56b
commit 2510c23
Showing
15 changed files
with
299 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use serde::de::DeserializeOwned; | ||
// COH3 Desktop App Utils | ||
use tauri_plugin_store::{StoreCollection, with_store}; | ||
use log::{error}; | ||
use tauri::{AppHandle, Manager, Runtime}; | ||
|
||
pub fn load_from_store<R: Runtime, T: DeserializeOwned>(handle: AppHandle<R>, key: &str) -> Option<T> { | ||
let stores = handle.state::<StoreCollection<R>>(); | ||
let path = handle | ||
.path_resolver() | ||
.app_data_dir() | ||
.unwrap() | ||
.join("config.dat"); | ||
|
||
match with_store(handle.clone(), stores, path, |store| { | ||
Ok(store.get(key).cloned()) | ||
}) { | ||
Ok(Some(value)) => match serde_json::from_value(value.clone()) { | ||
Ok(result) => Some(result), | ||
Err(err) => { | ||
error!("error deserializing store value at {key}: {err}"); | ||
None | ||
} | ||
}, | ||
Ok(None) => None, | ||
Err(err) => { | ||
error!("error retrieving store value at {key}: {err}"); | ||
None | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
pub mod parse_log_file; | ||
pub mod plugins; | ||
pub mod overlay_server; | ||
pub mod dp_utils; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use std::fs::File; | ||
use std::panic; | ||
use log::{error, info}; | ||
use std::path::PathBuf; | ||
|
||
use tiny_http::{Server, Response, StatusCode}; | ||
|
||
pub fn run_http_server(streamer_overlay_path: PathBuf) { | ||
|
||
let result = panic::catch_unwind(|| { | ||
|
||
// Ideally we would allow setting up port in the settings | ||
info!("Starting streamer overlay server on port 47824"); | ||
let server = Server::http("127.0.0.1:47824").unwrap(); | ||
|
||
for request in server.incoming_requests() { | ||
|
||
let file = match File::open(&streamer_overlay_path) { | ||
Ok(file) => file, | ||
Err(_) => { | ||
let response = Response::new_empty(StatusCode(404)); | ||
let _ = request.respond(response); | ||
continue; | ||
} | ||
}; | ||
|
||
let response = Response::from_file(file); | ||
let _ = request.respond(response); | ||
} | ||
|
||
}); | ||
|
||
if let Err(err) = result { | ||
error!("Couldn't start the streamer overlay server: {:?}", err); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,9 @@ | |
}, | ||
"window": { | ||
"all": true | ||
}, | ||
"process": { | ||
"all": true | ||
} | ||
}, | ||
"bundle": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.