Inline mvp and custom override CSS when rendering RSS posts

This commit is contained in:
2024-08-05 15:47:31 -07:00
parent 359e798cfa
commit 530bd8e350
5 changed files with 315 additions and 274 deletions

View File

@@ -14,7 +14,7 @@ const THREAD_PREFIX: &'static str = "news:";
use crate::{
error::ServerError,
graphql::{Body, Email, Html, Message, Tag, Thread, ThreadSummary},
EscapeHtml, SanitizeHtml, Transformer,
EscapeHtml, InlineStyle, SanitizeHtml, Transformer,
};
pub fn is_newsreader_search(query: &str) -> bool {
@@ -213,6 +213,7 @@ pub async fn thread(pool: &PgPool, thread_id: String) -> Result<Thread, ServerEr
// * Some sites appear to be HTML encoded, unencode them, i.e. imperialviolent
let tranformers: Vec<Box<dyn Transformer>> = vec![
Box::new(EscapeHtml),
Box::new(InlineStyle),
Box::new(SanitizeHtml {
cid_prefix: "",
base_url: &link,
@@ -224,7 +225,7 @@ pub async fn thread(pool: &PgPool, thread_id: String) -> Result<Thread, ServerEr
}
}
let body = Body::Html(Html {
html: html.to_string(),
html,
content_tree: "".to_string(),
});
let title = r.title.unwrap_or("NO TITLE".to_string());