fix: restore server-only guard for link printing in init block

This commit is contained in:
ospab 2026-05-16 19:30:15 +03:00
parent 694e420397
commit 5c7a55f9e0
3 changed files with 64 additions and 4074 deletions

4117
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -211,12 +211,12 @@ pub async fn run_client_core(
}
});
let bridge_task = tokio::spawn(async move {
let mut bridge_task = tokio::spawn(async move {
bridge.run(ui_tx, cmd_rx, shutdown_rx, proxy_events_rx, client_msgs_tx).await
});
let config_clone = config.clone();
let proxy_task = tokio::spawn(async move {
let mut proxy_task = tokio::spawn(async move {
tunnel::run_local_proxy(
config.local_proxy,
config.ostp,
@ -230,7 +230,7 @@ pub async fn run_client_core(
});
let wintun_shutdown_rx = shutdown_tx.subscribe();
let wintun_task = if config_clone.mode == "tun" {
let mut wintun_task = if config_clone.mode == "tun" {
Some(tokio::spawn(async move {
tunnel::run_tun_tunnel(config_clone, wintun_shutdown_rx).await
}))

View File

@ -381,15 +381,18 @@ async fn run_app() -> Result<()> {
"debug": false
}}"#, key)
};
fs::write(&args.config, content)?;
fs::write(&args.config, &content)?;
println!("Successfully initialized configuration at {:?}", args.config);
if is_server {
if let AppMode::Server(s) = dummy.mode {
let key = &s.access_keys[0];
let host = get_or_ask_public_ip(&args.config);
println!("\n>>> Handy Client Share Link for your users:");
println!(" ostp://{}@{}:50000", key, host);
let mut stripped = json_comments::StripComments::new(content.as_bytes());
if let Ok(config) = serde_json::from_reader::<_, UnifiedConfig>(&mut stripped) {
if let AppMode::Server(s) = config.mode {
let key = &s.access_keys[0];
let host = get_or_ask_public_ip(&args.config);
println!("\n>>> Handy Client Share Link for your users:");
println!(" ostp://{}@{}:50000", key, host);
}
}
}
return Ok(());