From 7fd707c8df9194f74eb2c867ee7a10ad82f95b92 Mon Sep 17 00:00:00 2001 From: "Aode (Lion)" Date: Wed, 25 Aug 2021 21:46:11 -0500 Subject: [PATCH] Begin work on spawning processes rather than binding to c libs --- Cargo.lock | 589 +++++++++++++++++-------------------- Cargo.toml | 15 +- docker/dev/dev.sh | 4 +- docker/prod/build-image.sh | 2 +- docker/prod/deploy.sh | 8 +- docker/prod/manifest.sh | 10 +- src/exiv2.rs | 77 +++++ src/ffmpeg.rs | 106 +++++++ src/magick.rs | 28 ++ src/main.rs | 6 +- src/range.rs | 1 + src/upload_manager.rs | 4 +- 12 files changed, 503 insertions(+), 347 deletions(-) create mode 100644 src/exiv2.rs create mode 100644 src/ffmpeg.rs create mode 100644 src/magick.rs diff --git a/Cargo.lock b/Cargo.lock index 2dba709..cfb30d3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -20,9 +20,9 @@ dependencies = [ [[package]] name = "actix-form-data" -version = "0.6.0-beta.3" +version = "0.6.0-beta.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8129904a01c8d6aec49040782a79975b64e4258787d614582a88e5a3efe6fb1" +checksum = "49732cf5dd12ea598320b66fae96011edeb95deb21e9524f9e003f284942dc3a" dependencies = [ "actix-multipart", "actix-rt", @@ -37,20 +37,22 @@ dependencies = [ [[package]] name = "actix-fs" version = "0.1.0" -source = "git+https://git.asonix.dog/asonix/actix-fs?branch=asonix/actix-rt-2#f28d287468e53ab3a36dca5ef336586a64b3e4f6" +source = "git+https://git.asonix.dog/asonix/actix-fs?branch=asonix/actix-rt-2#aef0e3c557b1365c0c1039bedd321724cd09201f" dependencies = [ "actix-rt", "bytes", - "futures", + "futures-util", "log", "thiserror", + "tokio", + "tokio-stream", ] [[package]] name = "actix-http" -version = "3.0.0-beta.8" +version = "3.0.0-beta.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cd16d6b846983ffabfd081e1a67abd7698094fcbe7b3d9bcf1acbc6f546a516" +checksum = "01260589f1aafad11224002741eb37bc603b4ce55b4e3556d2b2122f9aac7c51" dependencies = [ "actix-codec", "actix-rt", @@ -60,12 +62,10 @@ dependencies = [ "ahash", "base64", "bitflags", - "brotli2", "bytes", "bytestring", "derive_more", "encoding_rs", - "flate2", "futures-core", "futures-util", "h2", @@ -87,7 +87,6 @@ dependencies = [ "smallvec", "time", "tokio", - "zstd", ] [[package]] @@ -185,9 +184,7 @@ dependencies = [ "futures-core", "http", "log", - "tokio-rustls", "tokio-util", - "webpki-roots", ] [[package]] @@ -218,7 +215,6 @@ dependencies = [ "ahash", "bytes", "cfg-if", - "cookie", "derive_more", "either", "encoding_rs", @@ -252,12 +248,6 @@ dependencies = [ "syn", ] -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - [[package]] name = "ahash" version = "0.7.4" @@ -271,9 +261,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.18" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" dependencies = [ "memchr", ] @@ -298,9 +288,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.41" +version = "1.0.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15af2628f6890fe2609a3b91bef4c83450512802e59489f9c1cb1fa5df064a61" +checksum = "28ae2b3dec75a406790005a200b1bd89785afc02517a00ca99ecfe093ee9e6cf" [[package]] name = "async-stream" @@ -361,7 +351,6 @@ dependencies = [ "percent-encoding", "pin-project-lite", "rand", - "rustls", "serde", "serde_json", "serde_urlencoded", @@ -386,7 +375,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2da379dbebc0b76ef63ca68d8fc6e71c0f13e59432e0987e508c1820e6ab5239" dependencies = [ "bitflags", - "cexpr", + "cexpr 0.4.0", + "clang-sys", + "lazy_static", + "lazycell", + "peeking_take_while", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex 0.1.1", +] + +[[package]] +name = "bindgen" +version = "0.59.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "453c49e5950bb0eb63bb3df640e31618846c89d5b7faa54040d76e98e0134375" +dependencies = [ + "bitflags", + "cexpr 0.5.0", "clang-sys", "clap", "env_logger", @@ -398,15 +406,27 @@ dependencies = [ "quote", "regex", "rustc-hash", - "shlex", + "shlex 1.0.0", "which", ] [[package]] name = "bitflags" -version = "1.2.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitvec" +version = "0.19.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8942c8d352ae1838c9dda0b0ca2ab657696ef2232a20147cf1b30ae1a9cb4321" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] [[package]] name = "block-buffer" @@ -417,26 +437,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "brotli-sys" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4445dea95f4c2b41cde57cc9fee236ae4dbae88d8fcbdb4750fc1bb5d86aaecd" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "brotli2" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cb036c3eade309815c15ddbacec5b22c4d1f3983a774ab2eac2e3e9ea85568e" -dependencies = [ - "brotli-sys", - "libc", -] - [[package]] name = "bumpalo" version = "3.7.0" @@ -451,9 +451,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" +checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" [[package]] name = "bytestring" @@ -466,12 +466,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.68" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a72c244c1ff497a746a7e1fb3d14bd08420ecda70c8f25c7112f2781652d787" -dependencies = [ - "jobserver", -] +checksum = "e70cc2f62c6ce1868963827bd677764c62d07c3d9a3e1fb1177ee1a9ab199eb2" [[package]] name = "cexpr" @@ -479,7 +476,16 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27" dependencies = [ - "nom", + "nom 5.1.2", +] + +[[package]] +name = "cexpr" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db507a7679252d2276ed0dd8113c6875ec56d3089f9225b2b42c30cc1f8e5c89" +dependencies = [ + "nom 6.2.1", ] [[package]] @@ -502,9 +508,9 @@ dependencies = [ [[package]] name = "clang-sys" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "853eda514c284c2287f4bf20ae614f8781f40a81d32ecda6e91449304dfe077c" +checksum = "81cf2cc85830eae84823884db23c5306442a6c3d5bfd3beb2f2a2c829faa1816" dependencies = [ "glob", "libc", @@ -538,17 +544,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" -[[package]] -name = "cookie" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdf8865bac3d9a3bde5bde9088ca431b11f5d37c7a578b8086af77248b76627" -dependencies = [ - "percent-encoding", - "time", - "version_check", -] - [[package]] name = "cpufeatures" version = "0.1.5" @@ -592,13 +587,14 @@ dependencies = [ [[package]] name = "derive_more" -version = "0.99.14" +version = "0.99.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc7b9cef1e351660e5443924e4f43ab25fbbed3e9a5f052df3677deb4d6b320" +checksum = "40eebddd2156ce1bb37b20bbe5151340a31828b1f2d22ba4141f3531710e38df" dependencies = [ "convert_case", "proc-macro2", "quote", + "rustc_version 0.3.3", "syn", ] @@ -647,21 +643,22 @@ dependencies = [ [[package]] name = "ffmpeg-next" -version = "4.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3186d58788057973c658e1fa13a26ea1340718a8a131d5e1996d06e2b08befc" +version = "4.4.0-dev" +source = "git+https://github.com/jwiesler/rust-ffmpeg#1966244b303a365d22eca0e33160e58b3d8ce903" dependencies = [ "bitflags", "ffmpeg-sys-next", "libc", + "log", + "vsprintf", ] [[package]] name = "ffmpeg-sys-next" version = "4.3.5" -source = "git+https://github.com/jwiesler/rust-ffmpeg-sys?branch=master#5d819d172f116a8a6d960df35e4d5bc8b4a82924" +source = "git+https://github.com/jwiesler/rust-ffmpeg-sys#5d819d172f116a8a6d960df35e4d5bc8b4a82924" dependencies = [ - "bindgen", + "bindgen 0.56.0", "cc", "libc", "num_cpus", @@ -669,18 +666,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "flate2" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd3aec53de10fe96d7d8c565eb17f2c687bb5518a2ec453b5b1252964526abe0" -dependencies = [ - "cfg-if", - "crc32fast", - "libc", - "miniz_oxide", -] - [[package]] name = "fnv" version = "1.0.7" @@ -708,10 +693,16 @@ dependencies = [ ] [[package]] -name = "futures" -version = "0.3.15" +name = "funty" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e7e43a803dae2fa37c1f6a8fe121e1f7bf9548b4dfc0522a42f34145dadfc27" +checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" + +[[package]] +name = "futures" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1adc00f486adfc9ce99f77d717836f0c5aa84965eb0b4f051f4e83f7cab53f8b" dependencies = [ "futures-channel", "futures-core", @@ -724,9 +715,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.15" +version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e682a68b29a882df0545c143dc3646daefe80ba479bcdede94d5a703de2871e2" +checksum = "74ed2411805f6e4e3d9bc904c95d5d423b89b3b25dc0250aa74729de20629ff9" dependencies = [ "futures-core", "futures-sink", @@ -734,15 +725,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.15" +version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0402f765d8a89a26043b889b26ce3c4679d268fa6bb22cd7c6aad98340e179d1" +checksum = "af51b1b4a7fdff033703db39de8802c673eb91855f2e0d47dcf3bf2c0ef01f99" [[package]] name = "futures-executor" -version = "0.3.15" +version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "badaa6a909fac9e7236d0620a2f57f7664640c56575b71a7552fbd68deafab79" +checksum = "4d0d535a57b87e1ae31437b892713aee90cd2d7b0ee48727cd11fc72ef54761c" dependencies = [ "futures-core", "futures-task", @@ -751,15 +742,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.15" +version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acc499defb3b348f8d8f3f66415835a9131856ff7714bf10dadfc4ec4bdb29a1" +checksum = "0b0e06c393068f3a6ef246c75cdca793d6a46347e75286933e5e75fd2fd11582" [[package]] name = "futures-macro" -version = "0.3.15" +version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c40298486cdf52cc00cd6d6987892ba502c7656a16a4192a9992b1ccedd121" +checksum = "c54913bae956fb8df7f4dc6fc90362aa72e69148e3f39041fbe8742d21e0ac57" dependencies = [ "autocfg", "proc-macro-hack", @@ -770,21 +761,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.15" +version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a57bead0ceff0d6dde8f465ecd96c9338121bb7717d3e7b108059531870c4282" +checksum = "c0f30aaa67363d119812743aa5f33c201a7a66329f97d1a887022971feea4b53" [[package]] name = "futures-task" -version = "0.3.15" +version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a16bef9fc1a4dddb5bee51c989e3fbba26569cbb0e31f5b303c184e3dd33dae" +checksum = "bbe54a98670017f3be909561f6ad13e810d9a51f3f061b902062ca3da80799f2" [[package]] name = "futures-util" -version = "0.3.15" +version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feb5c238d27e2bf94ffdfd27b2c29e3df4a68c4193bb6427384259e2bf191967" +checksum = "67eb846bfd58e44a8481a00049e82c43e0ccb5d61f8dc071057cb19249dd4d78" dependencies = [ "autocfg", "futures-channel", @@ -849,9 +840,9 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "h2" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "825343c4eef0b63f541f8903f395dc5beb362a979b5799a84062527ef1e37726" +checksum = "d7f3675cfef6a30c8031cf9e6493ebdc3bb3272a3fea3923c4210d1830e6a472" dependencies = [ "bytes", "fnv", @@ -868,9 +859,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.9.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" [[package]] name = "heck" @@ -903,9 +894,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.4.1" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3a87b616e37e93c22fb19bcd386f02f3af5ea98a25670ad0fce773de23c5e68" +checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503" [[package]] name = "humantime" @@ -926,9 +917,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.6.2" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3" +checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" dependencies = [ "autocfg", "hashbrown", @@ -936,36 +927,18 @@ dependencies = [ [[package]] name = "instant" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" +checksum = "bee0328b1209d157ef001c94dd85b4f8f64139adb0eac2659f4b08382b2f474d" dependencies = [ "cfg-if", ] [[package]] name = "itoa" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" - -[[package]] -name = "jobserver" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "972f5ae5d1cb9c6ae417789196c803205313edde988685da5e3aae0827b9e7fd" -dependencies = [ - "libc", -] - -[[package]] -name = "js-sys" -version = "0.3.51" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83bdfbace3a0e81a4253f73b49e960b053e396a11012cbd49b9b74d6a2b67062" -dependencies = [ - "wasm-bindgen", -] +checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "language-tags" @@ -987,9 +960,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.97" +version = "0.2.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12b8adadd720df158f4d70dfe7ccc6adb0472d7c55ca83445f6a5ab3e36f8fb6" +checksum = "3cb00336871be5ed2c8ed44b60ae9959dc5b9f08539422ed43f09e34ecaeba21" [[package]] name = "libloading" @@ -1039,10 +1012,11 @@ dependencies = [ [[package]] name = "magick_rust" -version = "0.14.0" -source = "git+https://git.asonix.dog/asonix/magick-rust.git#11da380e1b56a595bddf47c4e716722da7b1033e" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13584c9d754ca069ee43d1ee155c4a14a87e7e68faf7b61255f2d3133ee259c4" dependencies = [ - "bindgen", + "bindgen 0.59.1", "libc", "pkg-config", ] @@ -1058,15 +1032,15 @@ dependencies = [ [[package]] name = "matches" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" +checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" [[package]] name = "memchr" -version = "2.4.0" +version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" +checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" [[package]] name = "memoffset" @@ -1083,16 +1057,6 @@ version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" -[[package]] -name = "miniz_oxide" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" -dependencies = [ - "adler", - "autocfg", -] - [[package]] name = "mio" version = "0.7.13" @@ -1125,6 +1089,18 @@ dependencies = [ "version_check", ] +[[package]] +name = "nom" +version = "6.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c5c51b9083a3c620fa67a2a635d1ce7d95b897e957d6b28ff9a5da960a103a6" +dependencies = [ + "bitvec", + "funty", + "memchr", + "version_check", +] + [[package]] name = "ntapi" version = "0.3.6" @@ -1229,6 +1205,15 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" +[[package]] +name = "pest" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" +dependencies = [ + "ucd-trie", +] + [[package]] name = "pict-rs" version = "0.3.0-alpha.12" @@ -1246,6 +1231,7 @@ dependencies = [ "futures", "magick_rust", "mime", + "num_cpus", "once_cell", "rand", "rexiv2", @@ -1256,6 +1242,7 @@ dependencies = [ "structopt", "thiserror", "time", + "tokio", "tracing", "tracing-futures", "tracing-subscriber", @@ -1264,18 +1251,18 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7509cc106041c40a4518d2af7a61530e1eed0e6285296a3d8c5472806ccc4a4" +checksum = "576bc800220cc65dac09e99e97b08b358cfab6e17078de8dc5fee223bd2d0c08" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48c950132583b500556b1efd71d45b319029f2b71518d979fcc208e16b42426f" +checksum = "6e8fe8163d14ce7f0cdac2e040116f22eac817edabff0be91e8aff7e9accf389" dependencies = [ "proc-macro2", "quote", @@ -1344,9 +1331,9 @@ checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" [[package]] name = "proc-macro2" -version = "1.0.27" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038" +checksum = "5c7ed8b8c7b886ea3ed7dde405212185f423ab44682667c8c6dd14aa1d9f6612" dependencies = [ "unicode-xid", ] @@ -1360,6 +1347,12 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "radium" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8" + [[package]] name = "rand" version = "0.8.4" @@ -1402,18 +1395,18 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab49abadf3f9e1c4bc499e8845e152ad87d2ad2d30371841171169e9d75feee" +checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" dependencies = [ "bitflags", ] [[package]] name = "regex" -version = "1.5.4" +version = "1.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" +checksum = "2a26af418b574bd56588335b3a3659a65725d4e636eb1016c2f9e3b38c7cc759" dependencies = [ "aho-corasick", "memchr", @@ -1446,21 +1439,6 @@ dependencies = [ "num-rational", ] -[[package]] -name = "ring" -version = "0.16.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" -dependencies = [ - "cc", - "libc", - "once_cell", - "spin", - "untrusted", - "web-sys", - "winapi", -] - [[package]] name = "rustc-hash" version = "1.1.0" @@ -1473,20 +1451,16 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" dependencies = [ - "semver", + "semver 0.9.0", ] [[package]] -name = "rustls" -version = "0.19.1" +name = "rustc_version" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" +checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" dependencies = [ - "base64", - "log", - "ring", - "sct", - "webpki", + "semver 0.11.0", ] [[package]] @@ -1501,23 +1475,22 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -[[package]] -name = "sct" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "semver" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ - "semver-parser", + "semver-parser 0.7.0", +] + +[[package]] +name = "semver" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" +dependencies = [ + "semver-parser 0.10.2", ] [[package]] @@ -1527,19 +1500,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] -name = "serde" -version = "1.0.126" +name = "semver-parser" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03" +checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" +dependencies = [ + "pest", +] + +[[package]] +name = "serde" +version = "1.0.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1f72836d2aa753853178eda473a3b9d8e4eefdaf20523b919677e6de489f8f1" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.126" +version = "1.0.129" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43" +checksum = "e57ae87ad533d9a56427558b516d0adac283614e347abf85b0dc0cbbf0a249f3" dependencies = [ "proc-macro2", "quote", @@ -1548,9 +1530,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.64" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" +checksum = "336b10da19a12ad094b59d870ebde26a45402e5b470add4b5fd03c5048a32127" dependencies = [ "itoa", "ryu", @@ -1571,9 +1553,9 @@ dependencies = [ [[package]] name = "sha-1" -version = "0.9.6" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c4cfa741c5832d0ef7fab46cabed29c2aae926db0b11bb2069edd8db5e64e16" +checksum = "1a0c8611594e2ab4ebbf06ec7cbbf0a99450b8570e96cbf5188b5d5f6ef18d81" dependencies = [ "block-buffer", "cfg-if", @@ -1603,9 +1585,9 @@ dependencies = [ [[package]] name = "sharded-slab" -version = "0.1.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79c719719ee05df97490f80a45acfc99e5a30ce98a1e4fb67aee422745ae14e3" +checksum = "740223c51853f3145fe7c90360d2d4232f2b62e3449489c207eccde818979982" dependencies = [ "lazy_static", ] @@ -1616,6 +1598,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" +[[package]] +name = "shlex" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42a568c8f2cd051a4d283bd6eb0343ac214c1b0f1ac19f93e1175b2dee38c73d" + [[package]] name = "signal-hook-registry" version = "1.4.0" @@ -1627,9 +1615,9 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f173ac3d1a7e3b28003f40de0b5ce7fe2710f9b9dc3fc38664cebee46b3b6527" +checksum = "c307a32c1c5c437f38c7fd45d753050587732ba8628319fbdf12a7e289ccc590" [[package]] name = "sled" @@ -1655,20 +1643,14 @@ checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" [[package]] name = "socket2" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e3dfc207c526015c632472a77be09cf1b6e46866581aecae5cc38fb4235dea2" +checksum = "765f090f0e423d2b55843402a07915add955e7d60657db13707a159727326cad" dependencies = [ "libc", "winapi", ] -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - [[package]] name = "standback" version = "0.2.17" @@ -1685,7 +1667,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" dependencies = [ "discard", - "rustc_version", + "rustc_version 0.2.3", "stdweb-derive", "stdweb-internal-macros", "stdweb-internal-runtime", @@ -1735,9 +1717,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "structopt" -version = "0.3.21" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5277acd7ee46e63e5168a80734c9f6ee81b1367a7d8772a2d765df2a3705d28c" +checksum = "69b041cdcb67226aca307e6e7be44c8806423d83e018bd662360a93dabce4d71" dependencies = [ "clap", "lazy_static", @@ -1746,9 +1728,9 @@ dependencies = [ [[package]] name = "structopt-derive" -version = "0.4.14" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ba9cdfda491b814720b6b06e0cac513d922fc407582032e8706e9f137976f90" +checksum = "7813934aecf5f51a54775e00068c237de98489463968231a51746bbbc03f9c10" dependencies = [ "heck", "proc-macro-error", @@ -1759,15 +1741,21 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.73" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f71489ff30030d2ae598524f61326b902466f72a0fb1a8564c001cc63425bcc7" +checksum = "b7f58f7e8eaa0009c5fec437aabf511bd9933e4b2d7407bd05273c01a8906ea7" dependencies = [ "proc-macro2", "quote", "unicode-xid", ] +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + [[package]] name = "termcolor" version = "1.1.2" @@ -1788,18 +1776,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.25" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa6f76457f59514c7eeb4e59d891395fab0b2fd1d40723ae737d64153392e9c6" +checksum = "93119e4feac1cbe6c798c34d3a53ea0026b0b1de6a120deef895137c0529bfe2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.25" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a36768c0fbf1bb15eca10defa29526bda730a2376c2ab4393ccfa16fb1a318d" +checksum = "060d69a0afe7796bf42e9e2ff91f5ee691fb15c53d38b4b62a9a53eb23164745" dependencies = [ "proc-macro2", "quote", @@ -1856,9 +1844,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.2.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b5220f05bb7de7f3f53c7c065e1199b3172696fe2db9f9c4d8ad9b4ee74c342" +checksum = "848a1e1181b9f6753b5e96a092749e29b11d19ede67dfbbd6c7dc7e0f49b5338" dependencies = [ "tinyvec_macros", ] @@ -1871,9 +1859,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.7.1" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fb2ed024293bb19f7a5dc54fe83bf86532a44c12a2bb8ba40d64a4509395ca2" +checksum = "92036be488bb6594459f2e03b60e42df6f937fe6ca5c5ffdcb539c6b84dc40f5" dependencies = [ "autocfg", "bytes", @@ -1888,14 +1876,14 @@ dependencies = [ ] [[package]] -name = "tokio-rustls" -version = "0.22.0" +name = "tokio-stream" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" +checksum = "7b2f3f698253f03119ac0102beaa64f67a67e08074d03a22d18784104543727f" dependencies = [ - "rustls", + "futures-core", + "pin-project-lite", "tokio", - "webpki", ] [[package]] @@ -1937,9 +1925,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.18" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9ff14f98b1a4b289c6248a023c1c2fa1491062964e9fed67ab29c4e4da4a052" +checksum = "2ca517f43f0fb96e0c3072ed5c275fe5eece87e8cb52f4a77b69226d3b1c9df8" dependencies = [ "lazy_static", ] @@ -1977,9 +1965,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.2.19" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab69019741fca4d98be3c62d2b75254528b5432233fd8a4d2739fec20278de48" +checksum = "b9cbe87a2fa7e35900ce5de20220a582a9483a7063811defce79d7cbd59d4cfe" dependencies = [ "ansi_term 0.12.1", "chrono", @@ -2013,6 +2001,12 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" +[[package]] +name = "ucd-trie" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" + [[package]] name = "unchecked-index" version = "0.2.2" @@ -2021,12 +2015,9 @@ checksum = "eeba86d422ce181a719445e51872fa30f1f7413b62becb52e95ec91aa262d85c" [[package]] name = "unicode-bidi" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eeb8be209bb1c96b7c177c7420d26e04eccacb0eeae6b980e35fcb74678107e0" -dependencies = [ - "matches", -] +checksum = "246f4c42e67e7a4e3c6106ff716a5d067d4132a642840b242e357e468a2a0085" [[package]] name = "unicode-normalization" @@ -2039,9 +2030,9 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.7.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796" +checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" [[package]] name = "unicode-width" @@ -2055,12 +2046,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - [[package]] name = "url" version = "2.2.2" @@ -2100,6 +2085,16 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" +[[package]] +name = "vsprintf" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aec2f81b75ca063294776b4f7e8da71d1d5ae81c2b1b149c8d89969230265d63" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "wasi" version = "0.10.2+wasi-snapshot-preview1" @@ -2108,9 +2103,9 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] name = "wasm-bindgen" -version = "0.2.74" +version = "0.2.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54ee1d4ed486f78874278e63e4069fc1ab9f6a18ca492076ffb90c5eb2997fd" +checksum = "8ce9b1b516211d33767048e5d47fa2a381ed8b76fc48d2ce4aa39877f9f183e0" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -2118,9 +2113,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.74" +version = "0.2.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b33f6a0694ccfea53d94db8b2ed1c3a8a4c86dd936b13b9f0a15ec4a451b900" +checksum = "cfe8dc78e2326ba5f845f4b5bf548401604fa20b1dd1d365fb73b6c1d6364041" dependencies = [ "bumpalo", "lazy_static", @@ -2133,9 +2128,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.74" +version = "0.2.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "088169ca61430fe1e58b8096c24975251700e7b1f6fd91cc9d59b04fb9b18bd4" +checksum = "44468aa53335841d9d6b6c023eaab07c0cd4bddbcfdee3e2bb1e8d2cb8069fef" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2143,9 +2138,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.74" +version = "0.2.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be2241542ff3d9f241f5e2cb6dd09b37efe786df8851c54957683a49f0987a97" +checksum = "0195807922713af1e67dc66132c7328206ed9766af3858164fb583eedc25fbad" dependencies = [ "proc-macro2", "quote", @@ -2156,38 +2151,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.74" +version = "0.2.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f" - -[[package]] -name = "web-sys" -version = "0.3.51" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e828417b379f3df7111d3a2a9e5753706cae29c41f7c4029ee9fd77f3e09e582" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webpki" -version = "0.21.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "webpki-roots" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aabe153544e473b775453675851ecc86863d2a81d786d741f6b76778f2a48940" -dependencies = [ - "webpki", -] +checksum = "acdb075a845574a1fa5f09fd77e43f7747599301ea3417a9fbffdeedfc1f4a29" [[package]] name = "which" @@ -2230,30 +2196,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "zstd" -version = "0.7.0+zstd.1.4.9" +name = "wyz" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9428752481d8372e15b1bf779ea518a179ad6c771cca2d2c60e4fbff3cc2cd52" -dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "3.1.0+zstd.1.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa1926623ad7fe406e090555387daf73db555b948134b4d73eac5eb08fb666d" -dependencies = [ - "libc", - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "1.5.0+zstd.1.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e6c094340240369025fc6b731b054ee2a834328fa584310ac96aa4baebdc465" -dependencies = [ - "cc", - "libc", -] +checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" diff --git a/Cargo.toml b/Cargo.toml index acf78ab..0d0b7e0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,14 +14,15 @@ edition = "2018" actix-form-data = "0.6.0-beta.1" actix-fs = { git = "https://git.asonix.dog/asonix/actix-fs", branch = "asonix/actix-rt-2" } actix-rt = "2.2.0" -actix-web = { version = "4.0.0-beta.8", default-features = false, features = ["compress-brotli", "compress-gzip", "compress-zstd"] } +actix-web = { version = "4.0.0-beta.8", default-features = false } anyhow = "1.0" async-stream = "0.3.0" -awc = { version = "3.0.0-beta.7", default-features = false, features = ["compress-brotli", "compress-gzip", "compress-zstd", "rustls"] } +awc = { version = "3.0.0-beta.7", default-features = false } base64 = "0.13.0" futures = "0.3.4" -magick_rust = { version = "0.14.0", git = "https://git.asonix.dog/asonix/magick-rust.git" } +magick_rust = { version = "0.15.0" } mime = "0.3.1" +num_cpus = "1" once_cell = "1.4.0" rand = "0.8.0" rexiv2 = "0.9.1" @@ -32,20 +33,18 @@ sled = { version = "0.34.6" } structopt = "0.3.14" thiserror = "1.0" time = { version = "0.2.23", features = ["serde"] } +tokio = { version = "1", default-features = false, features = ["sync", "process"] } tracing = "0.1.15" tracing-futures = "0.2.4" tracing-subscriber = { version = "0.2.5", features = ["fmt", "tracing-log"] } uuid = { version = "0.8", features = ["v4"] } [dependencies.ffmpeg-next] -version = "4.3.7" +version = "4.4.0-dev" default-features = false features = ["codec", "filter", "device", "format", "resampling", "postprocessing", "software-resampling", "software-scaling"] +git = "https://github.com/jwiesler/rust-ffmpeg" [dependencies.ffmpeg-sys-next] version = "4.3.5" git = "https://github.com/jwiesler/rust-ffmpeg-sys" -branch = "master" - -[patch.crates-io] -ffmpeg-sys-next = { git = "https://github.com/jwiesler/rust-ffmpeg-sys", branch = "master" } diff --git a/docker/dev/dev.sh b/docker/dev/dev.sh index 6f240e3..3be7e9a 100755 --- a/docker/dev/dev.sh +++ b/docker/dev/dev.sh @@ -5,5 +5,5 @@ ARCH=${1:-amd64} export USER_ID=$(id -u) export GROUP_ID=$(id -g) -docker-compose build --pull -docker-compose run --service-ports pictrs-$ARCH +sudo docker-compose build --pull +sudo docker-compose run --service-ports pictrs-$ARCH diff --git a/docker/prod/build-image.sh b/docker/prod/build-image.sh index deea042..73e8fdd 100755 --- a/docker/prod/build-image.sh +++ b/docker/prod/build-image.sh @@ -28,7 +28,7 @@ require "$REPO" repo require "$TAG" tag require "$ARCH" arch -docker build \ +sudo docker build \ --pull \ --build-arg TAG=$TAG \ -t $REPO:$ARCH-$TAG \ diff --git a/docker/prod/deploy.sh b/docker/prod/deploy.sh index 5bfb7ba..b810c0f 100755 --- a/docker/prod/deploy.sh +++ b/docker/prod/deploy.sh @@ -25,10 +25,10 @@ function build_image() { ./build-image.sh asonix/pictrs $tag $arch - docker tag asonix/pictrs:$arch-$tag asonix/pictrs:$arch-latest + sudo docker tag asonix/pictrs:$arch-$tag asonix/pictrs:$arch-latest - docker push asonix/pictrs:$arch-$tag - docker push asonix/pictrs:$arch-latest + sudo docker push asonix/pictrs:$arch-$tag + sudo docker push asonix/pictrs:$arch-latest } # Creating the new tag @@ -38,7 +38,7 @@ branch="$2" require "$new_tag" "tag" require "$branch" "branch" -if ! docker run --rm -it arm64v8/alpine:3.11 /bin/sh -c 'echo "docker is configured correctly"' +if ! sudo docker run --rm -it arm64v8/alpine:3.11 /bin/sh -c 'echo "docker is configured correctly"' then echo "docker is not configured to run on qemu-emulated architectures, fixing will require sudo" sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes diff --git a/docker/prod/manifest.sh b/docker/prod/manifest.sh index 905205c..814c321 100755 --- a/docker/prod/manifest.sh +++ b/docker/prod/manifest.sh @@ -23,18 +23,18 @@ require "$new_tag" "tag" set -xe -docker manifest create asonix/pictrs:$new_tag \ +sudo docker manifest create asonix/pictrs:$new_tag \ -a asonix/pictrs:arm64v8-$new_tag \ -a asonix/pictrs:arm32v7-$new_tag \ -a asonix/pictrs:amd64-$new_tag -docker manifest annotate asonix/pictrs:$new_tag \ +sudo docker manifest annotate asonix/pictrs:$new_tag \ asonix/pictrs:arm64v8-$new_tag --os linux --arch arm64 --variant v8 -docker manifest annotate asonix/pictrs:$new_tag \ +sudo docker manifest annotate asonix/pictrs:$new_tag \ asonix/pictrs:arm32v7-$new_tag --os linux --arch arm --variant v7 -docker manifest annotate asonix/pictrs:$new_tag \ +sudo docker manifest annotate asonix/pictrs:$new_tag \ asonix/pictrs:amd64-$new_tag --os linux --arch amd64 -docker manifest push asonix/pictrs:$new_tag --purge +sudo docker manifest push asonix/pictrs:$new_tag --purge diff --git a/src/exiv2.rs b/src/exiv2.rs new file mode 100644 index 0000000..4e80c04 --- /dev/null +++ b/src/exiv2.rs @@ -0,0 +1,77 @@ +#[derive(Debug, thiserror::Error)] +pub(crate) enum FormatError { + #[error("Failed to interface with exiv2")] + IO(#[from] std::io::Error), + + #[error("Failed to identify file")] + Status, + + #[error("Identify semaphore is closed")] + Closed, + + #[error("Requested information is not present")] + Missing, + + #[error("Requested information was present, but not supported")] + Unsupported, +} + +pub(crate) enum ValidInputType { + Mp4, + Gif, + Png, + Jpeg, +} + +static MAX_READS: once_cell::sync::OnceCell = + once_cell::sync::OnceCell::new(); + +fn semaphore() -> &'static tokio::sync::Semaphore { + MAX_READS.get_or_init(|| tokio::sync::Semaphore::new(num_cpus::get() * 4)) +} + +pub(crate) async fn format

(file: P) -> Result +where + P: AsRef, +{ + let permit = semaphore().acquire().await?; + + let output = tokio::process::Command::new("exiv2") + .args([ + &AsRef::::as_ref(&"pr"), + &file.as_ref().as_ref(), + ]) + .output() + .await?; + drop(permit); + + if !output.status.success() { + return Err(FormatError::Status); + } + + let s = String::from_utf8_lossy(&output.stdout); + + let line = s + .lines() + .find(|line| line.starts_with("MIME")) + .ok_or_else(|| FormatError::Missing)?; + + let mut segments = line.rsplit(':'); + let mime_type = segments.next().ok_or_else(|| FormatError::Missing)?; + + let input_type = match mime_type.trim() { + "video/mp4" => ValidInputType::Mp4, + "image/gif" => ValidInputType::Gif, + "image/png" => ValidInputType::Png, + "image/jpeg" => ValidInputType::Jpeg, + _ => return Err(FormatError::Unsupported), + }; + + Ok(input_type) +} + +impl From for FormatError { + fn from(_: tokio::sync::AcquireError) -> FormatError { + FormatError::Closed + } +} diff --git a/src/ffmpeg.rs b/src/ffmpeg.rs new file mode 100644 index 0000000..96d718c --- /dev/null +++ b/src/ffmpeg.rs @@ -0,0 +1,106 @@ +#[derive(Debug, thiserror::Error)] +pub(crate) enum VideoError { + #[error("Failed to interface with transcode process")] + IO(#[from] std::io::Error), + + #[error("Failed to convert file")] + Status, + + #[error("Transcode semaphore is closed")] + Closed, +} + +static MAX_TRANSCODES: once_cell::sync::OnceCell = + once_cell::sync::OnceCell::new(); + +fn semaphore() -> &'static tokio::sync::Semaphore { + MAX_TRANSCODES + .get_or_init(|| tokio::sync::Semaphore::new(num_cpus::get().saturating_sub(1).max(1))) +} + +pub(crate) async fn thumbnail_jpeg(from: P1, to: P2) -> Result<(), VideoError> +where + P1: AsRef, + P2: AsRef, +{ + thumbnail(from, to, "mjpeg").await +} + +pub(crate) async fn thumbnail_png(from: P1, to: P2) -> Result<(), VideoError> +where + P1: AsRef, + P2: AsRef, +{ + thumbnail(from, to, "png").await +} + +pub(crate) async fn to_mp4(from: P1, to: P2) -> Result<(), VideoError> +where + P1: AsRef, + P2: AsRef, +{ + let permit = semaphore().acquire().await?; + + let mut child = tokio::process::Command::new("ffmpeg") + .args([ + &AsRef::::as_ref(&"-i"), + &from.as_ref().as_ref(), + &"-movflags".as_ref(), + &"faststart".as_ref(), + &"-pix_fmt".as_ref(), + &"yuv420p".as_ref(), + &"-vf".as_ref(), + &"scale=trunc(iw/2)*2:truc(ih/2)*2".as_ref(), + &"-an".as_ref(), + &"-codec".as_ref(), + &"h264".as_ref(), + &to.as_ref().as_ref(), + ]) + .spawn()?; + + let status = child.wait().await?; + drop(permit); + + if !status.success() { + return Err(VideoError::Status); + } + + Ok(()) +} + +async fn thumbnail(from: P1, to: P2, codec: &str) -> Result<(), VideoError> +where + P1: AsRef, + P2: AsRef, +{ + let permit = semaphore().acquire().await?; + + let mut child = tokio::process::Command::new("ffmpeg") + .args([ + &AsRef::::as_ref(&"-i"), + &from.as_ref().as_ref(), + &"-ss".as_ref(), + &"00:00:01.000".as_ref(), + &"-vframes".as_ref(), + &"1".as_ref(), + &"-codec".as_ref(), + &codec.as_ref(), + &to.as_ref().as_ref(), + ]) + .spawn()?; + + let status = child.wait().await?; + drop(permit); + + if !status.success() { + return Err(VideoError::Status); + } + + Ok(()) +} + +impl From for VideoError { + fn from(_: tokio::sync::AcquireError) -> VideoError { + VideoError::Closed + } +} diff --git a/src/magick.rs b/src/magick.rs new file mode 100644 index 0000000..53db6a5 --- /dev/null +++ b/src/magick.rs @@ -0,0 +1,28 @@ +fn thumbnail_args(max_dimension: usize) -> [String; 2] { + [ + "-sample".to_string(), + format!("{}x{}>", max_dimension, max_dimension), + ] +} + +fn resize_args(max_dimension: usize) -> [String; 4] { + [ + "-filter".to_string(), + "Lanczos".to_string(), + "-resize".to_string(), + format!("{}x{}>", max_dimension, max_dimension), + ] +} + +fn crop_args(width: usize, height: usize) -> [String; 4] { + [ + "-gravity".to_string(), + "center".to_string(), + "-crop".to_string(), + format!("{}x{}>", width, height), + ] +} + +fn blur_args(radius: f64) -> [String; 2] { + ["-gaussian-blur".to_string(), radius.to_string()] +} diff --git a/src/main.rs b/src/main.rs index 7cddf91..55639a6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,7 @@ use actix_form_data::{Field, Form, Value}; use actix_web::{ guard, http::header::{CacheControl, CacheDirective, LastModified, ACCEPT_RANGES}, - middleware::{Compress, Logger}, + middleware::Logger, web, App, HttpResponse, HttpResponseBuilder, HttpServer, }; use awc::Client; @@ -17,6 +17,8 @@ use tracing_subscriber::EnvFilter; mod config; mod error; +mod exiv2; +mod ffmpeg; mod middleware; mod migrate; mod processor; @@ -564,6 +566,7 @@ async fn ranged_file_resp( None => { let stream = actix_fs::read_to_stream(path) .await? + .faster() .map_err(UploadError::from); let stream: Pin>>> = Box::pin(stream); @@ -747,7 +750,6 @@ async fn main() -> Result<(), anyhow::Error> { .finish(); App::new() - .wrap(Compress::default()) .wrap(Logger::default()) .wrap(Tracing) .app_data(web::Data::new(manager.clone())) diff --git a/src/range.rs b/src/range.rs index 172219c..2943b1a 100644 --- a/src/range.rs +++ b/src/range.rs @@ -67,6 +67,7 @@ impl Range { Ok(Box::pin( actix_fs::file::read_to_stream(file) .await? + .faster() .map_err(UploadError::from), )) } diff --git a/src/upload_manager.rs b/src/upload_manager.rs index 5da3f79..e6c2851 100644 --- a/src/upload_manager.rs +++ b/src/upload_manager.rs @@ -681,7 +681,7 @@ impl UploadManager { let mut hasher = self.inner.hasher.clone(); let file = actix_fs::file::open(tmpfile).await?; - let mut stream = Box::pin(actix_fs::file::read_to_stream(file).await?); + let mut stream = Box::pin(actix_fs::file::read_to_stream(file).await?.faster()); while let Some(res) = stream.next().await { let bytes = res?; @@ -913,7 +913,7 @@ where let file = actix_fs::file::create(to).await?; - actix_fs::file::write_stream(file, stream.map_err(UploadError::from)).await?; + actix_fs::file::write_stream_faster(file, stream.map_err(UploadError::from)).await?; Ok(()) }