forked from Ruderverein-Donau-Linz/rowt
add rss feed with common actions
This commit is contained in:
@ -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
17
src/rest/admin/rss.rs
Normal 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]
|
||||
}
|
Reference in New Issue
Block a user