2024-05-12 12:34:29 +00:00
|
|
|
// Prevents an additional console window on Windows in release, DO NOT REMOVE!!
|
2024-03-28 21:26:48 +00:00
|
|
|
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
|
|
|
|
|
2024-05-12 12:40:06 +00:00
|
|
|
extern crate core;
|
|
|
|
|
|
2024-11-05 20:39:21 +00:00
|
|
|
use log::{info, warn};
|
|
|
|
|
use mindwork_ai_studio::app_window::start_tauri;
|
2026-02-03 13:32:17 +00:00
|
|
|
use mindwork_ai_studio::runtime_certificate::{generate_runtime_certificate};
|
2024-11-05 20:39:21 +00:00
|
|
|
use mindwork_ai_studio::environment::is_dev;
|
|
|
|
|
use mindwork_ai_studio::log::init_logging;
|
2025-05-03 12:26:13 +00:00
|
|
|
use mindwork_ai_studio::metadata::MetaData;
|
2024-11-05 20:39:21 +00:00
|
|
|
use mindwork_ai_studio::runtime_api::start_runtime_api;
|
2026-05-14 15:16:28 +00:00
|
|
|
use mindwork_ai_studio::secret::init_secret_store;
|
2024-09-01 18:10:03 +00:00
|
|
|
|
2026-07-16 11:43:37 +00:00
|
|
|
// Keep `main` synchronous. Tauri owns the application's Tokio runtime, and Tauri itself as
|
|
|
|
|
// well as synchronous plugins may internally call `block_on` while they are initialized.
|
|
|
|
|
// In v26.7.3, `#[tokio::main]` caused the Linux single-instance plugin's synchronous D-Bus
|
|
|
|
|
// setup to enter `block_on` through zbus/tokio. Cargo feature unification made that path use
|
|
|
|
|
// Tokio, so startup panicked because a runtime was being started from inside another runtime.
|
|
|
|
|
//
|
|
|
|
|
// Run asynchronous background work with `tauri::async_runtime::spawn`. If startup must await
|
|
|
|
|
// asynchronous work, call `tauri::async_runtime::block_on` from this synchronous function
|
|
|
|
|
// before Tauri enters its event loop. If a real `#[tokio::main]` ever becomes unavoidable,
|
|
|
|
|
// first call `tauri::async_runtime::set(tokio::runtime::Handle::current())` before using any
|
|
|
|
|
// Tauri async function. Then audit every synchronously initialized Tauri plugin and transitive
|
|
|
|
|
// dependency for internal `block_on` calls. In particular, the Linux single-instance/D-Bus
|
|
|
|
|
// path must be made async, replaced, or moved to a non-conflicting backend. Such a runtime
|
|
|
|
|
// change requires explicit Linux startup tests; compiling successfully is not sufficient.
|
|
|
|
|
fn main() {
|
2025-05-03 12:26:13 +00:00
|
|
|
let metadata = MetaData::init_from_string(include_str!("../../metadata.txt"));
|
2026-07-19 20:48:30 +00:00
|
|
|
let tauri_context = tauri::generate_context!();
|
|
|
|
|
let bundle_identifier = tauri_context.config().identifier.clone();
|
2024-05-21 16:55:35 +00:00
|
|
|
|
2026-07-19 20:48:30 +00:00
|
|
|
init_logging(&bundle_identifier);
|
2024-05-21 16:55:35 +00:00
|
|
|
info!("Starting MindWork AI Studio:");
|
2024-11-05 20:39:21 +00:00
|
|
|
|
2024-09-03 14:13:57 +00:00
|
|
|
let working_directory = std::env::current_dir().unwrap();
|
|
|
|
|
info!(".. The working directory is: '{working_directory:?}'");
|
|
|
|
|
|
2025-05-03 12:26:13 +00:00
|
|
|
info!(".. Version: v{app_version} (commit {hash}, build {build_num}, {architecture})",
|
|
|
|
|
app_version = metadata.app_version,
|
|
|
|
|
hash = metadata.app_commit_hash,
|
|
|
|
|
build_num = metadata.build_number,
|
|
|
|
|
architecture = metadata.architecture);
|
|
|
|
|
info!(".. Build time: {build_time}", build_time = metadata.build_time);
|
|
|
|
|
info!(".. .NET SDK: v{sdk_version}", sdk_version = metadata.dotnet_sdk_version);
|
|
|
|
|
info!(".. .NET: v{dotnet_version}", dotnet_version = metadata.dotnet_version);
|
|
|
|
|
info!(".. Rust: v{rust_version}", rust_version = metadata.rust_version);
|
|
|
|
|
info!(".. MudBlazor: v{mud_blazor_version}", mud_blazor_version = metadata.mud_blazor_version);
|
|
|
|
|
info!(".. Tauri: v{tauri_version}", tauri_version = metadata.tauri_version);
|
|
|
|
|
info!(".. PDFium: v{pdfium_version}", pdfium_version = metadata.pdfium_version);
|
2026-06-02 15:22:59 +00:00
|
|
|
info!(".. Vector store: v{vector_store_version}", vector_store_version = metadata.vector_store_version);
|
2024-05-21 16:55:35 +00:00
|
|
|
|
2024-05-12 12:40:06 +00:00
|
|
|
if is_dev() {
|
|
|
|
|
warn!("Running in development mode.");
|
|
|
|
|
} else {
|
|
|
|
|
info!("Running in production mode.");
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-14 15:16:28 +00:00
|
|
|
init_secret_store();
|
2026-02-03 13:32:17 +00:00
|
|
|
generate_runtime_certificate();
|
2024-11-05 20:39:21 +00:00
|
|
|
start_runtime_api();
|
2025-05-17 11:36:28 +00:00
|
|
|
|
2026-07-19 20:48:30 +00:00
|
|
|
start_tauri(tauri_context);
|
2024-04-05 20:23:01 +00:00
|
|
|
}
|