mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2025-01-07 12:15:24 +00:00
list custom_domains
thanks a lot to @fdb-hiroshima and @BaptisteGelez for helping with the code.
This commit is contained in:
parent
65ae51b7e5
commit
351c01f71c
2 changed files with 13 additions and 1 deletions
|
@ -81,7 +81,7 @@ pub struct NewBlog {
|
|||
pub summary_html: SafeString,
|
||||
pub icon_id: Option<i32>,
|
||||
pub banner_id: Option<i32>,
|
||||
pub custom_domain: Option<String>,
|
||||
pub custom_domain: Option<Host>,
|
||||
}
|
||||
|
||||
const BLOG_PREFIX: &str = "~";
|
||||
|
@ -311,6 +311,15 @@ impl Blog {
|
|||
.map(|_| ())
|
||||
.map_err(Error::from)
|
||||
}
|
||||
|
||||
pub fn list_custom_domains(conn: &Connection) -> Result<Vec<String>> {
|
||||
blogs::table
|
||||
.filter(blogs::custom_domain.is_not_null())
|
||||
.select(blogs::custom_domain)
|
||||
.load::<Option<String>>(conn)
|
||||
.map_err(Error::from)
|
||||
.map(|res| res.into_iter().map(|s| s.unwrap()).collect::<Vec<_>>())
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'r> FromRequest<'a, 'r> for Host {
|
||||
|
|
|
@ -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(
|
||||
"/",
|
||||
|
|
Loading…
Reference in a new issue