diff options
author | Vika <vika@fireburn.ru> | 2022-05-07 20:28:43 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2022-05-07 20:28:43 +0300 |
commit | 139b7ec10bc7f08dae9bd57eef8eff73fbb22061 (patch) | |
tree | 973c4d903e731cb5e38b682f22c38c3da1dbcd92 /src/frontend/mod.rs | |
parent | 0679de841840c74ab49f54905783fac1faf028e1 (diff) | |
download | kittybox-139b7ec10bc7f08dae9bd57eef8eff73fbb22061.tar.zst |
Split into different crates
Templates and utility types are now separate crates to speed up compilation, linting and potential reuse/replacement. Potentially more crates could be split out/modularized, resulting in speedups, smaller binaries (whenever features are excluded) and even more reuse capabilities.
Diffstat (limited to 'src/frontend/mod.rs')
-rw-r--r-- | src/frontend/mod.rs | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/frontend/mod.rs b/src/frontend/mod.rs index daeebd9..106d839 100644 --- a/src/frontend/mod.rs +++ b/src/frontend/mod.rs @@ -4,21 +4,12 @@ use serde::{Deserialize, Serialize}; use futures_util::TryFutureExt; use warp::{http::StatusCode, Filter, host::Authority, path::FullPath}; -static POSTS_PER_PAGE: usize = 20; - //pub mod login; -mod templates; #[allow(unused_imports)] -use templates::{ErrorPage, MainPage, OnboardingPage, Template}; - -#[derive(Clone, Serialize, Deserialize)] -pub struct IndiewebEndpoints { - pub authorization_endpoint: String, - pub token_endpoint: String, - pub webmention: Option<String>, - pub microsub: Option<String>, -} +use kittybox_templates::{ErrorPage, MainPage, OnboardingPage, Template, POSTS_PER_PAGE}; + +pub use kittybox_util::IndiewebEndpoints; #[derive(Deserialize)] struct QueryParams { @@ -364,17 +355,17 @@ pub fn catchall<D: Storage>(db: D, endpoints: IndiewebEndpoints) -> impl Filter< { Some("h-entry") => Ok(( post_name.unwrap_or("Note").to_string(), - templates::Entry { post: &post }.to_string(), + kittybox_templates::Entry { post: &post }.to_string(), StatusCode::OK )), Some("h-card") => Ok(( post_name.unwrap_or("Contact card").to_string(), - templates::VCard { card: &post }.to_string(), + kittybox_templates::VCard { card: &post }.to_string(), StatusCode::OK )), Some("h-feed") => Ok(( post_name.unwrap_or("Feed").to_string(), - templates::Feed { feed: &post }.to_string(), + kittybox_templates::Feed { feed: &post }.to_string(), StatusCode::OK )), _ => Err(warp::reject::custom(FrontendError::with_code( |