diff --git a/Cargo.lock b/Cargo.lock index 17a2122..45834b9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,12 +2,63 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "ab_glyph" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01c0457472c38ea5bd1c3b5ada5e368271cb550be7a4ca4a0b4634e9913f6cc2" +dependencies = [ + "ab_glyph_rasterizer", + "owned_ttf_parser", +] + +[[package]] +name = "ab_glyph_rasterizer" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618" + [[package]] name = "adler2" version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "aes-gcm" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" +dependencies = [ + "aead", + "aes", + "cipher", + "ctr", + "ghash", + "subtle", +] + [[package]] name = "aligned" version = "0.4.3" @@ -41,6 +92,21 @@ dependencies = [ "alloc-no-stdlib", ] +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "android_system_properties" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" +dependencies = [ + "libc", +] + [[package]] name = "anyhow" version = "1.0.104" @@ -79,6 +145,15 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "ash" +version = "0.38.0+1.3.281" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f" +dependencies = [ + "libloading", +] + [[package]] name = "autocfg" version = "1.5.1" @@ -128,6 +203,33 @@ dependencies = [ "arrayvec", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64ct" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" + +[[package]] +name = "bit-set" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2f926cc3060f09db9ebc5b52823d85268d24bb917e472c0c4bea35780a7d" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51" + [[package]] name = "bitflags" version = "2.13.2" @@ -152,6 +254,15 @@ dependencies = [ "generic-array", ] +[[package]] +name = "block2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" +dependencies = [ + "objc2", +] + [[package]] name = "brotli-decompressor" version = "5.0.3" @@ -218,12 +329,68 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" +[[package]] +name = "cfg_aliases" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" + +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + +[[package]] +name = "codespan-reporting" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681" +dependencies = [ + "unicode-width", +] + [[package]] name = "color_quant" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "cpufeatures" version = "0.2.17" @@ -233,6 +400,11 @@ dependencies = [ "libc", ] +[[package]] +name = "craft-docpath" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=82a24b006eefa036b43c09a67fb9a3fbd17ffe63#82a24b006eefa036b43c09a67fb9a3fbd17ffe63" + [[package]] name = "crc32fast" version = "1.5.2" @@ -273,6 +445,18 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.7" @@ -283,6 +467,53 @@ dependencies = [ "typenum", ] +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher", +] + +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "pem-rfc7468", + "zeroize", +] + [[package]] name = "digest" version = "0.10.7" @@ -290,7 +521,66 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", + "subtle", +] + +[[package]] +name = "dispatch2" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" +dependencies = [ + "bitflags", + "objc2", +] + +[[package]] +name = "document-features" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" +dependencies = [ + "litrs", +] + +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" +dependencies = [ + "curve25519-dalek", + "ed25519", + "serde", + "sha2", + "subtle", + "zeroize", ] [[package]] @@ -299,6 +589,27 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "pem-rfc7468", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "equator" version = "0.4.2" @@ -319,6 +630,12 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "equivalent" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" + [[package]] name = "fax" version = "0.2.7" @@ -334,6 +651,22 @@ dependencies = [ "simd-adler32", ] +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + [[package]] name = "find-msvc-tools" version = "0.1.15" @@ -351,6 +684,21 @@ dependencies = [ "zlib-rs", ] +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "font-types" +version = "0.12.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835ae9d781464a79026cde387f9cbc650c9a4909d7cf7e658b127e3c35d2f35d" +dependencies = [ + "bytemuck", +] + [[package]] name = "futures-core" version = "0.3.34" @@ -383,6 +731,18 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi", ] [[package]] @@ -408,6 +768,16 @@ dependencies = [ "r-efi 6.0.0", ] +[[package]] +name = "ghash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1" +dependencies = [ + "opaque-debug", + "polyval", +] + [[package]] name = "gif" version = "0.14.2" @@ -418,6 +788,31 @@ dependencies = [ "weezl", ] +[[package]] +name = "gpu-allocator" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51255ea7cfaadb6c5f1528d43e92a82acb2b96c43365989a28b2d44ee38f8795" +dependencies = [ + "ash", + "hashbrown 0.16.1", + "log", + "presser", + "thiserror", + "windows", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "half" version = "2.7.1" @@ -426,9 +821,60 @@ checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" dependencies = [ "cfg-if", "crunchy", + "num-traits", "zerocopy", ] +[[package]] +name = "harfrust" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c03d949a14aa089bbb282f7dd76a498a7f684428e4257202efc119ec010376f9" +dependencies = [ + "bitflags", + "bytemuck", + "read-fonts", + "smallvec", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" +dependencies = [ + "foldhash", +] + +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "image" version = "0.25.10" @@ -464,6 +910,25 @@ version = "1.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e44b0a4eaa4c82f441d50a963f2d5f05a787240aeee097597033e72accfd22f" +[[package]] +name = "indexmap" +version = "2.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" +dependencies = [ + "equivalent", + "hashbrown 0.17.1", +] + +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "interpolate_name" version = "0.2.4" @@ -708,6 +1173,15 @@ dependencies = [ "tracing", ] +[[package]] +name = "lazy_static" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb" +dependencies = [ + "spin", +] + [[package]] name = "libc" version = "0.2.190" @@ -724,6 +1198,38 @@ dependencies = [ "cc", ] +[[package]] +name = "libloading" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" +dependencies = [ + "cfg-if", + "windows-link", +] + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "lightcraft-catalog" +version = "0.10.0" +source = "git+https://github.com/storytold/lightcraft?rev=5fe74557eca64638b1f9015c9769f7e52a889fa2#5fe74557eca64638b1f9015c9769f7e52a889fa2" +dependencies = [ + "crc32fast", + "lightcraft-develop", + "lightcraft-meta", + "lightcraft-raw", + "log", + "serde", + "serde_json", + "thiserror", + "web-time", +] + [[package]] name = "lightcraft-codecs" version = "0.10.0" @@ -761,6 +1267,21 @@ dependencies = [ "serde", ] +[[package]] +name = "lightcraft-denoise-core" +version = "0.10.0" +source = "git+https://github.com/storytold/lightcraft?rev=5fe74557eca64638b1f9015c9769f7e52a889fa2#5fe74557eca64638b1f9015c9769f7e52a889fa2" +dependencies = [ + "lightcraft-raster", + "miniz_oxide 0.8.9", + "rayon", + "serde", + "serde_json", + "sha2", + "thiserror", + "web-time", +] + [[package]] name = "lightcraft-develop" version = "0.10.0" @@ -773,6 +1294,43 @@ dependencies = [ "serde_json", ] +[[package]] +name = "lightcraft-engine" +version = "0.10.0" +source = "git+https://github.com/storytold/lightcraft?rev=5fe74557eca64638b1f9015c9769f7e52a889fa2#5fe74557eca64638b1f9015c9769f7e52a889fa2" +dependencies = [ + "ab_glyph", + "craft-docpath", + "harfrust", + "lightcraft-catalog", + "lightcraft-codecs", + "lightcraft-color", + "lightcraft-denoise-core", + "lightcraft-develop", + "lightcraft-faces", + "lightcraft-fetch", + "lightcraft-geocode", + "lightcraft-geom", + "lightcraft-gpu", + "lightcraft-lensdb", + "lightcraft-merge", + "lightcraft-meta", + "lightcraft-pipeline", + "lightcraft-preview", + "lightcraft-raster", + "lightcraft-raw", + "lightcraft-scenes", + "lightcraft-slideshow", + "log", + "miniz_oxide 0.8.9", + "rayon", + "serde", + "serde_json", + "thiserror", + "unicode-segmentation", + "web-time", +] + [[package]] name = "lightcraft-faces" version = "0.10.0" @@ -787,6 +1345,27 @@ dependencies = [ "web-time", ] +[[package]] +name = "lightcraft-fetch" +version = "0.10.0" +source = "git+https://github.com/storytold/lightcraft?rev=5fe74557eca64638b1f9015c9769f7e52a889fa2#5fe74557eca64638b1f9015c9769f7e52a889fa2" +dependencies = [ + "log", + "rustls", + "rustls-rustcrypto", + "sha2", + "webpki-roots", +] + +[[package]] +name = "lightcraft-geocode" +version = "0.10.0" +source = "git+https://github.com/storytold/lightcraft?rev=5fe74557eca64638b1f9015c9769f7e52a889fa2#5fe74557eca64638b1f9015c9769f7e52a889fa2" +dependencies = [ + "miniz_oxide 0.8.9", + "serde", +] + [[package]] name = "lightcraft-geom" version = "0.10.0" @@ -795,6 +1374,23 @@ dependencies = [ "serde", ] +[[package]] +name = "lightcraft-gpu" +version = "0.10.0" +source = "git+https://github.com/storytold/lightcraft?rev=5fe74557eca64638b1f9015c9769f7e52a889fa2#5fe74557eca64638b1f9015c9769f7e52a889fa2" +dependencies = [ + "bytemuck", + "lightcraft-color", + "lightcraft-develop", + "lightcraft-faces", + "lightcraft-geom", + "lightcraft-pipeline", + "lightcraft-raster", + "log", + "pollster", + "wgpu", +] + [[package]] name = "lightcraft-inpaint" version = "0.10.0" @@ -803,6 +1399,16 @@ dependencies = [ "rayon", ] +[[package]] +name = "lightcraft-lensdb" +version = "0.10.0" +source = "git+https://github.com/storytold/lightcraft?rev=5fe74557eca64638b1f9015c9769f7e52a889fa2#5fe74557eca64638b1f9015c9769f7e52a889fa2" +dependencies = [ + "lightcraft-develop", + "lightcraft-geom", + "quick-xml", +] + [[package]] name = "lightcraft-merge" version = "0.10.0" @@ -846,6 +1452,19 @@ dependencies = [ "serde", ] +[[package]] +name = "lightcraft-preview" +version = "0.10.0" +source = "git+https://github.com/storytold/lightcraft?rev=5fe74557eca64638b1f9015c9769f7e52a889fa2#5fe74557eca64638b1f9015c9769f7e52a889fa2" +dependencies = [ + "jpeg-encoder", + "lightcraft-raster", + "log", + "siphasher", + "zune-core", + "zune-jpeg", +] + [[package]] name = "lightcraft-raster" version = "0.10.0" @@ -888,6 +1507,16 @@ dependencies = [ "serde", ] +[[package]] +name = "lightcraft-slideshow" +version = "0.10.0" +source = "git+https://github.com/storytold/lightcraft?rev=5fe74557eca64638b1f9015c9769f7e52a889fa2#5fe74557eca64638b1f9015c9769f7e52a889fa2" +dependencies = [ + "lightcraft-raster", + "serde", + "serde_json", +] + [[package]] name = "lightcraft-tiff" version = "0.10.0" @@ -897,6 +1526,21 @@ dependencies = [ "thiserror", ] +[[package]] +name = "litrs" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4744e383959f0db86ede514b809b1c53251889093803c05267acc7d4e7030d70" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + [[package]] name = "log" version = "0.4.34" @@ -978,6 +1622,44 @@ dependencies = [ "pxfm", ] +[[package]] +name = "naga" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a616d2fb8c89516ac2723a581f69d6c18576046bed761bd6b305e5618e6ae130" +dependencies = [ + "arrayvec", + "bit-set", + "bitflags", + "cfg-if", + "cfg_aliases", + "codespan-reporting", + "half", + "hashbrown 0.17.1", + "indexmap", + "libm", + "log", + "naga-types", + "num-traits", + "once_cell", + "rustc-hash", + "spirv", + "thiserror", + "unicode-ident", +] + +[[package]] +name = "naga-types" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "590afbf58a6f4f62873cd5cff4468061844bafa1cdf399cc954537c22d768d49" +dependencies = [ + "hashbrown 0.17.1", + "indexmap", + "rustc-hash", + "thiserror", +] + [[package]] name = "ndarray" version = "0.17.2" @@ -1033,6 +1715,22 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-bigint-dig" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e661dda6640fad38e827a6d4a310ff4763082116fe217f279885c97f511bb0b7" +dependencies = [ + "lazy_static", + "libm", + "num-integer", + "num-iter", + "num-traits", + "rand 0.8.8", + "smallvec", + "zeroize", +] + [[package]] name = "num-complex" version = "0.4.6" @@ -1062,6 +1760,16 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-iter" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c92800bd69a1eac91786bcfe9da64a897eb72911b8dc3095decbd07429e8048b" +dependencies = [ + "num-integer", + "num-traits", +] + [[package]] name = "num-rational" version = "0.4.2" @@ -1080,6 +1788,93 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", + "libm", +] + +[[package]] +name = "objc2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08849bbd4767dfae9457696856ae1c84fe4e0281bbe4a7abff2d0e06fb7981f8" +dependencies = [ + "objc2-encode", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags", + "dispatch2", + "objc2", +] + +[[package]] +name = "objc2-core-graphics" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" +dependencies = [ + "dispatch2", + "objc2", + "objc2-core-foundation", + "objc2-io-surface", +] + +[[package]] +name = "objc2-encode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" + +[[package]] +name = "objc2-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" +dependencies = [ + "bitflags", + "objc2", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-io-surface" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" +dependencies = [ + "bitflags", + "objc2", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-metal" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794" +dependencies = [ + "bitflags", + "block2", + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f" +dependencies = [ + "bitflags", + "objc2", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation", + "objc2-metal", ] [[package]] @@ -1088,6 +1883,77 @@ version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + +[[package]] +name = "ordered-float" +version = "5.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c7c9e0d9b23589f26070720bac724174bfec1083e82f7854cdd0267518343c0" +dependencies = [ + "num-traits", +] + +[[package]] +name = "owned_ttf_parser" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36820e9051aca1014ddc75770aab4d68bc1e9e632f0f5627c4086bc216fb583b" +dependencies = [ + "ttf-parser", +] + +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2", +] + +[[package]] +name = "p384" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe42f1670a52a47d448f14b6a5c61dd78fce51856e68edaa38f7ae3a46b8d6b6" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2", +] + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + [[package]] name = "paste" version = "1.0.15" @@ -1100,13 +1966,24 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec" +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + [[package]] name = "photoreport-engine" version = "0.1.0" dependencies = [ + "lightcraft-catalog", "lightcraft-codecs", "lightcraft-color", "lightcraft-develop", + "lightcraft-engine", "lightcraft-geom", "lightcraft-merge", "lightcraft-meta", @@ -1153,6 +2030,38 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" +[[package]] +name = "pkcs1" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" +dependencies = [ + "der", + "pkcs8", + "spki", +] + +[[package]] +name = "pkcs5" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e847e2c91a18bfa887dd028ec33f2fe6f25db77db3619024764914affe8b69a6" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "pkcs5", + "spki", +] + [[package]] name = "png" version = "0.18.1" @@ -1166,6 +2075,35 @@ dependencies = [ "miniz_oxide 0.8.9", ] +[[package]] +name = "pollster" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc6355899e1c9462875b6757c79f3caa011a1fdae12bbb1a2e72dd1f234f8336" + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "polyval" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" +dependencies = [ + "cfg-if", + "cpufeatures", + "opaque-debug", + "universal-hash", +] + [[package]] name = "portable-atomic" version = "1.15.0" @@ -1190,6 +2128,21 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "presser" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" + +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro2" version = "1.0.107" @@ -1260,14 +2213,34 @@ version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" +[[package]] +name = "rand" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c" +dependencies = [ + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + [[package]] name = "rand" version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41" dependencies = [ - "rand_chacha", - "rand_core", + "rand_chacha 0.9.0", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", ] [[package]] @@ -1277,7 +2250,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", ] [[package]] @@ -1289,6 +2271,12 @@ dependencies = [ "getrandom 0.3.4", ] +[[package]] +name = "range-alloc" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca45419789ae5a7899559e9512e58ca889e41f04f1f2445e9f4b290ceccd1d08" + [[package]] name = "rav1e" version = "0.8.1" @@ -1316,8 +2304,8 @@ dependencies = [ "num-traits", "paste", "profiling", - "rand", - "rand_chacha", + "rand 0.9.5", + "rand_chacha 0.9.0", "simd_helpers", "thiserror", "v_frame", @@ -1339,6 +2327,24 @@ dependencies = [ "rgb", ] +[[package]] +name = "raw-window-handle" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" + +[[package]] +name = "raw-window-metal" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40d213455a5f1dc59214213c7330e074ddf8114c9a42411eb890c767357ce135" +dependencies = [ + "objc2", + "objc2-core-foundation", + "objc2-foundation", + "objc2-quartz-core", +] + [[package]] name = "rawpointer" version = "0.2.1" @@ -1365,18 +2371,204 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "read-fonts" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046a7d674daf459825b32f5062056d6882db0d2f5a479fbd76ccfc870ac18709" +dependencies = [ + "bytemuck", + "font-types", + "once_cell", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[package]] +name = "renderdoc-sys" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + [[package]] name = "rgb" version = "0.8.53" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "47b34b781b31e5d73e9fbc8689c70551fd1ade9a19e3e28cfec8580a79290cc4" +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys", +] + +[[package]] +name = "rsa" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8573f03f5883dcaebdfcf4725caa1ecb9c15b2ef50c43a07b816e06799bb12d" +dependencies = [ + "const-oid", + "digest", + "num-bigint-dig", + "num-integer", + "num-traits", + "pkcs1", + "pkcs8", + "rand_core 0.6.4", + "sha2", + "signature", + "spki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustls" +version = "0.23.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf" +dependencies = [ + "once_cell", + "rustls-pki-types", + "rustls-webpki 0.103.16", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustls-rustcrypto" +version = "0.0.2-alpha" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f12052947763ab8515f753315357599e9b0b4dab3b8ba15f30f725fe6d025557" +dependencies = [ + "aead", + "aes-gcm", + "chacha20poly1305", + "crypto-common", + "der", + "digest", + "ecdsa", + "ed25519-dalek", + "hmac", + "p256", + "p384", + "paste", + "pkcs8", + "rand_core 0.6.4", + "rsa", + "rustls", + "rustls-pki-types", + "rustls-webpki 0.102.8", + "sec1", + "sha2", + "signature", + "x25519-dalek", +] + +[[package]] +name = "rustls-webpki" +version = "0.102.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443b1b6d39d7c663139942cc4558262562d2c84123bb6282ef177009ca8b281" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + [[package]] name = "rustversion" version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + [[package]] name = "serde" version = "1.0.229" @@ -1437,6 +2629,16 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core 0.6.4", +] + [[package]] name = "simd-adler32" version = "0.3.10" @@ -1452,18 +2654,67 @@ dependencies = [ "quote", ] +[[package]] +name = "siphasher" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33f4fe9184a62d842c9ef383018f3306d8ba224fd9d836f56d7288308847c256" + [[package]] name = "slab" version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" +[[package]] +name = "smallvec" +version = "1.16.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0d5d4b1981b8bbbb7aed204cae5726d683d5d6ac7e74ec54122ea28f315e7c8" + +[[package]] +name = "spin" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3763264f6b73151db08c50ff20d7d8a0b8796e021cdea7ceedad07b80155fa0e" + +[[package]] +name = "spirv" +version = "0.4.0+sdk-1.4.341.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9571ea910ebd84c86af4b3ed27f9dbdc6ad06f17c5f96146b2b671e2976744f" +dependencies = [ + "bitflags", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + [[package]] name = "stable_deref_trait" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "2.0.119" @@ -1520,6 +2771,15 @@ dependencies = [ "zune-jpeg", ] +[[package]] +name = "tokio" +version = "1.54.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" +dependencies = [ + "pin-project-lite", +] + [[package]] name = "tracing" version = "0.1.44" @@ -1539,6 +2799,12 @@ dependencies = [ "once_cell", ] +[[package]] +name = "ttf-parser" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" + [[package]] name = "typenum" version = "1.20.1" @@ -1551,6 +2817,34 @@ version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d245f478577f809a851594d02313b640fb437e0bb33866753cff937863096954" +[[package]] +name = "unicode-segmentation" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" + +[[package]] +name = "unicode-width" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" + +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "v_frame" version = "0.3.9" @@ -1568,6 +2862,12 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + [[package]] name = "wasip2" version = "1.0.4+wasi-0.2.12" @@ -1590,6 +2890,17 @@ dependencies = [ "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cbab34de2d982e9b48e18d216d04c4a6f641066ff19ffb699980f591ee3610e" +dependencies = [ + "js-sys", + "tokio", + "wasm-bindgen", +] + [[package]] name = "wasm-bindgen-macro" version = "0.2.129" @@ -1622,6 +2933,16 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "web-sys" +version = "0.3.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88261b9deccee56594c11a3460c462c41f58d148598fe70ad77070126a68aba4" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "web-time" version = "1.1.0" @@ -1632,18 +2953,374 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webpki-roots" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5f280bbb2b287bc8e7de7e3852945a0ff50d1bbcb5ed42b6c7a568c546df171" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "weezl" version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88" +[[package]] +name = "wgpu" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527ccdf43dd5b2e8676eed9984ce00e2bbb0a1b85b70c1969dcb6cd2eb55ab9e" +dependencies = [ + "arrayvec", + "bitflags", + "bytemuck", + "cfg-if", + "cfg_aliases", + "document-features", + "hashbrown 0.17.1", + "js-sys", + "log", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "smallvec", + "static_assertions", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "wgpu-core", + "wgpu-hal", + "wgpu-types", +] + +[[package]] +name = "wgpu-core" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c018fce9b6270aa203c2fdd56f3cce996713534bd757e4ea58c8560b121f14" +dependencies = [ + "arrayvec", + "bit-set", + "bit-vec", + "bitflags", + "bytemuck", + "cfg_aliases", + "document-features", + "hashbrown 0.17.1", + "indexmap", + "log", + "naga", + "naga-types", + "once_cell", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "rustc-hash", + "smallvec", + "thiserror", + "wgpu-core-deps-apple", + "wgpu-core-deps-windows-linux-android", + "wgpu-hal", + "wgpu-naga-bridge", + "wgpu-types", +] + +[[package]] +name = "wgpu-core-deps-apple" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "061f3d319a40d39d00b1ecc2c33b89fe21d4e6fe01859df3500a3a8ecccd6b68" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-core-deps-windows-linux-android" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7586165fd5f6d881cb9ce4bb71f40d6caab2c0f1837e3fc1d9788a197fb6004f" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-hal" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6b7fb58561a792bc237628ba0792e332de418fefe145f13b5ed8201e6d52f58" +dependencies = [ + "android_system_properties", + "arrayvec", + "ash", + "bit-set", + "bitflags", + "block2", + "bytemuck", + "cfg-if", + "cfg_aliases", + "gpu-allocator", + "hashbrown 0.17.1", + "libc", + "libloading", + "log", + "naga", + "naga-types", + "objc2", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation", + "objc2-metal", + "objc2-quartz-core", + "once_cell", + "ordered-float", + "parking_lot", + "portable-atomic", + "portable-atomic-util", + "profiling", + "range-alloc", + "raw-window-handle", + "raw-window-metal", + "renderdoc-sys", + "smallvec", + "static_assertions", + "thiserror", + "wgpu-naga-bridge", + "wgpu-types", + "windows", + "windows-core", +] + +[[package]] +name = "wgpu-naga-bridge" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2f62e73117bb7a62bfd9c5a5841438a823f6566c6442a808ee269d2d055c081" +dependencies = [ + "naga", + "wgpu-types", +] + +[[package]] +name = "wgpu-types" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99dad6f1fbdbbdb4c278a6508b059d44688f5cebddf78d005a46a31340269286" +dependencies = [ + "bitflags", + "bytemuck", + "js-sys", + "log", + "naga-types", + "raw-window-handle", + "static_assertions", + "web-sys", +] + +[[package]] +name = "windows" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" +dependencies = [ + "windows-collections", + "windows-core", + "windows-future", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" +dependencies = [ + "windows-core", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-future" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" +dependencies = [ + "windows-core", + "windows-link", + "windows-threading", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-numerics" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" +dependencies = [ + "windows-core", + "windows-link", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows-threading" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + [[package]] name = "wit-bindgen" version = "0.57.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" +[[package]] +name = "x25519-dalek" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +dependencies = [ + "curve25519-dalek", + "rand_core 0.6.4", + "zeroize", +] + [[package]] name = "y4m" version = "0.8.0" @@ -1670,6 +3347,26 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "zeroize" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "zlib-rs" version = "0.6.8" diff --git a/Cargo.toml b/Cargo.toml index 4f9ef42..fb5f23b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,6 +20,10 @@ lightcraft-merge = { git = "https://github.com/storytold/lightcraft", rev = "5fe lightcraft-raw = { git = "https://github.com/storytold/lightcraft", rev = "5fe74557eca64638b1f9015c9769f7e52a889fa2" } lightcraft-color = { git = "https://github.com/storytold/lightcraft", rev = "5fe74557eca64638b1f9015c9769f7e52a889fa2" } lightcraft-meta = { git = "https://github.com/storytold/lightcraft", rev = "5fe74557eca64638b1f9015c9769f7e52a889fa2" } +# Photo Merge only. The develop crates do not export the colour-tag step a raw without matrices +# needs before write_linear_dng. Desktop turns this on; the browser engine does not. +lightcraft-engine = { git = "https://github.com/storytold/lightcraft", rev = "5fe74557eca64638b1f9015c9769f7e52a889fa2" } +lightcraft-catalog = { git = "https://github.com/storytold/lightcraft", rev = "5fe74557eca64638b1f9015c9769f7e52a889fa2" } serde = { version = "1", features = ["derive"] } serde_json = "1" thiserror = "2" diff --git a/apps/app/src/i18n.ts b/apps/app/src/i18n.ts index 5cc338e..14c0b27 100644 --- a/apps/app/src/i18n.ts +++ b/apps/app/src/i18n.ts @@ -56,6 +56,8 @@ export const t = { opening: "A abrir a pasta…", close: "Fechar", hint: "Folha de contacto desta pasta, neste computador. Não cria um evento nem envia fotografias. Estrelas e marcas ficam só nesta sessão.", + mergeTitle: "Funde as exposições desta pasta num DNG ao lado delas. As originais ficam. Não envia fotografias.", + merged: (n: number) => (n === 1 ? "1 DNG ficou nesta pasta." : `${n} DNG ficaram nesta pasta.`), empty: "Esta pasta não tem fotografias.", failed: "Não foi possível abrir esta pasta.", count: (n: number) => (n === 1 ? "1 foto" : `${n} fotos`), @@ -297,6 +299,9 @@ export const t = { missing: "Falta o ficheiro original de alguma exposição.", engine: "O motor ainda não grava o DNG. Quando a cópia do cartão acabar, atualiza a página.", failed: "Não fundi. Tenta outra vez.", + raw: "Não consegui ler estes RAW para os fundir.", + write: "Não consegui gravar o DNG nesta pasta.", + failedDetail: (reason: string) => `Não fundi. ${reason}`, }, }, card: { diff --git a/apps/app/src/library/FolderSheet.tsx b/apps/app/src/library/FolderSheet.tsx index a6189dc..081d4a5 100644 --- a/apps/app/src/library/FolderSheet.tsx +++ b/apps/app/src/library/FolderSheet.tsx @@ -4,6 +4,8 @@ import { t } from "../i18n.js"; import { LABEL_COLOR } from "./Grid.js"; import { FOLDER_CELL_H, FOLDER_CELL_W, FOLDER_GAP, folderCols, folderWindow } from "./folder-layout.js"; import type { FolderListing } from "./folderDrop.js"; +import { mergeFailureText } from "./folderMerge.js"; +import { MergeError } from "./mergeExposures.js"; import { isMac, patchForKey, pmPatchForKey } from "./store.js"; interface Mark { @@ -66,8 +68,17 @@ export function FolderSheet(props: { folder: FolderListing; onClose: () => void; thumb: (path: string, edge: number) => Promise; + /** + * Merges the photos on this sheet and returns how many DNG files were written beside them. + * Absent in a view that cannot edit. The library's own merge stays on the event underneath. + */ + merge?: (input: { + files: FolderListing["files"]; + selectedIds: readonly string[]; + onStatus: (stack: number, total: number) => void; + }) => Promise; }) { - const { folder, onClose, thumb } = props; + const { folder, onClose, thumb, merge } = props; const files = folder.files; const scroller = useRef(null); const [width, setWidth] = useState(800); @@ -78,6 +89,34 @@ export function FolderSheet(props: { const [selected, setSelected] = useState>(() => new Set(files[0] ? [files[0].path] : [])); const [marks, setMarks] = useState>(() => new Map()); const [loupe, setLoupe] = useState(false); + const [mergeStatus, setMergeStatus] = useState(null); + const [mergeFailed, setMergeFailed] = useState(false); + const [merging, setMerging] = useState(false); + const mergePending = useRef(false); + + const runMerge = () => { + if (!merge || mergePending.current) return; + mergePending.current = true; + setMerging(true); + setMergeFailed(false); + setMergeStatus(t.merge.reading); + void merge({ + files, + selectedIds: [...selected], + onStatus: (stack, total) => setMergeStatus(t.merge.working(stack, total)), + }).then( + (made) => setMergeStatus(t.folderSheet.merged(made)), + (err: unknown) => { + const code = err instanceof MergeError ? err.code : "failed"; + const detail = err instanceof MergeError ? err.detail : undefined; + setMergeStatus(mergeFailureText(code, detail)); + setMergeFailed(true); + }, + ).finally(() => { + mergePending.current = false; + setMerging(false); + }); + }; useEffect(() => { const el = scroller.current; @@ -221,6 +260,24 @@ export function FolderSheet(props: { {t.folderSheet.count(files.length)} {t.folderSheet.hint} + {merge && files.length > 0 && ( + + + {mergeStatus && ( + + {mergeStatus} + + )} + + )} diff --git a/apps/app/src/library/folderDrop.ts b/apps/app/src/library/folderDrop.ts index e14cc33..1372160 100644 --- a/apps/app/src/library/folderDrop.ts +++ b/apps/app/src/library/folderDrop.ts @@ -116,6 +116,19 @@ export async function openFolder(path: string, invoke: Invoke = desktopInvoke): } } +/** Capture metadata of one photo on the open sheet, read in the desktop process. */ +export function folderMeta(path: string, invoke: Invoke = desktopInvoke): Promise { + return invoke("folder_meta", { path }); +} + +/** + * Merges these photos in the desktop process and writes the DNG beside the middle one. + * The raws never cross into the page: a folder of CR3 does not fit in the browser engine. + */ +export function mergeFolderDng(paths: readonly string[], maxEdge: number, invoke: Invoke = desktopInvoke): Promise { + return invoke("folder_merge_dng", { paths, maxEdge }); +} + export async function folderThumb(path: string, edge: number, invoke?: Invoke): Promise { if (!invoke && !isDesktop()) return null; try { diff --git a/apps/app/src/library/folderMerge.test.ts b/apps/app/src/library/folderMerge.test.ts new file mode 100644 index 0000000..7003006 --- /dev/null +++ b/apps/app/src/library/folderMerge.test.ts @@ -0,0 +1,104 @@ +import { describe, expect, it } from "vitest"; +import { mergeFailureText, mergeFolderExposures, mergeFolderNative } from "./folderMerge.js"; +import { MergeError } from "./mergeExposures.js"; + +const at = (ms: number) => new Date(Date.parse("2026-10-21T10:00:00.000Z") + ms).toISOString(); + +function tags(bias: number, ms: number, exposureTime = 1 / 125): string { + return JSON.stringify({ + capturedAt: at(ms), + cameraModel: "EOS R5", + focalLength: 16, + aperture: 8, + iso: 100, + width: 4000, + height: 3000, + exposureBias: bias, + exposureTime, + }); +} + +function files() { + return [ + { path: "/job/sala/dark.cr3", name: "dark.cr3" }, + { path: "/job/sala/mid.cr3", name: "mid.cr3" }, + { path: "/job/sala/bright.cr3", name: "bright.cr3" }, + { path: "/job/sala/mid-fundido.dng", name: "mid-fundido.dng" }, + ]; +} + +const meta = new Map([ + ["/job/sala/dark.cr3", tags(-2, 0)], + ["/job/sala/mid.cr3", tags(0, 200)], + ["/job/sala/bright.cr3", tags(2, 400)], +]); + +describe("merge a contact sheet", () => { + it("writes one DNG beside the bracket when only the focused photo is selected", async () => { + const saved: { dir: string; name: string; bytes: Uint8Array }[] = []; + const made = await mergeFolderExposures({ + files: files(), + selectedIds: ["/job/sala/dark.cr3"], + readFile: async (path) => new TextEncoder().encode(path), + readMeta: (bytes) => meta.get(new TextDecoder().decode(bytes)) ?? "{}", + mergeDng: () => new Uint8Array([1, 2, 3]), + saveDng: async (dir, name, bytes) => { + saved.push({ dir, name, bytes }); + }, + }); + expect(made).toBe(1); + expect(saved).toEqual([{ dir: "/job/sala", name: "mid-fundido.dng", bytes: new Uint8Array([1, 2, 3]) }]); + }); + + it("merges the photos the user selected even when they are not a detected bracket", async () => { + const saved: string[] = []; + const made = await mergeFolderExposures({ + files: files(), + selectedIds: ["/job/sala/dark.cr3", "/job/sala/mid.cr3"], + readFile: async (path) => new TextEncoder().encode(path), + readMeta: () => tags(0, 0, 1 / 125), + mergeDng: (frames) => new Uint8Array([frames.length]), + saveDng: async (_dir, name) => { + saved.push(name); + }, + }); + expect(made).toBe(1); + expect(saved).toEqual(["dark-fundido.dng"]); + }); + + it("says there is no set when a single photo is not part of a bracket", async () => { + const run = mergeFolderExposures({ + files: [{ path: "/job/a.cr3", name: "a.cr3" }, { path: "/job/b.cr3", name: "b.cr3" }], + selectedIds: ["/job/a.cr3"], + readFile: async (path) => new TextEncoder().encode(path), + readMeta: () => tags(0, 0), + mergeDng: () => new Uint8Array([1]), + saveDng: async () => {}, + }); + await expect(run).rejects.toBeInstanceOf(MergeError); + await expect(run).rejects.toMatchObject({ code: "none" }); + }); +}); + +describe("merge a contact sheet on this computer", () => { + const pair = [ + { path: "/job/dark.cr3", name: "dark.cr3" }, + { path: "/job/mid.cr3", name: "mid.cr3" }, + ]; + + it("asks the desktop to merge the stack and keeps its reason when that fails", async () => { + const stacks: string[][] = []; + const run = mergeFolderNative({ + files: pair, + selectedIds: pair.map((file) => file.path), + metaOf: async () => tags(0, 0), + mergePaths: async (paths) => { + stacks.push([...paths]); + throw new Error("cannot read the photo: cr3"); + }, + }); + await expect(run).rejects.toMatchObject({ code: "failed", detail: "cannot read the photo: cr3" }); + expect(stacks).toEqual([["/job/dark.cr3", "/job/mid.cr3"]]); + expect(mergeFailureText("failed", "cannot read the photo: cr3")).toBe("Não consegui ler estes RAW para os fundir."); + }); +}); diff --git a/apps/app/src/library/folderMerge.ts b/apps/app/src/library/folderMerge.ts new file mode 100644 index 0000000..8e75345 --- /dev/null +++ b/apps/app/src/library/folderMerge.ts @@ -0,0 +1,206 @@ +import { loadEngine, type EngineModule } from "../develop/engine.js"; +import { t } from "../i18n.js"; +import { frameFromCapture } from "../realestate/readFrame.js"; +import { MergeError } from "./mergeExposures.js"; +import { MERGE_EDGE, isMergedName, stacksOfFrames } from "./mergeStacks.js"; + +export interface FolderExposure { + path: string; + name: string; +} + +function parentDir(path: string): string { + const slash = Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\")); + if (slash <= 0) throw new MergeError("failed"); + return path.slice(0, slash); +} + +function stemOf(name: string): string { + const dot = name.lastIndexOf("."); + return dot > 0 ? name.slice(0, dot) : name; +} + +/** + * Merges the contact sheet on this computer. A selection of two or more is that set; otherwise every + * bracket in the folder. The DNG is written beside the middle frame. Nothing is uploaded. + * Metadata is read first and the bytes dropped, then each stack is read again to merge: a folder of + * raws must not all sit in memory at once. + */ +export async function mergeFolderExposures(opts: { + files: readonly FolderExposure[]; + selectedIds: readonly string[]; + readFile: (path: string) => Promise; + readMeta: (bytes: Uint8Array) => string | Promise; + mergeDng: (files: Uint8Array[]) => Uint8Array; + saveDng: (dir: string, name: string, bytes: Uint8Array) => Promise; + onStatus?: (stack: number, total: number) => void; +}): Promise { + const candidates = opts.files.filter((file) => !isMergedName(file.name)); + const selected = new Set(opts.selectedIds); + const chosen = selected.size >= 2; + const pool = chosen ? candidates.filter((file) => selected.has(file.path)) : candidates; + if (pool.length < 2) throw new MergeError("none"); + + const frames = []; + for (const file of pool) { + const bytes = await readOrMissing(opts.readFile, file.path); + frames.push(await frameOfFile(file, bytes, opts.readMeta)); + } + + const stacks = stacksOfFrames(frames, opts.selectedIds); + if (stacks.length === 0) throw new MergeError("none"); + + const byPath = new Map(pool.map((file) => [file.path, file])); + let made = 0; + for (let index = 0; index < stacks.length; index++) { + opts.onStatus?.(index + 1, stacks.length); + const members = (stacks[index] ?? []).map((id) => byPath.get(id)).filter((file): file is FolderExposure => !!file); + if (members.length < 2) throw new MergeError("none"); + const files: Uint8Array[] = []; + for (const member of members) files.push(await readOrMissing(opts.readFile, member.path)); + const dng = mergedOrFailed(opts.mergeDng, files); + const mid = members[Math.floor((members.length - 1) / 2)]!; + try { + await opts.saveDng(parentDir(mid.path), `${stemOf(mid.name)}-fundido.dng`, dng); + } catch (err) { + if (err instanceof MergeError) throw err; + throw new MergeError("failed"); + } + made += 1; + } + return made; +} + +async function readOrMissing(readFile: (path: string) => Promise, path: string): Promise { + try { + const bytes = await readFile(path); + if (bytes.byteLength === 0) throw new MergeError("missing"); + return bytes; + } catch (err) { + if (err instanceof MergeError) throw err; + throw new MergeError("missing"); + } +} + +async function frameOfFile( + file: FolderExposure, + bytes: Uint8Array, + readMeta: (bytes: Uint8Array) => string | Promise, +) { + try { + const tags = JSON.parse(await readMeta(bytes)) as Record; + return frameFromCapture(file.path, file.name, tags); + } catch { + return { id: file.path, fileName: file.name }; + } +} + +function mergedOrFailed(mergeDng: (files: Uint8Array[]) => Uint8Array, files: Uint8Array[]): Uint8Array { + try { + const dng = mergeDng(files); + if (dng.byteLength === 0) throw new MergeError("failed"); + return dng; + } catch (err) { + if (err instanceof MergeError) throw err; + throw new MergeError("failed"); + } +} + +/** + * Merges the contact sheet in the desktop process. Metadata and the DNG stay there: sending every + * raw into the browser engine is what made a folder of CR3 fail with no reason. + */ +export async function mergeFolderNative(opts: { + files: readonly FolderExposure[]; + selectedIds: readonly string[]; + metaOf: (path: string) => Promise; + mergePaths: (paths: readonly string[]) => Promise; + onStatus?: (stack: number, total: number) => void; +}): Promise { + const candidates = opts.files.filter((file) => !isMergedName(file.name)); + const selected = new Set(opts.selectedIds); + const chosen = selected.size >= 2; + const pool = chosen ? candidates.filter((file) => selected.has(file.path)) : candidates; + if (pool.length < 2) throw new MergeError("none"); + + const frames = []; + for (const file of pool) { + try { + const tags = JSON.parse(await opts.metaOf(file.path)) as Record; + frames.push(frameFromCapture(file.path, file.name, tags)); + } catch (err) { + if (err instanceof MergeError) throw err; + frames.push({ id: file.path, fileName: file.name }); + } + } + + const stacks = stacksOfFrames(frames, opts.selectedIds); + if (stacks.length === 0) throw new MergeError("none"); + + let made = 0; + for (let index = 0; index < stacks.length; index++) { + opts.onStatus?.(index + 1, stacks.length); + const ids = stacks[index] ?? []; + if (ids.length < 2) throw new MergeError("none"); + try { + await opts.mergePaths(ids); + } catch (err) { + if (err instanceof MergeError) throw err; + const detail = err instanceof Error ? err.message : String(err); + throw new MergeError("failed", detail); + } + made += 1; + } + return made; +} + +/** The sentence under the button. An unknown failure keeps the desktop's reason, so the next try is not a guess. */ +export function mergeFailureText(code: MergeError["code"], detail?: string): string { + if (code !== "failed" || !detail) return t.merge.errors[code]; + const lower = detail.toLowerCase(); + if (lower.includes("permission") || lower.includes("read-only") || lower.includes("operation not permitted")) { + return t.merge.errors.write; + } + if (lower.includes("cannot read the photo") || lower.includes("cannot be reduced")) { + return t.merge.errors.raw; + } + return t.merge.errors.failedDetail(detail); +} + +/** The desktop merge: capture metadata and the linear DNG come from the develop engine. */ +export async function mergeFolderOnDisk(opts: { + files: readonly FolderExposure[]; + selectedIds: readonly string[]; + readFile: (path: string) => Promise; + saveDng: (dir: string, name: string, bytes: Uint8Array) => Promise; + onStatus?: (stack: number, total: number) => void; +}): Promise { + let engine: EngineModule; + try { + engine = await loadEngine(); + } catch { + throw new MergeError("engine"); + } + return mergeFolderExposures({ + ...opts, + readMeta: (bytes) => engine.readCaptureMeta(bytes), + mergeDng: (files) => dngOf(engine, files), + }); +} + +function dngOf(engine: EngineModule, files: Uint8Array[]): Uint8Array { + const job = new engine.BracketJob(); + try { + for (const file of files) job.push(file); + if (!job.mergeDng) throw new MergeError("engine"); + const dng = job.mergeDng(MERGE_EDGE); + const copy = new Uint8Array(dng.byteLength); + copy.set(dng); + return copy; + } catch (err) { + if (err instanceof MergeError) throw err; + throw new MergeError("failed"); + } finally { + job.free(); + } +} diff --git a/apps/app/src/library/folderSheet.test.tsx b/apps/app/src/library/folderSheet.test.tsx index aca9c6d..2f8e06b 100644 --- a/apps/app/src/library/folderSheet.test.tsx +++ b/apps/app/src/library/folderSheet.test.tsx @@ -37,6 +37,39 @@ describe("contact sheet", () => { expect(onClose).toHaveBeenCalledOnce(); }); + it("merges the photos on the sheet", async () => { + const user = userEvent.setup(); + const merge = vi.fn( + async (_input: { + files: { path: string; name: string }[]; + selectedIds: readonly string[]; + onStatus: (stack: number, total: number) => void; + }) => 1, + ); + render( + {}} + thumb={thumb} + merge={merge} + />, + ); + await user.click(screen.getByRole("button", { name: "Fundir exposições" })); + expect(merge).toHaveBeenCalledOnce(); + const input = merge.mock.calls[0]![0]; + expect(input.files.map((file) => file.name)).toEqual(["a.jpg", "b.jpg", "c.jpg"]); + expect(input.selectedIds).toEqual(["/job/a.jpg"]); + expect((await screen.findByRole("status")).textContent).toBe("1 DNG ficou nesta pasta."); + }); + it("does not mount a thumbnail button for every file", () => { const files = Array.from({ length: 200 }, (_, i) => ({ path: `/job/${i}.jpg`, name: `${i}.jpg` })); render( {}} thumb={thumb} />); diff --git a/apps/app/src/library/mergeExposures.ts b/apps/app/src/library/mergeExposures.ts index 119d40a..6a4127e 100644 --- a/apps/app/src/library/mergeExposures.ts +++ b/apps/app/src/library/mergeExposures.ts @@ -5,8 +5,11 @@ import { localOriginal } from "../platform.js"; import { MERGE_EDGE, stacksToMerge } from "./mergeStacks.js"; export class MergeError extends Error { - constructor(readonly code: "none" | "missing" | "engine" | "failed") { - super(code); + constructor( + readonly code: "none" | "missing" | "engine" | "failed", + readonly detail?: string, + ) { + super(detail ? `${code}: ${detail}` : code); } } diff --git a/apps/app/src/library/mergeStacks.ts b/apps/app/src/library/mergeStacks.ts index 0d08298..5ecf75c 100644 --- a/apps/app/src/library/mergeStacks.ts +++ b/apps/app/src/library/mergeStacks.ts @@ -4,12 +4,14 @@ import { groupBrackets, type BracketFrame } from "@photoreport/metadata"; /** The engine's long-side cap for a merge. The DNG is this photo, not the full sensor. */ export const MERGE_EDGE = 4096; +/** A DNG this merge already wrote is not another exposure. */ +export function isMergedName(name: string): boolean { + const lower = name.toLowerCase(); + return lower.endsWith(".dng") || lower.includes("-fundido"); +} + function isMergedFile(photo: PhotoSummary): boolean { - const names = [photo.originalName, photo.name]; - return names.some((name) => { - const lower = name.toLowerCase(); - return lower.endsWith(".dng") || lower.includes("-fundido"); - }); + return isMergedName(photo.originalName) || isMergedName(photo.name); } export function frameOf(photo: PhotoSummary): BracketFrame { @@ -27,25 +29,31 @@ export function frameOf(photo: PhotoSummary): BracketFrame { }; } -function byCapture(a: PhotoSummary, b: PhotoSummary): number { +function byFrame(a: BracketFrame, b: BracketFrame): number { const time = (a.capturedAt ?? "").localeCompare(b.capturedAt ?? ""); if (time !== 0) return time; - return (a.originalName || a.name).localeCompare(b.originalName || b.name, undefined, { numeric: true, sensitivity: "base" }); + return (a.fileName ?? a.id).localeCompare(b.fileName ?? b.id, undefined, { numeric: true, sensitivity: "base" }); } /** * Stacks to merge. A selection of two or more is that set (detected into angles when they are brackets, - * otherwise one stack in capture order). With nothing selected, every bracket in the folder is a stack. - * A DNG already produced here is not an exposure. + * otherwise one stack in capture order). With fewer than two selected, every bracket in the folder is a stack. + */ +export function stacksOfFrames(frames: readonly BracketFrame[], selectedIds: readonly string[]): string[][] { + const selected = new Set(selectedIds); + const chosen = selected.size >= 2; + const pool = chosen ? frames.filter((frame) => selected.has(frame.id)) : [...frames]; + if (pool.length < 2) return []; + const grouped = groupBrackets(pool); + if (grouped.stacks.length > 0) return grouped.stacks.map((stack) => stack.frameIds); + if (!chosen) return []; + return [[...pool].sort(byFrame).map((frame) => frame.id)]; +} + +/** + * Stacks in a library collection. A DNG already produced here is not an exposure. */ export function stacksToMerge(photos: readonly PhotoSummary[], selectedIds: readonly string[]): string[][] { const ready = photos.filter((photo) => photo.status === "READY" && !isMergedFile(photo)); - const selected = new Set(selectedIds); - const chosen = selected.size >= 2; - const pool = chosen ? ready.filter((photo) => selected.has(photo.id)) : ready; - if (pool.length < 2) return []; - const grouped = groupBrackets(pool.map(frameOf)); - if (grouped.stacks.length > 0) return grouped.stacks.map((stack) => stack.frameIds); - if (!chosen) return []; - return [[...pool].sort(byCapture).map((photo) => photo.id)]; + return stacksOfFrames(ready.map(frameOf), selectedIds); } diff --git a/apps/app/src/pages/LibraryPage.tsx b/apps/app/src/pages/LibraryPage.tsx index 992e5e2..1a52596 100644 --- a/apps/app/src/pages/LibraryPage.tsx +++ b/apps/app/src/pages/LibraryPage.tsx @@ -13,7 +13,9 @@ import { useFolderScan } from "../library/folderScan.js"; import { FacesView } from "../library/FacesView.js"; import { LookupBanner } from "../library/PhotoLookup.js"; import { FolderSheet } from "../library/FolderSheet.js"; -import { beginDropWait, folderDropPath, htmlDropIsFolder, nativePaths, openFolder, folderThumb, type FolderListing } from "../library/folderDrop.js"; +import { beginDropWait, folderDropPath, folderMeta, htmlDropIsFolder, mergeFolderDng, nativePaths, openFolder, folderThumb, type FolderListing } from "../library/folderDrop.js"; +import { mergeFolderNative } from "../library/folderMerge.js"; +import { MERGE_EDGE } from "../library/mergeStacks.js"; import { Grid, Loupe, type LoupeFace } from "../library/Grid.js"; import { InfoPanel } from "../library/InfoPanel.js"; import { IptcInfo } from "../library/IptcInfo.js"; @@ -577,7 +579,7 @@ export function LibraryPage() { ))} )} - {canCull && state.scope && !state.scope.startsWith("search:") && !state.scope.startsWith("face:") && ( + {canCull && !sheet && state.scope && !state.scope.startsWith("search:") && !state.scope.startsWith("face:") && ( )} {canCull && ( @@ -707,7 +709,36 @@ export function LibraryPage() { /> )} {sheet ? ( - setSheet(null)} thumb={folderThumb} /> + setSheet(null)} + thumb={folderThumb} + {...(canCull + ? { + merge: async (input: { + files: FolderListing["files"]; + selectedIds: readonly string[]; + onStatus: (stack: number, total: number) => void; + }) => { + const made = await mergeFolderNative({ + files: input.files, + selectedIds: input.selectedIds, + onStatus: input.onStatus, + metaOf: folderMeta, + mergePaths: (paths) => mergeFolderDng(paths, MERGE_EDGE).then(() => undefined), + }); + const folderPath = sheet.path; + try { + const listing = await openFolder(folderPath); + setSheet((current) => (current?.path === folderPath ? listing : current)); + } catch { + // The DNG is already beside the frames. Reopening the folder shows it. + } + return made; + }, + } + : {})} + /> ) : openingFolder ? (

