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 bridge.run(ui_tx, cmd_rx, shutdown_rx, proxy_events_rx, client_msgs_tx).await
}); });
let config_clone = config.clone(); let config_clone = config.clone();
let proxy_task = tokio::spawn(async move { let mut proxy_task = tokio::spawn(async move {
tunnel::run_local_proxy( tunnel::run_local_proxy(
config.local_proxy, config.local_proxy,
config.ostp, config.ostp,
@ -230,7 +230,7 @@ pub async fn run_client_core(
}); });
let wintun_shutdown_rx = shutdown_tx.subscribe(); 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 { Some(tokio::spawn(async move {
tunnel::run_tun_tunnel(config_clone, wintun_shutdown_rx).await tunnel::run_tun_tunnel(config_clone, wintun_shutdown_rx).await
})) }))

View File

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