diff options
Diffstat (limited to 'src/frontend/mod.rs')
-rw-r--r-- | src/frontend/mod.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/frontend/mod.rs b/src/frontend/mod.rs index 890879c..6194249 100644 --- a/src/frontend/mod.rs +++ b/src/frontend/mod.rs @@ -257,6 +257,7 @@ pub async fn mainpage<S: Storage>(mut req: Request<ApplicationState<S>>) -> Resu webmention: None, microsub: None, }, + feeds: Vec::default(), content: OnboardingPage {}.to_string(), } .to_string(), @@ -281,6 +282,7 @@ pub async fn mainpage<S: Storage>(mut req: Request<ApplicationState<S>>) -> Resu webmention: None, microsub: None, }, + feeds: backend.get_channels(hcard_url).await.unwrap_or_else(|_| Vec::default()), content: MainPage { feed: &feed?, card: &card?, @@ -335,6 +337,7 @@ pub async fn render_post<S: Storage>(mut req: Request<ApplicationState<S>>) -> R } }; let origin = url.origin(); + let owner = origin.ascii_serialization() + "/"; Ok(Response::builder(200) .content_type("text/html; charset=utf-8") @@ -346,7 +349,7 @@ pub async fn render_post<S: Storage>(mut req: Request<ApplicationState<S>>) -> R blog_name: &req .state() .storage - .get_setting("site_name", &(origin.ascii_serialization() + "/")) // XXX I'm pretty sure this is bound to cause issues with IDN-style domains + .get_setting("site_name", &owner) // XXX I'm pretty sure this is bound to cause issues with IDN-style domains .await .unwrap_or_else(|_| "Kitty Box!".to_string()), endpoints: IndiewebEndpoints { @@ -355,6 +358,7 @@ pub async fn render_post<S: Storage>(mut req: Request<ApplicationState<S>>) -> R webmention: None, microsub: None, }, + feeds: req.state().storage.get_channels(&owner).await.unwrap_or_else(|e| Vec::default()), content: template, } .to_string(), @@ -376,12 +380,14 @@ where ) -> Result { let authorization_endpoint = request.state().authorization_endpoint.to_string(); let token_endpoint = request.state().token_endpoint.to_string(); + let owner = request.url().origin().ascii_serialization().clone() + "/"; let site_name = &request .state() .storage - .get_setting("site_name", &(request.url().origin().ascii_serialization().clone() + "/")) + .get_setting("site_name", &owner) .await .unwrap_or_else(|_| "Kitty Box!".to_string()); + let feeds = request.state().storage.get_channels(&owner).await.unwrap_or_else(|_| Vec::default()); let mut res = next.run(request).await; let mut code: Option<StatusCode> = None; if let Some(err) = res.downcast_error::<FrontendError>() { @@ -406,6 +412,7 @@ where webmention: None, microsub: None, }, + feeds: feeds, content: ErrorPage { code }.to_string(), } .to_string(), |