2024-02-25 00:22:59 -08:00
|
|
|
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
|
|
|
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
|
|
|
|
2024-02-27 22:54:06 -08:00
|
|
|
use tauri::Manager;
|
|
|
|
mod telemetry;
|
2024-03-08 11:44:39 -08:00
|
|
|
use tracing_subscriber::FmtSubscriber;
|
2024-03-10 23:35:27 -07:00
|
|
|
mod close_splashscreen;
|
2024-02-27 22:54:06 -08:00
|
|
|
|
|
|
|
#[derive(Clone, serde::Serialize)]
|
|
|
|
struct Payload {
|
|
|
|
message: String,
|
|
|
|
}
|
|
|
|
|
2024-03-06 23:01:36 -08:00
|
|
|
const NTABLE_IP: (u8, u8, u8, u8) = (10, 12, 80, 2);
|
|
|
|
const NTABLE_PORT: u16 = 5810;
|
|
|
|
|
2024-02-25 00:22:59 -08:00
|
|
|
fn main() {
|
2024-02-28 21:43:18 -08:00
|
|
|
let rt = tokio::runtime::Runtime::new().expect("Failed to create Tokio runtime");
|
|
|
|
|
2024-03-08 11:44:39 -08:00
|
|
|
// set the environment variable RUST_LOG to debug in order to see debug messages
|
|
|
|
let subscriber = FmtSubscriber::builder()
|
|
|
|
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
|
|
|
|
.finish();
|
|
|
|
tracing::subscriber::set_global_default(subscriber).unwrap();
|
|
|
|
|
2024-02-28 21:43:18 -08:00
|
|
|
rt.block_on(async {
|
2024-03-10 23:35:27 -07:00
|
|
|
tauri::Builder::default()
|
|
|
|
.invoke_handler(tauri::generate_handler![
|
|
|
|
close_splashscreen::close_splashscreen
|
|
|
|
])
|
|
|
|
.run(tauri::generate_context!())
|
|
|
|
.expect("failed to run app");
|
|
|
|
|
2024-02-28 21:43:18 -08:00
|
|
|
tauri::Builder::default()
|
|
|
|
.setup(|app| {
|
|
|
|
// create app handle and send it to our event listeners
|
|
|
|
let app_handle = app.app_handle();
|
|
|
|
|
|
|
|
tokio::spawn(async move {
|
2024-03-06 23:14:54 -08:00
|
|
|
crate::telemetry::subscribe_topics(app_handle, NTABLE_IP, NTABLE_PORT).await;
|
2024-02-28 21:43:18 -08:00
|
|
|
});
|
2024-02-27 22:54:06 -08:00
|
|
|
|
2024-02-28 21:43:18 -08:00
|
|
|
Ok(())
|
|
|
|
})
|
|
|
|
.run(tauri::generate_context!())
|
|
|
|
.expect("failed to run app")
|
|
|
|
})
|
2024-02-25 00:22:59 -08:00
|
|
|
}
|