v0.1.0-pre.054
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: kb-app-demo-desktop/src/app_state.rs
|
||||
// version: 6
|
||||
// version: 8
|
||||
|
||||
//! Shared Tauri application state and startup initialization.
|
||||
|
||||
@@ -28,6 +28,7 @@ pub(crate) struct AppState {
|
||||
impl crate::AppState {
|
||||
/// Initializes configuration, logging and shared runtime state.
|
||||
pub(crate) fn initialize() -> kb_core::Result<crate::AppState> {
|
||||
load_workspace_dotenv();
|
||||
let config_path = resolve_config_path();
|
||||
let app_config = match kb_config::read_config_json_file(&config_path) {
|
||||
std::result::Result::Ok(config) => config,
|
||||
@@ -179,6 +180,23 @@ impl crate::AppState {
|
||||
}
|
||||
}
|
||||
|
||||
fn load_workspace_dotenv() {
|
||||
let workspace_path = crate::workspace_root_dir().join(".env");
|
||||
load_dotenv_path(&workspace_path);
|
||||
let desktop_path = crate::workspace_root_dir().join("kb-app-demo-desktop/.env");
|
||||
load_dotenv_path(&desktop_path);
|
||||
}
|
||||
|
||||
fn load_dotenv_path(path: &std::path::Path) {
|
||||
let result = dotenvy::from_path(path);
|
||||
if let std::result::Result::Err(error) = result {
|
||||
if matches!(error, dotenvy::Error::Io(ref io_error) if io_error.kind() == std::io::ErrorKind::NotFound) {
|
||||
return;
|
||||
}
|
||||
eprintln!("cannot load {}: {error}", path.display());
|
||||
}
|
||||
}
|
||||
|
||||
fn convert_logging_config(config: &kb_config::LoggingConfig) -> kb_logging::LoggingConfig {
|
||||
let mut targets = std::vec::Vec::<kb_logging::LogTargetConfig>::new();
|
||||
for target in &config.targets {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: kb-app-demo-desktop/src/demo_decode_replay.rs
|
||||
// version: 25
|
||||
// version: 27
|
||||
|
||||
//! Tauri commands and UI payloads for contextual instruction decode replay.
|
||||
|
||||
@@ -299,7 +299,7 @@ pub(crate) struct DemoDecodeReplayObserver<'a> {
|
||||
|
||||
impl kb_pipeline::DecodeReplayObserver for crate::DemoDecodeReplayObserver<'_> {
|
||||
fn on_progress(&self, event: &kb_pipeline::DecodeReplayProgressEvent) {
|
||||
let payload = DemoDecodeReplayProgressPayload {
|
||||
let payload = crate::DemoDecodeReplayProgressPayload {
|
||||
campaign_id: self.campaign_id.clone(),
|
||||
timestamp: event.timestamp.clone(),
|
||||
level: event.level.code().to_string(),
|
||||
@@ -727,7 +727,7 @@ mod tests {
|
||||
assert_eq!(
|
||||
names,
|
||||
std::vec![
|
||||
"kb_decoder_metadata_metaplex_token_metadata".to_string(),
|
||||
"metadata_metaplex_token_metadata".to_string(),
|
||||
"solana_native_classifier".to_string(),
|
||||
"spl_associated_token_account".to_string(),
|
||||
"spl_elgamal_registry".to_string(),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: kb-app-demo-desktop/src/tauri.rs
|
||||
// version: 9
|
||||
// version: 10
|
||||
|
||||
//! Tauri runtime assembly and private command wrappers.
|
||||
|
||||
@@ -92,6 +92,16 @@ pub fn run() -> kb_core::Result<()> {
|
||||
open_demo_config_window,
|
||||
load_demo_config,
|
||||
]);
|
||||
builder = builder.on_window_event(|window, event| {
|
||||
if window.label() != "main" || !matches!(event, tauri::WindowEvent::Destroyed) {
|
||||
return;
|
||||
}
|
||||
let app_handle = window.app_handle().clone();
|
||||
tauri::async_runtime::spawn(async move {
|
||||
let state = app_handle.state::<crate::AppState>();
|
||||
crate::disconnect_demo_ws_app_state(&state, false).await;
|
||||
});
|
||||
});
|
||||
builder = builder.plugin(tracing_builder.build::<tauri::Wry>());
|
||||
builder = builder.setup(|app| {
|
||||
let splash_window = match app.get_webview_window("splash") {
|
||||
@@ -112,6 +122,7 @@ pub fn run() -> kb_core::Result<()> {
|
||||
)));
|
||||
},
|
||||
};
|
||||
let app_handle = app.handle().clone();
|
||||
tauri::async_runtime::spawn(async move {
|
||||
let started_at = tokio::time::Instant::now();
|
||||
crate::emit_splash_order(
|
||||
@@ -135,6 +146,8 @@ pub fn run() -> kb_core::Result<()> {
|
||||
std::option::Option::None,
|
||||
std::option::Option::None,
|
||||
);
|
||||
let state = app_handle.state::<crate::AppState>();
|
||||
crate::initialize_postgres_schema_for_startup(&state, &splash_window).await;
|
||||
crate::emit_splash_order(
|
||||
&splash_window,
|
||||
"fadein",
|
||||
@@ -230,7 +243,7 @@ fn open_demo_core_extraction_window(
|
||||
"demo_core_extraction",
|
||||
tauri::WebviewUrl::App("demo_core_extraction.html".into()),
|
||||
)
|
||||
.title("Khadhroony Bot2 - Extraction canonical vers core")
|
||||
.title("Khadhroony Bot3 - Extraction canonical vers core")
|
||||
.inner_size(1280.0, 860.0)
|
||||
.min_inner_size(960.0, 620.0)
|
||||
.resizable(true)
|
||||
@@ -341,7 +354,7 @@ fn open_demo_decode_replay_window(
|
||||
"demo_decode_replay",
|
||||
tauri::WebviewUrl::App("demo_decode_replay.html".into()),
|
||||
)
|
||||
.title("Khadhroony Bot2 - Décodage et matérialisation")
|
||||
.title("Khadhroony Bot3 - Décodage et matérialisation")
|
||||
.inner_size(1320.0, 900.0)
|
||||
.min_inner_size(980.0, 660.0)
|
||||
.resizable(true)
|
||||
|
||||
Reference in New Issue
Block a user