This commit is contained in:
@@ -281,11 +281,7 @@ async fn try_sync_relay(relay: &Relay) -> Result<()> {
|
||||
.await?
|
||||
.is_none();
|
||||
|
||||
let host = if relay.custom_domain_verified == 1 && !relay.custom_domain.is_empty() {
|
||||
relay.custom_domain.clone()
|
||||
} else {
|
||||
format!("{}.{}", relay.subdomain, env::get().relay_domain)
|
||||
};
|
||||
let host = relay.host();
|
||||
|
||||
let mut body = serde_json::json!({
|
||||
"host": host,
|
||||
|
||||
@@ -96,6 +96,18 @@ pub struct Relay {
|
||||
pub created_at: i64,
|
||||
}
|
||||
|
||||
impl Relay {
|
||||
/// The relay's effective public host: its verified custom domain when set,
|
||||
/// otherwise its canonical `<subdomain>.<relay_domain>`.
|
||||
pub fn host(&self) -> String {
|
||||
if self.custom_domain_verified == 1 && !self.custom_domain.is_empty() {
|
||||
self.custom_domain.clone()
|
||||
} else {
|
||||
format!("{}.{}", self.subdomain, crate::env::get().relay_domain)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Relay {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
|
||||
Reference in New Issue
Block a user