This commit is contained in:
SpikeHD
2023-04-21 17:37:21 -07:00
parent 4bcfd7ec09
commit 64a04e927c
4 changed files with 20 additions and 0 deletions

1
src-tauri/Cargo.lock generated
View File

@@ -796,6 +796,7 @@ dependencies = [
"duct",
"file_diff",
"futures-util",
"getopts",
"http",
"hudsucker",
"is_elevated",

View File

@@ -28,6 +28,7 @@ tauri = { version = "1.0.7", features = ["api-all"] }
# Arg parsing
args = "2.0"
getopts = "0.2"
# Access system process info.
sysinfo = "0.24.6"

View File

@@ -3,9 +3,12 @@
windows_subsystem = "windows"
)]
use args::validations::{Order, OrderValidation};
use args::{Args, ArgsError};
use file_helpers::dir_exists;
use getopts;
use once_cell::sync::Lazy;
use proxy::set_proxy_addr;
use std::fs;
use std::io::Write;
use std::{collections::HashMap, sync::Mutex};
@@ -53,6 +56,14 @@ async fn parse_args(inp: &Vec<String>) -> Result<Args, ArgsError> {
);
args.flag("g", "no-gui", "Run in CLI mode");
args.flag("s", "server", "Launch the configured GC server");
args.option(
"H",
"host",
"Host to connect to (eg. 'localhost:443' or 'my.awesomeserver.com:6969)",
"SERVER_HOST",
getopts::Occur::Optional,
None,
);
args.parse(inp).unwrap();
@@ -82,6 +93,11 @@ async fn parse_args(inp: &Vec<String>) -> Result<Args, ArgsError> {
);
}
if !args.value_of::<String>("host")?.is_empty() {
let host = args.value_of::<String>("host")?;
set_proxy_addr(host);
}
if args.value_of("proxy")? {
println!("Starting proxy server...");
let mut pathbuf = tauri::api::path::data_dir().unwrap();

View File

@@ -47,6 +47,8 @@ pub fn set_proxy_addr(addr: String) {
} else {
*SERVER.lock().unwrap() = addr;
}
println!("Set server to {}", SERVER.lock().unwrap());
}
#[async_trait]