Add support for more file types
This commit is contained in:
parent
9b173bd11b
commit
5089122248
|
@ -93,7 +93,7 @@ pub struct Config {
|
|||
}
|
||||
|
||||
pub fn accept() -> &'static str {
|
||||
"image/png,image/jpeg,image/webp,.jpg,.jpeg,.png,.webp"
|
||||
"image/apng,image/avif,image/gif,image/png,image/jpeg,image/jxl,image/webp,.apng,.avif,.gif,.jpg,.jpeg,.jxl,.png,.webp"
|
||||
}
|
||||
|
||||
impl Config {
|
||||
|
@ -787,7 +787,7 @@ async fn view_collection(
|
|||
)
|
||||
}
|
||||
|
||||
#[tracing::instrument(name = "Edit Collection")]
|
||||
#[tracing::instrument(name = "Edit Collection", skip(req))]
|
||||
async fn edit_collection(
|
||||
path: web::Path<CollectionPath>,
|
||||
token: ValidToken,
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
#[derive(Clone, Copy, Debug, serde::Deserialize)]
|
||||
pub(crate) enum Extension {
|
||||
#[serde(rename = "avif")]
|
||||
Avif,
|
||||
|
||||
#[serde(rename = "jpg")]
|
||||
Jpg,
|
||||
|
||||
|
@ -10,6 +13,7 @@ pub(crate) enum Extension {
|
|||
impl std::fmt::Display for Extension {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::Avif => write!(f, "avif"),
|
||||
Self::Jpg => write!(f, "jpg"),
|
||||
Self::Webp => write!(f, "webp"),
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
<div class="image-box">
|
||||
<picture>
|
||||
<source type="image/webp" srcset="@state.srcset(filename, Extension::Webp)" />
|
||||
<source type="image/avif" srcset="@state.srcset(filename, Extension::Avif)" />
|
||||
<source type="image/jpeg" srcset="@state.srcset(filename, Extension::Jpg)" />
|
||||
<img src="@state.image_path(filename)" @if let Some(title)=entry.title.as_ref() { title="@title" } @if let
|
||||
Some(description)=entry.description.as_ref() { alt="@description" } />
|
||||
|
|
Loading…
Reference in a new issue