pub mod hosts;
pub mod lan_ip;
pub mod mdns;
pub mod server;
pub mod trust;
pub mod worktree;
pub fn build_proxy_url(slug: Option<&str>, s: &crate::settings::Settings) -> Option<String> {
if !s.proxy.enable {
return None;
}
let slug = slug?;
let scheme = if s.proxy.https { "https" } else { "http" };
let tld = &s.proxy.tld;
let standard_port = if s.proxy.https { 443u16 } else { 80u16 };
let effective_port = u16::try_from(s.proxy.port).ok().filter(|&p| p > 0)?;
let host = format!("{slug}.{tld}");
Some(if effective_port == standard_port {
format!("{scheme}://{host}")
} else {
format!("{scheme}://{host}:{effective_port}")
})
}