Filter out videos from gallery example
This commit is contained in:
parent
44e68aa4b6
commit
42d592d87b
2 changed files with 13 additions and 2 deletions
|
|
@ -38,7 +38,11 @@ impl Image {
|
|||
.json()
|
||||
.await?;
|
||||
|
||||
Ok(response.items)
|
||||
Ok(response
|
||||
.items
|
||||
.into_iter()
|
||||
.filter(|image| !image.url.ends_with(".mp4"))
|
||||
.collect())
|
||||
}
|
||||
|
||||
pub async fn blurhash(
|
||||
|
|
|
|||
|
|
@ -256,7 +256,14 @@ impl Gallery {
|
|||
self.now,
|
||||
)
|
||||
})
|
||||
.chain((self.images.len()..=Image::LIMIT).map(|_| placeholder()));
|
||||
.chain(
|
||||
if self.images.is_empty() {
|
||||
0..Image::LIMIT
|
||||
} else {
|
||||
0..0
|
||||
}
|
||||
.map(|_| placeholder()),
|
||||
);
|
||||
|
||||
let gallery = grid(images)
|
||||
.fluid(Preview::WIDTH)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue