diff options
| author | Christine Dodrill <me@christine.website> | 2021-07-05 20:12:42 -0400 |
|---|---|---|
| committer | Christine Dodrill <me@christine.website> | 2021-07-05 20:12:51 -0400 |
| commit | 8ce69f76c79f17c5a0fea1c5d96cd006da8171d0 (patch) | |
| tree | a9dc888be43afc401e9288379ed9e65defea3cdf /src/handlers/feeds.rs | |
| parent | 3c786a1c1fba1155eae9a066887479f4245e2b92 (diff) | |
| download | xesite-8ce69f76c79f17c5a0fea1c5d96cd006da8171d0.tar.xz xesite-8ce69f76c79f17c5a0fea1c5d96cd006da8171d0.zip | |
make new_post route for the android widget
Signed-off-by: Christine Dodrill <me@christine.website>
Diffstat (limited to 'src/handlers/feeds.rs')
| -rw-r--r-- | src/handlers/feeds.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/handlers/feeds.rs b/src/handlers/feeds.rs index d3f0289..3d540f6 100644 --- a/src/handlers/feeds.rs +++ b/src/handlers/feeds.rs @@ -1,5 +1,5 @@ use super::LAST_MODIFIED; -use crate::{app::State, templates}; +use crate::{app::State, post::Post, templates}; use lazy_static::lazy_static; use prometheus::{opts, register_int_counter_vec, IntCounterVec}; use std::{io, sync::Arc}; @@ -22,6 +22,14 @@ pub async fn jsonfeed(state: Arc<State>, since: Option<String>) -> Result<impl R Ok(warp::reply::json(&state.jf)) } +#[instrument(skip(state))] +pub async fn new_post(state: Arc<State>) -> Result<impl Reply, Rejection> { + let state = state.clone(); + let everything = state.everything.clone(); + let p: &Post = everything.iter().next().unwrap(); + Ok(warp::reply::json(&p.new_post)) +} + #[derive(Debug)] pub enum RenderError { Build(warp::http::Error), |
