add rss feed with common actions

This commit is contained in:
2023-04-18 12:10:11 +02:00
parent b50d546a5c
commit a3ac83228c
8 changed files with 138 additions and 4 deletions

View File

@ -1,11 +1,13 @@
use rocket::Route;
pub mod planned_event;
pub mod rss;
pub mod user;
pub fn routes() -> Vec<Route> {
let mut ret = Vec::new();
ret.append(&mut user::routes());
ret.append(&mut planned_event::routes());
ret.append(&mut rss::routes());
ret
}

17
src/rest/admin/rss.rs Normal file
View File

@ -0,0 +1,17 @@
use crate::rest::Log;
use rocket::{get, routes, Route, State};
use sqlx::SqlitePool;
#[get("/rss?<key>")]
async fn index(db: &State<SqlitePool>, key: Option<&str>) -> String {
match key {
Some(key) if key.eq("G9h/f2MFEr408IaB4Yd67/maVSsnAJNjcaZ2Tzl5Vo=") => {
Log::generate_feed(db).await
}
_ => "Not allowed".to_string(),
}
}
pub fn routes() -> Vec<Route> {
routes![index]
}