replace gethostname with hostname

This commit is contained in:
Luna Yao
2026-04-17 18:43:16 +02:00
parent ba7fc1098b
commit 3795800975
4 changed files with 18 additions and 27 deletions
+1 -4
View File
@@ -225,10 +225,7 @@ pub async fn run_web_client(
let mut flags = global_ctx.get_flags();
flags.bind_device = false;
global_ctx.set_flags(flags);
let hostname = match hostname {
None => gethostname::gethostname().to_string_lossy().to_string(),
Some(hostname) => hostname,
};
let hostname = hostname.unwrap_or_else(|| hostname::get().unwrap_or_default().to_string_lossy().into_owned());
Ok(WebClient::new(
create_connector_by_url(c_url.as_str(), &global_ctx, IpVersion::Both).await?,
token.to_string(),