Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⏪ Revert AVIF image support #409

Merged
merged 3 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/actions/build-docker/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ runs:
build-args: |
"GIT_REV=${{ env.GIT_REV }}"
"TAGS=${{ env.TAGS }}"
"RUN_PRISMA_GENERATE=false"
file: docker/Dockerfile
platforms: ${{ inputs.platforms }}
load: ${{ inputs.load }}
Expand Down
3 changes: 0 additions & 3 deletions .github/actions/coverage/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ inputs:
runs:
using: composite
steps:
- name: Setup dav1d
uses: ./.github/actions/setup-dav1d

- name: Setup rust
uses: ./.github/actions/setup-rust
with:
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup dav1d
uses: ./.github/actions/setup-dav1d

- name: Setup rust
uses: ./.github/actions/setup-rust
with:
Expand Down
117 changes: 0 additions & 117 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ email = { path = "../crates/email" }
epub = { git = "https://github.com/stumpapp/epub-rs", rev = "38e091abe96875952556ab7dec195022d0230e14" }
futures = { workspace = true }
globset = "0.4.14"
image = {version = "0.25.2", features = ["avif-native"]}
image = { version = "0.25.2" }
infer = "0.16.0"
itertools = { workspace = true }
prisma-client-rust = { workspace = true }
Expand Down Expand Up @@ -54,7 +54,6 @@ criterion = { version = "0.5.1", features = ["html_reports", "async_tokio"] }

[build-dependencies]
chrono = "0.4.37"
system-deps = "7.0.1"

[target.'cfg(target_os = "linux")'.dependencies]
libc = "0.2.152"
Expand Down
3 changes: 1 addition & 2 deletions core/src/filesystem/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ use walkdir::WalkDir;

use super::{media::is_accepted_cover_name, ContentType, FileError};

pub const ACCEPTED_IMAGE_EXTENSIONS: [&str; 6] =
["jpg", "png", "jpeg", "webp", "avif", "gif"];
pub const ACCEPTED_IMAGE_EXTENSIONS: [&str; 5] = ["jpg", "png", "jpeg", "webp", "gif"];

