aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@blos.sm>2024-01-31 22:12:02 +0000
committerLibravatar cel 🌸 <cel@blos.sm>2024-01-31 22:12:02 +0000
commitf38aaecc9a6abed226648417338baff032be8187 (patch)
tree45406cfec64fcbeba93dc0718bd2fb1348984f37 /src/main.rs
parentb6b6b083d0e41ca64ef09f52120ca8a07d925b56 (diff)
downloadblossom-f38aaecc9a6abed226648417338baff032be8187.tar.gz
blossom-f38aaecc9a6abed226648417338baff032be8187.tar.bz2
blossom-f38aaecc9a6abed226648417338baff032be8187.zip
add random-poem panel
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,
}
}