aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/main.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index 1c5126a..60c501f 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -25,6 +25,7 @@ use poem::{
EndpointExt, Route, Server,
};
use poem::{IntoResponse, Response};
+use rand::seq::SliceRandom;
use rust_embed::RustEmbed;
use error::BlossomError;
@@ -45,19 +46,23 @@ struct Static;
#[handler]
async fn home(Data(reqwest): Data<&reqwest::Client>) -> templates::Home {
let listenbrainz_client = listenbrainz::raw::Client::new();
- let (live, listenbrainz, blogposts) = tokio::join!(
+ let (live, listenbrainz, blogposts, poems) = tokio::join!(
live::get_live_status(reqwest),
scrobbles::get_now_playing(&listenbrainz_client),
// skweets::get_recents(&clients.skinnyverse),
- Blogpost::get_articles()
+ Blogpost::get_articles(),
+ Poem::get_articles()
);
let is_live = live.unwrap_or_default().online;
let listenbrainz = listenbrainz.unwrap_or_default();
let blogposts = blogposts.unwrap_or_default();
+ let poems = poems.unwrap_or_default();
+ let poem = poems.choose(&mut rand::thread_rng()).cloned();
templates::Home {
is_live,
listenbrainz,
blogposts,
+ poem,
}
}