pub fn read_entire_file<P: AsRef<Path>>(path: P) -> Result<Vec<u8>, FileError> {
let mut file = File::open(path)?;
Expand Down
15 changes: 0 additions & 15 deletions core/src/filesystem/content_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ pub enum ContentType {
PNG,
JPEG,
WEBP,
AVIF,
GIF,
TXT,
#[default]
Expand Down Expand Up @@ -80,7 +79,6 @@ impl ContentType {
"jpg" => ContentType::JPEG,
"jpeg" => ContentType::JPEG,
"webp" => ContentType::WEBP,
"avif" => ContentType::AVIF,
"gif" => ContentType::GIF,
"txt" => ContentType::TXT,
_ => temporary_content_workarounds(extension),
Expand Down Expand Up @@ -267,7 +265,6 @@ impl ContentType {
ContentType::PNG => "png",
ContentType::JPEG => "jpg",
ContentType::WEBP => "webp",
ContentType::AVIF => "avif",
ContentType::GIF => "gif",
ContentType::TXT => "txt",
ContentType::UNKNOWN => "",
Expand All @@ -294,7 +291,6 @@ impl From<&str> for ContentType {
"image/png" => ContentType::PNG,
"image/jpeg" => ContentType::JPEG,
"image/webp" => ContentType::WEBP,
"image/avif" => ContentType::AVIF,
"image/gif" => ContentType::GIF,
_ => ContentType::UNKNOWN,
}
Expand All @@ -316,7 +312,6 @@ impl std::fmt::Display for ContentType {
ContentType::PNG => write!(f, "image/png"),
ContentType::JPEG => write!(f, "image/jpeg"),
ContentType::WEBP => write!(f, "image/webp"),
ContentType::AVIF => write!(f, "image/avif"),
ContentType::GIF => write!(f, "image/gif"),
ContentType::TXT => write!(f, "text/plain"),
ContentType::UNKNOWN => write!(f, "unknown"),
Expand All @@ -332,7 +327,6 @@ impl From<ImageFormat> for ContentType {
// ImageFormat::JpegXl => ContentType::JPEG,
ImageFormat::Png => ContentType::PNG,
ImageFormat::Webp => ContentType::WEBP,
ImageFormat::Avif => ContentType::AVIF,
}
}
}
Expand All @@ -355,7 +349,6 @@ impl TryFrom<ContentType> for image::ImageFormat {
ContentType::PNG => Ok(image::ImageFormat::Png),
ContentType::JPEG => Ok(image::ImageFormat::Jpeg),
ContentType::WEBP => Ok(image::ImageFormat::WebP),
ContentType::AVIF => Ok(image::ImageFormat::Avif),
ContentType::GIF => Ok(image::ImageFormat::Gif),
ContentType::XHTML => Err(unsupported_error("ContentType::XHTML")),
ContentType::XML => Err(unsupported_error("ContentType::XML")),
Expand Down Expand Up @@ -391,7 +384,6 @@ mod tests {
assert_eq!(ContentType::from_extension("jpg"), ContentType::JPEG);
assert_eq!(ContentType::from_extension("jpeg"), ContentType::JPEG);
assert_eq!(ContentType::from_extension("webp"), ContentType::WEBP);
assert_eq!(ContentType::from_extension("avif"), ContentType::AVIF);
assert_eq!(ContentType::from_extension("gif"), ContentType::GIF);
assert_eq!(ContentType::from_extension("txt"), ContentType::TXT);
assert_eq!(ContentType::from_extension("opf"), ContentType::XML);
Expand All @@ -414,7 +406,6 @@ mod tests {
assert_eq!(ContentType::from_file("test.jpg"), ContentType::JPEG);
assert_eq!(ContentType::from_file("test.jpeg"), ContentType::JPEG);
assert_eq!(ContentType::from_file("test.webp"), ContentType::WEBP);
assert_eq!(ContentType::from_file("test.avif"), ContentType::AVIF);
assert_eq!(ContentType::from_file("test.gif"), ContentType::GIF);
assert_eq!(ContentType::from_file("test.txt"), ContentType::TXT);
assert_eq!(ContentType::from_file("test.unknown"), ContentType::UNKNOWN);
Expand Down Expand Up @@ -476,9 +467,6 @@ mod tests {
let path = Path::new("test.webp");
assert_eq!(ContentType::from_path(path), ContentType::WEBP);

let path = Path::new("test.avif");
assert_eq!(ContentType::from_path(path), ContentType::AVIF);

let path = Path::new("test.gif");
assert_eq!(ContentType::from_path(path), ContentType::GIF);

Expand Down Expand Up @@ -518,7 +506,6 @@ mod tests {
assert_eq!(ContentType::PNG.mime_type(), "image/png".to_string());
assert_eq!(ContentType::JPEG.mime_type(), "image/jpeg".to_string());
assert_eq!(ContentType::WEBP.mime_type(), "image/webp".to_string());
assert_eq!(ContentType::AVIF.mime_type(), "image/avif".to_string());
assert_eq!(ContentType::GIF.mime_type(), "image/gif".to_string());
assert_eq!(ContentType::TXT.mime_type(), "text/plain".to_string());
assert_eq!(ContentType::UNKNOWN.mime_type(), "unknown".to_string());
Expand All @@ -530,7 +517,6 @@ mod tests {
assert!(ContentType::PNG.is_image());
assert!(ContentType::JPEG.is_image());
assert!(ContentType::WEBP.is_image());
assert!(ContentType::AVIF.is_image());
assert!(ContentType::GIF.is_image());
assert!(!ContentType::XHTML.is_image());

Expand All @@ -557,7 +543,6 @@ mod tests {

// Not an OPDS 1.2 legacy image
assert!(!ContentType::WEBP.is_opds_legacy_image());
assert!(!ContentType::AVIF.is_opds_legacy_image());
}

#[test]
Expand Down
Loading
Loading