From a250c653d7b983ea8b22e6479686fba9fe8ffa5a Mon Sep 17 00:00:00 2001 From: char-ptr <44528100+char-ptr@users.noreply.github.com> Date: Thu, 5 Sep 2024 07:10:33 +0100 Subject: [PATCH] chore: prep release --- Cargo.lock | 1 + gdke-gui/bun.lockb | Bin 104927 -> 104927 bytes gdke-gui/src-tauri/Cargo.toml | 2 +- gdke-gui/src-tauri/src/lib.rs | 28 +++++++++++++++------------- gdke-gui/src/App.tsx | 2 +- src/lib.rs | 2 +- 6 files changed, 19 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cb9d8c1..12c3815 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1382,6 +1382,7 @@ name = "gdke-gui" version = "0.1.0" dependencies = [ "anyhow", + "gdke", "serde", "serde_json", "tauri", diff --git a/gdke-gui/bun.lockb b/gdke-gui/bun.lockb index dcd918782becbd65dff29ec6bff844c5b3cc2d23..d8f95cf75da51c88e0c1eb7bbc521478ea84c711 100755 GIT binary patch delta 25 hcmcb=neF~&wuUW?^M%92%P`` delta 25 dcmcb=neF~&wuUW?^M%=&7{FlrGGRu`HUM-K2T=e3 diff --git a/gdke-gui/src-tauri/Cargo.toml b/gdke-gui/src-tauri/Cargo.toml index 4721efa..a91738c 100644 --- a/gdke-gui/src-tauri/Cargo.toml +++ b/gdke-gui/src-tauri/Cargo.toml @@ -21,4 +21,4 @@ serde = { version = "1", features = ["derive"] } serde_json = "1" tauri-plugin-dialog = "2.0.0-rc" anyhow = "*" -# gdke = { path = "../.." } +gdke = { path = "../.." } diff --git a/gdke-gui/src-tauri/src/lib.rs b/gdke-gui/src-tauri/src/lib.rs index bd343a1..c95a650 100644 --- a/gdke-gui/src-tauri/src/lib.rs +++ b/gdke-gui/src-tauri/src/lib.rs @@ -3,21 +3,23 @@ use std::{ffi::OsStr, path::Path}; // Learn more about Tauri commands at https://tauri.app/v1/guides/features/command #[tauri::command] fn get_secret(program: &Path, sig: &str) -> Result { - spawn_and_inject_sig(program, sig) - .map_err(|e| e.to_string()) - .map(|val| { - let mut hex_str = "0x".to_string(); - for char in val { - hex_str.push_str(&format!("{char:02X}")) - } - hex_str - }) + unsafe { + gdke::spawn_and_inject(program, sig) + .map_err(|e| e.to_string()) + .map(|val| { + let mut hex_str = "0x".to_string(); + for char in val { + hex_str.push_str(&format!("{char:02X}")) + } + hex_str + }) + } // String::new() } -fn spawn_and_inject_sig>(proc: T, sig: &str) -> anyhow::Result<[u8; 32]> { - Ok([62; 32]) - // Err(()) -} +// fn spawn_and_inject_sig>(proc: T, sig: &str) -> anyhow::Result<[u8; 32]> { +// Ok([62; 32]) +// // Err(()) +// } #[cfg_attr(mobile, tauri::mobile_entry_point)] pub fn run() { diff --git a/gdke-gui/src/App.tsx b/gdke-gui/src/App.tsx index 8ed8ba5..6d59cd7 100644 --- a/gdke-gui/src/App.tsx +++ b/gdke-gui/src/App.tsx @@ -39,7 +39,7 @@ function App() { set_outcome([true, out as string]); set_loading(false); }, - (e) => { + (_) => { set_loading(false); set_outcome([false]); }, diff --git a/src/lib.rs b/src/lib.rs index 88b3e78..c1e4392 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -66,7 +66,7 @@ pub unsafe fn spawn_and_inject>(proc: T, sig: &str) -> anyhow::R if !pth.is_file() { panic!("file does not exist"); } - let cmd_line_c = CString::new(proc).expect("invalid cstr"); + let cmd_line_c = CString::new(proc.as_ref().as_encoded_bytes()).expect("invalid cstr"); let start_up_info = STARTUPINFOA { wShowWindow: 0, ..Default::default()