diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9fd8659..27ba818 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,7 +39,7 @@ jobs: - name: Compress build uses: vimtor/action-zip@v1 with: - files: src-tauri/target/debug/lang/ src-tauri/target/debug/keys/ src-tauri/target/debug/Cultivation.exe src-tauri/target/debug/bundle/msi/ + files: src-tauri/target/debug/lang/ src-tauri/target/debug/keys/ src-tauri/target/debug/patch/ src-tauri/target/debug/Cultivation.exe src-tauri/target/debug/bundle/msi/ recursive: true dest: Cultivation.zip @@ -74,7 +74,7 @@ jobs: - name: Compress build uses: vimtor/action-zip@v1 with: - files: src-tauri/target/debug/lang/ src-tauri/target/debug/keys/ src-tauri/target/debug/cultivation + files: src-tauri/target/debug/lang/ src-tauri/target/debug/keys/ src-tauri/target/debug/patch/ src-tauri/target/debug/cultivation recursive: true dest: Cultivation.zip diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 1dc7e64..58155eb 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -20,7 +20,7 @@ version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cipher", "cpufeatures", "opaque-debug", @@ -82,7 +82,23 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30ff05a702273012438132f449575dbc804e27b2f3cbe3069aa237d26c98fa33" dependencies = [ - "asn1-rs-derive", + "asn1-rs-derive 0.1.0", + "asn1-rs-impl", + "displaydoc", + "nom", + "num-traits 0.2.15", + "rusticata-macros", + "thiserror", + "time 0.3.11", +] + +[[package]] +name = "asn1-rs" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf6690c370453db30743b373a60ba498fc0d6d83b11f4abfd87a84a075db5dd4" +dependencies = [ + "asn1-rs-derive 0.4.0", "asn1-rs-impl", "displaydoc", "nom", @@ -104,6 +120,18 @@ dependencies = [ "synstructure", ] +[[package]] +name = "asn1-rs-derive" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "726535892e8eae7e70657b4c8ea93d26b8553afb1ce617caee529ef96d7dee6c" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + [[package]] name = "asn1-rs-impl" version = "0.1.0" @@ -281,6 +309,18 @@ dependencies = [ "memchr", ] +[[package]] +name = "bstr" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ffdb39cb703212f3c11973452c2861b972f757b021158f3516ba10f2fa8b2c1" +dependencies = [ + "memchr", + "once_cell", + "regex-automata", + "serde", +] + [[package]] name = "bumpalo" version = "3.10.0" @@ -447,12 +487,6 @@ dependencies = [ "smallvec", ] -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -592,7 +626,7 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -601,8 +635,8 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c02a4d71819009c192cf4872265391563fd6a84c81ff2c0f2a7026ca4c1d85c" dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils 0.8.10", + "cfg-if", + "crossbeam-utils", ] [[package]] @@ -611,24 +645,9 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" dependencies = [ - "cfg-if 1.0.0", - "crossbeam-epoch 0.9.9", - "crossbeam-utils 0.8.10", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" -dependencies = [ - "autocfg", - "cfg-if 0.1.10", - "crossbeam-utils 0.7.2", - "lazy_static", - "maybe-uninit", - "memoffset 0.5.6", - "scopeguard", + "cfg-if", + "crossbeam-epoch", + "crossbeam-utils", ] [[package]] @@ -638,31 +657,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07db9d94cbd326813772c968ccd25999e5f8ae22f4f8d1b11effa37ef6ce281d" dependencies = [ "autocfg", - "cfg-if 1.0.0", - "crossbeam-utils 0.8.10", - "memoffset 0.6.5", + "cfg-if", + "crossbeam-utils", + "memoffset", "once_cell", "scopeguard", ] -[[package]] -name = "crossbeam-utils" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" -dependencies = [ - "autocfg", - "cfg-if 0.1.10", - "lazy_static", -] - [[package]] name = "crossbeam-utils" version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d82ee10ce34d7bc12c2122495e7593a9c41347ecdd64185af4ecf72cb1a7f83" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", ] @@ -743,7 +751,7 @@ dependencies = [ "is_elevated", "once_cell", "open", - "rcgen", + "rcgen 0.9.3", "regex", "registry", "reqwest", @@ -757,7 +765,7 @@ dependencies = [ "tauri-build", "tokio", "tokio-rustls", - "tokio-tungstenite", + "tokio-tungstenite 0.17.2", "tracing", "unrar", "zip 0.6.2", @@ -841,7 +849,21 @@ version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe398ac75057914d7d07307bf67dc7f3f574a26783b4fc7805a20ffa9f506e82" dependencies = [ - "asn1-rs", + "asn1-rs 0.3.1", + "displaydoc", + "nom", + "num-bigint 0.4.3", + "num-traits 0.2.15", + "rusticata-macros", +] + +[[package]] +name = "der-parser" +version = "8.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42d4bc9b0db0a0df9ae64634ac5bdefb7afcb534e182275ca0beadbe486701c1" +dependencies = [ + "asn1-rs 0.5.1", "displaydoc", "nom", "num-bigint 0.4.3", @@ -864,9 +886,9 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.3" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" +checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" dependencies = [ "block-buffer", "crypto-common", @@ -879,7 +901,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "dirs-sys-next", ] @@ -975,7 +997,7 @@ version = "0.8.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -1017,7 +1039,7 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e1c54951450cbd39f3dbcf1005ac413b49487dabf18a720ad2383eccfeffb92" dependencies = [ - "memoffset 0.6.5", + "memoffset", "rustc_version 0.3.3", ] @@ -1033,7 +1055,7 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e94a7bbaa59354bc20dd75b67f23e2797b4490e9d6928203fb105c79e448c86c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "redox_syscall", "windows-sys", @@ -1310,7 +1332,7 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "wasi 0.9.0+wasi-snapshot-preview1", ] @@ -1321,7 +1343,7 @@ version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "wasi 0.11.0+wasi-snapshot-preview1", ] @@ -1414,7 +1436,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0a1e17342619edbc21a964c2afbeb6c820c6a2560032872f397bb97ea127bd0a" dependencies = [ "aho-corasick", - "bstr", + "bstr 0.2.17", "fnv", "log", "regex", @@ -1563,9 +1585,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" dependencies = [ "bytes", "fnv", @@ -1603,12 +1625,13 @@ checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" [[package]] name = "hudsucker" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b05c90565930259fbacb8f15d5e20132aa8056f3f73bc2b4aa6b7c9b4d89434" +checksum = "655326a6a1f44e52c64ee30a4fdfd86e4de893b2ed6757250391ec6c9a8f93a8" dependencies = [ "async-compression", "async-trait", + "bstr 1.3.0", "bytes", "futures", "http", @@ -1617,12 +1640,12 @@ dependencies = [ "hyper-tungstenite", "moka", "rand 0.8.5", - "rcgen", + "rcgen 0.10.0", "thiserror", "time 0.3.11", "tokio", "tokio-rustls", - "tokio-tungstenite", + "tokio-tungstenite 0.18.0", "tokio-util", "tracing", ] @@ -1681,15 +1704,15 @@ dependencies = [ [[package]] name = "hyper-tungstenite" -version = "0.6.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2e9b2a23919b72e723692a5b81330ecdd640bba2f2d0fc0089b7abf0be67bf7" +checksum = "880b8b1c98a5ec2a505c7c90db6d3f6f1f480af5655d9c5b55facc9382a5a5b5" dependencies = [ "hyper", "pin-project", "tokio", - "tokio-tungstenite", - "tungstenite", + "tokio-tungstenite 0.18.0", + "tungstenite 0.18.0", ] [[package]] @@ -1725,7 +1748,7 @@ version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "713f1b139373f96a2e0ce3ac931cd01ee973c3c5dd7c40c0c2efe96ad2b6751d" dependencies = [ - "crossbeam-utils 0.8.10", + "crossbeam-utils", "globset", "lazy_static", "log", @@ -1785,7 +1808,7 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -1959,7 +1982,7 @@ version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -1968,7 +1991,7 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff50ecb28bb86013e935fb6683ab1f6d3a20016f123c76fd4c27470076ac30f5" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "generator", "scoped-tls", "serde", @@ -2043,27 +2066,12 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" -[[package]] -name = "maybe-uninit" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" - [[package]] name = "memchr" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" -[[package]] -name = "memoffset" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa" -dependencies = [ - "autocfg", -] - [[package]] name = "memoffset" version = "0.6.5" @@ -2108,20 +2116,21 @@ dependencies = [ [[package]] name = "moka" -version = "0.8.6" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "975fa04238144061e7f8df9746b2e9cd93ef85881da5548d842a7c6a4b614415" +checksum = "2b6446f16d504e3d575df79cabb11bfbe9f24b17e9562d964a815db7b28ae3ec" dependencies = [ "async-io", "async-lock", "crossbeam-channel", - "crossbeam-epoch 0.8.2", - "crossbeam-utils 0.8.10", + "crossbeam-epoch", + "crossbeam-utils", "futures-util", "num_cpus", "once_cell", "parking_lot 0.12.1", "quanta", + "rustc_version 0.4.0", "scheduled-thread-pool", "skeptic", "smallvec", @@ -2191,7 +2200,7 @@ checksum = "e322c04a9e3440c327fca7b6c8a63e6890a32fa2ad689db972425f07e0d22abb" dependencies = [ "autocfg", "bitflags", - "cfg-if 1.0.0", + "cfg-if", "libc", ] @@ -2425,14 +2434,23 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38e20717fa0541f39bd146692035c37bedfa532b3e5071b35761082407546b2a" dependencies = [ - "asn1-rs", + "asn1-rs 0.3.1", +] + +[[package]] +name = "oid-registry" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bedf36ffb6ba96c2eb7144ef6270557b52e54b20c0a8e1eb2ff99a6c6959bff" +dependencies = [ + "asn1-rs 0.5.1", ] [[package]] name = "once_cell" -version = "1.13.0" +version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" +checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" [[package]] name = "opaque-debug" @@ -2457,7 +2475,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "618febf65336490dfcf20b73f885f5651a0c89c64c2d4a8c3662585a70bf5bd0" dependencies = [ "bitflags", - "cfg-if 1.0.0", + "cfg-if", "foreign-types", "libc", "once_cell", @@ -2594,7 +2612,7 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "instant", "libc", "redox_syscall", @@ -2608,7 +2626,7 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "redox_syscall", "smallvec", @@ -2854,7 +2872,7 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "685404d509889fade3e86fe3a5803bca2ec09b0c0778d5ada6ec8bf7a8de5259" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "log", "wepoll-ffi", @@ -2939,7 +2957,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bafd74c340a0a7e79415981ede3460df16b530fd071541901a57416eea950b17" dependencies = [ - "crossbeam-utils 0.8.10", + "crossbeam-utils", "libc", "mach", "once_cell", @@ -3105,7 +3123,7 @@ checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" dependencies = [ "crossbeam-channel", "crossbeam-deque", - "crossbeam-utils 0.8.10", + "crossbeam-utils", "num_cpus", ] @@ -3118,7 +3136,20 @@ dependencies = [ "pem", "ring", "time 0.3.11", - "x509-parser", + "x509-parser 0.13.2", + "yasna", +] + +[[package]] +name = "rcgen" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbe84efe2f38dea12e9bfc1f65377fdf03e53a18cb3b995faedf7934c7e785b" +dependencies = [ + "pem", + "ring", + "time 0.3.11", + "x509-parser 0.14.0", "yasna", ] @@ -3283,7 +3314,7 @@ version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6d5f2436026b4f6e79dc829837d467cc7e9a55ee40e750d716713540715a2df" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "ordered-multimap", ] @@ -3589,11 +3620,11 @@ dependencies = [ [[package]] name = "sha-1" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f" +checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest", ] @@ -3604,7 +3635,7 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c77f4e7f65455545c2153c1253d25056825e77ee2533f0e41deb65a93a34852f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest", ] @@ -3615,7 +3646,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55deaec60f81eefe3cce0dc50bda92d6d8e88f2a27df7c5033b42afeb1ed2676" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest", ] @@ -3848,7 +3879,7 @@ version = "0.24.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b6e19da72a8d75be4d40e4dd4686afca31507f26c3ffdf6bd3073278d9de0a0" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "core-foundation-sys", "libc", "ntapi", @@ -4128,7 +4159,7 @@ version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "fastrand", "libc", "redox_syscall", @@ -4270,13 +4301,25 @@ name = "tokio-tungstenite" version = "0.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f714dd15bead90401d77e04243611caec13726c2408afd5b31901dfcdcb3b181" +dependencies = [ + "futures-util", + "log", + "tokio", + "tungstenite 0.17.3", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54319c93411147bced34cb5609a80e0a8e44c5999c93903a81cd866630ec0bfd" dependencies = [ "futures-util", "log", "rustls", "tokio", "tokio-rustls", - "tungstenite", + "tungstenite 0.18.0", "webpki", "webpki-roots", ] @@ -4316,7 +4359,7 @@ version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "log", "pin-project-lite", "tracing-attributes", @@ -4407,11 +4450,30 @@ dependencies = [ "httparse", "log", "rand 0.8.5", - "rustls", "sha-1", "thiserror", "url", "utf-8", +] + +[[package]] +name = "tungstenite" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30ee6ab729cd4cf0fd55218530c4522ed30b7b6081752839b68fcec8d0960788" +dependencies = [ + "base64", + "byteorder", + "bytes", + "http", + "httparse", + "log", + "rand 0.8.5", + "rustls", + "sha1", + "thiserror", + "url", + "utf-8", "webpki", ] @@ -4644,7 +4706,7 @@ version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "wasm-bindgen-macro", ] @@ -4669,7 +4731,7 @@ version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de9a9cec1733468a8c657e57fa2413d2ae2c0129b95e87c5b72b8ace4d13f31f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "wasm-bindgen", "web-sys", @@ -5149,13 +5211,32 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fb9bace5b5589ffead1afb76e43e34cff39cd0f3ce7e170ae0c29e53b88eb1c" dependencies = [ - "asn1-rs", + "asn1-rs 0.3.1", "base64", "data-encoding", - "der-parser", + "der-parser 7.0.0", "lazy_static", "nom", - "oid-registry", + "oid-registry 0.4.0", + "ring", + "rusticata-macros", + "thiserror", + "time 0.3.11", +] + +[[package]] +name = "x509-parser" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0ecbeb7b67ce215e40e3cc7f2ff902f94a223acf44995934763467e7b1febc8" +dependencies = [ + "asn1-rs 0.5.1", + "base64", + "data-encoding", + "der-parser 8.1.0", + "lazy_static", + "nom", + "oid-registry 0.6.1", "ring", "rusticata-macros", "thiserror", @@ -5211,7 +5292,7 @@ dependencies = [ "bzip2", "constant_time_eq", "crc32fast", - "crossbeam-utils 0.8.10", + "crossbeam-utils", "flate2", "hmac", "pbkdf2", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 4e4793c..1b3527b 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -46,7 +46,7 @@ serde_json = "1" # Dependencies for the HTTP(S) proxy. http = "0.2" -hudsucker = "0.17.2" +hudsucker = "0.19.1" tracing = "0.1.21" tokio-rustls = "0.23.0" tokio-tungstenite = "0.17.0" diff --git a/src-tauri/patch/version.dll b/src-tauri/patch/version.dll new file mode 100644 index 0000000..9030f72 Binary files /dev/null and b/src-tauri/patch/version.dll differ diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 35d955d..ea3bd0b 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -157,7 +157,8 @@ fn enable_process_watcher(window: tauri::Window, process: String) { let mut system = System::new_all(); loop { - thread::sleep(std::time::Duration::from_secs(5)); + // Shorten loop timer to avoid user closing Cultivation before unpatching/proxy disconnecting + thread::sleep(std::time::Duration::from_secs(2)); // Refresh system info system.refresh_all(); diff --git a/src-tauri/src/proxy.rs b/src-tauri/src/proxy.rs index e844147..a327d20 100644 --- a/src-tauri/src/proxy.rs +++ b/src-tauri/src/proxy.rs @@ -12,7 +12,7 @@ use std::{path::PathBuf, str::FromStr, sync::Mutex}; use hudsucker::{ async_trait::async_trait, certificate_authority::RcgenAuthority, - hyper::{Body, Request, Response}, + hyper::{Body, Request, Response, StatusCode}, *, }; use rcgen::*; @@ -48,22 +48,33 @@ pub fn set_proxy_addr(addr: String) { impl HttpHandler for ProxyHandler { async fn handle_request( &mut self, - _context: &HttpContext, - mut request: Request, + _ctx: &HttpContext, + mut req: Request, ) -> RequestOrResponse { - let uri = request.uri().to_string(); - let uri_path_and_query = request.uri().path_and_query().unwrap().as_str(); + let uri = req.uri().to_string(); if uri.contains("hoyoverse.com") || uri.contains("mihoyo.com") || uri.contains("yuanshen.com") { - // Create new URI. - let new_uri = - Uri::from_str(format!("{}{}", SERVER.lock().unwrap(), uri_path_and_query).as_str()) - .unwrap(); - // Set request URI to the new one. - *request.uri_mut() = new_uri; + // Handle CONNECTs + if req.method().as_str() == "CONNECT" { + let builder = Response::builder() + .header("DecryptEndpoint", "Created") + .status(StatusCode::OK); + let res = builder.body(()).unwrap(); + + // Respond to CONNECT + *res.body() + } else { + let uri_path_and_query = req.uri().path_and_query().unwrap().as_str(); + // Create new URI. + let new_uri = + Uri::from_str(format!("{}{}", SERVER.lock().unwrap(), uri_path_and_query).as_str()) + .unwrap(); + // Set request URI to the new one. + *req.uri_mut() = new_uri; + } } - RequestOrResponse::Request(request) + req.into() } async fn handle_response( @@ -73,6 +84,10 @@ impl HttpHandler for ProxyHandler { ) -> Response { response } + + async fn should_intercept(&mut self, _ctx: &HttpContext, _req: &Request) -> bool { + true + } } /** diff --git a/src-tauri/src/web.rs b/src-tauri/src/web.rs index 29193ee..35ed83d 100644 --- a/src-tauri/src/web.rs +++ b/src-tauri/src/web.rs @@ -9,8 +9,13 @@ pub(crate) async fn query(site: &str) -> String { .header(CONTENT_TYPE, "application/json") .send() .await - .unwrap(); - response.text().await.unwrap() + .ok(); + + if response.is_some() { + return response.unwrap().text().await.unwrap(); + } else { + false.to_string() + } } #[tauri::command] @@ -23,9 +28,13 @@ pub(crate) async fn valid_url(url: String) -> bool { .header(USER_AGENT, "cultivation") .send() .await - .unwrap(); + .ok(); - response.status().as_str() == "200" + if response.is_some() { + return response.unwrap().status().as_str() == "200"; + } else { + false + } } #[tauri::command] diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index e4e2374..7cd6d0f 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -40,7 +40,7 @@ "providerShortName": null, "signingIdentity": null }, - "resources": ["lang/*.json", "keys/*"], + "resources": ["lang/*.json", "keys/*", "patch/*"], "targets": "all", "windows": { "allowDowngrades": false, diff --git a/src/utils/rsa.ts b/src/utils/rsa.ts index 475a014..84c3d68 100644 --- a/src/utils/rsa.ts +++ b/src/utils/rsa.ts @@ -71,45 +71,19 @@ export async function getBackupRSAPath() { } export async function downloadRSA() { - const rsaLink = 'https://github.com/34736384/RSAPatch/releases/download/v1.1.0/RSAPatch.dll' + // Patch file from: https://github.com/34736384/RSAPatch/ // Should make sure rsa path exists await invoke('dir_create', { path: await getBackupRSAPath(), }) - // Download the file - downloadHandler.addDownload(rsaLink, (await getBackupRSAPath()) + '\\version.dll', () => { - null - }) - let errored = false - - listen('download_error', ({ payload }) => { - // @ts-expect-error shut up typescript - const errorData: { - path: string - error: string - } = payload - - errored = true + // Copy patch from local for offline compatibility + await invoke('copy_file_with_new_name', { + path: (await invoke('install_location')) + '\\patch\\version.dll', + newPath: await getBackupRSAPath(), + newName: 'version.dll', }) - // There is 100% a better way to do this but I don't use ts enough to know - let downloadComplete = false - while (!downloadComplete) { - // Waits until download completes before continuing - if ( - (await invoke('dir_exists', { - path: (await getBackupRSAPath()) + '\\version.dll', - })) || - errored - ) { - downloadComplete = true - } - } - - if (errored) { - return false - } return true }