From 731db5a50402be298081cfeb916a96da4ca49986 Mon Sep 17 00:00:00 2001 From: brotoskyj Date: Tue, 11 Mar 2025 03:05:32 +0000 Subject: [PATCH] Support for C$ File Explorer 1. Need to implement multi threaded file explorer to prevent parent thread blocking https://pm.racooncity.org/project/champ/kanban --- Cargo.lock | 168 ++++++++++++++++++++++++++++++++--- Cargo.toml | 1 + src/main.rs | 2 +- src/utils/computermodules.rs | 31 +++++-- 4 files changed, 185 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e9326a5..344e4ce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -106,7 +106,7 @@ dependencies = [ "accesskit_macos", "accesskit_unix", "accesskit_windows", - "raw-window-handle", + "raw-window-handle 0.6.2", "winit", ] @@ -242,6 +242,12 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b" +[[package]] +name = "ascii" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16" + [[package]] name = "async-broadcast" version = "0.7.2" @@ -810,6 +816,7 @@ dependencies = [ name = "champ" version = "2025.3.6" dependencies = [ + "native-dialog", "reqwest", "serde_json", "simple-ldap", @@ -859,6 +866,36 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cbd0f76e066e64fdc5631e3bb46381254deab9ef1158292f27c8c57e3bf3fe59" +[[package]] +name = "cocoa" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6140449f97a6e97f9511815c5632d84c8aacf8ac271ad77c559218161a1373c" +dependencies = [ + "bitflags 1.3.2", + "block", + "cocoa-foundation", + "core-foundation 0.9.4", + "core-graphics 0.23.2", + "foreign-types 0.5.0", + "libc", + "objc", +] + +[[package]] +name = "cocoa-foundation" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c6234cbb2e4c785b456c0644748b1ac416dd045799740356f8363dfe00c93f7" +dependencies = [ + "bitflags 1.3.2", + "block", + "core-foundation 0.9.4", + "core-graphics-types 0.1.3", + "libc", + "objc", +] + [[package]] name = "codemap" version = "0.1.3" @@ -1238,6 +1275,27 @@ dependencies = [ "crypto-common", ] +[[package]] +name = "dirs-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + [[package]] name = "dispatch" version = "0.2.0" @@ -1974,7 +2032,7 @@ dependencies = [ "objc2-app-kit 0.2.2", "objc2-foundation 0.2.2", "once_cell", - "raw-window-handle", + "raw-window-handle 0.6.2", "wayland-sys", "windows-sys 0.52.0", "x11-dl", @@ -1988,7 +2046,7 @@ checksum = "85edca7075f8fc728f28cb8fbb111a96c3b89e930574369e3e9c27eb75d3788f" dependencies = [ "cfg_aliases", "glutin", - "raw-window-handle", + "raw-window-handle 0.6.2", "winit", ] @@ -2161,6 +2219,15 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "home" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" +dependencies = [ + "windows-sys 0.59.0", +] + [[package]] name = "http" version = "1.2.0" @@ -2290,7 +2357,7 @@ dependencies = [ "input", "memmap2", "nix", - "raw-window-handle", + "raw-window-handle 0.6.2", "xkbcommon", ] @@ -2354,7 +2421,7 @@ dependencies = [ "muda", "objc2-app-kit 0.3.0", "pin-weak", - "raw-window-handle", + "raw-window-handle 0.6.2", "rgb", "scoped-tls-hkt", "scopeguard", @@ -2438,7 +2505,7 @@ dependencies = [ "pin-project", "pin-weak", "portable-atomic", - "raw-window-handle", + "raw-window-handle 0.6.2", "resvg", "rgb", "rustybuzz", @@ -2521,7 +2588,7 @@ dependencies = [ "objc2-metal 0.3.0", "objc2-quartz-core 0.3.0", "pin-weak", - "raw-window-handle", + "raw-window-handle 0.6.2", "raw-window-metal", "scoped-tls-hkt", "skia-safe", @@ -2813,6 +2880,15 @@ version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.12.1" @@ -3261,6 +3337,29 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "native-dialog" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84e7038885d2aeab236bd60da9e159a5967b47cde3292da3b15ff1bec27c039f" +dependencies = [ + "ascii", + "block", + "cocoa", + "core-foundation 0.9.4", + "dirs-next", + "objc", + "objc-foundation", + "objc_id", + "once_cell", + "raw-window-handle 0.5.2", + "thiserror 1.0.69", + "versions", + "wfd", + "which", + "winapi", +] + [[package]] name = "native-tls" version = "0.2.14" @@ -3289,7 +3388,7 @@ dependencies = [ "log", "ndk-sys", "num_enum", - "raw-window-handle", + "raw-window-handle 0.6.2", "thiserror 1.0.69", ] @@ -4291,6 +4390,12 @@ dependencies = [ "rgb", ] +[[package]] +name = "raw-window-handle" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" + [[package]] name = "raw-window-handle" version = "0.6.2" @@ -4347,6 +4452,17 @@ dependencies = [ "bitflags 2.9.0", ] +[[package]] +name = "redox_users" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" +dependencies = [ + "getrandom 0.2.15", + "libredox", + "thiserror 1.0.69", +] + [[package]] name = "regex" version = "1.11.1" @@ -5003,7 +5119,7 @@ dependencies = [ "objc2 0.5.2", "objc2-foundation 0.2.2", "objc2-quartz-core 0.2.2", - "raw-window-handle", + "raw-window-handle 0.6.2", "redox_syscall 0.5.10", "rustix 0.38.44", "tiny-xlib", @@ -5721,6 +5837,16 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +[[package]] +name = "versions" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c73a36bc44e3039f51fbee93e39f41225f6b17b380eb70cc2aab942df06b34dd" +dependencies = [ + "itertools 0.11.0", + "nom", +] + [[package]] name = "vtable" version = "0.2.1" @@ -5984,6 +6110,28 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082" +[[package]] +name = "wfd" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e713040b67aae5bf1a0ae3e1ebba8cc29ab2b90da9aa1bff6e09031a8a41d7a8" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix 0.38.44", +] + [[package]] name = "winapi" version = "0.3.9" @@ -6349,7 +6497,7 @@ dependencies = [ "orbclient", "percent-encoding", "pin-project", - "raw-window-handle", + "raw-window-handle 0.6.2", "redox_syscall 0.4.1", "rustix 0.38.44", "sctk-adwaita", diff --git a/Cargo.toml b/Cargo.toml index bea194f..8314a79 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,7 @@ version = "2025.3.6" edition = "2021" [dependencies] +native-dialog = { version = "0.7.0", features = ["windows_dpi_awareness", "windows_visual_styles"] } reqwest = { version = "0.12.12", features = ["blocking"] } serde_json = "1.0.137" simple-ldap = "2.1.1" diff --git a/src/main.rs b/src/main.rs index da3781c..7708e72 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,5 @@ use slint::ComponentHandle; - +use native_dialog::FileDialog; slint::slint!(); slint::include_modules!(); pub mod utils; diff --git a/src/utils/computermodules.rs b/src/utils/computermodules.rs index 0180e00..c2a438f 100644 --- a/src/utils/computermodules.rs +++ b/src/utils/computermodules.rs @@ -1,27 +1,46 @@ use crate::{ComputerModuleCallbacks, MainWindow}; +use native_dialog::FileDialog; use slint::ComponentHandle; pub fn computer_file_explorer(app: MainWindow) { let computername = &app.global::().get_computername(); - println!("{}", computername); + let computername: String = computername.to_string(); + let mut path = String::new(); + path.push_str(r"\\"); + path.push_str(&computername); + path.push_str(r"\C$\"); + let dialog = FileDialog::new() + .set_location(&path) + .show_open_single_dir() + .unwrap(); + println!("{}", &dialog); } -pub fn current_logged_on_user() { +pub fn current_logged_on_user(app: MainWindow) { + let computername = &app.global::().get_computername(); println!("Test"); } -pub fn laps_password_viewer() { +pub fn laps_password_viewer(app: MainWindow) { + let computername = &app.global::().get_computername(); println!("Test"); } -pub fn remote_to_computer() { +pub fn remote_to_computer(app: MainWindow) { + let computername = &app.global::().get_computername(); println!("Test"); } -pub fn reboot_with_remote() { +pub fn reboot_with_remote(app: MainWindow) { + let computername = &app.global::().get_computername(); println!("Test"); } -pub fn sccm_log_parse() { +pub fn sccm_log_parse(app: MainWindow) { + let computername = &app.global::().get_computername(); println!("Test"); } + +fn path_validate() { + println!("Finding Path"); +}