feat(web): proper posts parsing!!!

This commit is contained in:
əlemi 2024-05-02 14:21:42 +02:00
parent 4d773d8ca9
commit 34ebd9628b
Signed by: alemi
GPG key ID: A4895B84D311642C
4 changed files with 441 additions and 362 deletions

790
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -26,7 +26,7 @@ leptos-use = { version = "0.10", features = ["serde"] }
reqwest = { version = "0.12", features = ["json"] }
apb = { path = "../apb", features = ["unstructured", "activitypub-fe", "activitypub-counters"] }
futures = "0.3.30"
dissolve = "0.2" # TODO strip html without this crate
lazy_static = "1.4"
chrono = { version = "0.4", features = ["serde"] }
web-sys = { version = "0.3", features = ["Screen"] }
mdhtml = { path = "../mdhtml/" }

View file

@ -79,7 +79,7 @@ pub fn Attachment(
#[component]
pub fn Object(object: crate::Object) -> impl IntoView {
let oid = object.id().unwrap_or_default().to_string();
let content = dissolve::strip_html_tags(object.content().unwrap_or_default());
let content = mdhtml::safe_html(object.content().unwrap_or_default());
let author_id = object.attributed_to().id().unwrap_or_default();
let author = CACHE.get_or(&author_id, serde_json::Value::String(author_id.clone()).into());
let sensitive = object.sensitive().unwrap_or_default();
@ -118,7 +118,7 @@ pub fn Object(object: crate::Object) -> impl IntoView {
</table>
<blockquote class="tl">
<Summary summary=object.summary().map(|x| x.to_string()) open=false >
{content.into_iter().map(|x| view! { <p>{x}</p> }).collect_view()}
<p inner_html={content}></p>
{attachments_padding}
{attachments}
</Summary>

View file

@ -153,12 +153,7 @@ pub fn UserPage(tl: Timeline) -> impl IntoView {
None
}}
</div>
<blockquote class="ml-2 mt-1">{
dissolve::strip_html_tags(&summary)
.into_iter()
.map(|x| view! { <div>{x}</div> })
.collect_view()
}</blockquote>
<blockquote class="ml-2 mt-1" inner_html={mdhtml::safe_html(&summary)}></blockquote>
</div>
</div>
<TimelineFeed tl=tl />