diff --git a/Cargo.lock b/Cargo.lock index 415ff8c..9f24798 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -995,7 +995,7 @@ dependencies = [ [[package]] name = "pict-rs" -version = "0.3.0-alpha.20" +version = "0.3.0-alpha.21" dependencies = [ "actix-form-data", "actix-fs", diff --git a/Cargo.toml b/Cargo.toml index 9ddf730..7d8840e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "pict-rs" description = "A simple image hosting service" -version = "0.3.0-alpha.20" +version = "0.3.0-alpha.21" authors = ["asonix "] license = "AGPL-3.0" readme = "README.md" diff --git a/docker/prod/docker-compose.yml b/docker/prod/docker-compose.yml index 86d346d..5f71ae8 100644 --- a/docker/prod/docker-compose.yml +++ b/docker/prod/docker-compose.yml @@ -2,7 +2,7 @@ version: '3.3' services: pictrs: - image: asonix/pictrs:v0.3.0-alpha.20-in-mem + image: asonix/pictrs:v0.3.0-alpha.21-in-mem ports: - "127.0.0.1:8080:8080" restart: always diff --git a/src/exiftool.rs b/src/exiftool.rs new file mode 100644 index 0000000..f57a266 --- /dev/null +++ b/src/exiftool.rs @@ -0,0 +1,13 @@ +pub(crate) fn clear_metadata_stream( + input: S, +) -> std::io::Result>> +where + S: futures::stream::Stream> + Unpin + 'static, + E: From + 'static, +{ + let process = crate::stream::Process::spawn( + tokio::process::Command::new("exiftool").args(["-all=", "-", "-out", "-"]), + )?; + + Ok(Box::pin(process.sink_stream(input).unwrap())) +} diff --git a/src/main.rs b/src/main.rs index f9bcbbf..f41577d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,6 +15,7 @@ use tracing_subscriber::EnvFilter; mod config; mod error; +mod exiftool; mod ffmpeg; mod magick; mod middleware; diff --git a/src/validate.rs b/src/validate.rs index 6a18dc2..d97b0b0 100644 --- a/src/validate.rs +++ b/src/validate.rs @@ -38,11 +38,11 @@ where )), (Some(Format::Jpeg) | None, ValidInputType::Jpeg) => Ok(( mime::IMAGE_JPEG, - crate::magick::clear_metadata_stream(copied_stream)?, + crate::exiftool::clear_metadata_stream(copied_stream)?, )), (Some(Format::Png) | None, ValidInputType::Png) => Ok(( mime::IMAGE_PNG, - crate::magick::clear_metadata_stream(copied_stream)?, + crate::exiftool::clear_metadata_stream(copied_stream)?, )), (Some(Format::Webp) | None, ValidInputType::Webp) => Ok(( image_webp(),