feat(web): proper posts parsing!!!
This commit is contained in:
parent
4d773d8ca9
commit
34ebd9628b
4 changed files with 441 additions and 362 deletions
790
Cargo.lock
generated
790
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -26,7 +26,7 @@ leptos-use = { version = "0.10", features = ["serde"] }
|
||||||
reqwest = { version = "0.12", features = ["json"] }
|
reqwest = { version = "0.12", features = ["json"] }
|
||||||
apb = { path = "../apb", features = ["unstructured", "activitypub-fe", "activitypub-counters"] }
|
apb = { path = "../apb", features = ["unstructured", "activitypub-fe", "activitypub-counters"] }
|
||||||
futures = "0.3.30"
|
futures = "0.3.30"
|
||||||
dissolve = "0.2" # TODO strip html without this crate
|
|
||||||
lazy_static = "1.4"
|
lazy_static = "1.4"
|
||||||
chrono = { version = "0.4", features = ["serde"] }
|
chrono = { version = "0.4", features = ["serde"] }
|
||||||
web-sys = { version = "0.3", features = ["Screen"] }
|
web-sys = { version = "0.3", features = ["Screen"] }
|
||||||
|
mdhtml = { path = "../mdhtml/" }
|
||||||
|
|
|
@ -79,7 +79,7 @@ pub fn Attachment(
|
||||||
#[component]
|
#[component]
|
||||||
pub fn Object(object: crate::Object) -> impl IntoView {
|
pub fn Object(object: crate::Object) -> impl IntoView {
|
||||||
let oid = object.id().unwrap_or_default().to_string();
|
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_id = object.attributed_to().id().unwrap_or_default();
|
||||||
let author = CACHE.get_or(&author_id, serde_json::Value::String(author_id.clone()).into());
|
let author = CACHE.get_or(&author_id, serde_json::Value::String(author_id.clone()).into());
|
||||||
let sensitive = object.sensitive().unwrap_or_default();
|
let sensitive = object.sensitive().unwrap_or_default();
|
||||||
|
@ -118,7 +118,7 @@ pub fn Object(object: crate::Object) -> impl IntoView {
|
||||||
</table>
|
</table>
|
||||||
<blockquote class="tl">
|
<blockquote class="tl">
|
||||||
<Summary summary=object.summary().map(|x| x.to_string()) open=false >
|
<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_padding}
|
||||||
{attachments}
|
{attachments}
|
||||||
</Summary>
|
</Summary>
|
||||||
|
|
|
@ -153,12 +153,7 @@ pub fn UserPage(tl: Timeline) -> impl IntoView {
|
||||||
None
|
None
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
<blockquote class="ml-2 mt-1">{
|
<blockquote class="ml-2 mt-1" inner_html={mdhtml::safe_html(&summary)}></blockquote>
|
||||||
dissolve::strip_html_tags(&summary)
|
|
||||||
.into_iter()
|
|
||||||
.map(|x| view! { <div>{x}</div> })
|
|
||||||
.collect_view()
|
|
||||||
}</blockquote>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<TimelineFeed tl=tl />
|
<TimelineFeed tl=tl />
|
||||||
|
|
Loading…
Reference in a new issue