rss: also add pub_date on user feed

This commit is contained in:
Martin Lindhe 2025-01-24 18:10:27 +01:00
parent 655f72abd5
commit 6a8aedf182

View file

@ -8,6 +8,7 @@ use crate::{config, utils};
use hyper::{Body, Request, Response}; use hyper::{Body, Request, Response};
use rinja::Template; use rinja::Template;
use time::{macros::format_description, OffsetDateTime}; use time::{macros::format_description, OffsetDateTime};
use chrono::DateTime;
// STRUCTS // STRUCTS
#[derive(Template)] #[derive(Template)]
@ -165,6 +166,7 @@ pub async fn rss(req: Request<Body>) -> Result<Response<Body>, String> {
title: Some(post.title.to_string()), title: Some(post.title.to_string()),
link: Some(utils::get_post_url(&post)), link: Some(utils::get_post_url(&post)),
author: Some(post.author.name), author: Some(post.author.name),
pub_date: Some(DateTime::from_timestamp(post.created_ts as i64, 0).unwrap_or_default().to_rfc2822()),
content: Some(rewrite_urls(&post.body)), content: Some(rewrite_urls(&post.body)),
..Default::default() ..Default::default()
}) })