remove rss dep

This commit is contained in:
philipp 2023-05-24 09:05:07 +02:00
parent fbdb7c0c32
commit bfdc815a36
2 changed files with 9 additions and 11 deletions

View File

@ -16,4 +16,3 @@ serde = { version = "1.0", features = [ "derive" ]}
serde_json = "1.0" serde_json = "1.0"
chrono = { version = "0.4", features = ["serde"]} chrono = { version = "0.4", features = ["serde"]}
tera = { version = "1.18", features = ["date-locale"]} tera = { version = "1.18", features = ["date-locale"]}
rss = "2.0"

View File

@ -32,17 +32,16 @@ LIMIT 1000
} }
pub async fn generate_feed(db: &SqlitePool) -> String { pub async fn generate_feed(db: &SqlitePool) -> String {
let mut channel = ChannelBuilder::default() let mut ret = String::from("<?xml version=\"1.0\" encoding=\"utf-8\"?>
.title("Ruder App Admin Feed") <rss version=\"2.0\">
.description("An RSS feed with activities from app.rudernlinz.at") <channel>
.build(); <title>Ruder App Admin Feed</title>
let mut items: Vec<Item> = vec![]; <description>An RSS feed with activities from app.rudernlinz.at</description>");
for log in Self::last(db).await { for log in Self::last(db).await {
let mut item = Item::default(); ret.push_str("<item>");
item.set_title(format!("({}) {}", log.created_at, log.msg)); ret.push_str(&format!("({}) {}", log.created_at, log.msg));
items.append(&mut vec![item]); ret.push_str("</item>");
} }
channel.set_items(items); ret
channel.to_string()
} }
} }