forked from coracle/caravel
Put host in the relay stuct
This commit is contained in:
@@ -281,11 +281,7 @@ async fn try_sync_relay(relay: &Relay) -> Result<()> {
|
|||||||
.await?
|
.await?
|
||||||
.is_none();
|
.is_none();
|
||||||
|
|
||||||
let host = if relay.custom_domain_verified == 1 && !relay.custom_domain.is_empty() {
|
let host = relay.host();
|
||||||
relay.custom_domain.clone()
|
|
||||||
} else {
|
|
||||||
format!("{}.{}", relay.subdomain, env::get().relay_domain)
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut body = serde_json::json!({
|
let mut body = serde_json::json!({
|
||||||
"host": host,
|
"host": host,
|
||||||
|
|||||||
@@ -96,6 +96,18 @@ pub struct Relay {
|
|||||||
pub created_at: i64,
|
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 {
|
impl Default for Relay {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
|||||||
Reference in New Issue
Block a user