{t.folderSheet.opening}

) : view === "faces" && state.scope && state.scope !== "inbox" && !state.scope.startsWith("search:") && !state.scope.startsWith("face:") ? ( diff --git a/apps/desktop/package.json b/apps/desktop/package.json index 9ab393b..6796782 100644 --- a/apps/desktop/package.json +++ b/apps/desktop/package.json @@ -1,6 +1,6 @@ { "name": "@photoreport/desktop", - "version": "0.3.23", + "version": "0.3.24", "private": true, "type": "module", "scripts": { diff --git a/apps/desktop/src-tauri/Cargo.toml b/apps/desktop/src-tauri/Cargo.toml index 4329cf8..aecf6c7 100644 --- a/apps/desktop/src-tauri/Cargo.toml +++ b/apps/desktop/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "photoreport-desktop" -version = "0.3.23" +version = "0.3.24" edition = "2024" publish = false description = "PhotoReport desktop: the web app in a native shell, with keychain sign-in and (later) local FTP and the native engine." @@ -31,7 +31,7 @@ sha2 = "0.10" libc = "0.2" image = { version = "0.25", default-features = false, features = ["jpeg"] } # Capture time and filmstrip thumbnails. The embedded-preview feature reads the camera JPEG; the browser build leaves it off. -photoreport-engine = { path = "../../../engine/core", features = ["embedded-preview"] } +photoreport-engine = { path = "../../../engine/core", features = ["embedded-preview", "photo-merge"] } photoreport-faces = { path = "../../../workers/faces" } tauri-plugin-dialog = "2" tauri-plugin-updater = "2" diff --git a/apps/desktop/src-tauri/build.rs b/apps/desktop/src-tauri/build.rs index 8ce5362..ca40817 100644 --- a/apps/desktop/src-tauri/build.rs +++ b/apps/desktop/src-tauri/build.rs @@ -22,6 +22,10 @@ fn main() { "folder_drop", "folder_open", "folder_thumb", + "folder_read", + "folder_meta", + "folder_merge_dng", + "folder_save_dng", "ftp_preview", "ftp_info", "catalog_folders", diff --git a/apps/desktop/src-tauri/capabilities/default.json b/apps/desktop/src-tauri/capabilities/default.json index 6e60960..aebf02e 100644 --- a/apps/desktop/src-tauri/capabilities/default.json +++ b/apps/desktop/src-tauri/capabilities/default.json @@ -37,6 +37,10 @@ "allow-folder-drop", "allow-folder-open", "allow-folder-thumb", + "allow-folder-read", + "allow-folder-meta", + "allow-folder-merge-dng", + "allow-folder-save-dng", "allow-ftp-preview", "allow-ftp-info", "allow-catalog-folders", diff --git a/apps/desktop/src-tauri/permissions/autogenerated/folder_merge_dng.toml b/apps/desktop/src-tauri/permissions/autogenerated/folder_merge_dng.toml new file mode 100644 index 0000000..365ce0e --- /dev/null +++ b/apps/desktop/src-tauri/permissions/autogenerated/folder_merge_dng.toml @@ -0,0 +1,11 @@ +# Automatically generated - DO NOT EDIT! + +[[permission]] +identifier = "allow-folder-merge-dng" +description = "Enables the folder_merge_dng command without any pre-configured scope." +commands.allow = ["folder_merge_dng"] + +[[permission]] +identifier = "deny-folder-merge-dng" +description = "Denies the folder_merge_dng command without any pre-configured scope." +commands.deny = ["folder_merge_dng"] diff --git a/apps/desktop/src-tauri/permissions/autogenerated/folder_meta.toml b/apps/desktop/src-tauri/permissions/autogenerated/folder_meta.toml new file mode 100644 index 0000000..bd4ed85 --- /dev/null +++ b/apps/desktop/src-tauri/permissions/autogenerated/folder_meta.toml @@ -0,0 +1,11 @@ +# Automatically generated - DO NOT EDIT! + +[[permission]] +identifier = "allow-folder-meta" +description = "Enables the folder_meta command without any pre-configured scope." +commands.allow = ["folder_meta"] + +[[permission]] +identifier = "deny-folder-meta" +description = "Denies the folder_meta command without any pre-configured scope." +commands.deny = ["folder_meta"] diff --git a/apps/desktop/src-tauri/permissions/autogenerated/folder_read.toml b/apps/desktop/src-tauri/permissions/autogenerated/folder_read.toml new file mode 100644 index 0000000..b2d2178 --- /dev/null +++ b/apps/desktop/src-tauri/permissions/autogenerated/folder_read.toml @@ -0,0 +1,11 @@ +# Automatically generated - DO NOT EDIT! + +[[permission]] +identifier = "allow-folder-read" +description = "Enables the folder_read command without any pre-configured scope." +commands.allow = ["folder_read"] + +[[permission]] +identifier = "deny-folder-read" +description = "Denies the folder_read command without any pre-configured scope." +commands.deny = ["folder_read"] diff --git a/apps/desktop/src-tauri/permissions/autogenerated/folder_save_dng.toml b/apps/desktop/src-tauri/permissions/autogenerated/folder_save_dng.toml new file mode 100644 index 0000000..5ef6564 --- /dev/null +++ b/apps/desktop/src-tauri/permissions/autogenerated/folder_save_dng.toml @@ -0,0 +1,11 @@ +# Automatically generated - DO NOT EDIT! + +[[permission]] +identifier = "allow-folder-save-dng" +description = "Enables the folder_save_dng command without any pre-configured scope." +commands.allow = ["folder_save_dng"] + +[[permission]] +identifier = "deny-folder-save-dng" +description = "Denies the folder_save_dng command without any pre-configured scope." +commands.deny = ["folder_save_dng"] diff --git a/apps/desktop/src-tauri/src/browse.rs b/apps/desktop/src-tauri/src/browse.rs index f5b1439..d0e73f5 100644 --- a/apps/desktop/src-tauri/src/browse.rs +++ b/apps/desktop/src-tauri/src/browse.rs @@ -1,8 +1,8 @@ //! A folder dropped on the window, shown as a contact sheet. //! //! The page only learns the path because the operating system delivered it to this window. `folder_open` refuses -//! any other path, and a thumbnail is only read for a file inside a folder that was opened that way. Nothing is -//! uploaded, moved or deleted: the sheet is a view of the folder on this computer. +//! any other path, and a file is only read inside a folder that was opened that way. Nothing is uploaded. +//! The one write is a merged `-fundido.dng` beside the frames of an open sheet. use std::collections::HashSet; use std::path::{Path, PathBuf}; @@ -80,6 +80,63 @@ impl OpenFolders { } Ok(canon) } + + /// Where a merged DNG may be written: a single `-fundido.dng` name, inside an opened folder, never through a + /// symlink that leaves it. Replacing an earlier merge of the same name is allowed. + pub fn allow_save_dng(&self, dir: &Path, name: &str, len: usize) -> Result { + if len == 0 || len > MAX_DNG_BYTES { + return Err("bad_file".to_string()); + } + if !is_fundido_dng(name) { + return Err("not_a_merge".to_string()); + } + let dir = dir.canonicalize().map_err(|e| e.to_string())?; + if !dir.is_dir() { + return Err("not_a_folder".to_string()); + } + let open = self.open.lock().unwrap(); + if !open.iter().any(|root| dir.starts_with(root)) { + return Err("not_allowed".to_string()); + } + let dest = dir.join(name); + match std::fs::symlink_metadata(&dest) { + Ok(meta) if meta.file_type().is_symlink() || !meta.is_file() => { + return Err("not_allowed".to_string()); + } + _ => {} + } + Ok(dest) + } +} + +/// A merged DNG is tens of megabytes. Anything larger is not this merge. +const MAX_DNG_BYTES: usize = 512 * 1024 * 1024; + +fn is_fundido_dng(name: &str) -> bool { + if name.contains('/') || name.contains('\\') || name.contains('\0') || name.starts_with('.') { + return false; + } + let lower = name.to_ascii_lowercase(); + lower.ends_with(".dng") && lower.contains("-fundido") +} + +fn percent_decode(value: &str) -> String { + let bytes = value.as_bytes(); + let mut out = Vec::with_capacity(bytes.len()); + let mut i = 0; + while i < bytes.len() { + if bytes[i] == b'%' + && i + 2 < bytes.len() + && let Ok(v) = u8::from_str_radix(&value[i + 1..i + 3], 16) + { + out.push(v); + i += 3; + continue; + } + out.push(bytes[i]); + i += 1; + } + String::from_utf8_lossy(&out).into_owned() } fn sort_names(paths: &mut [PathBuf]) { @@ -181,6 +238,113 @@ pub async fn folder_thumb( Ok(tauri::ipc::Response::new(jpeg)) } +/// The original of one photo on the open sheet, so a merge can read the exposures. +#[tauri::command] +pub async fn folder_read( + folders: tauri::State<'_, OpenFolders>, + path: String, +) -> Result { + let file = folders.allow_file(Path::new(&path))?; + let bytes = tokio::fs::read(&file).await.map_err(|e| e.to_string())?; + Ok(tauri::ipc::Response::new(bytes)) +} + +/// Capture metadata of one photo on the open sheet. The bytes stay in this process. +#[tauri::command] +pub async fn folder_meta( + folders: tauri::State<'_, OpenFolders>, + path: String, +) -> Result { + let file = folders.allow_file(Path::new(&path))?; + tokio::task::spawn_blocking(move || { + let bytes = std::fs::read(&file).map_err(|e| e.to_string())?; + Ok(photoreport_engine::capture::read_capture(&bytes).to_string()) + }) + .await + .map_err(|e| e.to_string())? +} + +/// The files of one stack, in merge order, and where the DNG is written (beside the middle frame). +pub fn merge_plan( + folders: &OpenFolders, + paths: &[String], +) -> Result<(Vec, PathBuf), String> { + if paths.len() < 2 { + return Err("none".to_string()); + } + let mut files = Vec::with_capacity(paths.len()); + for path in paths { + files.push(folders.allow_file(Path::new(path))?); + } + let mid = &files[(files.len() - 1) / 2]; + let dir = mid.parent().ok_or_else(|| "failed".to_string())?; + let stem = mid + .file_stem() + .and_then(|s| s.to_str()) + .ok_or_else(|| "failed".to_string())?; + let dest = folders.allow_save_dng(dir, &format!("{stem}-fundido.dng"), 1)?; + Ok((files, dest)) +} + +fn merge_files_to(files: &[PathBuf], dest: &Path, max_edge: u32) -> Result<(), String> { + let mut bufs = Vec::with_capacity(files.len()); + for file in files { + bufs.push(std::fs::read(file).map_err(|e| e.to_string())?); + } + let refs: Vec<&[u8]> = bufs.iter().map(Vec::as_slice).collect(); + let dng = + photoreport_engine::merge::merge_linear_dng(&refs, max_edge).map_err(|e| e.to_string())?; + if dng.is_empty() || dng.len() > MAX_DNG_BYTES { + return Err("bad_file".to_string()); + } + std::fs::write(dest, dng).map_err(|e| e.to_string()) +} + +/// Merges one stack and writes the DNG beside the middle frame. The raws are not sent to the page. +#[tauri::command] +pub async fn folder_merge_dng( + folders: tauri::State<'_, OpenFolders>, + paths: Vec, + max_edge: u32, +) -> Result { + let (files, dest) = merge_plan(&folders, &paths)?; + tokio::task::spawn_blocking(move || { + merge_files_to(&files, &dest, max_edge)?; + Ok(dest.to_string_lossy().into_owned()) + }) + .await + .map_err(|e| e.to_string())? +} + +/// Writes one merged DNG into an opened folder. The bytes are the request body; `dir` and `name` are +/// percent-encoded headers, so the DNG is not sent as a JSON array. +#[tauri::command] +pub async fn folder_save_dng( + request: tauri::ipc::Request<'_>, + folders: tauri::State<'_, OpenFolders>, +) -> Result { + let header = |name: &str| { + request + .headers() + .get(name) + .and_then(|v| v.to_str().ok()) + .map(percent_decode) + .ok_or_else(|| format!("missing {name}")) + }; + let dir = header("dir")?; + let name = header("name")?; + let tauri::ipc::InvokeBody::Raw(data) = request.body() else { + return Err("expected the file as the body".to_string()); + }; + // Copy before the write: the request does not live across the await. + let bytes = data.to_vec(); + let path = folders.allow_save_dng(Path::new(&dir), &name, bytes.len())?; + tokio::fs::write(&path, &bytes) + .await + .map_err(|e| e.to_string())?; + Ok(path.to_string_lossy().into_owned()) +} + #[cfg(test)] mod tests { use super::*; @@ -278,4 +442,88 @@ mod tests { assert!(thumb.len() < bytes.len()); let _ = std::fs::remove_dir_all(&root); } + + #[test] + fn a_merge_is_only_a_fundido_dng_inside_the_open_folder() { + let root = temp_dir("save"); + let nested = root.join("sala"); + std::fs::create_dir_all(&nested).unwrap(); + let other = temp_dir("save-other"); + let folders = OpenFolders::default(); + folders.note(&[root.clone()]); + folders.open(&root).unwrap(); + + let saved = folders + .allow_save_dng(&nested, "IMG_0002-fundido.dng", 4) + .unwrap(); + assert_eq!( + saved, + nested.canonicalize().unwrap().join("IMG_0002-fundido.dng") + ); + assert_eq!( + folders + .allow_save_dng(&other, "IMG_0002-fundido.dng", 4) + .unwrap_err(), + "not_allowed" + ); + assert_eq!( + folders + .allow_save_dng(&nested, "../IMG_0002-fundido.dng", 4) + .unwrap_err(), + "not_a_merge" + ); + assert_eq!( + folders + .allow_save_dng(&nested, "IMG_0002.dng", 4) + .unwrap_err(), + "not_a_merge" + ); + assert_eq!( + folders + .allow_save_dng(&nested, "IMG_0002-fundido.dng", 0) + .unwrap_err(), + "bad_file" + ); + + #[cfg(unix)] + { + let link = nested.join("IMG_0002-fundido.dng"); + let outside = other.join("secret.dng"); + std::fs::write(&outside, b"x").unwrap(); + std::os::unix::fs::symlink(&outside, &link).unwrap(); + assert_eq!( + folders + .allow_save_dng(&nested, "IMG_0002-fundido.dng", 4) + .unwrap_err(), + "not_allowed" + ); + } + + let _ = std::fs::remove_dir_all(&root); + let _ = std::fs::remove_dir_all(&other); + } + + #[test] + fn a_stack_is_named_after_its_middle_frame() { + let root = temp_dir("plan"); + let names = ["dark.jpg", "mid.jpg", "bright.jpg"]; + for name in names { + std::fs::write(root.join(name), b"jpeg").unwrap(); + } + let folders = OpenFolders::default(); + folders.note(&[root.clone()]); + folders.open(&root).unwrap(); + let paths: Vec = names + .iter() + .map(|name| root.join(name).to_string_lossy().into_owned()) + .collect(); + let (files, dest) = merge_plan(&folders, &paths).unwrap(); + assert_eq!(files.len(), 3); + assert_eq!( + dest.file_name().unwrap().to_string_lossy(), + "mid-fundido.dng" + ); + assert_eq!(merge_plan(&folders, &paths[..1]).unwrap_err(), "none"); + let _ = std::fs::remove_dir_all(&root); + } } diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rs index 7373973..9679a3d 100644 --- a/apps/desktop/src-tauri/src/lib.rs +++ b/apps/desktop/src-tauri/src/lib.rs @@ -145,6 +145,10 @@ pub fn run() { browse::folder_drop, browse::folder_open, browse::folder_thumb, + browse::folder_read, + browse::folder_meta, + browse::folder_merge_dng, + browse::folder_save_dng, ftp::ftp_preview, ftp::ftp_info, catalog::catalog_folders, diff --git a/apps/desktop/src-tauri/tauri.conf.json b/apps/desktop/src-tauri/tauri.conf.json index 322e183..aa3f0c7 100644 --- a/apps/desktop/src-tauri/tauri.conf.json +++ b/apps/desktop/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "PhotoReport", - "version": "0.3.23", + "version": "0.3.24", "identifier": "pt.photoreport.desktop", "build": { "devUrl": "http://localhost:5173", diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index d6deb3b..a2b7afe 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -10,8 +10,10 @@ This file is the in-repo summary agents work from. Decisions dated 2026-10-11. Final domain: `app.photoreport.pt`. Data (accounts, galleries, sales, squads) is imported, not restarted. - Desktop = Tauri around the same React SPA (replaces the Flutter Studio). - Develop engine = LightCraft crates (`lightcraft-develop`, `lightcraft-pipeline`, `lightcraft-raw`, - `lightcraft-codecs`, `lightcraft-faces`), pinned, behind `engine/core`. Not `lightcraft-engine`/`catalog`: - our catalog is the API. + `lightcraft-codecs`, `lightcraft-faces`), pinned, behind `engine/core`. Not `lightcraft-engine`/`catalog` + for the library: our catalog is the API. The desktop folder merge is the exception (`photo-merge`): + it runs LightCraft Photo Merge so a raw without its own matrices still gets colour tags in the DNG. + The browser engine leaves that feature off. - Faces: `lightcraft-faces` (YuNet detection + AuraFace v1 recognition, SFace optional; pure Rust) in `workers/faces`, a long-running process the background worker talks to over stdin/stdout. See "Faces" below. Enabled for FPA (own photos, internal federation use for news and galleries); off by default elsewhere. diff --git a/engine/core/Cargo.toml b/engine/core/Cargo.toml index b7acb87..588e74e 100644 --- a/engine/core/Cargo.toml +++ b/engine/core/Cargo.toml @@ -11,6 +11,9 @@ default = ["parallel"] parallel = ["lightcraft-codecs/parallel"] # Camera JPEG inside a raw, for the desktop filmstrip. Off in the browser build. embedded-preview = [] +# Write a merged DNG the way LightCraft Photo Merge does, including colour tags for CR2/CR3/NEF. +# Off in the browser build: that crate is the native app engine, not the develop core. +photo-merge = ["dep:lightcraft-engine", "dep:lightcraft-catalog"] [dependencies] lightcraft-develop = { workspace = true } @@ -22,6 +25,8 @@ lightcraft-merge = { workspace = true } lightcraft-raw = { workspace = true } lightcraft-color = { workspace = true } lightcraft-meta = { workspace = true } +lightcraft-engine = { workspace = true, optional = true } +lightcraft-catalog = { workspace = true, optional = true } serde = { workspace = true } serde_json = { workspace = true } thiserror = { workspace = true } diff --git a/engine/core/src/merge.rs b/engine/core/src/merge.rs index 74db07b..8405bcd 100644 --- a/engine/core/src/merge.rs +++ b/engine/core/src/merge.rs @@ -10,10 +10,9 @@ use std::sync::Arc; use lightcraft_color::Xy; use lightcraft_develop::DevelopSettings; use lightcraft_merge::frame::Frame; -use lightcraft_merge::{ - Deghost, DngSamples, FrameColor, HdrOptions, HdrResult, merge_hdr, no_progress, - write_linear_dng, -}; +use lightcraft_merge::{Deghost, FrameColor, HdrOptions, HdrResult, merge_hdr, no_progress}; +#[cfg(not(feature = "photo-merge"))] +use lightcraft_merge::{DngSamples, write_linear_dng}; use lightcraft_pipeline::{Quality, RenderRequest, SourceInfo, auto}; use lightcraft_raster::Rgb32f; use lightcraft_raster::resample::{Filter, fit}; @@ -233,7 +232,63 @@ pub fn merge_linear_dng(files: &[&[u8]], max_edge: u32) -> Result, Engin "a bracket needs at least two exposures".into(), )); } - let edge = clamped_edge(max_edge); + write_merged_dng(files, clamped_edge(max_edge)) +} + +/// LightCraft Photo Merge (`MergeJob`) reads each raw with `starting_colour_tags` before +/// `write_linear_dng`. A CR3 has no colour matrix of its own; without that step the file is a +/// linear DNG other raw tools refuse. The develop crates do not export the step. +#[cfg(feature = "photo-merge")] +fn write_merged_dng(files: &[&[u8]], edge: usize) -> Result, EngineError> { + use std::sync::Arc; + + use lightcraft_catalog::PhotoId; + use lightcraft_engine::merge::{MergeFinish, MergeJob, MergeKind}; + + let owned: Vec> = files.iter().map(|file| (*file).to_vec()).collect(); + let count = owned.len(); + let read = Arc::new(move |path: &str| -> Result, String> { + let index: usize = path + .parse() + .map_err(|_| format!("bad frame index {path}"))?; + owned + .get(index) + .cloned() + .ok_or_else(|| format!("missing frame {index}")) + }); + let sources = (0..count) + .map(|index| (PhotoId(index as u64), index.to_string())) + .collect(); + let job = MergeJob { + kind: MergeKind::Hdr { + hdr: HdrOptions { + align: true, + deghost: Deghost::None, + }, + }, + finish: MergeFinish { + auto_settings: false, + stack: false, + show_overlay: false, + }, + sources, + preview: Some(edge), + read, + }; + let out = job + .run(&|_done, _stage| true) + .map_err(EngineError::Decode)?; + let raw = lightcraft_raw::decode(&out.dng).map_err(|e| EngineError::Decode(e.to_string()))?; + if !lightcraft_raw::color::has_matrix(&raw.color) { + return Err(EngineError::Decode( + "the merged file has no colour matrix, so other raw tools cannot open it".into(), + )); + } + Ok(out.dng) +} + +#[cfg(not(feature = "photo-merge"))] +fn write_merged_dng(files: &[&[u8]], edge: usize) -> Result, EngineError> { let mut frames = Vec::with_capacity(files.len()); for file in files { frames.push(load_bracket_frame(file, edge)?); @@ -360,6 +415,11 @@ mod tests { let files = [dark.as_slice(), mid.as_slice(), bright.as_slice()]; let dng = merge_linear_dng(&files, 256).expect("dng"); assert!(dng.len() > 64); + let raw = lightcraft_raw::decode(&dng).expect("colour tags"); + assert!( + lightcraft_raw::color::has_matrix(&raw.color), + "a merged DNG without ColorMatrix is refused by other raw tools" + ); let source = crate::render::Source::decode(&dng, 256).expect("decode"); let (w, h) = source.size(); assert!(w >= 64 && h >= 64, "{w}x{h}"); @@ -370,6 +430,38 @@ mod tests { ); } + /// Three camera raws in `PHOTOREPORT_MERGE_SAMPLES` (comma-separated paths). Confirms the + /// Photo Merge colour tags, which a synthetic linear DNG already has on its own. + #[cfg(feature = "photo-merge")] + #[test] + #[ignore = "local camera raws via PHOTOREPORT_MERGE_SAMPLES"] + fn a_camera_raw_merge_carries_lightcraft_colour_tags() { + let spec = std::env::var("PHOTOREPORT_MERGE_SAMPLES") + .expect("PHOTOREPORT_MERGE_SAMPLES is three raw paths separated by commas"); + let paths: Vec<&str> = spec + .split(',') + .map(str::trim) + .filter(|path| !path.is_empty()) + .collect(); + assert!(paths.len() >= 2, "need at least two raws"); + let mut owned = Vec::new(); + for path in &paths { + let bytes = std::fs::read(path).unwrap_or_else(|err| panic!("{path}: {err}")); + owned.push(bytes); + } + let refs: Vec<&[u8]> = owned.iter().map(Vec::as_slice).collect(); + let dng = merge_linear_dng(&refs, 4096).expect("dng"); + let raw = lightcraft_raw::decode(&dng).expect("decode"); + assert!( + lightcraft_raw::color::has_matrix(&raw.color), + "ColorMatrix missing" + ); + assert!( + !raw.color.profile.is_empty(), + "matrix without the fitted camera look" + ); + } + #[test] fn one_photo_is_not_a_bracket() { let mid = exposure_dng(0.0);