commit 51e16359debcedcd751562bab1dcc72f189dda77 Author: Bluemangoo Date: Sat Jun 20 23:03:06 2026 +0800 Initial Commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..96ef862 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +target/ +.idea/ diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..eaea1b9 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,2935 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[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 = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + +[[package]] +name = "aligned" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee4508988c62edf04abd8d92897fca0c2995d907ce1dfeaf369dac3716a40685" +dependencies = [ + "as-slice", +] + +[[package]] +name = "aligned-vec" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc890384c8602f339876ded803c97ad529f3842aba97f6392b3dba0dd171769b" +dependencies = [ + "equator", +] + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anyhow" +version = "1.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" + +[[package]] +name = "arbitrary" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1" + +[[package]] +name = "arg_enum_proc_macro" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "as-slice" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516" +dependencies = [ + "stable_deref_trait", +] + +[[package]] +name = "assets-updater" +version = "0.1.0" +dependencies = [ + "aes", + "cbc", + "chrono", + "cipher", + "common", + "cridecoder", + "hex", + "image", + "log", + "regex", + "reqwest", + "rmp-serde", + "serde", + "tempfile", + "thiserror", + "tokio", + "twox-hash", + "yaml_serde", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "av-scenechange" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f321d77c20e19b92c39e7471cf986812cbb46659d2af674adc4331ef3f18394" +dependencies = [ + "aligned", + "anyhow", + "arg_enum_proc_macro", + "arrayvec", + "log", + "num-rational", + "num-traits", + "pastey", + "rayon", + "thiserror", + "v_frame", + "y4m", +] + +[[package]] +name = "av1-grain" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cfddb07216410377231960af4fcab838eaa12e013417781b78bd95ee22077f8" +dependencies = [ + "anyhow", + "arrayvec", + "log", + "nom", + "num-rational", + "v_frame", +] + +[[package]] +name = "avif-serialize" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7178fe5f7d460b13895ebb9dcb28a3a6216d2df2574a0806cb51b555d297f38" +dependencies = [ + "arrayvec", +] + +[[package]] +name = "aws-lc-rs" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ec2f1fc3ec205783a5da9a7e6c1509cc69dedf09a1949e412c1e18469326d00" +dependencies = [ + "aws-lc-sys", + "zeroize", +] + +[[package]] +name = "aws-lc-sys" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a2f9779ce85b93ab6170dd940ad0169b5766ff848247aff13bb788b832fe3f4" +dependencies = [ + "cc", + "cmake", + "dunce", + "fs_extra", +] + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bit_field" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e4b40c7323adcfc0a41c4b88143ed58346ff65a288fc144329c5c45e05d70c6" + +[[package]] +name = "bitflags" +version = "2.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8" + +[[package]] +name = "bitstream-io" +version = "4.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7eff00be299a18769011411c9def0d827e8f2d7bf0c3dbf53633147a8867fd1f" +dependencies = [ + "no_std_io2", +] + +[[package]] +name = "block-padding" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93" +dependencies = [ + "generic-array", +] + +[[package]] +name = "built" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c0e531d93d39c34eef561e929e8a7f86d77a5af08aac4f6d6e39976c51858e9" + +[[package]] +name = "bumpalo" +version = "3.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" + +[[package]] +name = "bytemuck" +version = "1.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "byteorder-lite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" + +[[package]] +name = "bytes" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ae3f5d315924270530207e2a68396c3cc547f6dca3fbdca317cfb1a51edb593" + +[[package]] +name = "cbc" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6" +dependencies = [ + "cipher", +] + +[[package]] +name = "cc" +version = "1.2.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e228eec9be7c17ccb640b59b36a5cd805ea2a564a4c5e162c2f659fea30d3b96" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "chrono" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-traits", + "serde", + "wasm-bindgen", + "windows-link", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "cmake" +version = "0.1.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0f78a02292a74a88ac736019ab962ece0bc380e3f977bf72e376c5d78ff0678" +dependencies = [ + "cc", +] + +[[package]] +name = "color_quant" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" + +[[package]] +name = "combine" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] +name = "common" +version = "0.1.0" +dependencies = [ + "serde", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "cridecoder" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0966976a5c4ea5cc6251d37777427625a1d6e9a0018d21f388c0c970d84f9c3d" +dependencies = [ + "byteorder", + "encoding_rs", + "hex", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "deranged" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" + +[[package]] +name = "displaydoc" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ac70aa55017e108007fbaf5aa0f54b021c98f92ff8af59d42eda9da96e3dd4f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + +[[package]] +name = "either" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e" + +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "entry" +version = "0.1.0" +dependencies = [ + "anyhow", + "assets-updater", + "common", + "log", + "reqwest", + "serde", + "serde_json", + "simplelog", + "tokio", +] + +[[package]] +name = "equator" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4711b213838dfee0117e3be6ac926007d7f433d7bbe33595975d4190cb07e6fc" +dependencies = [ + "equator-macro", +] + +[[package]] +name = "equator-macro" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44f23cf4b44bfce11a86ace86f8a73ffdec849c9fd00a386a53d278bd9e81fb3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "exr" +version = "1.74.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4300e043a56aa2cb633c01af81ca8f699a321879a7854d3896a0ba89056363be" +dependencies = [ + "bit_field", + "half", + "lebe", + "miniz_oxide", + "rayon-core", + "smallvec", + "zune-inflate", +] + +[[package]] +name = "fastrand" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" + +[[package]] +name = "fax" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caf1079563223d5d59d83c85886a56e586cfd5c1a26292e971a0fa266531ac5a" + +[[package]] +name = "fdeflate" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + +[[package]] +name = "flate2" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + +[[package]] +name = "futures-channel" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" + +[[package]] +name = "futures-sink" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" + +[[package]] +name = "futures-task" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" + +[[package]] +name = "futures-util" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi 5.3.0", + "wasip2", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", +] + +[[package]] +name = "gif" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8cfcc411d9adbbaba82fb72661cc1bcca13e8bba98b364e62b2dba8f960159" +dependencies = [ + "color_quant", + "weezl", +] + +[[package]] +name = "h2" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6cb093c84e8bd9b188d4c4a8cb6579fc016968d14c99882163cd3ff402a4f155" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "half" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" +dependencies = [ + "cfg-if", + "crunchy", + "zerocopy", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "http" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6970f50e31d6fc17d3fa27329444bfa74e196cf62e95052a3f6fee181dba6425" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "hyper" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55281c53a1894c864990125767da440a4e630446785086f52523b20033b74498" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "h2", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ca68d021ef39cf6463ab54c1d0f5daf03377b70561305bb89a8f83aab66e0f" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "tokio", + "tokio-rustls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" +dependencies = [ + "base64", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "system-configuration", + "tokio", + "tower-service", + "tracing", + "windows-registry", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38" + +[[package]] +name = "icu_properties" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14" + +[[package]] +name = "icu_provider" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "image" +version = "0.25.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104" +dependencies = [ + "bytemuck", + "byteorder-lite", + "color_quant", + "exr", + "gif", + "image-webp", + "moxcms", + "num-traits", + "png", + "qoi", + "ravif", + "rayon", + "rgb", + "tiff", + "zune-core", + "zune-jpeg", +] + +[[package]] +name = "image-webp" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525e9ff3e1a4be2fbea1fdf0e98686a6d98b4d8f937e1bf7402245af1909e8c3" +dependencies = [ + "byteorder-lite", + "quick-error", +] + +[[package]] +name = "imgref" +version = "1.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89194689a993ab15268672e99e7b0e19da2da3268ac682e8f02d29d4d1434cd7" + +[[package]] +name = "indexmap" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "block-padding", + "generic-array", +] + +[[package]] +name = "interpolate_name" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "ipnet" +version = "2.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2" + +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "jni" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498" +dependencies = [ + "cfg-if", + "combine", + "jni-macros", + "jni-sys", + "log", + "simd_cesu8", + "thiserror", + "walkdir", + "windows-link", +] + +[[package]] +name = "jni-macros" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "simd_cesu8", + "syn", +] + +[[package]] +name = "jni-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" +dependencies = [ + "jni-sys-macros", +] + +[[package]] +name = "jni-sys-macros" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.4", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03d04c30968dffe80775bd4d7fb676131cd04a1fb46d2686dbffbaec2d9dfd31" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "lebe" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a79a3332a6609480d7d0c9eab957bca6b455b91bb84e66d19f5ff66294b85b8" + +[[package]] +name = "libc" +version = "0.2.186" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" + +[[package]] +name = "libfuzzer-sys" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9fd2f41a1cba099f79a0b6b6c35656cf7c03351a7bae8ff0f28f25270f929d2" +dependencies = [ + "arbitrary", + "cc", +] + +[[package]] +name = "libyaml-rs" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e126dda6f34391ab7b444f9922055facc83c07a910da3eb16f1e4d9c45dc777" + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litemap" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" + +[[package]] +name = "log" +version = "0.4.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "953f07c43838f8e6f9758cab68bf5bed85465e7587ebe0b823f1bcd81978ad3a" + +[[package]] +name = "loop9" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fae87c125b03c1d2c0150c90365d7d6bcc53fb73a9acaef207d2d065860f062" +dependencies = [ + "imgref", +] + +[[package]] +name = "lru-slab" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" + +[[package]] +name = "maybe-rayon" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519" +dependencies = [ + "cfg-if", + "rayon", +] + +[[package]] +name = "memchr" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "mio" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02bd0af71c67b473010cbbc60715ee815645a4dc942899111f494b4b737d6fda" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "moxcms" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b" +dependencies = [ + "num-traits", + "pxfm", +] + +[[package]] +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + +[[package]] +name = "no_std_io2" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418abd1b6d34fbf6cae440dc874771b0525a604428704c76e48b29a5e67b8003" +dependencies = [ + "memchr", +] + +[[package]] +name = "nom" +version = "8.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405" +dependencies = [ + "memchr", +] + +[[package]] +name = "noop_proc_macro" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8" + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" + +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" +dependencies = [ + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_threads" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" +dependencies = [ + "libc", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "openssl-probe" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pastey" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec" + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "png" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61" +dependencies = [ + "bitflags", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide", +] + +[[package]] +name = "potential_utf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564" +dependencies = [ + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "profiling" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5" +dependencies = [ + "profiling-procmacros", +] + +[[package]] +name = "profiling-procmacros" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4488a4a36b9a4ba6b9334a32a39971f77c1436ec82c38707bce707699cc3bbcb" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "pxfm" +version = "0.1.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0c5ccf5294c6ccd63a74f1565028353830a9c2f5eb0c682c355c471726a6e3f" + +[[package]] +name = "qoi" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "quick-error" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" + +[[package]] +name = "quinn" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2", + "thiserror", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "434b42fec591c96ef50e21e886936e66d3cc3f737104fdb9b737c40ffb94c098" +dependencies = [ + "aws-lc-rs", + "bytes", + "getrandom 0.3.4", + "lru-slab", + "rand", + "ring", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "thiserror", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.60.2", +] + +[[package]] +name = "quote" +version = "1.0.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c5af06bb1b7d3216d91932aed5265164bf384dc89cd6ba05cf59a35f5f76ea" +dependencies = [ + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "rav1e" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43b6dd56e85d9483277cde964fd1bdb0428de4fec5ebba7540995639a21cb32b" +dependencies = [ + "aligned-vec", + "arbitrary", + "arg_enum_proc_macro", + "arrayvec", + "av-scenechange", + "av1-grain", + "bitstream-io", + "built", + "cfg-if", + "interpolate_name", + "itertools", + "libc", + "libfuzzer-sys", + "log", + "maybe-rayon", + "new_debug_unreachable", + "noop_proc_macro", + "num-derive", + "num-traits", + "paste", + "profiling", + "rand", + "rand_chacha", + "simd_helpers", + "thiserror", + "v_frame", + "wasm-bindgen", +] + +[[package]] +name = "ravif" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e52310197d971b0f5be7fe6b57530dcd27beb35c1b013f29d66c1ad73fbbcc45" +dependencies = [ + "avif-serialize", + "imgref", + "loop9", + "quick-error", + "rav1e", + "rayon", + "rgb", +] + +[[package]] +name = "rayon" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "regex" +version = "1.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1292b7759ae1cb9ec195452d1390a074f0cd8541ab7a5a8c31cd6db45d4a6ba" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" + +[[package]] +name = "reqwest" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "219c5811de6525e5416c7d5d53bb656d3afdbc6c5af816e0802bcfa42dbdc1c3" +dependencies = [ + "base64", + "bytes", + "encoding_rs", + "futures-core", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "js-sys", + "log", + "mime", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pki-types", + "rustls-platform-verifier", + "serde", + "serde_json", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[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 0.52.0", +] + +[[package]] +name = "rmp" +version = "0.8.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ba8be72d372b2c9b35542551678538b562e7cf86c3315773cae48dfbfe7790c" +dependencies = [ + "num-traits", +] + +[[package]] +name = "rmp-serde" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f81bee8c8ef9b577d1681a70ebbc962c232461e397b22c208c43c04b67a155" +dependencies = [ + "rmp", + "serde", +] + +[[package]] +name = "rustc-hash" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls" +version = "0.23.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef86cd5876211988985292b91c96a8f2d298df24e75989a43a3c73f2d4d8168b" +dependencies = [ + "aws-lc-rs", + "once_cell", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-native-certs" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dab5152771c58876a2146916e53e35057e1a4dfa2b9df0f0305b07f611fdea4d" +dependencies = [ + "openssl-probe", + "rustls-pki-types", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pki-types" +version = "1.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30a7197ae7eb376e574fe940d068c30fe0462554a3ddbe4eca7838e049c937a9" +dependencies = [ + "web-time", + "zeroize", +] + +[[package]] +name = "rustls-platform-verifier" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d1e2536ce4f35f4846aa13bff16bd0ff40157cdb14cc056c7b14ba41233ba0" +dependencies = [ + "core-foundation 0.10.1", + "core-foundation-sys", + "jni", + "log", + "once_cell", + "rustls", + "rustls-native-certs", + "rustls-platform-verifier-android", + "rustls-webpki", + "security-framework", + "security-framework-sys", + "webpki-root-certs", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls-platform-verifier-android" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f" + +[[package]] +name = "rustls-webpki" +version = "0.103.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e" +dependencies = [ + "aws-lc-rs", + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "schannel" +version = "0.1.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "security-framework" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" +dependencies = [ + "bitflags", + "core-foundation 0.10.1", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[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.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.150" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "simd-adler32" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214" + +[[package]] +name = "simd_cesu8" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94f90157bb87cddf702797c5dadfa0be7d266cdf49e22da2fcaa32eff75b2c33" +dependencies = [ + "rustc_version", + "simdutf8", +] + +[[package]] +name = "simd_helpers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95890f873bec569a0362c235787f3aca6e1e887302ba4840839bcc6459c42da6" +dependencies = [ + "quote", +] + +[[package]] +name = "simdutf8" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + +[[package]] +name = "simplelog" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16257adbfaef1ee58b1363bdc0664c9b8e1e30aed86049635fb5f147d065a9c0" +dependencies = [ + "log", + "termcolor", + "time", +] + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90" + +[[package]] +name = "socket2" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52d1cfed4120b4d927bf7c0f86d2087a4a7d6027c906d9f9d525a80573b9be51" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[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.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "system-configuration" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b" +dependencies = [ + "bitflags", + "core-foundation 0.9.4", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "tempfile" +version = "3.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand", + "getrandom 0.4.3", + "once_cell", + "rustix", + "windows-sys 0.61.2", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "test-main" +version = "0.1.0" +dependencies = [ + "entry", + "simplelog", +] + +[[package]] +name = "thiserror" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tiff" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63feaf3343d35b6ca4d50483f94843803b0f51634937cc2ec519fc32232bc52" +dependencies = [ + "fax", + "flate2", + "half", + "quick-error", + "weezl", + "zune-jpeg", +] + +[[package]] +name = "time" +version = "0.3.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711a53c2d47bbd818258c498c8dbfe186a2526c631495cfe7e078567f86b8469" +dependencies = [ + "deranged", + "libc", + "num-conv", + "num_threads", + "powerfmt", + "serde_core", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" + +[[package]] +name = "time-macros" +version = "0.2.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71c652a3727a9cbb9a02f707f530b618ce00d0ccd762009c8c23bd191df3c17d" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tinystr" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc7f01b389ac15039e4dc9531aa973a135d7a4135281b12d7c1bc79fd57fffe" +dependencies = [ + "bytes", + "libc", + "mio", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" +dependencies = [ + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", + "url", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "twox-hash" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ea3136b675547379c4bd395ca6b938e5ad3c3d20fad76e7fe85f9e0d011419c" +dependencies = [ + "rand", +] + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "v_frame" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "666b7727c8875d6ab5db9533418d7c764233ac9c0cff1d469aec8fa127597be2" +dependencies = [ + "aligned-vec", + "num-traits", + "wasm-bindgen", +] + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.125" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ddb3f79143bced6de84270411622a2699cee572fc0875aeaf1e7867cf9fca1a" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "503b14d284f2c8dac03b819967e155ea753f573586193b2b2c95990cb5d69280" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.125" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e21a184b13fb19e157296e2c46056aec9092264fab83e4ba59e68c61b323c3d" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.125" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fecefd9c35bd935a20fc3fc344b5f29138961e4f47fb03297d88f2587afb5ebd" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.125" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23939e44bb9a5d7576fa2b563dc2e136628f1224e88a8deed09e04858b77871f" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-sys" +version = "0.3.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6430a72df5eb332242960fe84b3002a241163998241eb596d4f739b9757061d" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-root-certs" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d46a5a140e6f7afeccd8eae97eff335163939eac8b929834875168b29b3d267" +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 = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[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-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[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", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-registry" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" +dependencies = [ + "windows-link", + "windows-result", + "windows-strings", +] + +[[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 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", +] + +[[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_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + +[[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_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + +[[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_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + +[[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_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + +[[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_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "writeable" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" + +[[package]] +name = "y4m" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5a4b21e1a62b67a2970e6831bc091d7b87e119e7f9791aef9702e3bef04448" + +[[package]] +name = "yaml_serde" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08c7c1b1a6a7c8a6b2741a6c21a4f8918e51899b111cfa08d1288202656e3975" +dependencies = [ + "indexmap", + "itoa", + "libyaml-rs", + "ryu", + "serde", +] + +[[package]] +name = "yoke" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.52" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce1022995ff5ff5d841ad7d994facc23098cd40152f2c1d11cd607c6f530653f" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.52" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ae7f38b72ec2a254e2b87ef277cf2cd4fb97cbebf944faa6f33354da0867930" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e" + +[[package]] +name = "zerotrie" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zmij" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" + +[[package]] +name = "zune-core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb8a0807f7c01457d0379ba880ba6322660448ddebc890ce29bb64da71fb40f9" + +[[package]] +name = "zune-inflate" +version = "0.2.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "zune-jpeg" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296" +dependencies = [ + "zune-core", +] diff --git a/assets-updater/Cargo.toml b/assets-updater/Cargo.toml new file mode 100644 index 0000000..15aa5f0 --- /dev/null +++ b/assets-updater/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "assets-updater" +version = "0.1.0" +edition = "2024" + +[dependencies] +common = { path = "../common" } + +aes = { workspace = true } +tokio = { workspace = true, features = ["process"] } +rmp-serde = { workspace = true } +hex = { workspace = true } +cbc = { workspace = true } +tempfile = { workspace = true } +chrono = { workspace = true, features = ["serde"] } +reqwest = { workspace = true } +serde = { workspace = true, features = ["derive"] } +regex = { workspace = true } +yaml_serde = { workspace = true } +image = { workspace = true } +cridecoder = { workspace = true } +thiserror = { workspace = true } +log = { workspace = true } +cipher = { workspace = true, features = ["block-padding"] } +twox-hash = { workspace = true, features = ["xxhash3_128"] } diff --git a/assets-updater/src/core/asset_execution.rs b/assets-updater/src/core/asset_execution.rs new file mode 100644 index 0000000..6f02211 --- /dev/null +++ b/assets-updater/src/core/asset_execution.rs @@ -0,0 +1,384 @@ +use std::collections::HashMap; +use std::path::PathBuf; +use std::time::Duration; + +use crate::core::config::{AppConfig, RegionConfig, RegionProviderConfig}; +use crate::core::errors::AssetExecutionError; +use crate::core::export_pipeline::extract_unity_asset_bundle; +use crate::core::retry::retry_async; +use aes::cipher::block_padding::Pkcs7; +use aes::cipher::{BlockDecryptMut, KeyIvInit}; +use chrono::FixedOffset; +use common::updater::{AssetCategory, SyncContext}; +use reqwest::header::{ + ACCEPT, ACCEPT_ENCODING, ACCEPT_LANGUAGE, CONNECTION, COOKIE, HeaderMap, HeaderValue, + SET_COOKIE, USER_AGENT, +}; +use serde::{Deserialize, Serialize}; + +type Aes128CbcDec = cbc::Decryptor; +type Aes192CbcDec = cbc::Decryptor; +type Aes256CbcDec = cbc::Decryptor; + +/// Deserializes a msgpack/JSON null or missing value as an empty String. +/// Go silently coerces nil → zero value for non-pointer types; this helper +/// mirrors that behavior for String fields. +fn de_null_as_empty_string<'de, D>(deserializer: D) -> Result +where + D: serde::Deserializer<'de>, +{ + Ok(Option::::deserialize(deserializer)?.unwrap_or_default()) +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct AssetBundleDetail { + #[serde(rename = "bundleName", deserialize_with = "de_null_as_empty_string")] + pub bundle_name: String, + #[serde(rename = "cacheFileName", deserialize_with = "de_null_as_empty_string")] + pub cache_file_name: String, + #[serde( + rename = "cacheDirectoryName", + deserialize_with = "de_null_as_empty_string" + )] + pub cache_directory_name: String, + // nuverse regions use `crc` instead of `hash`; the server may send nil here. + #[serde(rename = "hash", deserialize_with = "de_null_as_empty_string")] + pub hash: String, + #[serde(rename = "category")] + pub category: AssetCategory, + #[serde(rename = "crc")] + pub crc: i64, + #[serde(rename = "fileSize")] + pub file_size: i64, + #[serde(rename = "dependencies")] + pub dependencies: Vec, + #[serde(rename = "paths", default)] + pub paths: Vec, + #[serde(rename = "isBuiltin")] + pub is_builtin: bool, + #[serde(rename = "isRelocate")] + pub is_relocate: Option, + #[serde(rename = "md5Hash")] + pub md5_hash: Option, + #[serde(rename = "downloadPath")] + pub download_path: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct AssetBundleInfo { + #[serde(rename = "version")] + pub version: Option, + #[serde(rename = "os")] + pub os: Option, + #[serde(rename = "bundles")] + pub bundles: HashMap, +} + +#[derive(Debug, Clone)] +pub struct AssetExecutionContext { + client: reqwest::Client, + region_name: String, + region: RegionConfig, + retry: crate::core::config::RetryConfig, + runtime_cookie: Option, + resolved_asset_version: Option, + pub sync_context: SyncContext, +} + +impl AssetExecutionContext { + pub fn new( + app_config: &AppConfig, + sync_context: &SyncContext, + region: &RegionConfig, + ) -> Result { + let mut headers = HeaderMap::new(); + headers.insert(ACCEPT, HeaderValue::from_static("*/*")); + headers.insert( + USER_AGENT, + HeaderValue::from_static("ProductName/134 CFNetwork/1408.0.4 Darwin/22.5.0"), + ); + headers.insert(CONNECTION, HeaderValue::from_static("keep-alive")); + headers.insert( + ACCEPT_ENCODING, + HeaderValue::from_static("gzip, deflate, br"), + ); + headers.insert( + ACCEPT_LANGUAGE, + HeaderValue::from_static("zh-CN,zh-Hans;q=0.9"), + ); + headers.insert( + "X-Unity-Version", + HeaderValue::from_str(®ion.runtime.unity_version) + .map_err(|err| AssetExecutionError::HttpClient(err.to_string()))?, + ); + + let mut builder = reqwest::Client::builder() + .default_headers(headers) + .connect_timeout(Duration::from_secs(10)) + .timeout(Duration::from_secs(180)) + .pool_max_idle_per_host(100) + .tcp_keepalive(Duration::from_secs(30)); + + if let Some(proxy) = &app_config.execution.proxy + && !proxy.is_empty() + { + builder = builder.proxy( + reqwest::Proxy::all(proxy) + .map_err(|err| AssetExecutionError::HttpClient(err.to_string()))?, + ); + } else { + builder = builder.no_proxy(); + } + + Ok(Self { + client: builder + .build() + .map_err(|err| AssetExecutionError::HttpClient(err.to_string()))?, + sync_context: sync_context.clone(), + region_name: sync_context.region.clone(), + region: region.clone(), + retry: app_config.execution.retry.clone(), + runtime_cookie: None, + resolved_asset_version: sync_context.asset_version.clone(), + }) + } + + pub async fn download( + &self, + task: &str, + app_config: &AppConfig, + ) -> Result<(PathBuf, /*single file*/ bool), AssetExecutionError> { + let ctx = self.clone(); + ctx.download_and_export_bundle(app_config, task).await + } + + fn render_bundle_url(&self, task: &str) -> Result { + match &self.region.provider { + RegionProviderConfig::ColorfulPalette { + asset_bundle_url_template, + profile_hash, + .. + } => { + let asset_version = + self.sync_context.asset_version.as_deref().ok_or_else(|| { + AssetExecutionError::MissingAssetVersionOrHash { + region: self.region_name.clone(), + } + })?; + let asset_hash = self.sync_context.asset_hash.as_deref().ok_or_else(|| { + AssetExecutionError::MissingAssetVersionOrHash { + region: self.region_name.clone(), + } + })?; + + Ok(asset_bundle_url_template + .replace("{bundle_path}", task) + .replace("{asset_version}", asset_version) + .replace("{asset_hash}", asset_hash) + .replace("{env}", "production") + .replace("{hash}", profile_hash) + + &time_arg_jst()) + } + RegionProviderConfig::Nuverse { + asset_bundle_url_template, + .. + } => { + let app_version = self.sync_context.app_version.as_ref().ok_or_else(|| { + AssetExecutionError::MissingAppVersion { + region: self.region_name.clone(), + } + })?; + let asset_version = self + .resolved_asset_version + .as_deref() + .unwrap_or(""); + Ok(asset_bundle_url_template + .replace("{bundle_path}", task) + .replace("{app_version}", app_version) + .replace("{asset_version}", asset_version) + + &time_arg_jst()) + } + } + } + + async fn get_with_retry(&self, url: &str) -> Result, AssetExecutionError> { + retry_async( + &self.retry, + "http get", + |_| async { + let mut request = self.client.get(url); + if let Some(cookie) = &self.runtime_cookie { + request = request.header(COOKIE, cookie); + } + match request.send().await { + Ok(response) if response.status().is_success() => { + Ok(response.bytes().await?.to_vec()) + } + Ok(response) => Err(AssetExecutionError::HttpStatus { + url: url.to_string(), + status: response.status().as_u16(), + }), + Err(err) => Err(AssetExecutionError::Http(err)), + } + }, + is_retryable_http_error, + ) + .await + } + + pub async fn fetch_runtime_cookies(&mut self) -> Result<(), AssetExecutionError> { + let url = "https://issue.sekai.colorfulpalette.org/api/signature".to_string(); + self.runtime_cookie = retry_async( + &self.retry, + "cookie bootstrap", + |_| async { + let response = self.client.post(&url).send().await?; + if response.status().is_success() { + Ok(response + .headers() + .get(SET_COOKIE) + .and_then(|value| value.to_str().ok()) + .map(str::to_string)) + } else { + Err(AssetExecutionError::HttpStatus { + url: url.clone(), + status: response.status().as_u16(), + }) + } + }, + is_retryable_http_error, + ) + .await?; + Ok(()) + } + + async fn download_and_export_bundle( + &self, + app_config: &AppConfig, + task: &str, + ) -> Result<(PathBuf, bool), AssetExecutionError> { + let bundle_url = self.render_bundle_url(task)?; + let body = self.get_with_retry(&bundle_url).await?; + let deobfuscated = deobfuscate(&body); + + let temp_file = std::env::temp_dir() + .join("sekai-updater") + .join("obf") + .join(&self.region_name) + .join(task); + if let Some(parent) = temp_file.parent() { + std::fs::create_dir_all(parent).map_err(|source| { + AssetExecutionError::CreateTempDir { + path: parent.to_path_buf(), + source, + } + })?; + } + std::fs::write(&temp_file, deobfuscated).map_err(|source| { + AssetExecutionError::WriteTempFile { + path: temp_file.clone(), + source, + } + })?; + let export_result = extract_unity_asset_bundle( + app_config, + &self.sync_context, + &self.region, + &temp_file, + task, + task, + ) + .await; + let _ = std::fs::remove_file(&temp_file); + export_result.map_err(Into::into) + } +} + +fn is_retryable_http_error(err: &AssetExecutionError) -> bool { + match err { + AssetExecutionError::Http(_) => true, + AssetExecutionError::HttpStatus { status, .. } => *status >= 500, + _ => false, + } +} + +pub fn decrypt_asset_bundle_info( + aes_key_hex: &str, + aes_iv_hex: &str, + content: &[u8], +) -> Result { + if content.is_empty() { + return Err(AssetExecutionError::EmptyEncryptedContent); + } + if !content.len().is_multiple_of(16) { + return Err(AssetExecutionError::InvalidEncryptedBlockSize); + } + + let key = hex::decode(aes_key_hex) + .map_err(|err| AssetExecutionError::InvalidAesKeyHex(err.to_string()))?; + let iv = hex::decode(aes_iv_hex) + .map_err(|err| AssetExecutionError::InvalidAesIvHex(err.to_string()))?; + if iv.len() != 16 { + return Err(AssetExecutionError::InvalidAesIvLength { got: iv.len() }); + } + + let mut buf = content.to_vec(); + let decrypted = match key.len() { + 16 => Aes128CbcDec::new_from_slices(&key, &iv) + .map_err(|err| AssetExecutionError::AssetInfoDecode(err.to_string()))? + .decrypt_padded_mut::(&mut buf) + .map_err(|err| AssetExecutionError::AssetInfoDecode(err.to_string()))?, + 24 => Aes192CbcDec::new_from_slices(&key, &iv) + .map_err(|err| AssetExecutionError::AssetInfoDecode(err.to_string()))? + .decrypt_padded_mut::(&mut buf) + .map_err(|err| AssetExecutionError::AssetInfoDecode(err.to_string()))?, + 32 => Aes256CbcDec::new_from_slices(&key, &iv) + .map_err(|err| AssetExecutionError::AssetInfoDecode(err.to_string()))? + .decrypt_padded_mut::(&mut buf) + .map_err(|err| AssetExecutionError::AssetInfoDecode(err.to_string()))?, + _ => { + return Err(AssetExecutionError::AssetInfoDecode(format!( + "unsupported AES key length {}", + key.len() + ))); + } + }; + + rmp_serde::from_slice::(decrypted) + .map_err(|err| AssetExecutionError::AssetInfoDecode(err.to_string())) +} + +pub fn deobfuscate(data: &[u8]) -> Vec { + const SIMPLE: [u8; 4] = [0x20, 0x00, 0x00, 0x00]; + const XOR_HEADER: [u8; 4] = [0x10, 0x00, 0x00, 0x00]; + + if data.starts_with(&SIMPLE) { + return data[4..].to_vec(); + } + + if data.starts_with(&XOR_HEADER) { + let body = &data[4..]; + if body.len() < 128 { + return body.to_vec(); + } + + let mut header = vec![0u8; 128]; + let pattern = [0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00]; + for idx in 0..128 { + header[idx] = body[idx] ^ pattern[idx % pattern.len()]; + } + let mut output = header; + output.extend_from_slice(&body[128..]); + return output; + } + + data.to_vec() +} + +fn time_arg_jst() -> String { + let tz = FixedOffset::east_opt(9 * 3600).unwrap(); + format!( + "?t={}", + chrono::Utc::now().with_timezone(&tz).format("%Y%m%d%H%M%S") + ) +} diff --git a/assets-updater/src/core/codec.rs b/assets-updater/src/core/codec.rs new file mode 100644 index 0000000..6c4b1dd --- /dev/null +++ b/assets-updater/src/core/codec.rs @@ -0,0 +1,89 @@ +use std::fs::File; +use std::path::{Path, PathBuf}; + +use cridecoder::{extract_acb_from_file, extract_usm_file, HcaDecoder}; +use serde::Serialize; + +use crate::core::errors::CodecError; + +pub const CODEC_BACKEND: &str = "crates.io:cridecoder@0.1.1"; + +#[derive(Debug, Clone, Serialize)] +pub struct CodecSummary { + pub backend: &'static str, + pub supports_acb: bool, + pub supports_usm: bool, + pub supports_hca_to_wav: bool, + pub supports_usm_metadata: bool, +} + +pub fn codec_summary() -> CodecSummary { + CodecSummary { + backend: CODEC_BACKEND, + supports_acb: true, + supports_usm: true, + supports_hca_to_wav: true, + supports_usm_metadata: true, + } +} + +pub fn export_acb(input: &Path, output_dir: &Path) -> Result>, CodecError> { + extract_acb_from_file(input, output_dir).map_err(|err| CodecError::Acb(err.to_string())) +} + +pub fn export_usm(input: &Path, output_dir: &Path) -> Result, CodecError> { + let outputs = extract_usm_file(input, output_dir, None, false) + .map_err(|err| CodecError::Usm(err.to_string()))?; + normalize_usm_output_names(input, outputs) +} + +pub fn read_usm_metadata(input: &Path) -> Result { + cridecoder::usm::read_metadata_file(input).map_err(|err| CodecError::Metadata(err.to_string())) +} + +pub fn decode_hca_to_wav(input: &Path, output: &Path) -> Result<(), CodecError> { + let input_path = input + .to_str() + .ok_or_else(|| CodecError::NonUtf8Path(input.to_path_buf()))?; + + let mut decoder = + HcaDecoder::from_file(input_path).map_err(|err| CodecError::Hca(err.to_string()))?; + let mut file = File::create(output).map_err(|source| CodecError::Io { + path: output.to_path_buf(), + source, + })?; + decoder + .decode_to_wav(&mut file) + .map_err(|err| CodecError::Hca(err.to_string())) +} + +fn normalize_usm_output_names( + input: &Path, + outputs: Vec, +) -> Result, CodecError> { + let input_stem = input + .file_stem() + .and_then(|stem| stem.to_str()) + .ok_or_else(|| CodecError::NonUtf8Path(input.to_path_buf()))?; + + let mut normalized = Vec::with_capacity(outputs.len()); + for output in outputs { + let ext = output + .extension() + .and_then(|ext| ext.to_str()) + .ok_or_else(|| CodecError::NonUtf8Path(output.clone()))?; + let target = output.with_file_name(format!("{input_stem}.{ext}")); + + if output != target { + std::fs::rename(&output, &target).map_err(|source| CodecError::Io { + path: target.clone(), + source, + })?; + normalized.push(target); + } else { + normalized.push(output); + } + } + + Ok(normalized) +} diff --git a/assets-updater/src/core/config.rs b/assets-updater/src/core/config.rs new file mode 100644 index 0000000..e5b9938 --- /dev/null +++ b/assets-updater/src/core/config.rs @@ -0,0 +1,167 @@ +use std::collections::BTreeMap; + +use serde::{Deserialize, Serialize}; + +use crate::core::errors::ConfigError; + +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(default)] +pub struct AppConfig { + pub execution: ExecutionConfig, + pub tools: ToolsConfig, + pub concurrency: ConcurrencyConfig, + pub regions: BTreeMap, +} + +impl AppConfig { + pub fn validate(&self) -> Result<(), ConfigError> { + for region_name in self.regions.keys() { + if region_name.to_lowercase() != *region_name { + return Err(ConfigError::InvalidRegionName(region_name.clone())); + } + } + + Ok(()) + } +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(default)] +pub struct ToolsConfig { + pub ffmpeg_path: String, + pub asset_studio_cli_path: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(default)] +pub struct ExecutionConfig { + pub proxy: Option, + pub timeout_seconds: u64, + pub allow_cancel: bool, + pub retry: RetryConfig, +} + +impl Default for ExecutionConfig { + fn default() -> Self { + Self { + proxy: None, + timeout_seconds: 300, + allow_cancel: true, + retry: RetryConfig::default(), + } + } +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(default)] +pub struct RetryConfig { + pub attempts: usize, + pub initial_backoff_ms: u64, + pub max_backoff_ms: u64, +} + +impl Default for RetryConfig { + fn default() -> Self { + Self { + attempts: 4, + initial_backoff_ms: 1_000, + max_backoff_ms: 4_000, + } + } +} + +impl Default for ToolsConfig { + fn default() -> Self { + Self { + ffmpeg_path: "ffmpeg".to_string(), + asset_studio_cli_path: None, + } + } +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(default)] +pub struct ConcurrencyConfig { + pub download: usize, + pub upload: usize, + pub acb: usize, + pub usm: usize, + pub hca: usize, +} + +impl Default for ConcurrencyConfig { + fn default() -> Self { + Self { + download: 4, + upload: 4, + acb: 8, + usm: 4, + hca: 16, + } + } +} + +#[derive(Debug, Clone, Serialize, Deserialize, Default)] +#[serde(default)] +pub struct RegionConfig { + pub provider: RegionProviderConfig, + pub crypto: CryptoConfig, + pub runtime: RegionRuntimeConfig, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(tag = "kind", rename_all = "snake_case")] +pub enum RegionProviderConfig { + ColorfulPalette { + asset_info_url_template: String, + asset_bundle_url_template: String, + profile_hash: String, + }, + Nuverse { + asset_version_url: String, + asset_info_url_template: String, + asset_bundle_url_template: String, + #[serde(default)] + required_cookies: bool, + #[serde(default)] + cookie_bootstrap_url: Option, + }, +} + +impl Default for RegionProviderConfig { + fn default() -> Self { + Self::ColorfulPalette { + asset_info_url_template: String::new(), + asset_bundle_url_template: String::new(), + profile_hash: String::new(), + } + } +} + +#[derive(Debug, Clone, Serialize, Deserialize, Default)] +#[serde(default)] +pub struct CryptoConfig { + pub aes_key_hex: Option, + pub aes_iv_hex: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(default)] +pub struct RegionRuntimeConfig { + pub unity_version: String, +} + +impl Default for RegionRuntimeConfig { + fn default() -> Self { + Self { + unity_version: "2022.3.21f1".to_string(), + } + } +} + +#[derive(Debug, Clone, Serialize, Deserialize, Default)] +#[serde(default)] +pub struct RegionPathsConfig { + pub asset_save_dir: Option, + pub downloaded_asset_record_file: Option, +} diff --git a/assets-updater/src/core/errors.rs b/assets-updater/src/core/errors.rs new file mode 100644 index 0000000..8294774 --- /dev/null +++ b/assets-updater/src/core/errors.rs @@ -0,0 +1,144 @@ +use std::path::PathBuf; + +use thiserror::Error; + +#[derive(Debug, Error)] +pub enum ConfigError { + #[error("failed to read config file {path}: {source}")] + Read { + path: PathBuf, + #[source] + source: std::io::Error, + }, + #[error("failed to parse config file {path}: {source}")] + Parse { + path: PathBuf, + #[source] + source: yaml_serde::Error, + }, + #[error("config_version must be 2, got {0}")] + UnsupportedVersion(u32), + #[error("no v2 config file found; tried: {0}")] + MissingConfigFile(String), + #[error("invalid region key `{0}`; region keys must be lowercase")] + InvalidRegionName(String), + #[error("missing required environment variable `{name}` referenced by `{field}`")] + MissingEnvironmentVariable { field: String, name: String }, +} + +#[derive(Debug, Error)] +pub enum RegionError { + #[error("region `{0}` not found")] + NotFound(String), + #[error("region `{0}` is disabled")] + Disabled(String), +} + + +#[derive(Debug, Error)] +pub enum CodecError { + #[error("path {0} is not valid UTF-8 for cridecoder file APIs")] + NonUtf8Path(PathBuf), + #[error("io error at {path}: {source}")] + Io { + path: PathBuf, + #[source] + source: std::io::Error, + }, + #[error("ACB extraction failed: {0}")] + Acb(String), + #[error("USM extraction failed: {0}")] + Usm(String), + #[error("USM metadata read failed: {0}")] + Metadata(String), + #[error("HCA decode failed: {0}")] + Hca(String), +} + +#[derive(Debug, Error)] +pub enum ExportPipelineError { + #[error(transparent)] + Codec(#[from] CodecError), + #[error("io error at {path}: {source}")] + Io { + path: PathBuf, + #[source] + source: std::io::Error, + }, + #[error("image codec error at {path}: {source}")] + Image { + path: PathBuf, + #[source] + source: image::ImageError, + }, + #[error("failed to spawn command `{program}`: {source}")] + Spawn { + program: String, + #[source] + source: std::io::Error, + }, + #[error("command `{program}` failed with status {status}: {stderr}")] + CommandFailed { + program: String, + status: String, + stderr: String, + }, + #[error("failed to spawn worker `{worker}`: {source}")] + WorkerSpawn { + worker: String, + #[source] + source: std::io::Error, + }, + #[error("worker `{worker}` panicked: {message}")] + WorkerPanic { worker: String, message: String }, +} + +#[derive(Debug, Error)] +pub enum AssetExecutionError { + #[error(transparent)] + Region(#[from] RegionError), + #[error(transparent)] + ExportPipeline(#[from] ExportPipelineError), + #[error("http request failed: {0}")] + Http(#[from] reqwest::Error), + #[error("failed to initialize HTTP client: {0}")] + HttpClient(String), + #[error("HTTP request to {url} returned status {status}")] + HttpStatus { url: String, status: u16 }, + #[error("region `{region}` is missing asset_save_dir")] + MissingAssetSaveDir { region: String }, + #[error("nuverse region `{region}` requires asset_version and asset_hash")] + MissingAppVersion { region: String }, + #[error("colorful_palette region `{region}` requires asset_version and asset_hash")] + MissingAssetVersionOrHash { region: String }, + #[error("colorful_palette region `{region}` is missing profile hash for `{profile}`")] + MissingProfileHash { region: String, profile: String }, + #[error("region `{region}` is missing AES key or IV configuration")] + MissingCryptoConfig { region: String }, + #[error("invalid AES key hex: {0}")] + InvalidAesKeyHex(String), + #[error("invalid AES IV hex: {0}")] + InvalidAesIvHex(String), + #[error("invalid AES IV length: got {got}, want 16")] + InvalidAesIvLength { got: usize }, + #[error("encrypted content cannot be empty")] + EmptyEncryptedContent, + #[error("encrypted content length is not a multiple of AES block size")] + InvalidEncryptedBlockSize, + #[error("failed to decrypt or deserialize asset info: {0}")] + AssetInfoDecode(String), + #[error("failed to create temp directory for {path}: {source}")] + CreateTempDir { + path: PathBuf, + #[source] + source: std::io::Error, + }, + #[error("failed to write temp file {path}: {source}")] + WriteTempFile { + path: PathBuf, + #[source] + source: std::io::Error, + }, + #[error("job execution cancelled")] + Cancelled, +} diff --git a/assets-updater/src/core/export_pipeline.rs b/assets-updater/src/core/export_pipeline.rs new file mode 100644 index 0000000..63b45cb --- /dev/null +++ b/assets-updater/src/core/export_pipeline.rs @@ -0,0 +1,774 @@ +use std::collections::VecDeque; +use std::path::{Path, PathBuf}; +use std::sync::{Arc, Mutex}; + +use crate::core::codec; +use crate::core::config::{AppConfig, RegionConfig}; +use crate::core::errors::ExportPipelineError; +use crate::core::media::{ + FrameRate, convert_m2v_to_mp4, convert_usm_to_mp4, convert_wav_to_flac, convert_wav_to_mp3, +}; +use crate::core::retry::retry_async; +use common::updater::SyncContext; +use image::codecs::webp::WebPEncoder; +use image::{ExtendedColorType, ImageReader}; +use log::debug; +use serde::Serialize; +use tokio::process::Command; + +#[derive(Debug, Clone, Copy)] +struct AssetStudioCliCapabilities { + filter_exclude_mode: bool, + filter_blacklist_mode: bool, + sekai_keep_single_container_filename: bool, +} + +#[derive(Debug, Clone, Serialize, Default)] +pub struct PostProcessSummary { + pub export_root: PathBuf, + pub generated_files: Vec, +} + +pub fn get_export_group(export_path: &str) -> &'static str { + if export_path.is_empty() { + return "container"; + } + + let normalized = export_path + .replace('\\', "/") + .trim_start_matches('/') + .to_lowercase(); + + for prefix in [ + "event/center", + "event/thumbnail", + "gacha/icon", + "fix_prefab/mc_new", + "mysekai/character/", + ] { + if normalized.starts_with(prefix) { + return "containerFull"; + } + } + + "container" +} + +pub fn get_hex_index(input: &str) -> String { + let hash_val = twox_hash::XxHash3_128::oneshot(input.as_bytes()); + format!("{:032x}", hash_val) +} + +pub fn empty_dir(base: PathBuf, name: String) -> PathBuf { + let mut dir = base.join(&name); + let mut cnt = 1; + while dir.exists() { + dir = base.join(format!("{}_{}", &name, cnt)); + cnt += 1; + } + std::fs::create_dir_all(&dir).unwrap(); + dir +} + +pub async fn extract_unity_asset_bundle( + app_config: &AppConfig, + sync_context: &SyncContext, + region: &RegionConfig, + asset_bundle_file: &Path, + export_path: &str, + download_path: &str, +) -> Result<(PathBuf, bool), ExportPipelineError> { + let hash = get_hex_index(export_path); + let output_dir = empty_dir( + std::env::temp_dir() + .join("sekai-updater") + .join("extract") + .join(&sync_context.region), + hash, + ); + let Some(asset_studio_cli_path) = app_config.tools.asset_studio_cli_path.as_deref() else { + return Ok((asset_bundle_file.parent().unwrap().to_path_buf(), true)); + }; + + let exclude_path_prefix = "assets/sekai/assetbundle/resources/ondemand".to_string(); + let actual_export_path = output_dir.join(export_path); + + debug!("{}", actual_export_path.to_string_lossy()); + let capabilities = detect_assetstudio_cli_capabilities(asset_studio_cli_path); + let args = build_assetstudio_export_args( + asset_bundle_file, + output_dir.as_path(), + export_path, + &exclude_path_prefix, + region, + sync_context, + capabilities, + ); + + retry_async( + &app_config.execution.retry, + "assetstudio export", + |_| async { + let output = Command::new(asset_studio_cli_path) + .args(&args) + .output() + .await + .map_err(|source| ExportPipelineError::Spawn { + program: asset_studio_cli_path.to_string(), + source, + })?; + + if output.status.success() { + Ok(()) + } else { + Err(ExportPipelineError::CommandFailed { + program: asset_studio_cli_path.to_string(), + status: output.status.to_string(), + stderr: String::from_utf8_lossy(&output.stderr).trim().to_string(), + }) + } + }, + is_retryable_command_error, + ) + .await?; + + let mut count = 0; + let mut is_bundle_name_file = true; + let download_name = match download_path.rsplit_once("/") { + None => download_path, + Some((_, name)) => name, + }; + walk(&output_dir, &mut |f| { + count += 1; + let file_name = f.file_name().unwrap().to_string_lossy(); + is_bundle_name_file = is_bundle_name_file + && match file_name.rsplit_once(".") { + Some((name, _)) => name.eq_ignore_ascii_case(download_name), + None => file_name.eq_ignore_ascii_case(download_name), + } + })?; + + post_process_exported_files(app_config, sync_context, region, &output_dir).await?; + Ok((output_dir, is_bundle_name_file && count <= 1)) +} + +pub async fn post_process_exported_files( + app_config: &AppConfig, + sync_context: &SyncContext, + region: &RegionConfig, + export_path: &Path, +) -> Result<(), ExportPipelineError> { + if !export_path.exists() { + return Ok(()); + } + + handle_usm_files( + export_path, + sync_context, + &app_config.tools.ffmpeg_path, + &app_config.execution.retry, + ) + .await?; + handle_acb_files( + export_path, + sync_context, + region, + &app_config.tools.ffmpeg_path, + &app_config.execution.retry, + app_config.concurrency.acb, + app_config.concurrency.hca, + ) + .await?; + handle_png_conversion(export_path, sync_context, region).await?; + + Ok(()) +} + +async fn handle_usm_files( + export_path: &Path, + sync_context: &SyncContext, + ffmpeg_path: &str, + retry: &crate::core::config::RetryConfig, +) -> Result, ExportPipelineError> { + let usm_files = find_files_by_extension(export_path, "usm")?; + if !sync_context.export.usm.export || !sync_context.export.usm.decode || usm_files.is_empty() { + return Ok(Vec::new()); + } + + let mut out: Vec = vec![]; + + for f in usm_files { + out.append(&mut process_usm_file(&f, sync_context, ffmpeg_path, retry).await?); + } + Ok(out) +} + +async fn process_usm_file( + usm_file: &Path, + sync_context: &SyncContext, + ffmpeg_path: &str, + retry: &crate::core::config::RetryConfig, +) -> Result, ExportPipelineError> { + let output_name = usm_file + .file_stem() + .and_then(|stem| stem.to_str()) + .ok_or_else(|| ExportPipelineError::Io { + path: usm_file.to_path_buf(), + source: std::io::Error::new(std::io::ErrorKind::InvalidData, "invalid usm file name"), + })? + .to_string(); + + if sync_context.export.video.convert_to_mp4 + && sync_context.export.video.direct_usm_to_mp4_with_ffmpeg + { + let mp4 = usm_file + .parent() + .unwrap() + .join(format!("{output_name}.mp4")); + convert_usm_to_mp4(usm_file, &mp4, ffmpeg_path, retry).await?; + remove_file_if_exists(usm_file)?; + return Ok(vec![mp4]); + } + + let metadata = codec::read_usm_metadata(usm_file).ok(); + let frame_rate = metadata + .as_ref() + .and_then(|metadata| metadata.video_frame_rate()) + .filter(|(_, denominator)| *denominator > 0) + .map(FrameRate::from_tuple); + let extracted = codec::export_usm(usm_file, usm_file.parent().unwrap())?; + let mut generated = extracted.clone(); + + if sync_context.export.video.convert_to_mp4 { + for extracted_file in extracted { + if extracted_file + .extension() + .and_then(|ext| ext.to_str()) + .map(|ext| ext.eq_ignore_ascii_case("m2v")) + .unwrap_or(false) + { + let mp4 = usm_file + .parent() + .unwrap() + .join(format!("{output_name}.mp4")); + convert_m2v_to_mp4( + &extracted_file, + &mp4, + sync_context.export.video.remove_m2v, + ffmpeg_path, + frame_rate, + retry, + ) + .await?; + generated.push(mp4); + if sync_context.export.video.remove_m2v { + generated.retain(|path| path != &extracted_file); + } + } + } + } + + remove_file_if_exists(usm_file)?; + Ok(generated) +} + +async fn handle_acb_files( + export_path: &Path, + sync_context: &SyncContext, + region: &RegionConfig, + ffmpeg_path: &str, + retry: &crate::core::config::RetryConfig, + acb_concurrency: usize, + hca_concurrency: usize, +) -> Result, ExportPipelineError> { + let acb_files = find_files_by_extension(export_path, "acb")?; + if !sync_context.export.acb.export || !sync_context.export.acb.decode || acb_files.is_empty() { + return Ok(Vec::new()); + } + + let export_path = export_path.to_path_buf(); + let region = region.clone(); + let sync_context = sync_context.clone(); + let ffmpeg_path = ffmpeg_path.to_string(); + let retry = retry.clone(); + run_path_tasks(acb_files, acb_concurrency, move |acb_file| { + process_acb_file( + &acb_file, + &export_path, + &sync_context, + ®ion, + &ffmpeg_path, + &retry, + hca_concurrency, + ) + }) +} + +fn process_acb_file( + acb_file: &Path, + _output_dir: &Path, + sync_context: &SyncContext, + region: &RegionConfig, + ffmpeg_path: &str, + retry: &crate::core::config::RetryConfig, + hca_concurrency: usize, +) -> Result, ExportPipelineError> { + let parent_dir = acb_file.parent().ok_or_else(|| ExportPipelineError::Io { + path: acb_file.to_path_buf(), + source: std::io::Error::new(std::io::ErrorKind::NotFound, "missing parent directory"), + })?; + let extract_dir = tempfile::Builder::new() + .prefix("acb-extract-") + .tempdir_in(parent_dir) + .map_err(|source| ExportPipelineError::Io { + path: parent_dir.to_path_buf(), + source, + })?; + + let _ = codec::export_acb(acb_file, extract_dir.path())?; + let mut hca_files = find_files_by_extension(extract_dir.path(), "hca")?; + + let acb_path_lower = acb_file.to_string_lossy().replace('\\', "/").to_lowercase(); + if acb_path_lower.contains("music/long") { + hca_files.retain(|path| { + let lower = path + .file_name() + .and_then(|name| name.to_str()) + .unwrap_or_default() + .to_lowercase(); + !(lower.ends_with("_vr.hca") || lower.ends_with("_screen.hca")) + }); + } + + if !sync_context.export.hca.decode { + remove_file_if_exists(acb_file)?; + return Ok(Vec::new()); + } + + let extract_output_dir = extract_dir.path().to_path_buf(); + let region = region.clone(); + let sync_context = sync_context.clone(); + let ffmpeg_path = ffmpeg_path.to_string(); + let retry = retry.clone(); + let generated = run_path_tasks(hca_files, hca_concurrency, move |hca_file| { + process_hca_file( + &hca_file, + &extract_output_dir, + &sync_context, + ®ion, + &ffmpeg_path, + &retry, + ) + })?; + let final_outputs = move_result_files(acb_file.parent().unwrap(), &generated)?; + + remove_file_if_exists(acb_file)?; + Ok(final_outputs) +} + +fn process_hca_file( + hca_file: &Path, + output_dir: &Path, + sync_context: &SyncContext, + _: &RegionConfig, + ffmpeg_path: &str, + retry: &crate::core::config::RetryConfig, +) -> Result, ExportPipelineError> { + let base_name = hca_file + .file_stem() + .and_then(|stem| stem.to_str()) + .ok_or_else(|| ExportPipelineError::Io { + path: hca_file.to_path_buf(), + source: std::io::Error::new(std::io::ErrorKind::InvalidData, "invalid hca file name"), + })?; + + let wav_file = hca_file.with_extension("wav"); + codec::decode_hca_to_wav(hca_file, &wav_file)?; + remove_file_if_exists(hca_file)?; + + let mut generated = vec![wav_file.clone()]; + if sync_context.export.audio.convert_to_mp3 { + let mp3 = output_dir.join(format!("{base_name}.mp3")); + convert_wav_to_mp3(&wav_file, &mp3, ffmpeg_path, retry)?; + if sync_context.export.audio.remove_wav { + remove_file_if_exists(&wav_file)?; + generated.retain(|path| path != &wav_file); + } + generated.push(mp3); + } else if sync_context.export.audio.convert_to_flac { + let flac = output_dir.join(format!("{base_name}.flac")); + convert_wav_to_flac(&wav_file, &flac, ffmpeg_path, retry)?; + if sync_context.export.audio.remove_wav { + remove_file_if_exists(&wav_file)?; + generated.retain(|path| path != &wav_file); + } + generated.push(flac); + } else if sync_context.export.audio.remove_wav { + remove_file_if_exists(&wav_file)?; + generated.clear(); + } + + let final_outputs = move_result_files(hca_file.parent().unwrap(), &generated)?; + Ok(final_outputs) +} + +async fn handle_png_conversion( + export_path: &Path, + sync_context: &SyncContext, + _: &RegionConfig, +) -> Result, ExportPipelineError> { + if !sync_context.export.images.convert_to_webp { + return Ok(Vec::new()); + } + + let png_files = find_files_by_extension(export_path, "png")?; + let mut generated = Vec::new(); + for png_file in png_files { + let webp = png_file.with_extension("webp"); + convert_png_to_webp(&png_file, &webp)?; + generated.push(webp.clone()); + if sync_context.export.images.remove_png { + remove_file_if_exists(&png_file)?; + } + } + Ok(generated) +} + +fn convert_png_to_webp(png_file: &Path, webp_file: &Path) -> Result<(), ExportPipelineError> { + let image = ImageReader::open(png_file) + .map_err(|source| ExportPipelineError::Io { + path: png_file.to_path_buf(), + source, + })? + .decode() + .map_err(|source| ExportPipelineError::Image { + path: png_file.to_path_buf(), + source, + })?; + let rgba = image.to_rgba8(); + let (width, height) = rgba.dimensions(); + let writer = std::fs::File::create(webp_file).map_err(|source| ExportPipelineError::Io { + path: webp_file.to_path_buf(), + source, + })?; + let writer = std::io::BufWriter::new(writer); + + WebPEncoder::new_lossless(writer) + .encode(rgba.as_raw(), width, height, ExtendedColorType::Rgba8) + .map_err(|source| ExportPipelineError::Image { + path: webp_file.to_path_buf(), + source, + }) +} + +fn is_retryable_command_error(err: &ExportPipelineError) -> bool { + match err { + ExportPipelineError::Spawn { source, .. } => matches!( + source.kind(), + std::io::ErrorKind::Interrupted + | std::io::ErrorKind::TimedOut + | std::io::ErrorKind::WouldBlock + | std::io::ErrorKind::BrokenPipe + | std::io::ErrorKind::ConnectionReset + | std::io::ErrorKind::ConnectionAborted + | std::io::ErrorKind::ConnectionRefused + ), + ExportPipelineError::CommandFailed { .. } => true, + _ => false, + } +} + +fn build_assetstudio_export_args( + asset_bundle_file: &Path, + output_dir: &Path, + export_path: &str, + exclude_path_prefix: &str, + region: &RegionConfig, + sync_context: &SyncContext, + capabilities: AssetStudioCliCapabilities, +) -> Vec { + let mut args = vec![ + asset_bundle_file.to_string_lossy().to_string(), + "-m".to_string(), + "export".to_string(), + "-t".to_string(), + "monoBehaviour,textAsset,tex2d,tex2dArray,audio".to_string(), + "-g".to_string(), + get_export_group(export_path).to_string(), + "-f".to_string(), + "assetName".to_string(), + "-o".to_string(), + output_dir.to_string_lossy().to_string(), + "--strip-path-prefix".to_string(), + exclude_path_prefix.to_string(), + "-r".to_string(), + ]; + + if capabilities.filter_exclude_mode { + args.push("--filter-exclude-mode".to_string()); + } else if capabilities.filter_blacklist_mode { + args.push("--filter-blacklist-mode".to_string()); + } + + args.push("--filter-with-regex".to_string()); + + if capabilities.sekai_keep_single_container_filename { + args.push("--sekai-keep-single-container-filename".to_string()); + } + + if !region.runtime.unity_version.is_empty() { + args.push("--unity-version".to_string()); + args.push(region.runtime.unity_version.clone()); + } + + let mut excluded_exts = Vec::new(); + if !sync_context.export.usm.export { + excluded_exts.push("usm"); + } + if !sync_context.export.acb.export { + excluded_exts.push("acb"); + } + if !excluded_exts.is_empty() { + args.push("--filter-by-name".to_string()); + args.push(format!(r".*\.({})$", excluded_exts.join("|"))); + } + + args +} + +fn detect_assetstudio_cli_capabilities(asset_studio_cli_path: &str) -> AssetStudioCliCapabilities { + static CACHE: std::sync::OnceLock< + Mutex>, + > = std::sync::OnceLock::new(); + let cache = CACHE.get_or_init(|| Mutex::new(std::collections::HashMap::new())); + + if let Some(cached) = cache.lock().unwrap().get(asset_studio_cli_path).copied() { + return cached; + } + + let fallback = AssetStudioCliCapabilities { + filter_exclude_mode: true, + filter_blacklist_mode: false, + sekai_keep_single_container_filename: true, + }; + + let detected = match std::process::Command::new(asset_studio_cli_path) + .arg("--help") + .output() + { + Ok(output) => { + let help = format!( + "{}\n{}", + String::from_utf8_lossy(&output.stdout), + String::from_utf8_lossy(&output.stderr) + ); + AssetStudioCliCapabilities { + filter_exclude_mode: help.contains("--filter-exclude-mode"), + filter_blacklist_mode: help.contains("--filter-blacklist-mode"), + sekai_keep_single_container_filename: help + .contains("--sekai-keep-single-container-filename"), + } + } + Err(_) => fallback, + }; + + cache + .lock() + .unwrap() + .insert(asset_studio_cli_path.to_string(), detected); + detected +} + +fn move_result_files( + output_dir: &Path, + generated: &[PathBuf], +) -> Result, ExportPipelineError> { + let mut final_outputs = Vec::new(); + for path in generated { + let file_name = match path.file_name() { + Some(name) => name, + None => continue, + }; + let destination = output_dir.join(file_name); + if path != &destination { + std::fs::rename(path, &destination).map_err(|source| ExportPipelineError::Io { + path: destination.clone(), + source, + })?; + final_outputs.push(destination); + } else if destination.exists() { + final_outputs.push(destination); + } + } + Ok(final_outputs) +} + +fn run_path_tasks( + paths: Vec, + concurrency: usize, + task: F, +) -> Result, ExportPipelineError> +where + F: Fn(PathBuf) -> Result, ExportPipelineError> + Send + Sync + 'static, +{ + if paths.is_empty() { + return Ok(Vec::new()); + } + + let worker_count = concurrency.max(1).min(paths.len()); + let queue = Arc::new(Mutex::new(VecDeque::from(paths))); + let results = Arc::new(Mutex::new(Vec::::new())); + let first_error = Arc::new(Mutex::new(None::)); + let task = Arc::new(task); + let mut handles = Vec::with_capacity(worker_count); + const WORKER_STACK_SIZE: usize = 32 * 1024 * 1024; + + for _ in 0..worker_count { + let queue = queue.clone(); + let results = results.clone(); + let first_error = first_error.clone(); + let task = task.clone(); + let worker_name = "export-task".to_string(); + let handle = std::thread::Builder::new() + .name(worker_name.clone()) + .stack_size(WORKER_STACK_SIZE) + .spawn(move || { + loop { + if first_error.lock().unwrap().is_some() { + break; + } + + let next_path = queue.lock().unwrap().pop_front(); + let Some(path) = next_path else { + break; + }; + + match task(path) { + Ok(mut generated) => results.lock().unwrap().append(&mut generated), + Err(err) => { + let mut first = first_error.lock().unwrap(); + if first.is_none() { + *first = Some(err); + } + break; + } + } + } + }) + .map_err(|source| ExportPipelineError::WorkerSpawn { + worker: worker_name, + source, + })?; + handles.push(handle); + } + + for handle in handles { + handle + .join() + .map_err(|panic| ExportPipelineError::WorkerPanic { + worker: "export task".to_string(), + message: panic_message(panic), + })?; + } + + if let Some(err) = first_error.lock().unwrap().take() { + return Err(err); + } + + let mut results = results.lock().unwrap(); + Ok(std::mem::take(&mut *results)) +} + +fn panic_message(panic: Box) -> String { + if let Some(message) = panic.downcast_ref::<&str>() { + (*message).to_string() + } else if let Some(message) = panic.downcast_ref::() { + message.clone() + } else { + "unknown worker panic".to_string() + } +} + +pub fn find_files(dir: &Path) -> Result, ExportPipelineError> { + let mut files = Vec::new(); + walk(dir, &mut |path| { + files.push(path.to_path_buf()); + })?; + Ok(files) +} + +pub fn find_files_by_extension(dir: &Path, ext: &str) -> Result, ExportPipelineError> { + let target_ext = ext.to_lowercase(); + let mut files = Vec::new(); + walk(dir, &mut |path| { + if path + .extension() + .and_then(|value| value.to_str()) + .map(|value| value.eq_ignore_ascii_case(&target_ext)) + .unwrap_or(false) + { + files.push(path.to_path_buf()); + } + })?; + Ok(files) +} + +pub fn find_files_by_extensions

( + dir: &Path, + ext: &[P], +) -> Result, ExportPipelineError> +where + P: AsRef, +{ + let target_ext = ext + .iter() + .map(|x| x.as_ref().to_lowercase()) + .collect::>(); + let mut files = Vec::new(); + walk(dir, &mut |path| { + if path + .extension() + .and_then(|value| value.to_str()) + .map(|value| target_ext.contains(&value.to_lowercase())) + .unwrap_or(false) + { + files.push(path.to_path_buf()); + } + })?; + Ok(files) +} + +fn walk(dir: &Path, f: &mut dyn FnMut(&Path)) -> Result<(), ExportPipelineError> { + for entry in std::fs::read_dir(dir).map_err(|source| ExportPipelineError::Io { + path: dir.to_path_buf(), + source, + })? { + let entry = entry.map_err(|source| ExportPipelineError::Io { + path: dir.to_path_buf(), + source, + })?; + let path = entry.path(); + let file_type = entry + .file_type() + .map_err(|source| ExportPipelineError::Io { + path: path.clone(), + source, + })?; + if file_type.is_dir() { + walk(&path, f)?; + } else { + f(&path); + } + } + Ok(()) +} + +fn remove_file_if_exists(path: &Path) -> Result<(), ExportPipelineError> { + if path.exists() { + std::fs::remove_file(path).map_err(|source| ExportPipelineError::Io { + path: path.to_path_buf(), + source, + })?; + } + Ok(()) +} diff --git a/assets-updater/src/core/media.rs b/assets-updater/src/core/media.rs new file mode 100644 index 0000000..b79997a --- /dev/null +++ b/assets-updater/src/core/media.rs @@ -0,0 +1,229 @@ +use std::fmt::{Display, Formatter}; +use std::path::Path; + +use tokio::process::Command; + +use crate::core::config::RetryConfig; +use crate::core::errors::ExportPipelineError; +use crate::core::retry::{retry_async, retry_sync}; + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct FrameRate { + pub numerator: i32, + pub denominator: i32, +} + +impl FrameRate { + pub fn from_tuple((numerator, denominator): (i32, i32)) -> Self { + Self { + numerator, + denominator, + } + } +} + +impl Display for FrameRate { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + if self.denominator <= 1 { + write!(f, "{}", self.numerator) + } else { + write!(f, "{}/{}", self.numerator, self.denominator) + } + } +} + +pub async fn convert_usm_to_mp4( + usm_file: &Path, + mp4_file: &Path, + ffmpeg_path: &str, + retry: &RetryConfig, +) -> Result<(), ExportPipelineError> { + retry_async( + retry, + "ffmpeg usm->mp4", + |_| async { + run_ffmpeg( + ffmpeg_path, + &[ + "-i", + &usm_file.to_string_lossy(), + "-c:v", + "libx264", + "-c:a", + "aac", + "-b:a", + "192k", + "-movflags", + "+faststart", + "-y", + &mp4_file.to_string_lossy(), + ], + ) + .run_async() + .await + }, + is_retryable_command_error, + ) + .await +} + +pub async fn convert_m2v_to_mp4( + m2v_file: &Path, + mp4_file: &Path, + delete_original: bool, + ffmpeg_path: &str, + frame_rate: Option, + retry: &RetryConfig, +) -> Result<(), ExportPipelineError> { + let mut args = Vec::new(); + if let Some(rate) = frame_rate { + args.push("-r".to_string()); + args.push(rate.to_string()); + } + args.push("-i".to_string()); + args.push(m2v_file.to_string_lossy().to_string()); + args.push("-c:v".to_string()); + args.push("libx264".to_string()); + if let Some(rate) = frame_rate { + args.push("-r".to_string()); + args.push(rate.to_string()); + } + args.push("-y".to_string()); + args.push(mp4_file.to_string_lossy().to_string()); + + retry_async( + retry, + "ffmpeg m2v->mp4", + |_| async { + let refs: Vec<&str> = args.iter().map(String::as_str).collect(); + run_ffmpeg(ffmpeg_path, &refs).run_async().await + }, + is_retryable_command_error, + ) + .await?; + if delete_original && m2v_file.exists() { + std::fs::remove_file(m2v_file).map_err(|source| ExportPipelineError::Io { + path: m2v_file.to_path_buf(), + source, + })?; + } + Ok(()) +} + +pub fn convert_wav_to_mp3( + wav_file: &Path, + mp3_file: &Path, + ffmpeg_path: &str, + retry: &RetryConfig, +) -> Result<(), ExportPipelineError> { + retry_sync( + retry, + "ffmpeg wav->mp3", + |_| { + run_ffmpeg_sync( + ffmpeg_path, + &[ + "-i", + &wav_file.to_string_lossy(), + "-b:a", + "320k", + "-y", + &mp3_file.to_string_lossy(), + ], + ) + }, + is_retryable_command_error, + ) +} + +pub fn convert_wav_to_flac( + wav_file: &Path, + flac_file: &Path, + ffmpeg_path: &str, + retry: &RetryConfig, +) -> Result<(), ExportPipelineError> { + retry_sync( + retry, + "ffmpeg wav->flac", + |_| { + run_ffmpeg_sync( + ffmpeg_path, + &[ + "-i", + &wav_file.to_string_lossy(), + "-compression_level", + "12", + "-y", + &flac_file.to_string_lossy(), + ], + ) + }, + is_retryable_command_error, + ) +} + +fn run_ffmpeg<'a>(ffmpeg_path: &'a str, args: &'a [&'a str]) -> FfmpegCommand<'a> { + FfmpegCommand { ffmpeg_path, args } +} + +fn run_ffmpeg_sync(ffmpeg_path: &str, args: &[&str]) -> Result<(), ExportPipelineError> { + let output = std::process::Command::new(ffmpeg_path) + .args(args) + .output() + .map_err(|source| ExportPipelineError::Spawn { + program: ffmpeg_path.to_string(), + source, + })?; + map_command_output(ffmpeg_path, output) +} + +struct FfmpegCommand<'a> { + ffmpeg_path: &'a str, + args: &'a [&'a str], +} + +impl<'a> FfmpegCommand<'a> { + async fn run_async(self) -> Result<(), ExportPipelineError> { + let output = Command::new(self.ffmpeg_path) + .args(self.args) + .output() + .await + .map_err(|source| ExportPipelineError::Spawn { + program: self.ffmpeg_path.to_string(), + source, + })?; + map_command_output(self.ffmpeg_path, output) + } +} + +fn is_retryable_command_error(err: &ExportPipelineError) -> bool { + match err { + ExportPipelineError::Spawn { source, .. } => matches!( + source.kind(), + std::io::ErrorKind::Interrupted + | std::io::ErrorKind::TimedOut + | std::io::ErrorKind::WouldBlock + | std::io::ErrorKind::BrokenPipe + | std::io::ErrorKind::ConnectionReset + | std::io::ErrorKind::ConnectionAborted + | std::io::ErrorKind::ConnectionRefused + ), + ExportPipelineError::CommandFailed { .. } => true, + _ => false, + } +} + +fn map_command_output( + program: &str, + output: std::process::Output, +) -> Result<(), ExportPipelineError> { + if output.status.success() { + Ok(()) + } else { + Err(ExportPipelineError::CommandFailed { + program: program.to_string(), + status: output.status.to_string(), + stderr: String::from_utf8_lossy(&output.stderr).trim().to_string(), + }) + } +} diff --git a/assets-updater/src/core/mod.rs b/assets-updater/src/core/mod.rs new file mode 100644 index 0000000..95d60d8 --- /dev/null +++ b/assets-updater/src/core/mod.rs @@ -0,0 +1,7 @@ +pub mod asset_execution; +pub mod config; +pub mod export_pipeline; +pub mod retry; +pub mod media; +pub mod codec; +pub mod errors; \ No newline at end of file diff --git a/assets-updater/src/core/retry.rs b/assets-updater/src/core/retry.rs new file mode 100644 index 0000000..921247f --- /dev/null +++ b/assets-updater/src/core/retry.rs @@ -0,0 +1,83 @@ +use std::fmt::Display; +use std::future::Future; +use std::time::Duration; +use log::warn; +use tokio::time::sleep; + +use crate::core::config::RetryConfig; + +pub async fn retry_async( + config: &RetryConfig, + operation: &str, + mut op: Op, + should_retry: ShouldRetry, +) -> Result +where + E: Display, + Op: FnMut(usize) -> Fut, + Fut: Future>, + ShouldRetry: Fn(&E) -> bool, +{ + let attempts = config.attempts.max(1); + for attempt in 1..=attempts { + match op(attempt).await { + Ok(value) => return Ok(value), + Err(err) if attempt < attempts && should_retry(&err) => { + let delay = backoff_delay(config, attempt); + warn!( + "operation '{}' failed after {} attempt(s) with error: {}, retrying in {} ms", + operation, + attempt, + err, + delay.as_millis() + ); + sleep(delay).await; + } + Err(err) => return Err(err), + } + } + + unreachable!("retry_async must return from within the attempt loop") +} + +pub fn retry_sync( + config: &RetryConfig, + operation: &str, + mut op: Op, + should_retry: ShouldRetry, +) -> Result +where + E: Display, + Op: FnMut(usize) -> Result, + ShouldRetry: Fn(&E) -> bool, +{ + let attempts = config.attempts.max(1); + for attempt in 1..=attempts { + match op(attempt) { + Ok(value) => return Ok(value), + Err(err) if attempt < attempts && should_retry(&err) => { + let delay = backoff_delay(config, attempt); + warn!( + "operation '{}' failed after {} attempt(s) with error: {}, retrying in {} ms", + operation, + attempt, + err, + delay.as_millis() + ); + std::thread::sleep(delay); + } + Err(err) => return Err(err), + } + } + + unreachable!("retry_sync must return from within the attempt loop") +} + +fn backoff_delay(config: &RetryConfig, attempt: usize) -> Duration { + let base = config.initial_backoff_ms.max(1); + let max = config.max_backoff_ms.max(base); + let multiplier = 1u64 + .checked_shl(attempt.saturating_sub(1) as u32) + .unwrap_or(u64::MAX); + Duration::from_millis(base.saturating_mul(multiplier).min(max)) +} diff --git a/assets-updater/src/lib.rs b/assets-updater/src/lib.rs new file mode 100644 index 0000000..5a7ca06 --- /dev/null +++ b/assets-updater/src/lib.rs @@ -0,0 +1 @@ +pub mod core; diff --git a/cargo.toml b/cargo.toml new file mode 100644 index 0000000..e66d993 --- /dev/null +++ b/cargo.toml @@ -0,0 +1,28 @@ +[workspace] +resolver = "3" +members = ["entry", "common", "assets-updater", "test-main"] + +#[profile.dev] +#codegen-units = 4 + +[workspace.dependencies] +anyhow = "1.0.102" +log = "0.4.29" +serde = "1.0.228" +serde_json = "1.0.150" +tokio = "1.51.0" +aes = "0.8.4" +rmp-serde = "1.3.1" +hex = "0.4.3" +cbc = "0.1.2" +tempfile = "3.27.0" +chrono = "0.4.44" +reqwest = "0.13.2" +regex = "1.12.3" +yaml_serde = "0.10.4" +image = "0.25.10" +cridecoder = "0.1.1" +thiserror = "2.0.18" +cipher = "0.4.4" +twox-hash = "2.1.2" + diff --git a/common/Cargo.toml b/common/Cargo.toml new file mode 100644 index 0000000..248f35f --- /dev/null +++ b/common/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "common" +version = "0.1.0" +edition = "2024" + +[dependencies] +serde = { workspace = true, features = ["derive"] } \ No newline at end of file diff --git a/common/src/lib.rs b/common/src/lib.rs new file mode 100644 index 0000000..e126084 --- /dev/null +++ b/common/src/lib.rs @@ -0,0 +1 @@ +pub mod updater; \ No newline at end of file diff --git a/common/src/updater.rs b/common/src/updater.rs new file mode 100644 index 0000000..568b1d1 --- /dev/null +++ b/common/src/updater.rs @@ -0,0 +1,161 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct SyncContext { + pub region: String, + #[serde(default)] + pub export: RegionExportConfig, + #[serde(default)] + pub asset_version: Option, + #[serde(default)] + pub asset_hash: Option, + #[serde(default)] + pub app_version: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize, Default)] +#[serde(default)] +pub struct RegionFiltersConfig { + #[serde(default)] + pub start_app: Vec, + #[serde(default)] + pub on_demand: Vec, + #[serde(default)] + pub skip: Vec, + #[serde(default)] + pub file_ext: Vec, +} + +#[derive(Debug, Clone, Serialize, Deserialize, Default)] +#[serde(default)] +pub struct RegionExportConfig { + #[serde(default)] + pub usm: UsmExportConfig, + #[serde(default)] + pub acb: AcbExportConfig, + #[serde(default)] + pub hca: HcaExportConfig, + #[serde(default)] + pub images: ImageExportConfig, + #[serde(default)] + pub video: VideoExportConfig, + #[serde(default)] + pub audio: AudioExportConfig, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(default)] +pub struct UsmExportConfig { + pub export: bool, + pub decode: bool, +} + +impl Default for UsmExportConfig { + fn default() -> Self { + Self { + export: true, + decode: true, + } + } +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(default)] +pub struct AcbExportConfig { + pub export: bool, + pub decode: bool, +} + +impl Default for AcbExportConfig { + fn default() -> Self { + Self { + export: true, + decode: true, + } + } +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(default)] +pub struct HcaExportConfig { + pub decode: bool, +} + +impl Default for HcaExportConfig { + fn default() -> Self { + Self { decode: true } + } +} + +#[derive(Debug, Clone, Serialize, Deserialize, Default)] +#[serde(default)] +pub struct ImageExportConfig { + pub convert_to_webp: bool, + pub remove_png: bool, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(default)] +pub struct VideoExportConfig { + pub convert_to_mp4: bool, + pub direct_usm_to_mp4_with_ffmpeg: bool, + pub remove_m2v: bool, +} + +impl Default for VideoExportConfig { + fn default() -> Self { + Self { + convert_to_mp4: true, + direct_usm_to_mp4_with_ffmpeg: false, + remove_m2v: true, + } + } +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(default)] +pub struct AudioExportConfig { + pub convert_to_mp3: bool, + pub convert_to_flac: bool, + pub remove_wav: bool, +} + +impl Default for AudioExportConfig { + fn default() -> Self { + Self { + convert_to_mp3: true, + convert_to_flac: false, + remove_wav: true, + } + } +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct DownloadTask { + pub download_path: String, + pub bundle_path: String, + pub bundle_hash: String, + pub category: AssetCategory, +} + +#[derive(Debug, Clone, Serialize, PartialEq, Eq)] +pub enum AssetCategory { + StartApp, + OnDemand, + Other(String), +} + +impl<'de> Deserialize<'de> for AssetCategory { + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + // Treat nil/null as Other("") — matches Go's zero-value coercion. + let raw = Option::::deserialize(deserializer)?.unwrap_or_default(); + Ok(match raw.as_str() { + "StartApp" | "startApp" => Self::StartApp, + "OnDemand" | "onDemand" => Self::OnDemand, + other => Self::Other(other.to_string()), + }) + } +} diff --git a/entry/Cargo.toml b/entry/Cargo.toml new file mode 100644 index 0000000..5ea66fc --- /dev/null +++ b/entry/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "entry" +version = "0.1.0" +edition = "2024" + +[lib] +name = "sekai_sync_lib" +crate-type = ["rlib", "cdylib"] + +[dependencies] +common = { path = "../common" } +assets-updater = { path = "../assets-updater" } + +tokio = { workspace = true, features = ["macros", "rt", "rt-multi-thread"] } +serde = { workspace = true, features = ["derive"] } +serde_json = { workspace = true } +reqwest = { workspace = true, features = ["json"] } +log = { workspace = true } +anyhow = { workspace = true } +simplelog = "0.12.2" \ No newline at end of file diff --git a/entry/src/data.rs b/entry/src/data.rs new file mode 100644 index 0000000..d5eb9ee --- /dev/null +++ b/entry/src/data.rs @@ -0,0 +1,123 @@ +use crate::CONFIG; +use serde::{Deserialize, Serialize}; +use std::path::PathBuf; + +#[derive(Debug)] +pub struct Config { + pub cwd: String, + pub name: String, + pub as_path: String, // AssetStudio +} +impl Config { + pub fn cache_dir(&self) -> PathBuf { + PathBuf::from(&self.cwd).join("cache").join(&self.name) + } + pub fn data_dir(&self) -> PathBuf { + PathBuf::from(&self.cwd).join("data").join(&self.name) + } +} +#[derive(Debug, Default)] +pub struct OptConfig { + pub proxy: Option, + pub ghp: Option, +} + +impl OptConfig { + pub const fn new() -> Self { + Self { + proxy: None, + ghp: None, + } + } +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct State { + pub git_hash: Option, + pub master_hash: Option, + pub event_id: Option, +} +impl State { + fn load(x: &str) -> Self { + serde_json::from_str(x).unwrap() + } + + + pub const fn new() -> Self { + Self { + git_hash: None, + master_hash: None, + event_id: None, + } + } + + pub fn init(&mut self) -> anyhow::Result<()> { + let path = CONFIG.get().unwrap().data_dir().join("state.json"); + if path.exists() { + let i = Self::load(&std::fs::read_to_string(path)?); + self.git_hash = i.git_hash; + self.master_hash = i.master_hash; + self.event_id = i.event_id; + } + Ok(()) + } + + pub fn save(&self) { + let d = CONFIG.get().unwrap().data_dir(); + std::fs::create_dir_all(&d).unwrap(); + let json = serde_json::to_string(self).unwrap(); + std::fs::write(d.join("state.json"), json).unwrap(); + } +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct EventStory { + pub id: u64, + #[serde(rename = "eventId")] + pub event_id: u64, + // outline: String, + #[serde(rename = "assetbundleName")] + pub assetbundle_name: String, +} + +// 用这个找是因为这个文件小一点((( +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct CardEpisode { + pub id: u64, + pub seq: u64, + #[serde(rename = "cardId")] + pub card_id: u64, + #[serde(rename = "assetbundleName")] + pub assetbundle_name: String, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct EventCard { + pub id: u64, + #[serde(rename = "cardId")] + pub card_id: u64, + #[serde(rename = "eventId")] + pub event_id: u64, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct CurrentVersion { + #[serde(rename = "appHash")] + pub app_hash: String, + #[serde(rename = "systemProfile")] + pub system_profile: String, + #[serde(rename = "appVersion")] + pub app_version: String, + #[serde(rename = "assetVersion")] + pub asset_version: String, + #[serde(rename = "dataVersion")] + pub data_version: String, + #[serde(rename = "assetHash")] + pub asset_hash: String, +} + +#[derive(Debug, Clone, Serialize)] +pub struct FetchResult{ + pub event_id: u64, + pub card_paths: Vec, +} \ No newline at end of file diff --git a/entry/src/download.rs b/entry/src/download.rs new file mode 100644 index 0000000..978d420 --- /dev/null +++ b/entry/src/download.rs @@ -0,0 +1,60 @@ +use crate::{CONFIG, OPT_CONFIG}; +use crate::github::get_master_data; +use assets_updater::core::asset_execution::AssetExecutionContext; +use assets_updater::core::config::{AppConfig, CryptoConfig, ExecutionConfig, RegionConfig, RegionProviderConfig, RegionRuntimeConfig, ToolsConfig}; +use assets_updater::core::errors::AssetExecutionError; +use common::updater::SyncContext; +use std::path::PathBuf; + +pub struct Downloader { + exec: AssetExecutionContext, + app_config: AppConfig, +} +impl Downloader { + pub async fn new() -> anyhow::Result { + let master_data = get_master_data().await?; + let mut execution = ExecutionConfig::default(); + // if let Ok(opt_conf) = &OPT_CONFIG.read() + // && let Some(proxy) = &opt_conf.proxy + // { + // execution.proxy = Some(proxy.to_string()); + // } + let app_config = AppConfig { + execution, + tools: ToolsConfig{ + asset_studio_cli_path : Some(CONFIG.get().unwrap().as_path.clone()), + ..Default::default() + }, + ..Default::default() + }; + + let mut exec = AssetExecutionContext::new(&app_config, &SyncContext{ + region: "jp".to_string(), + export: Default::default(), + asset_version: Some(master_data.asset_version), + asset_hash: Some(master_data.asset_hash), + app_version: Some(master_data.app_version), + }, &RegionConfig { + provider: RegionProviderConfig::ColorfulPalette { + asset_info_url_template: "https://{env}-{hash}-assetbundle-info.sekai.colorfulpalette.org/api/version/{asset_version}/{asset_hash}/os/ios".to_owned(), + asset_bundle_url_template: "https://{env}-{hash}-assetbundle.sekai.colorfulpalette.org/{asset_version}/{asset_hash}/ios/{bundle_path}".to_owned(), + profile_hash: "cf2d2388".to_owned(), + }, + crypto: CryptoConfig{ + aes_iv_hex: Some("6732666343305a637a4e394d544a3631".to_owned()), + aes_key_hex: Some("6d737833495630693958453575595a31".to_owned()), + }, + runtime: RegionRuntimeConfig{ + unity_version: "2022.3.21f1".to_owned() + }, + })?; + exec.fetch_runtime_cookies().await?; + Ok(Downloader { exec, app_config }) + } + pub async fn pull( + &self, + bundle_path: &str, + ) -> Result<(PathBuf, /*single file*/ bool), AssetExecutionError> { + self.exec.download(bundle_path, &self.app_config).await + } +} diff --git a/entry/src/github.rs b/entry/src/github.rs new file mode 100644 index 0000000..3d5892b --- /dev/null +++ b/entry/src/github.rs @@ -0,0 +1,84 @@ +use crate::data::CurrentVersion; +use crate::{OPT_CONFIG, STORE, UA}; +use anyhow::anyhow; +use reqwest::Client; +use serde::Deserialize; + +const COMMIT_URL: &str = "https://api.github.com/repos/Team-Haruki/haruki-sekai-master/commits?path=master/events.json&per_page=1"; + +#[derive(Debug, Deserialize)] +struct CommitResponse { + sha: String, +} + +fn http_client() -> anyhow::Result { + let mut builder = Client::builder(); + if let Ok(opt_conf) = &OPT_CONFIG.read() { + if let Some(proxy) = &opt_conf.proxy { + builder = builder.proxy(reqwest::Proxy::all(proxy)?); + } + if let Some(ghp) = &opt_conf.ghp { + builder = builder.default_headers({ + let mut headers = reqwest::header::HeaderMap::new(); + headers.insert( + reqwest::header::AUTHORIZATION, + format!("Bearer {ghp}").parse()?, + ); + headers.insert(reqwest::header::USER_AGENT, UA.parse()?); + headers + }); + } + } + Ok(builder.build()?) +} + +pub async fn fetch_last_hash() -> anyhow::Result { + let resp = http_client()?.get(COMMIT_URL).send().await?; + let text = resp.text().await?; + let data: Vec = serde_json::from_str(&text)?; + Ok(data.first().ok_or(anyhow!(""))?.sha.clone()) +} + +pub fn raw_url(path: &str) -> String { + "https://raw.githubusercontent.com/Team-Haruki/haruki-sekai-master/refs/heads/main/".to_owned() + + path +} + +pub async fn sync_data() -> anyhow::Result<()> { + let client = http_client()?; + let events_cards = &client + .get(raw_url("master/eventCards.json")) + .send() + .await? + .text() + .await?; + let event_stories = &client + .get(raw_url("master/eventStories.json")) + .send() + .await? + .text() + .await?; + let card_episodes = &client + .get(raw_url("master/cardEpisodes.json")) + .send() + .await? + .text() + .await?; + let mut store = STORE.write().map_err(|e| anyhow!("{}", e))?; + store.set_event_cards(serde_json::from_str(events_cards)?); + store.set_event_stories(serde_json::from_str(event_stories)?); + store.set_card_episodes(serde_json::from_str(card_episodes)?); + + Ok(()) +} + +pub async fn get_master_data() -> anyhow::Result { + let client = http_client()?; + let text = client + .get(raw_url("versions/current_version.json")) + .send() + .await? + .text() + .await?; + Ok(serde_json::from_str(&text)?) +} diff --git a/entry/src/lib.rs b/entry/src/lib.rs new file mode 100644 index 0000000..67e1845 --- /dev/null +++ b/entry/src/lib.rs @@ -0,0 +1,125 @@ +mod data; +mod download; +mod github; +mod main_loop; +mod store; + +use crate::data::{Config, FetchResult, OptConfig, State}; +use crate::main_loop::main; +use crate::store::Store; +use log::{LevelFilter, debug}; +use simplelog::{ColorChoice, TermLogger, TerminalMode}; +use std::ffi::{CStr, CString, c_char}; +use std::sync::{OnceLock, RwLock}; +use std::thread; +use std::time::Duration; +use tokio::runtime::Runtime; + +pub static CONFIG: OnceLock = OnceLock::new(); +pub static OPT_CONFIG: RwLock = RwLock::new(OptConfig::new()); +pub static PROVIDE: RwLock> = RwLock::new(None); +pub static STORE: RwLock = RwLock::new(Store::new()); +pub static STATE: RwLock = RwLock::new(State::new()); + +pub const UA: &str = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36"; + +unsafe fn parse_str(x: *const c_char) -> String { + if x.is_null() { + return "".to_owned(); + } + let c_str = unsafe { CStr::from_ptr(x) }; + c_str.to_string_lossy().into_owned() +} + +macro_rules! def_opt_str_setter { + ($name: ident) => { + /// # Safety + #[unsafe(no_mangle)] + pub unsafe extern "C" fn $name(x: *const c_char) { + let x = unsafe { parse_str(x) }; + if x.is_empty() { + OPT_CONFIG.write().unwrap().$name = None; + } else { + OPT_CONFIG.write().unwrap().$name = Some(x); + } + } + }; +} + +def_opt_str_setter!(proxy); +def_opt_str_setter!(ghp); + +/// # Safety +#[unsafe(no_mangle)] +pub unsafe extern "C" fn boot( + cwd: *const c_char, + name: *const c_char, + as_path: *const c_char, +) -> i32 { + unsafe { + CONFIG + .set(Config { + cwd: parse_str(cwd), + name: parse_str(name), + as_path: parse_str(as_path), + }) + .unwrap(); + } + STATE + .write() + .unwrap() + .init() + .expect("Failed to initialize state"); + *STORE.write().unwrap() = Store::load(); + // TermLogger::init( + // LevelFilter::Debug, + // simplelog::Config::default(), + // TerminalMode::Mixed, + // ColorChoice::Auto, + // ) + // .unwrap(); + thread::spawn(|| { + let rt = Runtime::new().expect("Failed to create Tokio runtime"); + + rt.block_on(keep_loop()); + }); + + 0 +} + +/// # Safety +#[unsafe(no_mangle)] +pub unsafe extern "C" fn fetch_data() -> *mut c_char { + let mut provide = PROVIDE.write().unwrap(); + if provide.is_none() { + return std::ptr::null_mut(); + } + let result = provide.take().unwrap(); + *provide = None; + + let json_string = serde_json::to_string(&result).unwrap(); + + let c_str = CString::new(json_string).unwrap(); + c_str.into_raw() +} + +/// # Safety +#[unsafe(no_mangle)] +pub unsafe extern "C" fn free_string(s: *mut c_char) { + if s.is_null() { + return; + } + unsafe { + let _ = CString::from_raw(s); + } +} + +async fn keep_loop() { + loop { + debug!("loop_start"); + if let Err(err) = main().await { + println!("Error: {}", err); + } + tokio::time::sleep(Duration::from_secs(60)).await; + } +} diff --git a/entry/src/main_loop.rs b/entry/src/main_loop.rs new file mode 100644 index 0000000..7832304 --- /dev/null +++ b/entry/src/main_loop.rs @@ -0,0 +1,91 @@ +use crate::data::{FetchResult, State}; +use crate::download::Downloader; +use crate::github::{fetch_last_hash, sync_data}; +use crate::{CONFIG, PROVIDE, STATE, STORE}; +use anyhow::anyhow; +use assets_updater::core::export_pipeline::find_files; +use std::fs; +use log::debug; + +pub async fn main() -> anyhow::Result<()> { + let current_hash = fetch_last_hash().await?; + let old_state = { + let mut l = STATE.read(); + if l.is_err() { + STATE.clear_poison(); + drop(l); + let mut s = STATE.write().map_err(|e| anyhow!("{}", e))?; + *s = State::new(); + let _ = s.init(); + drop(s); + l = STATE.read(); + } + if let Ok(state) = l { + state.clone() + } else { + State::new() + } + }; + if let Some(old_hash) = &old_state.git_hash + && old_hash == ¤t_hash + { + return Ok(()); + } + // hash updated + + sync_data().await?; + let store = STORE.read().map_err(|e| anyhow!("{}", e))?; + let event = store.find_last_event(); + if event + .as_ref() + .zip(old_state.event_id.as_ref()) + .is_none_or(|(e, id)| &e.event_id == id) + { + let mut state = STATE.write().map_err(|e| anyhow!("{}", e))?; + state.git_hash = Some(current_hash); + if let Some(event) = event { + state.event_id = Some(event.event_id); + } + state.save(); + return Ok(()); + } + let event = event.unwrap(); + // event updated + + let cards = store.find_cards_by_event(event.event_id); + drop(store); + let downloader = Downloader::new().await?; + let mut images = Vec::new(); + let cache_dir = CONFIG.get().unwrap().cache_dir(); + for card in cards { + debug!("Pulling card {} from bundle {}", card.card_id, card.assetbundle_name); + let dir = downloader + .pull(&format!("character/member/{}", card.assetbundle_name)) + .await?; + let files = find_files(&dir.0)?; + for file in files { + if file.is_file() && file.extension().map(|ext| ext == "png").unwrap_or(false) { + let new_filename = format!( + "{}_{}", + card.assetbundle_name, + file.file_name().unwrap().to_str().unwrap() + ); + let new_file = cache_dir.join(new_filename); + fs::copy(&file, &new_file)?; + fs::remove_file(&file)?; + images.push(new_file); + } + } + } + + *PROVIDE.write().map_err(|e| anyhow!("{}", e))? = Some(FetchResult { + event_id: event.event_id, + card_paths: images, + }); + let mut state = STATE.write().map_err(|e| anyhow!("{}", e))?; + state.git_hash = Some(current_hash); + state.event_id = Some(event.event_id); + state.save(); + + Ok(()) +} diff --git a/entry/src/store.rs b/entry/src/store.rs new file mode 100644 index 0000000..299df67 --- /dev/null +++ b/entry/src/store.rs @@ -0,0 +1,97 @@ +use crate::CONFIG; +use crate::data::{CardEpisode, EventCard, EventStory}; +use serde::Serialize; +use serde::de::DeserializeOwned; +use std::fs; +use std::path::PathBuf; + +#[derive(Debug, Default)] +pub struct Store { + pub event_stories: Vec, + pub card_episodes: Vec, + pub event_cards: Vec, +} + +impl Store { + pub const fn new() -> Self { + Self { + event_cards: Vec::new(), + card_episodes: Vec::new(), + event_stories: Vec::new(), + } + } + + pub fn load() -> Self { + let cache_dir = CONFIG.get().unwrap().cache_dir(); + + // 确保缓存目录存在 + if !cache_dir.exists() { + let _ = fs::create_dir_all(&cache_dir); + } + + Self { + event_stories: Self::load_file(&cache_dir.join("event_stories.json")), + card_episodes: Self::load_file(&cache_dir.join("card_episodes.json")), + event_cards: Self::load_file(&cache_dir.join("event_cards.json")), + } + } + + fn load_file(path: &PathBuf) -> Vec { + fs::read_to_string(path) + .ok() + .and_then(|content| serde_json::from_str(&content).ok()) + .unwrap_or_default() + } + + fn save_file(path: &PathBuf, data: &Vec) { + if let Ok(content) = serde_json::to_string_pretty(data) { + let _ = fs::write(path, content); + } + } + + pub fn set_event_stories(&mut self, data: Vec) { + self.event_stories = data; + let path = CONFIG.get().unwrap().cache_dir().join("event_stories.json"); + Self::save_file(&path, &self.event_stories); + } + + pub fn set_card_episodes(&mut self, data: Vec) { + self.card_episodes = data; + let path = CONFIG.get().unwrap().cache_dir().join("card_episodes.json"); + Self::save_file(&path, &self.card_episodes); + } + + pub fn set_event_cards(&mut self, data: Vec) { + self.event_cards = data; + let path = CONFIG.get().unwrap().cache_dir().join("event_cards.json"); + Self::save_file(&path, &self.event_cards); + } + + pub fn save_all(&self) { + let cache_dir = CONFIG.get().unwrap().cache_dir(); + Self::save_file(&cache_dir.join("event_stories.json"), &self.event_stories); + Self::save_file(&cache_dir.join("card_episodes.json"), &self.card_episodes); + Self::save_file(&cache_dir.join("event_cards.json"), &self.event_cards); + } + + pub fn find_last_event(&self) -> Option { + self.event_stories + .iter() + .max_by_key(|s| s.event_id) + .cloned() + } + + pub fn find_cards_by_event(&self, event_id: u64) -> Vec { + self.event_cards + .iter() + .filter(|e| e.event_id == event_id) + .filter_map(|c| { + self.card_episodes + .iter() + .rev() + .find(|e| e.card_id == c.card_id) + }) + .cloned() + .collect() + } +} diff --git a/test-main/Cargo.toml b/test-main/Cargo.toml new file mode 100644 index 0000000..153c785 --- /dev/null +++ b/test-main/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "test-main" +version = "0.1.0" +edition = "2024" + +[dependencies] +entry = { path = "../entry" } + +simplelog = "0.12.2" \ No newline at end of file diff --git a/test-main/src/main.rs b/test-main/src/main.rs new file mode 100644 index 0000000..1d9272b --- /dev/null +++ b/test-main/src/main.rs @@ -0,0 +1,30 @@ +use simplelog::{ColorChoice, Config, LevelFilter, TermLogger, TerminalMode}; +use sekai_sync_lib::{boot, ghp, proxy}; + +fn main() { + let _proxy = "http://127.0.0.1:7890"; + let _cwd = "D:\\Workspace\\sekai-sync-lib\\target"; + let _name = "sekai-sync-lib"; + let _as_path = "D:\\Workspace\\AssetStudio\\AssetStudioCLI\\bin\\Release\\net9.0\\AssetStudioModCLI.exe"; + let _ghp = "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"; + // + // TermLogger::init( + // LevelFilter::Debug, + // Config::default(), + // TerminalMode::Mixed, + // ColorChoice::Auto, + // ).unwrap(); + + macro_rules! cstr { + ($v:expr) => { + std::ffi::CString::new($v).unwrap().as_ptr() + }; + } + unsafe { + proxy(cstr!(_proxy)); + ghp(cstr!(_ghp)); + boot(cstr!(_cwd), cstr!(_name), cstr!(_as_path)); + }; + + std::thread::sleep(std::time::Duration::from_hours(10)); +}