diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs index de9b7ad..3d52f46 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,14 +1,17 @@ +#![feature(path_file_prefix)] + +mod article; mod atom; mod blog; mod error; mod live; +mod poetry; mod posts; mod scrobbles; mod skweets; mod templates; mod utils; -use std::rc::Rc; use std::{collections::HashSet, time::Duration}; use poem::http::StatusCode; @@ -28,6 +31,9 @@ use error::BlossomError; use serde::Deserialize; use tracing_subscriber::FmtSubscriber; +use crate::article::Article; +use crate::blog::Blogpost; + type Result<T> = std::result::Result<T, BlossomError>; #[derive(RustEmbed)] @@ -41,7 +47,7 @@ async fn home(Data(reqwest): Data<&reqwest::Client>) -> templates::Home { live::get_live_status(reqwest), scrobbles::get_now_playing(&listenbrainz_client), // skweets::get_recents(&clients.skinnyverse), - blog::get_blogposts() + Blogpost::get_articles() ); let is_live = live.unwrap_or_default().online; let listenbrainz = listenbrainz.unwrap_or_default(); @@ -56,7 +62,7 @@ async fn home(Data(reqwest): Data<&reqwest::Client>) -> templates::Home { // #[get("/blog/<blogpost>")] #[handler] async fn blogpost(Path(blogpost): Path<String>) -> Result<templates::Blogpost> { - let blogpost = blog::get_blogpost(&blogpost).await?; + let blogpost = Blogpost::get_article(&blogpost).await?; Ok(templates::Blogpost { blogpost, filter_tags: HashSet::new(), @@ -71,7 +77,7 @@ struct FilterTags { // #[get("/blog?<filter>")] #[handler] async fn get_blog(filter_tags: Option<Query<FilterTags>>) -> Result<templates::Blog> { - let mut blogposts = blog::get_blogposts().await?; + let mut blogposts = Blogpost::get_articles().await?; let tags: Vec<String> = posts::Post::get_tags(&blogposts) .into_iter() .map(|tag| tag.to_owned()) @@ -90,7 +96,7 @@ async fn get_blog(filter_tags: Option<Query<FilterTags>>) -> Result<templates::B #[handler] async fn feed() -> Result<Response> { - let posts = blog::get_blogposts().await?; + let posts = Blogpost::get_articles().await?; // TODO: i18n let context = atom::Context { page_title: "celeste's hard drive".to_owned(), |