diff --git a/src/core/info/version.rs b/src/core/info/version.rs index 40910820..e1e13b76 100644 --- a/src/core/info/version.rs +++ b/src/core/info/version.rs @@ -8,6 +8,7 @@ use std::sync::OnceLock; static BRANDING: &str = "continuwuity"; +static WEBSITE: &str = "https://continuwuity.com"; static SEMANTIC: &str = env!("CARGO_PKG_VERSION"); static VERSION: OnceLock = OnceLock::new(); @@ -23,7 +24,14 @@ pub fn version() -> &'static str { VERSION.get_or_init(init_version) } #[inline] pub fn user_agent() -> &'static str { USER_AGENT.get_or_init(init_user_agent) } -fn init_user_agent() -> String { format!("{}/{}", name(), version()) } +fn init_user_agent() -> String { + format!( + "{}/{SEMANTIC}{} (embedbot; +{WEBSITE})", + name(), + conduwuit_build_metadata::version_tag() + .map_or_else(String::new, |extra| format!("+{extra}")) + ) +} fn init_version() -> String { conduwuit_build_metadata::version_tag() diff --git a/src/service/client/mod.rs b/src/service/client/mod.rs index d109ab6a..bd5853c9 100644 --- a/src/service/client/mod.rs +++ b/src/service/client/mod.rs @@ -39,7 +39,7 @@ impl crate::Service for Service { let url_preview_user_agent = config .url_preview_user_agent .clone() - .unwrap_or_else(|| conduwuit::version::user_agent().to_string()); + .unwrap_or_else(|| conduwuit::version::user_agent().to_owned()); Ok(Arc::new(Self { default: base(config)?