Modules Progress
1. Completed Geolocate API Module 2. Started User Search Modules 3. Laid ground work for Computer Modules Added error handling in Geolocate API Added place holder for update check function Support for C$ File Explorer 1. Need to implement threaded file explorer to prevent parent thread blocking https://pm.racooncity.org/project/champ/kanban 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
This commit is contained in:
Generated
+1713
-556
File diff suppressed because it is too large
Load Diff
+4
-1
@@ -1,12 +1,15 @@
|
||||
[package]
|
||||
name = "champ"
|
||||
version = "0.1.0"
|
||||
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"
|
||||
slint = "1.9.2"
|
||||
tokio = { version = "1.43.0", features = ["full"] }
|
||||
|
||||
[build-dependencies]
|
||||
slint-build = "1.9.2"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
fn main() {
|
||||
let config = slint_build::CompilerConfiguration::new()
|
||||
.with_style("fluent-dark".into());
|
||||
let config = slint_build::CompilerConfiguration::new().with_style("fluent-dark".into());
|
||||
slint_build::compile_with_config("ui/template.slint", config).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
+27
-31
@@ -1,43 +1,39 @@
|
||||
use slint::ComponentHandle;
|
||||
use native_dialog::FileDialog;
|
||||
slint::slint!();
|
||||
slint::include_modules!();
|
||||
use reqwest;
|
||||
use serde_json::Value;
|
||||
use slint::ToSharedString;
|
||||
pub mod utils;
|
||||
|
||||
fn main() {
|
||||
utils::othertoolmodules::update();
|
||||
let app: MainWindow = MainWindow::new().unwrap();
|
||||
let othertoolmodulecallbacks = app.global::<OtherToolCallbacks>();
|
||||
let usermodulecallbacks: UserModuleCallbacks<'_> = app.global::<UserModuleCallbacks>();
|
||||
usermodulecallbacks.on_searchUser({
|
||||
move || {
|
||||
utils::usermodules::username_search();
|
||||
}
|
||||
});
|
||||
let computermodulecallbacks: ComputerModuleCallbacks<'_> =
|
||||
app.global::<ComputerModuleCallbacks>();
|
||||
computermodulecallbacks.on_CFE({
|
||||
let app_weak = app.as_weak();
|
||||
move || {
|
||||
let app: MainWindow = app_weak.unwrap();
|
||||
utils::computermodules::computer_file_explorer(app);
|
||||
}
|
||||
});
|
||||
let othertoolmodulecallbacks: OtherToolCallbacks<'_> = app.global::<OtherToolCallbacks>();
|
||||
othertoolmodulecallbacks.on_killCherwell({
|
||||
move || {
|
||||
utils::othertoolmodules::kill_cherwell();
|
||||
}
|
||||
});
|
||||
othertoolmodulecallbacks.on_ipapi({
|
||||
let app_weak = app.as_weak();
|
||||
move || {
|
||||
let app = app_weak.unwrap();
|
||||
let mut url = String::from("http://ip-api.com/json/");
|
||||
url.push_str(&app.global::<OtherToolCallbacks>().get_ipaddressbar());
|
||||
let resp: String = reqwest::blocking::get(url)
|
||||
.unwrap()
|
||||
.text()
|
||||
.ok()
|
||||
.unwrap()
|
||||
.into();
|
||||
let apitest = geolocateapi(&resp);
|
||||
let isp = apitest["isp"].to_shared_string();
|
||||
let country = apitest["country"].to_shared_string();
|
||||
let region = apitest["regionName"].to_shared_string();
|
||||
let city = apitest["city"].to_shared_string();
|
||||
app.global::<OtherToolCallbacks>()
|
||||
.set_isp(slint::SharedString::from(isp));
|
||||
app.global::<OtherToolCallbacks>()
|
||||
.set_country(slint::SharedString::from(country));
|
||||
app.global::<OtherToolCallbacks>()
|
||||
.set_state(slint::SharedString::from(region));
|
||||
app.global::<OtherToolCallbacks>()
|
||||
.set_city(slint::SharedString::from(city));
|
||||
let app: MainWindow = app_weak.unwrap();
|
||||
utils::othertoolmodules::ip_gelocate_api(app);
|
||||
}
|
||||
});
|
||||
app.run().unwrap();
|
||||
}
|
||||
|
||||
fn geolocateapi(data: &String) -> Value {
|
||||
let parsed: Value = serde_json::from_str(data).unwrap();
|
||||
return (parsed).clone();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
pub mod computermodules;
|
||||
pub mod othertoolmodules;
|
||||
pub mod usermodules;
|
||||
@@ -0,0 +1,46 @@
|
||||
use crate::{ComputerModuleCallbacks, MainWindow};
|
||||
use native_dialog::FileDialog;
|
||||
use slint::ComponentHandle;
|
||||
|
||||
pub fn computer_file_explorer(app: MainWindow) {
|
||||
let computername = &app.global::<ComputerModuleCallbacks>().get_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(app: MainWindow) {
|
||||
let computername = &app.global::<ComputerModuleCallbacks>().get_computername();
|
||||
println!("Test");
|
||||
}
|
||||
|
||||
pub fn laps_password_viewer(app: MainWindow) {
|
||||
let computername = &app.global::<ComputerModuleCallbacks>().get_computername();
|
||||
println!("Test");
|
||||
}
|
||||
|
||||
pub fn remote_to_computer(app: MainWindow) {
|
||||
let computername = &app.global::<ComputerModuleCallbacks>().get_computername();
|
||||
println!("Test");
|
||||
}
|
||||
|
||||
pub fn reboot_with_remote(app: MainWindow) {
|
||||
let computername = &app.global::<ComputerModuleCallbacks>().get_computername();
|
||||
println!("Test");
|
||||
}
|
||||
|
||||
pub fn sccm_log_parse(app: MainWindow) {
|
||||
let computername = &app.global::<ComputerModuleCallbacks>().get_computername();
|
||||
println!("Test");
|
||||
}
|
||||
|
||||
fn path_validate() {
|
||||
println!("Finding Path");
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
use crate::{MainWindow, OtherToolCallbacks};
|
||||
use reqwest;
|
||||
use serde_json::Value;
|
||||
use slint::{ComponentHandle, ToSharedString};
|
||||
|
||||
pub fn kill_cherwell() {
|
||||
println!("Test");
|
||||
}
|
||||
|
||||
pub fn ip_gelocate_api(app: MainWindow) {
|
||||
let mut url: String = String::from("http://ip-api.com/json/");
|
||||
url.push_str(&app.global::<OtherToolCallbacks>().get_ipaddressbar());
|
||||
let resp: Result<reqwest::blocking::Response, reqwest::Error> = reqwest::blocking::get(url);
|
||||
match &resp {
|
||||
Err(_e) => {
|
||||
app.global::<OtherToolCallbacks>()
|
||||
.set_isp(slint::SharedString::from("Failed to resolve IP/URL"));
|
||||
app.global::<OtherToolCallbacks>()
|
||||
.set_country(slint::SharedString::from("Failed to resolve IP/URL"));
|
||||
app.global::<OtherToolCallbacks>()
|
||||
.set_state(slint::SharedString::from("Failed to resolve IP/URL"));
|
||||
app.global::<OtherToolCallbacks>()
|
||||
.set_city(slint::SharedString::from("Failed to resolve IP/URL"));
|
||||
}
|
||||
Ok(_t) => {
|
||||
let result: String = resp.unwrap().text().unwrap();
|
||||
let parsed: Value = serde_json::from_str(&result).unwrap();
|
||||
let isp: slint::SharedString = parsed["isp"].to_shared_string();
|
||||
let country: slint::SharedString = parsed["country"].to_shared_string();
|
||||
let region: slint::SharedString = parsed["regionName"].to_shared_string();
|
||||
let city: slint::SharedString = parsed["city"].to_shared_string();
|
||||
app.global::<OtherToolCallbacks>().set_isp(isp);
|
||||
app.global::<OtherToolCallbacks>().set_country(country);
|
||||
app.global::<OtherToolCallbacks>().set_state(region);
|
||||
app.global::<OtherToolCallbacks>().set_city(city);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn update() {
|
||||
println!("Checking for Updates!");
|
||||
let version: &str = env!("CARGO_PKG_VERSION");
|
||||
println!("{}", version);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
pub fn username_search() {
|
||||
println!("Test");
|
||||
}
|
||||
|
||||
pub fn lastname_search() {
|
||||
println!("Test");
|
||||
}
|
||||
@@ -1,5 +1,15 @@
|
||||
import { AboutSlint, VerticalBox, GridBox, Button, LineEdit, HorizontalBox, TextEdit, SpinBox } from "std-widgets.slint";
|
||||
|
||||
export global ComputerModuleCallbacks {
|
||||
pure callback CFE();
|
||||
pure callback CLU();
|
||||
pure callback LAPS();
|
||||
pure callback RTC();
|
||||
pure callback RRTC();
|
||||
pure callback SLP();
|
||||
in-out property <string> computername;
|
||||
}
|
||||
|
||||
export component ComputerModules inherits Window {
|
||||
VerticalLayout {
|
||||
spacing: 5px;
|
||||
@@ -15,6 +25,9 @@ export component ComputerModules inherits Window {
|
||||
|
||||
LineEdit {
|
||||
height: 35px;
|
||||
edited(text) => {
|
||||
ComputerModuleCallbacks.computername = self.text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +37,9 @@ export component ComputerModules inherits Window {
|
||||
spacing: 5px;
|
||||
Button {
|
||||
text: "Computer File Explorer";
|
||||
clicked => {
|
||||
ComputerModuleCallbacks.CFE();
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import { AboutSlint, VerticalBox, GridBox, Button, LineEdit, HorizontalBox, TextEdit, SpinBox, StandardListView } from "std-widgets.slint";
|
||||
|
||||
export global UserModuleCallbacks {
|
||||
pure callback searchUser();
|
||||
}
|
||||
|
||||
export component UserModules inherits Window {
|
||||
VerticalLayout {
|
||||
spacing: 5px;
|
||||
@@ -29,6 +33,9 @@ export component UserModules inherits Window {
|
||||
Button {
|
||||
text: "Search";
|
||||
primary: true;
|
||||
clicked => {
|
||||
UserModuleCallbacks.searchUser();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ import { ComputerModules } from "pages/computermodules.slint";
|
||||
import { OtherTools } from "pages/othertools.slint";
|
||||
import { SettingsModules } from "pages/settings.slint";
|
||||
import { SideBar } from "sidebar.slint";
|
||||
export { UserModuleCallbacks } from "pages/usermodules.slint";
|
||||
export { ComputerModuleCallbacks } from "pages/computermodules.slint";
|
||||
export { OtherToolCallbacks } from "pages/othertools.slint";
|
||||
|
||||
export component MainWindow inherits Window {
|
||||
|
||||
Reference in New Issue
Block a user