fix(web): for sensitive video dont preload source

This commit is contained in:
əlemi 2024-05-11 21:01:16 +02:00
parent e96b778392
commit a60b5774a1
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -40,18 +40,20 @@ pub fn Attachment(
</p> </p>
}.into_view(), }.into_view(),
"video" => "video" => {
let _href = href.clone();
view! { view! {
<div class="center cursor box ml-1" <div class="center cursor box ml-1"
on:click=move |_| set_expand.set(!expand.get()) on:click=move |_| set_expand.set(!expand.get())
title={object.name().unwrap_or_default().to_string()} title={object.name().unwrap_or_default().to_string()}
> >
<video controls loop class="attachment" class:expand=expand > <video controls loop class="attachment" class:expand=expand >
<source src={href.clone()} type={media_type} /> {move || if sensitive && !expand.get() { None } else { Some(view! { <source src={_href.clone()} type={media_type.clone()} /> }) }}
<a href={href} target="_blank">audio clip</a> <a href={href.clone()} target="_blank">video clip</a>
</video> </video>
</div> </div>
}.into_view(), }.into_view()
},
"audio" => "audio" =>
view! { view! {