diff --git a/plume-models/src/blogs.rs b/plume-models/src/blogs.rs index 6c5a449d..2a64d886 100644 --- a/plume-models/src/blogs.rs +++ b/plume-models/src/blogs.rs @@ -81,7 +81,7 @@ pub struct NewBlog { pub summary_html: SafeString, pub icon_id: Option, pub banner_id: Option, - pub custom_domain: Option, + pub custom_domain: Option, } const BLOG_PREFIX: &str = "~"; @@ -311,6 +311,15 @@ impl Blog { .map(|_| ()) .map_err(Error::from) } + + pub fn list_custom_domains(conn: &Connection) -> Result> { + blogs::table + .filter(blogs::custom_domain.is_not_null()) + .select(blogs::custom_domain) + .load::>(conn) + .map_err(Error::from) + .map(|res| res.into_iter().map(|s| s.unwrap()).collect::>()) + } } impl<'a, 'r> FromRequest<'a, 'r> for Host { diff --git a/src/main.rs b/src/main.rs index 0bdfaddc..6c466777 100644 --- a/src/main.rs +++ b/src/main.rs @@ -175,6 +175,9 @@ Then try to restart Plume println!("Please refer to the documentation to see how to configure it."); } + let custom_domains = plume_models::blogs::Blog::list_custom_domains(&dbpool.get().unwrap()).unwrap(); + dbg!(custom_domains); + let rocket = rocket::custom(CONFIG.rocket.clone().unwrap()) .mount( "/",