2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-11-20 11:21:14 +00:00

Version v0.3.0-alpha.21-in-mem

This commit is contained in:
Aode (lion) 2021-08-31 11:02:30 -05:00
parent 247c798c99
commit ee215bfa5e
6 changed files with 19 additions and 5 deletions

2
Cargo.lock generated
View file

@ -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",

View file

@ -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 <asonix@asonix.dog>"]
license = "AGPL-3.0"
readme = "README.md"

View file

@ -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

13
src/exiftool.rs Normal file
View file

@ -0,0 +1,13 @@
pub(crate) fn clear_metadata_stream<S, E>(
input: S,
) -> std::io::Result<futures::stream::LocalBoxStream<'static, Result<actix_web::web::Bytes, E>>>
where
S: futures::stream::Stream<Item = Result<actix_web::web::Bytes, E>> + Unpin + 'static,
E: From<std::io::Error> + 'static,
{
let process = crate::stream::Process::spawn(
tokio::process::Command::new("exiftool").args(["-all=", "-", "-out", "-"]),
)?;
Ok(Box::pin(process.sink_stream(input).unwrap()))
}

View file

@ -15,6 +15,7 @@ use tracing_subscriber::EnvFilter;
mod config;
mod error;
mod exiftool;
mod ffmpeg;
mod magick;
mod middleware;

View file

@ -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(),