mirror of
https://git.asonix.dog/asonix/pict-rs
synced 2024-11-10 06:25:00 +00:00
Version v0.3.0-alpha.21-in-mem
This commit is contained in:
parent
247c798c99
commit
ee215bfa5e
6 changed files with 19 additions and 5 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -995,7 +995,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pict-rs"
|
name = "pict-rs"
|
||||||
version = "0.3.0-alpha.20"
|
version = "0.3.0-alpha.21"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-form-data",
|
"actix-form-data",
|
||||||
"actix-fs",
|
"actix-fs",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "pict-rs"
|
name = "pict-rs"
|
||||||
description = "A simple image hosting service"
|
description = "A simple image hosting service"
|
||||||
version = "0.3.0-alpha.20"
|
version = "0.3.0-alpha.21"
|
||||||
authors = ["asonix <asonix@asonix.dog>"]
|
authors = ["asonix <asonix@asonix.dog>"]
|
||||||
license = "AGPL-3.0"
|
license = "AGPL-3.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
|
@ -2,7 +2,7 @@ version: '3.3'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
pictrs:
|
pictrs:
|
||||||
image: asonix/pictrs:v0.3.0-alpha.20-in-mem
|
image: asonix/pictrs:v0.3.0-alpha.21-in-mem
|
||||||
ports:
|
ports:
|
||||||
- "127.0.0.1:8080:8080"
|
- "127.0.0.1:8080:8080"
|
||||||
restart: always
|
restart: always
|
||||||
|
|
13
src/exiftool.rs
Normal file
13
src/exiftool.rs
Normal 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()))
|
||||||
|
}
|
|
@ -15,6 +15,7 @@ use tracing_subscriber::EnvFilter;
|
||||||
|
|
||||||
mod config;
|
mod config;
|
||||||
mod error;
|
mod error;
|
||||||
|
mod exiftool;
|
||||||
mod ffmpeg;
|
mod ffmpeg;
|
||||||
mod magick;
|
mod magick;
|
||||||
mod middleware;
|
mod middleware;
|
||||||
|
|
|
@ -38,11 +38,11 @@ where
|
||||||
)),
|
)),
|
||||||
(Some(Format::Jpeg) | None, ValidInputType::Jpeg) => Ok((
|
(Some(Format::Jpeg) | None, ValidInputType::Jpeg) => Ok((
|
||||||
mime::IMAGE_JPEG,
|
mime::IMAGE_JPEG,
|
||||||
crate::magick::clear_metadata_stream(copied_stream)?,
|
crate::exiftool::clear_metadata_stream(copied_stream)?,
|
||||||
)),
|
)),
|
||||||
(Some(Format::Png) | None, ValidInputType::Png) => Ok((
|
(Some(Format::Png) | None, ValidInputType::Png) => Ok((
|
||||||
mime::IMAGE_PNG,
|
mime::IMAGE_PNG,
|
||||||
crate::magick::clear_metadata_stream(copied_stream)?,
|
crate::exiftool::clear_metadata_stream(copied_stream)?,
|
||||||
)),
|
)),
|
||||||
(Some(Format::Webp) | None, ValidInputType::Webp) => Ok((
|
(Some(Format::Webp) | None, ValidInputType::Webp) => Ok((
|
||||||
image_webp(),
|
image_webp(),
|
||||||
|
|
Loading…
Reference in a new issue