From b9a5b78472a3faf56bda38d35e7bf270bdcefad1 Mon Sep 17 00:00:00 2001 From: worksoup <2055038075@qq.com> Date: Mon, 25 Mar 2024 16:25:10 +0800 Subject: [PATCH 01/17] update deps. --- Cargo.lock | 573 +++++++++++++++++++++++++++++++++++++++++++---------- Cargo.toml | 2 +- 2 files changed, 469 insertions(+), 106 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e183f16..0d47aee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,16 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "ab_glyph" +version = "0.2.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80179d7dd5d7e8c285d67c4a1e652972a92de7475beddfb92028c76463b13225" +dependencies = [ + "ab_glyph_rasterizer", + "owned_ttf_parser", +] + [[package]] name = "ab_glyph_rasterizer" version = "0.1.8" @@ -32,6 +42,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "aligned-vec" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4aa90d7ce82d4be67b64039a3d588d38dbcc6736577de4a847025ce5b0c468d1" + [[package]] name = "android-tzdata" version = "0.1.1" @@ -95,6 +111,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "anyhow" +version = "1.0.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" + [[package]] name = "approx" version = "0.5.1" @@ -104,6 +126,29 @@ dependencies = [ "num-traits", ] +[[package]] +name = "arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" + +[[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.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + [[package]] name = "async-compression" version = "0.4.6" @@ -123,6 +168,29 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "av1-grain" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6678909d8c5d46a42abcf571271e15fdbc0a225e3646cf23762cd415046c78bf" +dependencies = [ + "anyhow", + "arrayvec", + "log", + "nom", + "num-rational", + "v_frame", +] + +[[package]] +name = "avif-serialize" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "876c75a42f6364451a033496a14c44bffe41f5f4a8236f697391f11024e596d2" +dependencies = [ + "arrayvec", +] + [[package]] name = "backtrace" version = "0.3.71" @@ -183,6 +251,18 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +[[package]] +name = "bitstream-io" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06c9989a51171e2e81038ab168b6ae22886fe9ded214430dbb4f41c28cf176da" + +[[package]] +name = "built" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d17f4d6e4dc36d1a02fbedc2753a096848e7c1b0772f7654eab8e2c927dd53" + [[package]] name = "bumpalo" version = "3.15.4" @@ -212,6 +292,20 @@ name = "cc" version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5" +dependencies = [ + "jobserver", + "libc", +] + +[[package]] +name = "cfg-expr" +version = "0.15.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa50868b64a9a6fda9d593ce778849ea8715cd2a3d2cc17ffdb4a2f2f2f1961d" +dependencies = [ + "smallvec", + "target-lexicon", +] [[package]] name = "cfg-if" @@ -521,7 +615,7 @@ dependencies = [ "lazy_static", "num_enum", "percent-encoding", - "rand 0.8.5", + "rand", "reqwest", "reqwest_cookie_store", "rxing", @@ -921,17 +1015,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - [[package]] name = "getrandom" version = "0.2.12" @@ -939,8 +1022,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", + "js-sys", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", + "wasm-bindgen", ] [[package]] @@ -1125,7 +1210,7 @@ dependencies = [ "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows-core", + "windows-core 0.52.0", ] [[package]] @@ -1159,40 +1244,62 @@ dependencies = [ [[package]] name = "image" -version = "0.24.9" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5690139d2f55868e080017335e4b94cb7414274c74f1669c84fb5feba2c9f69d" +checksum = "a9b4f005360d32e9325029b38ba47ebd7a56f3316df09249368939562d518645" dependencies = [ "bytemuck", "byteorder", "color_quant", "exr", "gif", - "jpeg-decoder", + "image-webp", "num-traits", "png", "qoi", + "ravif", + "rayon", + "rgb", "tiff", + "zune-core", + "zune-jpeg", +] + +[[package]] +name = "image-webp" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a84a25dcae3ac487bc24ef280f9e20c79c9b1a3e5e32cbed3041d1c514aa87c" +dependencies = [ + "byteorder", + "thiserror", ] [[package]] name = "imageproc" -version = "0.23.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aee993351d466301a29655d628bfc6f5a35a0d062b6160ca0808f425805fd7" +checksum = "a2a0d7770f428b4615960cc8602775d1f04c75d41b0ccdef862e889ebaae9bbf" dependencies = [ + "ab_glyph", "approx", "conv", + "getrandom", "image", "itertools", "nalgebra", "num", - "rand 0.7.3", + "rand", "rand_distr", "rayon", - "rusttype", ] +[[package]] +name = "imgref" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44feda355f4159a7c757171a77de25daf6411e217b4cabd03bd6650690468126" + [[package]] name = "indexmap" version = "2.2.6" @@ -1214,9 +1321,9 @@ dependencies = [ [[package]] name = "inquire" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fca231a35040487041f975afae9272ecd3701cc95a5efbbda36c6ecc22a269c" +checksum = "fe95f33091b9b7b517a5849bce4dce1b550b430fc20d58059fcaa319ed895d8b" dependencies = [ "bitflags 2.5.0", "crossterm", @@ -1229,6 +1336,17 @@ dependencies = [ "unicode-width", ] +[[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.9.0" @@ -1237,9 +1355,9 @@ checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "itertools" -version = "0.10.5" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" dependencies = [ "either", ] @@ -1250,14 +1368,20 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +[[package]] +name = "jobserver" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6" +dependencies = [ + "libc", +] + [[package]] name = "jpeg-decoder" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0" -dependencies = [ - "rayon", -] [[package]] name = "js-sys" @@ -1296,6 +1420,23 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "libfuzzer-sys" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a96cfd5557eb82f2b83fed4955246c988d331975a002961b07c81584d107e7f7" +dependencies = [ + "arbitrary", + "cc", + "once_cell", +] + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + [[package]] name = "libredox" version = "0.0.1" @@ -1329,6 +1470,15 @@ version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +[[package]] +name = "loop9" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fae87c125b03c1d2c0150c90365d7d6bcc53fb73a9acaef207d2d065860f062" +dependencies = [ + "imgref", +] + [[package]] name = "matrixmultiply" version = "0.3.8" @@ -1339,6 +1489,16 @@ dependencies = [ "rawpointer", ] +[[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.7.1" @@ -1361,6 +1521,12 @@ dependencies = [ "unicase", ] +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "miniz_oxide" version = "0.7.2" @@ -1379,7 +1545,7 @@ checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", "log", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", "windows-sys 0.48.0", ] @@ -1394,9 +1560,9 @@ dependencies = [ [[package]] name = "nalgebra" -version = "0.30.1" +version = "0.32.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb2d0de08694bed883320212c18ee3008576bfe8c306f4c3c4a58b4876998be" +checksum = "4541eb06dce09c0241ebbaab7102f0a01a0c8994afed2e5d0d66775016e25ac2" dependencies = [ "approx", "matrixmultiply", @@ -1425,6 +1591,12 @@ dependencies = [ "tempfile", ] +[[package]] +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + [[package]] name = "newline-converter" version = "0.3.0" @@ -1434,6 +1606,22 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "noop_proc_macro" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8" + [[package]] name = "ntapi" version = "0.4.1" @@ -1483,6 +1671,17 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" +[[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" @@ -1522,6 +1721,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ "autocfg", + "libm", ] [[package]] @@ -1622,9 +1822,9 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] name = "owned_ttf_parser" -version = "0.15.2" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05e6affeb1632d6ff6a23d2cd40ffed138e82f1532571a26f527c8a284bb2fbb" +checksum = "d4586edfe4c648c71797a74c84bacb32b52b212eff5dfe2bb9f2c599844023e7" dependencies = [ "ttf-parser", ] @@ -1699,7 +1899,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" dependencies = [ "phf_shared", - "rand 0.8.5", + "rand", ] [[package]] @@ -1780,7 +1980,7 @@ version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" dependencies = [ - "toml_edit", + "toml_edit 0.21.1", ] [[package]] @@ -1792,6 +1992,25 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "profiling" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d84d1d7a6ac92673717f9f6d1518374ef257669c24ebc5ac25d5033828be58" +dependencies = [ + "profiling-procmacros", +] + +[[package]] +name = "profiling-procmacros" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8021cf59c8ec9c432cfc2526ac6b8aa508ecaf29cd415f271b8406c1b851c3fd" +dependencies = [ + "quote", + "syn", +] + [[package]] name = "psl-types" version = "2.0.11" @@ -1817,6 +2036,12 @@ dependencies = [ "bytemuck", ] +[[package]] +name = "quick-error" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" + [[package]] name = "quick-xml" version = "0.30.0" @@ -1835,19 +2060,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc", -] - [[package]] name = "rand" version = "0.8.5" @@ -1855,18 +2067,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", + "rand_chacha", + "rand_core", ] [[package]] @@ -1876,43 +2078,76 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core 0.6.4", + "rand_core", ] [[package]] name = "rand_core" -version = "0.5.1" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.1.16", + "getrandom", ] [[package]] -name = "rand_core" -version = "0.6.4" +name = "rand_distr" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31" dependencies = [ - "getrandom 0.2.12", + "num-traits", + "rand", ] [[package]] -name = "rand_distr" -version = "0.2.2" +name = "rav1e" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96977acbdd3a6576fb1d27391900035bf3863d4a16422973a409b488cf29ffb2" +checksum = "cd87ce80a7665b1cce111f8a16c1f3929f6547ce91ade6addf4ec86a8dda5ce9" dependencies = [ - "rand 0.7.3", + "arbitrary", + "arg_enum_proc_macro", + "arrayvec", + "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", + "once_cell", + "paste", + "profiling", + "rand", + "rand_chacha", + "simd_helpers", + "system-deps", + "thiserror", + "v_frame", + "wasm-bindgen", ] [[package]] -name = "rand_hc" -version = "0.2.0" +name = "ravif" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +checksum = "bc13288f5ab39e6d7c9d501759712e6969fcc9734220846fc9ed26cae2cc4234" dependencies = [ - "rand_core 0.5.1", + "avif-serialize", + "imgref", + "loop9", + "quick-error", + "rav1e", + "rayon", + "rgb", ] [[package]] @@ -1956,7 +2191,7 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" dependencies = [ - "getrandom 0.2.12", + "getrandom", "libredox", "thiserror", ] @@ -2049,6 +2284,15 @@ dependencies = [ "url", ] +[[package]] +name = "rgb" +version = "0.8.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05aaa8004b64fd573fc9d002f4e632d51ad4f026c2b5ba95fcb6c2f32c2c47d8" +dependencies = [ + "bytemuck", +] + [[package]] name = "rustc-demangle" version = "0.1.23" @@ -2077,21 +2321,11 @@ dependencies = [ "base64", ] -[[package]] -name = "rusttype" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ff8374aa04134254b7995b63ad3dc41c7f7236f69528b28553da7d72efaa967" -dependencies = [ - "ab_glyph_rasterizer", - "owned_ttf_parser", -] - [[package]] name = "rxing" -version = "0.5.8" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe411033c47315e5b98d9e376e98b417bb0657b696268cbbd74fd938aac568c1" +checksum = "eb93252fce512341b53c6d3735a5c05a6dc4dbfdd78c4b90aaee4c41fa83e5e7" dependencies = [ "bit_reverse", "chrono", @@ -2206,6 +2440,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_spanned" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" +dependencies = [ + "serde", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -2250,9 +2493,9 @@ dependencies = [ [[package]] name = "simba" -version = "0.7.3" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f3fd720c48c53cace224ae62bef1bbff363a70c68c4802a78b5cc6159618176" +checksum = "061507c94fc6ab4ba1c9a0305018408e312e17c041eb63bef8aa726fa33aceae" dependencies = [ "approx", "num-complex", @@ -2267,6 +2510,15 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" +[[package]] +name = "simd_helpers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95890f873bec569a0362c235787f3aca6e1e887302ba4840839bcc6459c42da6" +dependencies = [ + "quote", +] + [[package]] name = "siphasher" version = "0.3.11" @@ -2372,7 +2624,7 @@ dependencies = [ "ntapi", "once_cell", "rayon", - "windows", + "windows 0.52.0", ] [[package]] @@ -2396,6 +2648,25 @@ dependencies = [ "libc", ] +[[package]] +name = "system-deps" +version = "6.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349" +dependencies = [ + "cfg-expr", + "heck", + "pkg-config", + "toml", + "version-compare", +] + +[[package]] +name = "target-lexicon" +version = "0.12.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" + [[package]] name = "tempfile" version = "3.10.1" @@ -2560,11 +2831,26 @@ dependencies = [ "tracing", ] +[[package]] +name = "toml" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit 0.22.9", +] + [[package]] name = "toml_datetime" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +dependencies = [ + "serde", +] [[package]] name = "toml_edit" @@ -2574,7 +2860,20 @@ checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ "indexmap", "toml_datetime", - "winnow", + "winnow 0.5.40", +] + +[[package]] +name = "toml_edit" +version = "0.22.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e40bb779c5187258fd7aad0eb68cb8706a0a81fa712fbea808ab43c4b8374c4" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow 0.6.5", ] [[package]] @@ -2633,9 +2932,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "ttf-parser" -version = "0.15.2" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b3e06c9b9d80ed6b745c7159c40b311ad2916abb34a49e9be2653b90db0d8dd" +checksum = "17f77d76d837a7830fe1d4f12b7b4ba4192c1888001c7164257e4bc6d21d96b4" [[package]] name = "typenum" @@ -2718,12 +3017,29 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +[[package]] +name = "v_frame" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f32aaa24bacd11e488aa9ba66369c7cd514885742c9fe08cfe85884db3e92b" +dependencies = [ + "aligned-vec", + "num-traits", + "wasm-bindgen", +] + [[package]] name = "vcpkg" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" +[[package]] +name = "version-compare" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" + [[package]] name = "version_check" version = "0.9.4" @@ -2739,12 +3055,6 @@ dependencies = [ "try-lock", ] -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -2871,7 +3181,17 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" dependencies = [ - "windows-core", + "windows-core 0.52.0", + "windows-targets 0.52.4", +] + +[[package]] +name = "windows" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9252e5725dbed82865af151df558e754e4a3c2c30818359eb17465f1346a1b49" +dependencies = [ + "windows-core 0.54.0", "windows-targets 0.52.4", ] @@ -2884,6 +3204,25 @@ dependencies = [ "windows-targets 0.52.4", ] +[[package]] +name = "windows-core" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12661b9c89351d684a50a8a643ce5f608e20243b9fb84687800163429f161d65" +dependencies = [ + "windows-result", + "windows-targets 0.52.4", +] + +[[package]] +name = "windows-result" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd19df78e5168dfb0aedc343d1d1b8d422ab2db6756d2dc3fef75035402a3f64" +dependencies = [ + "windows-targets 0.52.4", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -3025,6 +3364,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "winnow" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dffa400e67ed5a4dd237983829e66475f0a4a26938c4b04c21baede6262215b8" +dependencies = [ + "memchr", +] + [[package]] name = "winreg" version = "0.50.0" @@ -3037,9 +3385,9 @@ dependencies = [ [[package]] name = "xcap" -version = "0.0.4" +version = "0.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6776c1b371ea7c73bc98a40ae5c6a69c648669ff2e6d8a03fc8b80ddc58a0498" +checksum = "696a57ff11f3b9553881d5d5dc69424e376e87e01cd389ce14e1d0e34cbaa53c" dependencies = [ "core-foundation", "core-graphics", @@ -3049,7 +3397,7 @@ dependencies = [ "percent-encoding", "sysinfo", "thiserror", - "windows", + "windows 0.54.0", "xcb", ] @@ -3064,6 +3412,12 @@ dependencies = [ "quick-xml", ] +[[package]] +name = "zune-core" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f423a2c17029964870cfaabb1f13dfab7d092a62a29a89264f4d36990ca414a" + [[package]] name = "zune-inflate" version = "0.2.54" @@ -3072,3 +3426,12 @@ checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02" dependencies = [ "simd-adler32", ] + +[[package]] +name = "zune-jpeg" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec866b44a2a1fd6133d363f073ca1b179f438f99e7e5bfb1e33f7181facfe448" +dependencies = [ + "zune-core", +] diff --git a/Cargo.toml b/Cargo.toml index e8fb701..31a0b8f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,7 @@ reqwest_cookie_store = "0.7" rxing = "0.5" # screenshots = "0.8" # display-info = "0.5" -xcap = "0.0.4" +xcap = "0.0.5" serde = "1.0" serde_json = "1.0" serde_derive = "1.0" From 665f8394483e827291117afff1944c808f0158af Mon Sep 17 00:00:00 2001 From: worksoup <2055038075@qq.com> Date: Mon, 25 Mar 2024 16:35:09 +0800 Subject: [PATCH 02/17] temp --- Cargo.lock | 210 ++++++++++++++++++++++++++++++++++++++++++++++++++-- Cargo.toml | 6 ++ src/main.rs | 8 +- 3 files changed, 214 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0d47aee..971565b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -440,13 +440,24 @@ dependencies = [ "version_check", ] +[[package]] +name = "cookie" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cd91cf61412820176e137621345ee43b3f4423e589e7ae4e50d601d93e35ef8" +dependencies = [ + "percent-encoding", + "time", + "version_check", +] + [[package]] name = "cookie_store" version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "387461abbc748185c3a6e1673d826918b450b87ff22639429c694619a83b6cf6" dependencies = [ - "cookie", + "cookie 0.17.0", "idna 0.3.0", "log", "publicsuffix", @@ -457,6 +468,24 @@ dependencies = [ "url", ] +[[package]] +name = "cookie_store" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4934e6b7e8419148b6ef56950d277af8561060b56afd59e2aadf98b59fce6baa" +dependencies = [ + "cookie 0.18.0", + "idna 0.5.0", + "indexmap", + "log", + "publicsuffix", + "serde", + "serde_derive", + "serde_json", + "time", + "url", +] + [[package]] name = "core-foundation" version = "0.9.4" @@ -605,8 +634,9 @@ version = "0.1.2" dependencies = [ "chrono", "clap", - "cookie_store", + "cookie_store 0.20.0", "des", + "dir", "directories", "futures", "hex", @@ -623,9 +653,14 @@ dependencies = [ "serde_derive", "serde_json", "sqlite", + "store", "tokio", "tokio-stream", + "toml", "unicode-width", + "ureq", + "user", + "utils", "xcap", ] @@ -658,6 +693,15 @@ dependencies = [ "cipher", ] +[[package]] +name = "dir" +version = "0.1.1" +source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#7e90c2fbc439f4c1a708433f1f50fe3168ec2aa3" +dependencies = [ + "directories", + "lazy_static", +] + [[package]] name = "directories" version = "5.0.1" @@ -780,6 +824,15 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "error" +version = "0.1.1" +source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#7e90c2fbc439f4c1a708433f1f50fe3168ec2aa3" +dependencies = [ + "thiserror", + "ureq", +] + [[package]] name = "exr" version = "1.72.0" @@ -1470,6 +1523,22 @@ version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +[[package]] +name = "login" +version = "0.1.1" +source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#7e90c2fbc439f4c1a708433f1f50fe3168ec2aa3" +dependencies = [ + "cookie_store 0.21.0", + "des", + "dir", + "error", + "hex", + "log", + "serde", + "serde_json", + "ureq", +] + [[package]] name = "loop9" version = "0.1.5" @@ -2234,8 +2303,8 @@ dependencies = [ "async-compression", "base64", "bytes", - "cookie", - "cookie_store", + "cookie 0.17.0", + "cookie_store 0.20.0", "encoding_rs", "futures-core", "futures-util", @@ -2279,7 +2348,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93ea5c6f30c19d766efe8d823c88f9abd1c56516648a0d4264ab2dc04cc19472" dependencies = [ "bytes", - "cookie_store", + "cookie_store 0.20.0", "reqwest", "url", ] @@ -2293,6 +2362,21 @@ dependencies = [ "bytemuck", ] +[[package]] +name = "ring" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +dependencies = [ + "cc", + "cfg-if", + "getrandom", + "libc", + "spin", + "untrusted", + "windows-sys 0.52.0", +] + [[package]] name = "rustc-demangle" version = "0.1.23" @@ -2312,6 +2396,20 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rustls" +version = "0.22.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e87c9956bd9807afa1f77e0f7594af32566e830e088a5576d27c5b6f30f49d41" +dependencies = [ + "log", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + [[package]] name = "rustls-pemfile" version = "1.0.4" @@ -2321,6 +2419,23 @@ dependencies = [ "base64", ] +[[package]] +name = "rustls-pki-types" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "868e20fada228fefaf6b652e00cc73623d54f8171e7352c18bb281571f2d92da" + +[[package]] +name = "rustls-webpki" +version = "0.102.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faaa0a62740bedb9b2ef5afa303da42764c012f743917351dc9a237ea1663610" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + [[package]] name = "rxing" version = "0.5.9" @@ -2589,12 +2704,29 @@ dependencies = [ "sqlite3-src", ] +[[package]] +name = "store" +version = "0.1.1" +source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#7e90c2fbc439f4c1a708433f1f50fe3168ec2aa3" +dependencies = [ + "dir", + "log", + "sqlite", + "user", +] + [[package]] name = "strsim" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + [[package]] name = "syn" version = "2.0.55" @@ -2984,6 +3116,33 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "ureq" +version = "2.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11f214ce18d8b2cbe84ed3aa6486ed3f5b285cf8d8fbdbce9f3f767a724adc35" +dependencies = [ + "base64", + "cookie 0.18.0", + "cookie_store 0.21.0", + "flate2", + "log", + "once_cell", + "rustls", + "rustls-pki-types", + "rustls-webpki", + "serde", + "serde_json", + "url", + "webpki-roots", +] + [[package]] name = "uriparse" version = "0.6.4" @@ -3011,12 +3170,38 @@ version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" +[[package]] +name = "user" +version = "0.1.1" +source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#7e90c2fbc439f4c1a708433f1f50fe3168ec2aa3" +dependencies = [ + "cookie_store 0.21.0", + "dir", + "error", + "log", + "login", + "serde", + "serde_json", + "ureq", +] + [[package]] name = "utf8parse" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +[[package]] +name = "utils" +version = "0.1.1" +source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#7e90c2fbc439f4c1a708433f1f50fe3168ec2aa3" +dependencies = [ + "chrono", + "inquire", + "log", + "unicode-width", +] + [[package]] name = "v_frame" version = "0.3.8" @@ -3137,6 +3322,15 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webpki-roots" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3de34ae270483955a94f4b21bdaaeb83d508bb84a01435f393818edb0012009" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "weezl" version = "0.1.8" @@ -3412,6 +3606,12 @@ dependencies = [ "quick-xml", ] +[[package]] +name = "zeroize" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" + [[package]] name = "zune-core" version = "0.4.12" diff --git a/Cargo.toml b/Cargo.toml index 31a0b8f..b5ecd4a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,7 @@ chrono = "0.4" clap = { version = "4.5", features = ["derive"] } cookie_store = "0.20" des = "0.8" +dir = { git = "https://github.com/worksoup/cxsign.git", branch = "newsign" } directories = "5.0" futures = "0.3" hex-literal = "0.4" @@ -34,10 +35,15 @@ xcap = "0.0.5" serde = "1.0" serde_json = "1.0" serde_derive = "1.0" +store = { git = "https://github.com/worksoup/cxsign.git", branch = "newsign" } sqlite = "0.34" tokio = { version = "1.35", features = ["full"] } +toml = "0.8" tokio-stream = "0.1" unicode-width = "0.1" +ureq = { version = "2.9", features = ["cookies", "json"] } +user = { git = "https://github.com/worksoup/cxsign.git", branch = "newsign" } +utils = { git = "https://github.com/worksoup/cxsign.git", branch = "newsign" } num_enum = "0.7" # url = "2.4" # strfmt = "*" diff --git a/src/main.rs b/src/main.rs index ca28054..b58a385 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,18 +5,16 @@ #![feature(map_try_insert)] #![feature(let_chains)] -mod activity; mod cli; -mod session; -mod utils; mod protocol; +mod session; use cli::{ arg::{AccCmds, Args, MainCmds}, location::Struct位置操作使用的信息, }; -use utils::{sql::DataBase, 配置文件夹}; - +use dir::DIR; +use store::sql::DataBase; #[tokio::main] async fn main() { let args = ::parse(); From 0e782df4d38c044fadbe68c0d6038dd6ad67b2b2 Mon Sep 17 00:00:00 2001 From: worksoup <2055038075@qq.com> Date: Mon, 25 Mar 2024 19:22:59 +0800 Subject: [PATCH 03/17] temp --- Cargo.lock | 682 ++++++++++++++++++++++++++++---- Cargo.toml | 3 + src/main.rs | 46 ++- src/tools/account.rs | 59 +++ src/{utils => tools}/address.rs | 0 src/{utils => tools}/mod.rs | 2 +- src/{utils => tools}/photo.rs | 0 src/{utils => tools}/sign.rs | 12 +- src/{utils => tools}/sql.rs | 0 src/utils/account.rs | 61 --- 10 files changed, 708 insertions(+), 157 deletions(-) create mode 100644 src/tools/account.rs rename src/{utils => tools}/address.rs (100%) rename src/{utils => tools}/mod.rs (98%) rename src/{utils => tools}/photo.rs (100%) rename src/{utils => tools}/sign.rs (94%) rename src/{utils => tools}/sql.rs (100%) delete mode 100644 src/utils/account.rs diff --git a/Cargo.lock b/Cargo.lock index 971565b..19de7ca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -18,6 +18,22 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046" +[[package]] +name = "activity" +version = "0.1.1" +source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#7e90c2fbc439f4c1a708433f1f50fe3168ec2aa3" +dependencies = [ + "chrono", + "log 0.4.21", + "num_enum", + "percent-encoding 2.3.1", + "serde", + "types", + "ureq", + "user", + "utils", +] + [[package]] name = "addr2line" version = "0.21.0" @@ -149,6 +165,12 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +[[package]] +name = "ascii" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97be891acc47ca214468e09425d02cef3af2c94d0d82081cd02061f996802f14" + [[package]] name = "async-compression" version = "0.4.6" @@ -162,6 +184,15 @@ dependencies = [ "tokio", ] +[[package]] +name = "autocfg" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78" +dependencies = [ + "autocfg 1.1.0", +] + [[package]] name = "autocfg" version = "1.1.0" @@ -176,7 +207,7 @@ checksum = "6678909d8c5d46a42abcf571271e15fdbc0a225e3646cf23762cd415046c78bf" dependencies = [ "anyhow", "arrayvec", - "log", + "log 0.4.21", "nom", "num-rational", "v_frame", @@ -206,6 +237,16 @@ dependencies = [ "rustc-demangle", ] +[[package]] +name = "base64" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" +dependencies = [ + "byteorder", + "safemem", +] + [[package]] name = "base64" version = "0.21.7" @@ -257,6 +298,16 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06c9989a51171e2e81038ab168b6ae22886fe9ded214430dbb4f41c28cf176da" +[[package]] +name = "buf_redux" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b953a6887648bb07a535631f2bc00fbdb2a2216f135552cb3f534ed136b9c07f" +dependencies = [ + "memchr", + "safemem", +] + [[package]] name = "built" version = "0.7.1" @@ -335,7 +386,7 @@ checksum = "d59ae0466b83e838b81a54256c39d5d7c20b9d7daa10510a242d9b75abd5936e" dependencies = [ "chrono", "chrono-tz-build", - "phf", + "phf 0.11.2", ] [[package]] @@ -345,10 +396,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "433e39f13c9a060046954e0592a8d0a4bcb1040125cbf91cb8ee58964cfb350f" dependencies = [ "parse-zoneinfo", - "phf", - "phf_codegen", + "phf 0.11.2", + "phf_codegen 0.11.2", ] +[[package]] +name = "chunked_transfer" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "498d20a7aaf62625b9bf26e637cf7736417cde1d0c99f1d04d1170229a85cf87" + [[package]] name = "cipher" version = "0.4.4" @@ -399,6 +456,15 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" +[[package]] +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "codepage-437" version = "0.1.0" @@ -435,9 +501,9 @@ version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7efb37c3e1ccb1ff97164ad95ac1606e8ccd35b3fa0a7d99a304c7f4a428cc24" dependencies = [ - "percent-encoding", - "time", - "version_check", + "percent-encoding 2.3.1", + "time 0.3.34", + "version_check 0.9.4", ] [[package]] @@ -446,9 +512,9 @@ version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3cd91cf61412820176e137621345ee43b3f4423e589e7ae4e50d601d93e35ef8" dependencies = [ - "percent-encoding", - "time", - "version_check", + "percent-encoding 2.3.1", + "time 0.3.34", + "version_check 0.9.4", ] [[package]] @@ -459,13 +525,13 @@ checksum = "387461abbc748185c3a6e1673d826918b450b87ff22639429c694619a83b6cf6" dependencies = [ "cookie 0.17.0", "idna 0.3.0", - "log", + "log 0.4.21", "publicsuffix", "serde", "serde_derive", "serde_json", - "time", - "url", + "time 0.3.34", + "url 2.5.0", ] [[package]] @@ -477,13 +543,13 @@ dependencies = [ "cookie 0.18.0", "idna 0.5.0", "indexmap", - "log", + "log 0.4.21", "publicsuffix", "serde", "serde_derive", "serde_json", - "time", - "url", + "time 0.3.34", + "url 2.5.0", ] [[package]] @@ -632,6 +698,7 @@ checksum = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" name = "cxsign" version = "0.1.2" dependencies = [ + "activity", "chrono", "clap", "cookie_store 0.20.0", @@ -643,9 +710,10 @@ dependencies = [ "hex-literal", "inquire", "lazy_static", + "login", "num_enum", - "percent-encoding", - "rand", + "percent-encoding 2.3.1", + "rand 0.8.5", "reqwest", "reqwest_cookie_store", "rxing", @@ -657,6 +725,7 @@ dependencies = [ "tokio", "tokio-stream", "toml", + "types", "unicode-width", "ureq", "user", @@ -948,9 +1017,15 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ - "percent-encoding", + "percent-encoding 2.3.1", ] +[[package]] +name = "fuchsia-cprng" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" + [[package]] name = "futures" version = "0.3.30" @@ -1065,7 +1140,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", - "version_check", + "version_check 0.9.4", ] [[package]] @@ -1077,7 +1152,7 @@ dependencies = [ "cfg-if", "js-sys", "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", "wasm-bindgen", ] @@ -1097,6 +1172,12 @@ version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +[[package]] +name = "groupable" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32619942b8be646939eaf3db0602b39f5229b74575b67efc897811ded1db4e57" + [[package]] name = "h2" version = "0.4.3" @@ -1196,6 +1277,25 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +[[package]] +name = "hyper" +version = "0.10.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a0652d9a2609a968c14be1a9ea00bf4b1d64e2e1f53a1b51b6fff3a6e829273" +dependencies = [ + "base64 0.9.3", + "httparse", + "language-tags", + "log 0.3.9", + "mime 0.2.6", + "num_cpus", + "time 0.1.45", + "traitobject", + "typeable", + "unicase 1.4.2", + "url 1.7.2", +] + [[package]] name = "hyper" version = "1.2.0" @@ -1224,7 +1324,7 @@ checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", "http-body-util", - "hyper", + "hyper 1.2.0", "hyper-util", "native-tls", "tokio", @@ -1243,7 +1343,7 @@ dependencies = [ "futures-util", "http", "http-body", - "hyper", + "hyper 1.2.0", "pin-project-lite", "socket2", "tokio", @@ -1275,6 +1375,17 @@ dependencies = [ "cc", ] +[[package]] +name = "idna" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "idna" version = "0.3.0" @@ -1342,7 +1453,7 @@ dependencies = [ "itertools", "nalgebra", "num", - "rand", + "rand 0.8.5", "rand_distr", "rayon", ] @@ -1406,6 +1517,22 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +[[package]] +name = "iron" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6d308ca2d884650a8bf9ed2ff4cb13fbb2207b71f64cda11dc9b892067295e8" +dependencies = [ + "hyper 0.10.16", + "log 0.3.9", + "mime_guess 1.8.8", + "modifier", + "num_cpus", + "plugin", + "typemap", + "url 1.7.2", +] + [[package]] name = "itertools" version = "0.12.1" @@ -1445,6 +1572,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "language-tags" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" + [[package]] name = "lazy_static" version = "1.4.0" @@ -1513,10 +1646,19 @@ version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ - "autocfg", + "autocfg 1.1.0", "scopeguard", ] +[[package]] +name = "log" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" +dependencies = [ + "log 0.4.21", +] + [[package]] name = "log" version = "0.4.21" @@ -1533,7 +1675,7 @@ dependencies = [ "dir", "error", "hex", - "log", + "log 0.4.21", "serde", "serde_json", "ureq", @@ -1548,13 +1690,19 @@ dependencies = [ "imgref", ] +[[package]] +name = "matches" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" + [[package]] name = "matrixmultiply" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7574c1cf36da4798ab73da5b215bbf444f50718207754cb522201d78d1cd0ff2" dependencies = [ - "autocfg", + "autocfg 1.1.0", "rawpointer", ] @@ -1574,20 +1722,41 @@ version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +[[package]] +name = "mime" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0" +dependencies = [ + "log 0.3.9", +] + [[package]] name = "mime" version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "mime_guess" +version = "1.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "216929a5ee4dd316b1702eedf5e74548c123d370f47841ceaac38ca154690ca3" +dependencies = [ + "mime 0.2.6", + "phf 0.7.24", + "phf_codegen 0.7.24", + "unicase 1.4.2", +] + [[package]] name = "mime_guess" version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" dependencies = [ - "mime", - "unicase", + "mime 0.3.17", + "unicase 2.7.0", ] [[package]] @@ -1613,11 +1782,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", - "log", - "wasi", + "log 0.4.21", + "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys 0.48.0", ] +[[package]] +name = "modifier" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41f5c9112cb662acd3b204077e0de5bc66305fa8df65c8019d5adb10e9ab6e58" + [[package]] name = "multimap" version = "0.10.0" @@ -1627,6 +1802,38 @@ dependencies = [ "serde", ] +[[package]] +name = "multipart" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00dec633863867f29cb39df64a397cdf4a6354708ddd7759f70c7fb51c5f9182" +dependencies = [ + "buf_redux", + "httparse", + "hyper 0.10.16", + "iron", + "log 0.4.21", + "mime 0.3.17", + "mime_guess 2.0.4", + "nickel", + "quick-error 1.2.3", + "rand 0.8.5", + "safemem", + "tempfile", + "tiny_http", + "twoway", +] + +[[package]] +name = "mustache" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51956ef1c5d20a1384524d91e616fb44dfc7d8f249bf696d49c97dd3289ecab5" +dependencies = [ + "log 0.3.9", + "serde", +] + [[package]] name = "nalgebra" version = "0.32.4" @@ -1650,7 +1857,7 @@ checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" dependencies = [ "lazy_static", "libc", - "log", + "log 0.4.21", "openssl", "openssl-probe", "openssl-sys", @@ -1675,6 +1882,27 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "nickel" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5061a832728db2dacb61cefe0ce303b58f85764ec680e71d9138229640a46d9" +dependencies = [ + "groupable", + "hyper 0.10.16", + "lazy_static", + "log 0.3.9", + "modifier", + "mustache", + "plugin", + "regex", + "serde", + "serde_json", + "time 0.1.45", + "typemap", + "url 1.7.2", +] + [[package]] name = "nom" version = "7.1.3" @@ -1720,7 +1948,7 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" dependencies = [ - "autocfg", + "autocfg 1.1.0", "num-integer", "num-traits", ] @@ -1766,7 +1994,7 @@ version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" dependencies = [ - "autocfg", + "autocfg 1.1.0", "num-integer", "num-traits", ] @@ -1777,7 +2005,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ - "autocfg", + "autocfg 1.1.0", "num-bigint", "num-integer", "num-traits", @@ -1789,7 +2017,7 @@ version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ - "autocfg", + "autocfg 1.1.0", "libm", ] @@ -1898,6 +2126,16 @@ dependencies = [ "ttf-parser", ] +[[package]] +name = "pan" +version = "0.1.1" +source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#7e90c2fbc439f4c1a708433f1f50fe3168ec2aa3" +dependencies = [ + "mime_guess 2.0.4", + "multipart", + "ureq", +] + [[package]] name = "parking_lot" version = "0.12.1" @@ -1936,19 +2174,44 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +[[package]] +name = "percent-encoding" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" + [[package]] name = "percent-encoding" version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +[[package]] +name = "phf" +version = "0.7.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3da44b85f8e8dfaec21adae67f95d93244b2ecf6ad2a692320598dcc8e6dd18" +dependencies = [ + "phf_shared 0.7.24", +] + [[package]] name = "phf" version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" dependencies = [ - "phf_shared", + "phf_shared 0.11.2", +] + +[[package]] +name = "phf_codegen" +version = "0.7.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b03e85129e324ad4166b06b2c7491ae27fe3ec353af72e72cd1654c7225d517e" +dependencies = [ + "phf_generator 0.7.24", + "phf_shared 0.7.24", ] [[package]] @@ -1957,8 +2220,18 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a" dependencies = [ - "phf_generator", - "phf_shared", + "phf_generator 0.11.2", + "phf_shared 0.11.2", +] + +[[package]] +name = "phf_generator" +version = "0.7.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09364cc93c159b8b06b1f4dd8a4398984503483891b0c26b867cf431fb132662" +dependencies = [ + "phf_shared 0.7.24", + "rand 0.6.5", ] [[package]] @@ -1967,8 +2240,18 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" dependencies = [ - "phf_shared", - "rand", + "phf_shared 0.11.2", + "rand 0.8.5", +] + +[[package]] +name = "phf_shared" +version = "0.7.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "234f71a15de2288bcb7e3b6515828d22af7ec8598ee6d24c3b526fa0a80b67a0" +dependencies = [ + "siphasher 0.2.3", + "unicase 1.4.2", ] [[package]] @@ -1977,7 +2260,7 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" dependencies = [ - "siphasher", + "siphasher 0.3.11", ] [[package]] @@ -2018,6 +2301,15 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +[[package]] +name = "plugin" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a6a0dc3910bc8db877ffed8e457763b317cf880df4ae19109b9f77d277cf6e0" +dependencies = [ + "typemap", +] + [[package]] name = "png" version = "0.17.13" @@ -2105,6 +2397,12 @@ dependencies = [ "bytemuck", ] +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + [[package]] name = "quick-error" version = "2.0.1" @@ -2129,6 +2427,25 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" +dependencies = [ + "autocfg 0.1.8", + "libc", + "rand_chacha 0.1.1", + "rand_core 0.4.2", + "rand_hc", + "rand_isaac", + "rand_jitter", + "rand_os", + "rand_pcg", + "rand_xorshift", + "winapi", +] + [[package]] name = "rand" version = "0.8.5" @@ -2136,8 +2453,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha", - "rand_core", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" +dependencies = [ + "autocfg 0.1.8", + "rand_core 0.3.1", ] [[package]] @@ -2147,9 +2474,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_core" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +dependencies = [ + "rand_core 0.4.2", ] +[[package]] +name = "rand_core" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" + [[package]] name = "rand_core" version = "0.6.4" @@ -2166,7 +2508,69 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31" dependencies = [ "num-traits", - "rand", + "rand 0.8.5", +] + +[[package]] +name = "rand_hc" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" +dependencies = [ + "rand_core 0.3.1", +] + +[[package]] +name = "rand_isaac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" +dependencies = [ + "rand_core 0.3.1", +] + +[[package]] +name = "rand_jitter" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" +dependencies = [ + "libc", + "rand_core 0.4.2", + "winapi", +] + +[[package]] +name = "rand_os" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" +dependencies = [ + "cloudabi", + "fuchsia-cprng", + "libc", + "rand_core 0.4.2", + "rdrand", + "winapi", +] + +[[package]] +name = "rand_pcg" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" +dependencies = [ + "autocfg 0.1.8", + "rand_core 0.4.2", +] + +[[package]] +name = "rand_xorshift" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" +dependencies = [ + "rand_core 0.3.1", ] [[package]] @@ -2186,7 +2590,7 @@ dependencies = [ "itertools", "libc", "libfuzzer-sys", - "log", + "log 0.4.21", "maybe-rayon", "new_debug_unreachable", "noop_proc_macro", @@ -2195,8 +2599,8 @@ dependencies = [ "once_cell", "paste", "profiling", - "rand", - "rand_chacha", + "rand 0.8.5", + "rand_chacha 0.3.1", "simd_helpers", "system-deps", "thiserror", @@ -2213,7 +2617,7 @@ dependencies = [ "avif-serialize", "imgref", "loop9", - "quick-error", + "quick-error 2.0.1", "rav1e", "rayon", "rgb", @@ -2245,6 +2649,15 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "rdrand" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" +dependencies = [ + "rand_core 0.3.1", +] + [[package]] name = "redox_syscall" version = "0.4.1" @@ -2301,7 +2714,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e333b1eb9fe677f6893a9efcb0d277a2d3edd83f358a236b657c32301dc6e5f6" dependencies = [ "async-compression", - "base64", + "base64 0.21.7", "bytes", "cookie 0.17.0", "cookie_store 0.20.0", @@ -2312,17 +2725,17 @@ dependencies = [ "http", "http-body", "http-body-util", - "hyper", + "hyper 1.2.0", "hyper-tls", "hyper-util", "ipnet", "js-sys", - "log", - "mime", - "mime_guess", + "log 0.4.21", + "mime 0.3.17", + "mime_guess 2.0.4", "native-tls", "once_cell", - "percent-encoding", + "percent-encoding 2.3.1", "pin-project-lite", "rustls-pemfile", "serde", @@ -2334,7 +2747,7 @@ dependencies = [ "tokio-native-tls", "tokio-util", "tower-service", - "url", + "url 2.5.0", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -2350,7 +2763,7 @@ dependencies = [ "bytes", "cookie_store 0.20.0", "reqwest", - "url", + "url 2.5.0", ] [[package]] @@ -2402,7 +2815,7 @@ version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e87c9956bd9807afa1f77e0f7594af32566e830e088a5576d27c5b6f30f49d41" dependencies = [ - "log", + "log 0.4.21", "ring", "rustls-pki-types", "rustls-webpki", @@ -2416,7 +2829,7 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ - "base64", + "base64 0.21.7", ] [[package]] @@ -2486,6 +2899,12 @@ dependencies = [ "bytemuck", ] +[[package]] +name = "safemem" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" + [[package]] name = "schannel" version = "0.1.23" @@ -2634,6 +3053,12 @@ dependencies = [ "quote", ] +[[package]] +name = "siphasher" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" + [[package]] name = "siphasher" version = "0.3.11" @@ -2646,7 +3071,7 @@ version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ - "autocfg", + "autocfg 1.1.0", ] [[package]] @@ -2710,7 +3135,7 @@ version = "0.1.1" source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#7e90c2fbc439f4c1a708433f1f50fe3168ec2aa3" dependencies = [ "dir", - "log", + "log 0.4.21", "sqlite", "user", ] @@ -2852,6 +3277,17 @@ dependencies = [ "weezl", ] +[[package]] +name = "time" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" +dependencies = [ + "libc", + "wasi 0.10.0+wasi-snapshot-preview1", + "winapi", +] + [[package]] name = "time" version = "0.3.34" @@ -2883,6 +3319,19 @@ dependencies = [ "time-core", ] +[[package]] +name = "tiny_http" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e22cb179b63e5fc2d0b5be237dc107da072e2407809ac70a8ce85b93fe8f562" +dependencies = [ + "ascii", + "chrono", + "chunked_transfer", + "log 0.4.21", + "url 1.7.2", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -3042,7 +3491,7 @@ version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "log", + "log 0.4.21", "pin-project-lite", "tracing-core", ] @@ -3056,6 +3505,12 @@ dependencies = [ "once_cell", ] +[[package]] +name = "traitobject" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" + [[package]] name = "try-lock" version = "0.2.5" @@ -3068,19 +3523,68 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17f77d76d837a7830fe1d4f12b7b4ba4192c1888001c7164257e4bc6d21d96b4" +[[package]] +name = "twoway" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59b11b2b5241ba34be09c3cc85a36e56e48f9888862e19cedf23336d35316ed1" +dependencies = [ + "memchr", +] + +[[package]] +name = "typeable" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" + +[[package]] +name = "typemap" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "653be63c80a3296da5551e1bfd2cca35227e13cdd08c6668903ae2f4f77aa1f6" +dependencies = [ + "unsafe-any", +] + [[package]] name = "typenum" version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "types" +version = "0.1.1" +source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#7e90c2fbc439f4c1a708433f1f50fe3168ec2aa3" +dependencies = [ + "dir", + "log 0.4.21", + "pan", + "rand 0.8.5", + "serde", + "sqlite", + "store", + "ureq", + "user", +] + +[[package]] +name = "unicase" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33" +dependencies = [ + "version_check 0.1.5", +] + [[package]] name = "unicase" version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" dependencies = [ - "version_check", + "version_check 0.9.4", ] [[package]] @@ -3116,6 +3620,15 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" +[[package]] +name = "unsafe-any" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f30360d7979f5e9c6e6cea48af192ea8fab4afb3cf72597154b8f08935bc9c7f" +dependencies = [ + "traitobject", +] + [[package]] name = "untrusted" version = "0.9.0" @@ -3128,18 +3641,18 @@ version = "2.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11f214ce18d8b2cbe84ed3aa6486ed3f5b285cf8d8fbdbce9f3f767a724adc35" dependencies = [ - "base64", + "base64 0.21.7", "cookie 0.18.0", "cookie_store 0.21.0", "flate2", - "log", + "log 0.4.21", "once_cell", "rustls", "rustls-pki-types", "rustls-webpki", "serde", "serde_json", - "url", + "url 2.5.0", "webpki-roots", ] @@ -3153,6 +3666,17 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "url" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" +dependencies = [ + "idna 0.1.5", + "matches", + "percent-encoding 1.0.1", +] + [[package]] name = "url" version = "2.5.0" @@ -3161,7 +3685,7 @@ checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", "idna 0.5.0", - "percent-encoding", + "percent-encoding 2.3.1", ] [[package]] @@ -3178,7 +3702,7 @@ dependencies = [ "cookie_store 0.21.0", "dir", "error", - "log", + "log 0.4.21", "login", "serde", "serde_json", @@ -3198,7 +3722,7 @@ source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#7e90c2fbc439 dependencies = [ "chrono", "inquire", - "log", + "log 0.4.21", "unicode-width", ] @@ -3225,6 +3749,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" +[[package]] +name = "version_check" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" + [[package]] name = "version_check" version = "0.9.4" @@ -3240,6 +3770,12 @@ dependencies = [ "try-lock", ] +[[package]] +name = "wasi" +version = "0.10.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -3263,7 +3799,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", - "log", + "log 0.4.21", "once_cell", "proc-macro2", "quote", @@ -3587,8 +4123,8 @@ dependencies = [ "core-graphics", "dbus", "image", - "log", - "percent-encoding", + "log 0.4.21", + "percent-encoding 2.3.1", "sysinfo", "thiserror", "windows 0.54.0", diff --git a/Cargo.toml b/Cargo.toml index b5ecd4a..56e2662 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +activity = { git = "https://github.com/worksoup/cxsign.git", branch = "newsign" } chrono = "0.4" clap = { version = "4.5", features = ["derive"] } cookie_store = "0.20" @@ -18,6 +19,7 @@ hex = "0.4" #image = "0.25" inquire = "0.7" lazy_static = "1.4" +login = { git = "https://github.com/worksoup/cxsign.git", branch = "newsign" } percent-encoding = "2.3" rand = "0.8" reqwest = { version = "0.12", features = [ @@ -39,6 +41,7 @@ store = { git = "https://github.com/worksoup/cxsign.git", branch = "newsign" } sqlite = "0.34" tokio = { version = "1.35", features = ["full"] } toml = "0.8" +types = { git = "https://github.com/worksoup/cxsign.git", branch = "newsign" } tokio-stream = "0.1" unicode-width = "0.1" ureq = { version = "2.9", features = ["cookies", "json"] } diff --git a/src/main.rs b/src/main.rs index b58a385..5a358a0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,13 +8,15 @@ mod cli; mod protocol; mod session; +mod tools; use cli::{ arg::{AccCmds, Args, MainCmds}, location::Struct位置操作使用的信息, }; -use dir::DIR; -use store::sql::DataBase; +use store::sql::{AccountTable, DataBase, DataBaseTableTrait}; +use types::{Course, CourseTable}; + #[tokio::main] async fn main() { let args = ::parse(); @@ -28,7 +30,7 @@ async fn main() { precisely, no_random_shift, } = args; - let db = DataBase::new(); + let db = DataBase::default(); if let Some(sub_cmd) = command { match sub_cmd { MainCmds::Account { command, fresh } => { @@ -36,7 +38,7 @@ async fn main() { match acc_sub_cmd { AccCmds::Add { uname } => { // 添加账号。 - utils::account::添加账号(&db, uname, None).await; + tools::account::添加账号(&db, uname, None).await; } AccCmds::Remove { uname, yes } => { if !yes { @@ -49,42 +51,48 @@ async fn main() { } } // 删除指定账号。 - db.delete_account(&uname); + AccountTable::from_ref(&db).delete_account(&uname); } } } else { - let accounts = db.get_accounts(); + let table = AccountTable::from_ref(&db); + let accounts = table.get_accounts(); if fresh { for (uname, (ref enc_pwd, _)) in accounts { - db.delete_account(&uname); - utils::account::添加账号_使用加密过的密码_刷新时用_此时密码一定是存在的且为加密后的密码(&db, uname, enc_pwd).await; + table.delete_account(&uname); + tools::account::添加账号_使用加密过的密码_刷新时用_此时密码一定是存在的且为加密后的密码(&db, uname, enc_pwd).await; } } // 列出所有账号。 - let accounts = db.get_accounts(); + let accounts = table.get_accounts(); for a in accounts { println!("{}, {}", a.0, a.1 .1); } } } MainCmds::Course { fresh } => { + let table = CourseTable::from_ref(&db); if fresh { // 重新获取课程信息并缓存。 - let sessions = utils::account::通过账号获取签到会话( + let sessions = tools::account::通过账号获取签到会话( &db, - &db.get_accounts().keys().map(|s| s.as_str()).collect(), + &AccountTable::from_ref(&db) + .get_accounts() + .keys() + .map(|s| s.as_str()) + .collect(), ) .await; - db.delete_all_course(); + CourseTable::delete(&db); for (_, session) in sessions { - let courses = session.获取课程列表().await.unwrap(); + let courses = Course::get_courses(&session).unwrap(); for c in courses { - db.add_course_or(&c, |_, _| {}); + table.add_course_or(&c, |_, _| {}); } } } // 列出所有课程。 - let courses = db.get_courses(); + let courses = table.get_courses(); for c in courses { println!("{}", c.1); } @@ -120,9 +128,13 @@ async fn main() { cli::location::location(&db, args) } MainCmds::List { course, all } => { - let sessions = utils::account::通过账号获取签到会话( + let sessions = tools::account::通过账号获取签到会话( &db, - &db.get_accounts().keys().map(|s| s.as_str()).collect(), + &AccountTable::from_ref(&db) + .get_accounts() + .keys() + .map(|s| s.as_str()) + .collect(), ) .await; let (available_sign_activities, other_sign_activities) = diff --git a/src/tools/account.rs b/src/tools/account.rs new file mode 100644 index 0000000..f1c95c3 --- /dev/null +++ b/src/tools/account.rs @@ -0,0 +1,59 @@ +use dir::DIR; +use std::collections::HashMap; + +use user::session::Session; + +use store::sql::{AccountTable, DataBase, DataBaseTableTrait}; +use types::{Course, CourseTable}; + +// 添加账号。TODO: 跳过输入密码阶段 +pub async fn 添加账号(db: &DataBase, uname: String, pwd: Option) { + let pwd = if let Some(pwd) = pwd { + pwd + } else { + inquire::Password::new("密码:") + .without_confirmation() + .prompt() + .unwrap() + }; + let enc_pwd = login::utils::des_enc(&pwd); + let session = Session::login(&dir::DIR, &uname, &enc_pwd).unwrap(); + let table = AccountTable::from_ref(&db); + let name = session.get_stu_name(); + table.add_account_or(&uname, &enc_pwd, name, AccountTable::update_account); + let courses = Course::get_courses(&session).unwrap(); + for c in courses { + let table = CourseTable::from_ref(&db); + table.add_course_or(&c, |_, _| {}); + } +} +pub async fn 添加账号_使用加密过的密码_刷新时用_此时密码一定是存在的且为加密后的密码( + db: &DataBase, + uname: String, + 加密过的密码: &str, +) { + let session = Session::login(&DIR, &uname, 加密过的密码).unwrap(); + let name = session.get_stu_name(); + let table = AccountTable::from_ref(&db); + table.add_account_or(&uname, 加密过的密码, name, AccountTable::update_account); + let courses = Course::get_courses(&session).unwrap(); + for c in courses { + let table = CourseTable::from_ref(&db); + table.add_course_or(&c, |_, _| {}); + } +} + +pub async fn 通过账号获取签到会话( + db: &DataBase, + 账号列表: &Vec<&str>, +) -> HashMap { + let mut s = HashMap::new(); + for 账号 in 账号列表 { + let table = AccountTable::from_ref(&db); + if table.has_account(账号) { + let 签到会话 = Session::load_json(&DIR, 账号).unwrap(); + s.insert(账号.to_string(), 签到会话); + } + } + s +} diff --git a/src/utils/address.rs b/src/tools/address.rs similarity index 100% rename from src/utils/address.rs rename to src/tools/address.rs diff --git a/src/utils/mod.rs b/src/tools/mod.rs similarity index 98% rename from src/utils/mod.rs rename to src/tools/mod.rs index 96faeb8..e8d6cce 100644 --- a/src/utils/mod.rs +++ b/src/tools/mod.rs @@ -110,6 +110,6 @@ pub fn 获取unicode字符串定宽显示时应当设置的宽度( // mod test { // #[test] // fn test_des() { -// println!("{}", crate::utils::pwd_des("0123456789.")); +// println!("{}", crate::tools::pwd_des("0123456789.")); // } // } diff --git a/src/utils/photo.rs b/src/tools/photo.rs similarity index 100% rename from src/utils/photo.rs rename to src/tools/photo.rs diff --git a/src/utils/sign.rs b/src/tools/sign.rs similarity index 94% rename from src/utils/sign.rs rename to src/tools/sign.rs index bba0bad..5d79fe8 100644 --- a/src/utils/sign.rs +++ b/src/tools/sign.rs @@ -1,20 +1,22 @@ +use activity::sign::Sign; use std::collections::{hash_map::OccupiedError, HashMap}; use rxing::{Point, PointU}; +use user::session::Session; -use crate::{activity::sign::Struct签到, session::Struct签到会话, utils::请求确认}; +use utils::inquire_confirm; pub async fn 获取所有签到( - sessions: &HashMap, + sessions: &HashMap, ) -> ( - HashMap>, - HashMap>, + HashMap>, + HashMap>, ) { let mut 有效签到 = HashMap::new(); let mut 其他签到 = HashMap::new(); for session in sessions { let (available_sign_activities, other_sign_activities, _) = - session.1.遍历课程以获取所有活动().await.unwrap(); + activity::Activity::get_all_activities(session.1).unwrap(); for sa in available_sign_activities { let mut map = HashMap::new(); map.insert(session.0, session.1); diff --git a/src/utils/sql.rs b/src/tools/sql.rs similarity index 100% rename from src/utils/sql.rs rename to src/tools/sql.rs diff --git a/src/utils/account.rs b/src/utils/account.rs deleted file mode 100644 index d1f889e..0000000 --- a/src/utils/account.rs +++ /dev/null @@ -1,61 +0,0 @@ -use std::collections::HashMap; - -use crate::session::Struct签到会话; - -use super::sql::DataBase; - -// 添加账号。TODO: 跳过输入密码阶段 -pub async fn 添加账号(db: &DataBase, uname: String, pwd: Option) { - let pwd = if let Some(pwd) = pwd { - pwd - } else { - inquire::Password::new("密码:") - .without_confirmation() - .prompt() - .unwrap() - }; - let enc_pwd = crate::utils::des加密(&pwd); - let session = Struct签到会话::通过账号密码登录(&uname, &enc_pwd) - .await - .unwrap(); - let name = session.get_用户真名(); - db.add_account_or(&uname, &enc_pwd, name, DataBase::update_account); - let courses = session.获取课程列表().await.unwrap(); - for c in courses { - db.add_course_or(&c, |_, _| {}); - } -} -pub async fn 添加账号_使用加密过的密码_刷新时用_此时密码一定是存在的且为加密后的密码( - db: &DataBase, - uname: String, - 加密过的密码: &str, -) { - let session = Struct签到会话::通过账号密码登录(&uname, 加密过的密码) - .await - .unwrap(); - let name = session.get_用户真名(); - db.add_account_or(&uname, 加密过的密码, name, DataBase::update_account); - let courses = session.获取课程列表().await.unwrap(); - for c in courses { - db.add_course_or(&c, |_, _| {}); - } -} - -pub async fn 通过账号获取签到会话( - db: &DataBase, - 账号列表: &Vec<&str>, -) -> HashMap { - // let accounts = db.get_accounts(); - let 配置文件夹 = crate::utils::配置文件夹.clone(); - let mut s = HashMap::new(); - for 账号 in 账号列表 { - if db.has_account(账号) { - let cookies文件路径 = 配置文件夹.join(账号.to_string() + ".json"); - let 签到会话 = Struct签到会话::从cookies文件加载(cookies文件路径) - .await - .unwrap(); - s.insert(账号.to_string(), 签到会话); - } - } - s -} From 381c93e492c4e5a88497f81fff8297e038a6e980 Mon Sep 17 00:00:00 2001 From: worksoup <2055038075@qq.com> Date: Thu, 28 Mar 2024 21:09:26 +0800 Subject: [PATCH 04/17] =?UTF-8?q?=E6=88=90=E5=8A=9F=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 1815 +++++------------------------- Cargo.toml | 51 +- src/activity/mod.rs | 92 -- src/activity/sign.rs | 444 -------- src/cli/location.rs | 87 +- src/cli/mod.rs | 342 ++---- src/cli/sign.rs | 164 --- src/cli/single_sign.rs | 187 --- src/main.rs | 47 +- src/protocol/account_manage.rs | 8 - src/protocol/active_list.rs | 27 - src/protocol/analysis.rs | 19 - src/protocol/back_clazz_data.rs | 9 - src/protocol/check_signcode.rs | 16 - src/protocol/get_attend_info.rs | 12 - src/protocol/get_location_log.rs | 18 - src/protocol/login_enc.rs | 28 - src/protocol/login_page.rs | 9 - src/protocol/mod.rs | 38 - src/protocol/other.rs | 76 -- src/protocol/pan_chaoxing.rs | 9 - src/protocol/pan_list.rs | 14 - src/protocol/pan_token.rs | 8 - src/protocol/pan_upload.rs | 19 - src/protocol/ppt_sign.rs | 90 -- src/protocol/pre_sign.rs | 34 - src/protocol/sign_detail.rs | 11 - src/session/cookies.rs | 158 --- src/session/course.rs | 93 -- src/session/mod.rs | 259 ----- src/tools/account.rs | 59 - src/tools/address.rs | 234 ---- src/tools/mod.rs | 191 ++-- src/tools/photo.rs | 81 -- src/tools/sign.rs | 177 --- src/tools/sql.rs | 452 -------- 36 files changed, 495 insertions(+), 4883 deletions(-) delete mode 100644 src/activity/mod.rs delete mode 100644 src/activity/sign.rs delete mode 100644 src/cli/sign.rs delete mode 100644 src/cli/single_sign.rs delete mode 100644 src/protocol/account_manage.rs delete mode 100644 src/protocol/active_list.rs delete mode 100644 src/protocol/analysis.rs delete mode 100644 src/protocol/back_clazz_data.rs delete mode 100644 src/protocol/check_signcode.rs delete mode 100644 src/protocol/get_attend_info.rs delete mode 100644 src/protocol/get_location_log.rs delete mode 100644 src/protocol/login_enc.rs delete mode 100644 src/protocol/login_page.rs delete mode 100644 src/protocol/mod.rs delete mode 100644 src/protocol/other.rs delete mode 100644 src/protocol/pan_chaoxing.rs delete mode 100644 src/protocol/pan_list.rs delete mode 100644 src/protocol/pan_token.rs delete mode 100644 src/protocol/pan_upload.rs delete mode 100644 src/protocol/ppt_sign.rs delete mode 100644 src/protocol/pre_sign.rs delete mode 100644 src/protocol/sign_detail.rs delete mode 100644 src/session/cookies.rs delete mode 100644 src/session/course.rs delete mode 100644 src/session/mod.rs delete mode 100644 src/tools/account.rs delete mode 100644 src/tools/address.rs delete mode 100644 src/tools/photo.rs delete mode 100644 src/tools/sign.rs delete mode 100644 src/tools/sql.rs diff --git a/Cargo.lock b/Cargo.lock index 19de7ca..4534b92 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -18,31 +18,6 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046" -[[package]] -name = "activity" -version = "0.1.1" -source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#7e90c2fbc439f4c1a708433f1f50fe3168ec2aa3" -dependencies = [ - "chrono", - "log 0.4.21", - "num_enum", - "percent-encoding 2.3.1", - "serde", - "types", - "ureq", - "user", - "utils", -] - -[[package]] -name = "addr2line" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" -dependencies = [ - "gimli", -] - [[package]] name = "adler" version = "1.0.2" @@ -165,39 +140,11 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" -[[package]] -name = "ascii" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97be891acc47ca214468e09425d02cef3af2c94d0d82081cd02061f996802f14" - -[[package]] -name = "async-compression" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a116f46a969224200a0a97f29cfd4c50e7534e4b4826bd23ea2c3c533039c82c" -dependencies = [ - "flate2", - "futures-core", - "memchr", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "autocfg" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78" -dependencies = [ - "autocfg 1.1.0", -] - [[package]] name = "autocfg" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "av1-grain" @@ -207,7 +154,7 @@ checksum = "6678909d8c5d46a42abcf571271e15fdbc0a225e3646cf23762cd415046c78bf" dependencies = [ "anyhow", "arrayvec", - "log 0.4.21", + "log", "nom", "num-rational", "v_frame", @@ -222,31 +169,6 @@ dependencies = [ "arrayvec", ] -[[package]] -name = "backtrace" -version = "0.3.71" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "base64" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" -dependencies = [ - "byteorder", - "safemem", -] - [[package]] name = "base64" version = "0.21.7" @@ -298,16 +220,6 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06c9989a51171e2e81038ab168b6ae22886fe9ded214430dbb4f41c28cf176da" -[[package]] -name = "buf_redux" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b953a6887648bb07a535631f2bc00fbdb2a2216f135552cb3f534ed136b9c07f" -dependencies = [ - "memchr", - "safemem", -] - [[package]] name = "built" version = "0.7.1" @@ -332,12 +244,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" -[[package]] -name = "bytes" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" - [[package]] name = "cc" version = "1.0.90" @@ -366,9 +272,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.35" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eaf5903dcbc0a39312feb77df2ff4c76387d591b9fc7b04a238dcf8bb62639a" +checksum = "8a0d04d43504c61aa6c7531f1871dd0d418d91130162063b789da00fd7057a5e" dependencies = [ "android-tzdata", "iana-time-zone", @@ -386,7 +292,7 @@ checksum = "d59ae0466b83e838b81a54256c39d5d7c20b9d7daa10510a242d9b75abd5936e" dependencies = [ "chrono", "chrono-tz-build", - "phf 0.11.2", + "phf", ] [[package]] @@ -396,16 +302,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "433e39f13c9a060046954e0592a8d0a4bcb1040125cbf91cb8ee58964cfb350f" dependencies = [ "parse-zoneinfo", - "phf 0.11.2", - "phf_codegen 0.11.2", + "phf", + "phf_codegen", ] -[[package]] -name = "chunked_transfer" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "498d20a7aaf62625b9bf26e637cf7736417cde1d0c99f1d04d1170229a85cf87" - [[package]] name = "cipher" version = "0.4.4" @@ -418,9 +318,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.3" +version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "949626d00e063efc93b6dca932419ceb5432f99769911c0b995f7e884c778813" +checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" dependencies = [ "clap_builder", "clap_derive", @@ -440,9 +340,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.3" +version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90239a040c80f5e14809ca132ddc4176ab33d5e17e49691793296e3fcb34d72f" +checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" dependencies = [ "heck", "proc-macro2", @@ -456,15 +356,6 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" -[[package]] -name = "cloudabi" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "codepage-437" version = "0.1.0" @@ -497,41 +388,13 @@ dependencies = [ [[package]] name = "cookie" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7efb37c3e1ccb1ff97164ad95ac1606e8ccd35b3fa0a7d99a304c7f4a428cc24" -dependencies = [ - "percent-encoding 2.3.1", - "time 0.3.34", - "version_check 0.9.4", -] - -[[package]] -name = "cookie" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cd91cf61412820176e137621345ee43b3f4423e589e7ae4e50d601d93e35ef8" -dependencies = [ - "percent-encoding 2.3.1", - "time 0.3.34", - "version_check 0.9.4", -] - -[[package]] -name = "cookie_store" -version = "0.20.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "387461abbc748185c3a6e1673d826918b450b87ff22639429c694619a83b6cf6" +checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747" dependencies = [ - "cookie 0.17.0", - "idna 0.3.0", - "log 0.4.21", - "publicsuffix", - "serde", - "serde_derive", - "serde_json", - "time 0.3.34", - "url 2.5.0", + "percent-encoding", + "time", + "version_check", ] [[package]] @@ -540,16 +403,16 @@ version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4934e6b7e8419148b6ef56950d277af8561060b56afd59e2aadf98b59fce6baa" dependencies = [ - "cookie 0.18.0", + "cookie", "idna 0.5.0", "indexmap", - "log 0.4.21", + "log", "publicsuffix", "serde", "serde_derive", "serde_json", - "time 0.3.34", - "url 2.5.0", + "time", + "url", ] [[package]] @@ -577,7 +440,7 @@ dependencies = [ "bitflags 1.3.2", "core-foundation", "core-graphics-types", - "foreign-types 0.5.0", + "foreign-types", "libc", ] @@ -694,43 +557,153 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" +[[package]] +name = "cxsign" +version = "0.1.1" +source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#96d89fec9f809cc324cada4070dd34c2182a358a" +dependencies = [ + "cxsign_app", +] + [[package]] name = "cxsign" version = "0.1.2" dependencies = [ - "activity", - "chrono", "clap", - "cookie_store 0.20.0", - "des", - "dir", - "directories", - "futures", - "hex", - "hex-literal", + "cxsign 0.1.1", "inquire", - "lazy_static", - "login", +] + +[[package]] +name = "cxsign_activity" +version = "0.1.1" +source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#96d89fec9f809cc324cada4070dd34c2182a358a" +dependencies = [ + "chrono", + "cxsign_types", + "cxsign_user", + "cxsign_utils", + "log", "num_enum", - "percent-encoding 2.3.1", - "rand 0.8.5", - "reqwest", - "reqwest_cookie_store", + "percent-encoding", + "serde", + "ureq", +] + +[[package]] +name = "cxsign_app" +version = "0.1.1" +source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#96d89fec9f809cc324cada4070dd34c2182a358a" +dependencies = [ + "cxsign_activity", + "cxsign_dir", + "cxsign_error", + "cxsign_login", + "cxsign_pan", + "cxsign_store", + "cxsign_types", + "cxsign_user", + "cxsign_utils", + "log", "rxing", + "xcap", +] + +[[package]] +name = "cxsign_dir" +version = "0.1.1" +source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#96d89fec9f809cc324cada4070dd34c2182a358a" +dependencies = [ + "directories", + "lazy_static", +] + +[[package]] +name = "cxsign_error" +version = "0.1.1" +source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#96d89fec9f809cc324cada4070dd34c2182a358a" +dependencies = [ + "thiserror", + "ureq", +] + +[[package]] +name = "cxsign_login" +version = "0.1.1" +source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#96d89fec9f809cc324cada4070dd34c2182a358a" +dependencies = [ + "cookie_store", + "cxsign_error", + "des", + "hex", + "log", "serde", - "serde_derive", "serde_json", + "ureq", +] + +[[package]] +name = "cxsign_pan" +version = "0.1.1" +source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#96d89fec9f809cc324cada4070dd34c2182a358a" +dependencies = [ + "log", + "mime_guess", + "rand", + "ureq", +] + +[[package]] +name = "cxsign_store" +version = "0.1.1" +source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#96d89fec9f809cc324cada4070dd34c2182a358a" +dependencies = [ + "cxsign_dir", + "cxsign_user", + "log", + "sqlite", +] + +[[package]] +name = "cxsign_types" +version = "0.1.1" +source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#96d89fec9f809cc324cada4070dd34c2182a358a" +dependencies = [ + "cxsign_dir", + "cxsign_pan", + "cxsign_store", + "cxsign_user", + "log", + "rand", + "serde", "sqlite", - "store", - "tokio", - "tokio-stream", - "toml", - "types", - "unicode-width", "ureq", - "user", - "utils", - "xcap", +] + +[[package]] +name = "cxsign_user" +version = "0.1.1" +source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#96d89fec9f809cc324cada4070dd34c2182a358a" +dependencies = [ + "cookie_store", + "cxsign_dir", + "cxsign_error", + "cxsign_login", + "log", + "serde", + "serde_json", + "ureq", +] + +[[package]] +name = "cxsign_utils" +version = "0.1.1" +source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#96d89fec9f809cc324cada4070dd34c2182a358a" +dependencies = [ + "chrono", + "inquire", + "log", + "unicode-width", ] [[package]] @@ -762,15 +735,6 @@ dependencies = [ "cipher", ] -[[package]] -name = "dir" -version = "0.1.1" -source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#7e90c2fbc439f4c1a708433f1f50fe3168ec2aa3" -dependencies = [ - "directories", - "lazy_static", -] - [[package]] name = "directories" version = "5.0.1" @@ -868,40 +832,12 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569" -[[package]] -name = "encoding_rs" -version = "0.8.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" -dependencies = [ - "cfg-if", -] - [[package]] name = "equivalent" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" -[[package]] -name = "errno" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "error" -version = "0.1.1" -source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#7e90c2fbc439f4c1a708433f1f50fe3168ec2aa3" -dependencies = [ - "thiserror", - "ureq", -] - [[package]] name = "exr" version = "1.72.0" @@ -929,12 +865,6 @@ dependencies = [ "regex-syntax", ] -[[package]] -name = "fastrand" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" - [[package]] name = "fdeflate" version = "0.3.4" @@ -969,15 +899,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared 0.1.1", -] - [[package]] name = "foreign-types" version = "0.5.0" @@ -985,7 +906,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" dependencies = [ "foreign-types-macros", - "foreign-types-shared 0.3.1", + "foreign-types-shared", ] [[package]] @@ -999,12 +920,6 @@ dependencies = [ "syn", ] -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "foreign-types-shared" version = "0.3.1" @@ -1017,195 +932,69 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ - "percent-encoding 2.3.1", + "percent-encoding", ] [[package]] -name = "fuchsia-cprng" -version = "0.1.1" +name = "fuzzy-matcher" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" +checksum = "54614a3312934d066701a80f20f15fa3b56d67ac7722b39eea5b4c9dd1d66c94" +dependencies = [ + "thread_local", +] [[package]] -name = "futures" -version = "0.3.30" +name = "fxhash" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", + "byteorder", ] [[package]] -name = "futures-channel" -version = "0.3.30" +name = "generic-array" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ - "futures-core", - "futures-sink", + "typenum", + "version_check", ] [[package]] -name = "futures-core" -version = "0.3.30" +name = "getrandom" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] [[package]] -name = "futures-executor" -version = "0.3.30" +name = "gif" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "3fb2d69b19215e18bb912fa30f7ce15846e301408695e44e0ef719f1da9e19f2" dependencies = [ - "futures-core", - "futures-task", - "futures-util", + "color_quant", + "weezl", ] [[package]] -name = "futures-io" -version = "0.3.30" +name = "half" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" - -[[package]] -name = "futures-macro" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "futures-sink" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" - -[[package]] -name = "futures-task" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" - -[[package]] -name = "futures-util" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "fuzzy-matcher" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54614a3312934d066701a80f20f15fa3b56d67ac7722b39eea5b4c9dd1d66c94" -dependencies = [ - "thread_local", -] - -[[package]] -name = "fxhash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" -dependencies = [ - "byteorder", -] - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check 0.9.4", -] - -[[package]] -name = "getrandom" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", - "wasm-bindgen", -] - -[[package]] -name = "gif" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb2d69b19215e18bb912fa30f7ce15846e301408695e44e0ef719f1da9e19f2" -dependencies = [ - "color_quant", - "weezl", -] - -[[package]] -name = "gimli" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" - -[[package]] -name = "groupable" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32619942b8be646939eaf3db0602b39f5229b74575b67efc897811ded1db4e57" - -[[package]] -name = "h2" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51ee2dd2e4f378392eeff5d51618cd9a63166a2513846bbc55f21cfacd9199d4" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "half" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5eceaaeec696539ddaf7b333340f1af35a5aa87ae3e4f3ead0532f72affab2e" -dependencies = [ - "cfg-if", - "crunchy", -] +checksum = "b5eceaaeec696539ddaf7b333340f1af35a5aa87ae3e4f3ead0532f72affab2e" +dependencies = [ + "cfg-if", + "crunchy", +] [[package]] name = "hashbrown" @@ -1219,139 +1008,12 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" -[[package]] -name = "hermit-abi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" - [[package]] name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -[[package]] -name = "hex-literal" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" - -[[package]] -name = "http" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" -dependencies = [ - "bytes", - "http", -] - -[[package]] -name = "http-body-util" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" -dependencies = [ - "bytes", - "futures-core", - "http", - "http-body", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" - -[[package]] -name = "hyper" -version = "0.10.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a0652d9a2609a968c14be1a9ea00bf4b1d64e2e1f53a1b51b6fff3a6e829273" -dependencies = [ - "base64 0.9.3", - "httparse", - "language-tags", - "log 0.3.9", - "mime 0.2.6", - "num_cpus", - "time 0.1.45", - "traitobject", - "typeable", - "unicase 1.4.2", - "url 1.7.2", -] - -[[package]] -name = "hyper" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "186548d73ac615b32a73aafe38fb4f56c0d340e110e5a200bcadbaf2e199263a" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "h2", - "http", - "http-body", - "httparse", - "itoa", - "pin-project-lite", - "smallvec", - "tokio", - "want", -] - -[[package]] -name = "hyper-tls" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" -dependencies = [ - "bytes", - "http-body-util", - "hyper 1.2.0", - "hyper-util", - "native-tls", - "tokio", - "tokio-native-tls", - "tower-service", -] - -[[package]] -name = "hyper-util" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "http", - "http-body", - "hyper 1.2.0", - "pin-project-lite", - "socket2", - "tokio", - "tower", - "tower-service", - "tracing", -] - [[package]] name = "iana-time-zone" version = "0.1.60" @@ -1375,17 +1037,6 @@ dependencies = [ "cc", ] -[[package]] -name = "idna" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "idna" version = "0.3.0" @@ -1453,7 +1104,7 @@ dependencies = [ "itertools", "nalgebra", "num", - "rand 0.8.5", + "rand", "rand_distr", "rayon", ] @@ -1511,28 +1162,6 @@ dependencies = [ "syn", ] -[[package]] -name = "ipnet" -version = "2.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" - -[[package]] -name = "iron" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6d308ca2d884650a8bf9ed2ff4cb13fbb2207b71f64cda11dc9b892067295e8" -dependencies = [ - "hyper 0.10.16", - "log 0.3.9", - "mime_guess 1.8.8", - "modifier", - "num_cpus", - "plugin", - "typemap", - "url 1.7.2", -] - [[package]] name = "itertools" version = "0.12.1" @@ -1544,9 +1173,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jobserver" @@ -1572,12 +1201,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "language-tags" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" - [[package]] name = "lazy_static" version = "1.4.0" @@ -1634,53 +1257,22 @@ dependencies = [ "redox_syscall", ] -[[package]] -name = "linux-raw-sys" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" - [[package]] name = "lock_api" version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ - "autocfg 1.1.0", + "autocfg", "scopeguard", ] -[[package]] -name = "log" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" -dependencies = [ - "log 0.4.21", -] - [[package]] name = "log" version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" -[[package]] -name = "login" -version = "0.1.1" -source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#7e90c2fbc439f4c1a708433f1f50fe3168ec2aa3" -dependencies = [ - "cookie_store 0.21.0", - "des", - "dir", - "error", - "hex", - "log 0.4.21", - "serde", - "serde_json", - "ureq", -] - [[package]] name = "loop9" version = "0.1.5" @@ -1690,19 +1282,13 @@ dependencies = [ "imgref", ] -[[package]] -name = "matches" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" - [[package]] name = "matrixmultiply" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7574c1cf36da4798ab73da5b215bbf444f50718207754cb522201d78d1cd0ff2" dependencies = [ - "autocfg 1.1.0", + "autocfg", "rawpointer", ] @@ -1718,18 +1304,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.1" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" - -[[package]] -name = "mime" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0" -dependencies = [ - "log 0.3.9", -] +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "mime" @@ -1737,26 +1314,14 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" -[[package]] -name = "mime_guess" -version = "1.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216929a5ee4dd316b1702eedf5e74548c123d370f47841ceaac38ca154690ca3" -dependencies = [ - "mime 0.2.6", - "phf 0.7.24", - "phf_codegen 0.7.24", - "unicase 1.4.2", -] - [[package]] name = "mime_guess" version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" dependencies = [ - "mime 0.3.17", - "unicase 2.7.0", + "mime", + "unicase", ] [[package]] @@ -1782,17 +1347,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", - "log 0.4.21", - "wasi 0.11.0+wasi-snapshot-preview1", + "log", + "wasi", "windows-sys 0.48.0", ] -[[package]] -name = "modifier" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41f5c9112cb662acd3b204077e0de5bc66305fa8df65c8019d5adb10e9ab6e58" - [[package]] name = "multimap" version = "0.10.0" @@ -1802,38 +1361,6 @@ dependencies = [ "serde", ] -[[package]] -name = "multipart" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00dec633863867f29cb39df64a397cdf4a6354708ddd7759f70c7fb51c5f9182" -dependencies = [ - "buf_redux", - "httparse", - "hyper 0.10.16", - "iron", - "log 0.4.21", - "mime 0.3.17", - "mime_guess 2.0.4", - "nickel", - "quick-error 1.2.3", - "rand 0.8.5", - "safemem", - "tempfile", - "tiny_http", - "twoway", -] - -[[package]] -name = "mustache" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51956ef1c5d20a1384524d91e616fb44dfc7d8f249bf696d49c97dd3289ecab5" -dependencies = [ - "log 0.3.9", - "serde", -] - [[package]] name = "nalgebra" version = "0.32.4" @@ -1849,24 +1376,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "native-tls" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" -dependencies = [ - "lazy_static", - "libc", - "log 0.4.21", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -1882,27 +1391,6 @@ dependencies = [ "unicode-segmentation", ] -[[package]] -name = "nickel" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5061a832728db2dacb61cefe0ce303b58f85764ec680e71d9138229640a46d9" -dependencies = [ - "groupable", - "hyper 0.10.16", - "lazy_static", - "log 0.3.9", - "modifier", - "mustache", - "plugin", - "regex", - "serde", - "serde_json", - "time 0.1.45", - "typemap", - "url 1.7.2", -] - [[package]] name = "nom" version = "7.1.3" @@ -1948,7 +1436,7 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" dependencies = [ - "autocfg 1.1.0", + "autocfg", "num-integer", "num-traits", ] @@ -1994,7 +1482,7 @@ version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" dependencies = [ - "autocfg 1.1.0", + "autocfg", "num-integer", "num-traits", ] @@ -2005,7 +1493,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ - "autocfg 1.1.0", + "autocfg", "num-bigint", "num-integer", "num-traits", @@ -2017,20 +1505,10 @@ version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ - "autocfg 1.1.0", + "autocfg", "libm", ] -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi", - "libc", -] - [[package]] name = "num_enum" version = "0.7.2" @@ -2052,65 +1530,12 @@ dependencies = [ "syn", ] -[[package]] -name = "object" -version = "0.32.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" -dependencies = [ - "memchr", -] - [[package]] name = "once_cell" version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" -[[package]] -name = "openssl" -version = "0.10.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" -dependencies = [ - "bitflags 2.5.0", - "cfg-if", - "foreign-types 0.3.2", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "openssl-probe" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" - -[[package]] -name = "openssl-sys" -version = "0.9.101" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dda2b0f344e78efc2facf7d195d098df0dd72151b26ab98da807afc26c198dff" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "option-ext" version = "0.2.0" @@ -2126,16 +1551,6 @@ dependencies = [ "ttf-parser", ] -[[package]] -name = "pan" -version = "0.1.1" -source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#7e90c2fbc439f4c1a708433f1f50fe3168ec2aa3" -dependencies = [ - "mime_guess 2.0.4", - "multipart", - "ureq", -] - [[package]] name = "parking_lot" version = "0.12.1" @@ -2174,44 +1589,19 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" -[[package]] -name = "percent-encoding" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" - [[package]] name = "percent-encoding" version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" -[[package]] -name = "phf" -version = "0.7.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3da44b85f8e8dfaec21adae67f95d93244b2ecf6ad2a692320598dcc8e6dd18" -dependencies = [ - "phf_shared 0.7.24", -] - [[package]] name = "phf" version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" dependencies = [ - "phf_shared 0.11.2", -] - -[[package]] -name = "phf_codegen" -version = "0.7.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b03e85129e324ad4166b06b2c7491ae27fe3ec353af72e72cd1654c7225d517e" -dependencies = [ - "phf_generator 0.7.24", - "phf_shared 0.7.24", + "phf_shared", ] [[package]] @@ -2220,18 +1610,8 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a" dependencies = [ - "phf_generator 0.11.2", - "phf_shared 0.11.2", -] - -[[package]] -name = "phf_generator" -version = "0.7.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09364cc93c159b8b06b1f4dd8a4398984503483891b0c26b867cf431fb132662" -dependencies = [ - "phf_shared 0.7.24", - "rand 0.6.5", + "phf_generator", + "phf_shared", ] [[package]] @@ -2240,18 +1620,8 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" dependencies = [ - "phf_shared 0.11.2", - "rand 0.8.5", -] - -[[package]] -name = "phf_shared" -version = "0.7.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "234f71a15de2288bcb7e3b6515828d22af7ec8598ee6d24c3b526fa0a80b67a0" -dependencies = [ - "siphasher 0.2.3", - "unicase 1.4.2", + "phf_shared", + "rand", ] [[package]] @@ -2260,56 +1630,15 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" dependencies = [ - "siphasher 0.3.11", -] - -[[package]] -name = "pin-project" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" -dependencies = [ - "pin-project-internal", + "siphasher", ] -[[package]] -name = "pin-project-internal" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - [[package]] name = "pkg-config" version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" -[[package]] -name = "plugin" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a6a0dc3910bc8db877ffed8e457763b317cf880df4ae19109b9f77d277cf6e0" -dependencies = [ - "typemap", -] - [[package]] name = "png" version = "0.17.13" @@ -2397,12 +1726,6 @@ dependencies = [ "bytemuck", ] -[[package]] -name = "quick-error" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" - [[package]] name = "quick-error" version = "2.0.1" @@ -2427,25 +1750,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "rand" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" -dependencies = [ - "autocfg 0.1.8", - "libc", - "rand_chacha 0.1.1", - "rand_core 0.4.2", - "rand_hc", - "rand_isaac", - "rand_jitter", - "rand_os", - "rand_pcg", - "rand_xorshift", - "winapi", -] - [[package]] name = "rand" version = "0.8.5" @@ -2453,18 +1757,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_chacha" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" -dependencies = [ - "autocfg 0.1.8", - "rand_core 0.3.1", + "rand_chacha", + "rand_core", ] [[package]] @@ -2474,24 +1768,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_core" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -dependencies = [ - "rand_core 0.4.2", + "rand_core", ] -[[package]] -name = "rand_core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" - [[package]] name = "rand_core" version = "0.6.4" @@ -2508,69 +1787,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31" dependencies = [ "num-traits", - "rand 0.8.5", -] - -[[package]] -name = "rand_hc" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" -dependencies = [ - "rand_core 0.3.1", -] - -[[package]] -name = "rand_isaac" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" -dependencies = [ - "rand_core 0.3.1", -] - -[[package]] -name = "rand_jitter" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" -dependencies = [ - "libc", - "rand_core 0.4.2", - "winapi", -] - -[[package]] -name = "rand_os" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" -dependencies = [ - "cloudabi", - "fuchsia-cprng", - "libc", - "rand_core 0.4.2", - "rdrand", - "winapi", -] - -[[package]] -name = "rand_pcg" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" -dependencies = [ - "autocfg 0.1.8", - "rand_core 0.4.2", -] - -[[package]] -name = "rand_xorshift" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" -dependencies = [ - "rand_core 0.3.1", + "rand", ] [[package]] @@ -2590,7 +1807,7 @@ dependencies = [ "itertools", "libc", "libfuzzer-sys", - "log 0.4.21", + "log", "maybe-rayon", "new_debug_unreachable", "noop_proc_macro", @@ -2599,8 +1816,8 @@ dependencies = [ "once_cell", "paste", "profiling", - "rand 0.8.5", - "rand_chacha 0.3.1", + "rand", + "rand_chacha", "simd_helpers", "system-deps", "thiserror", @@ -2617,7 +1834,7 @@ dependencies = [ "avif-serialize", "imgref", "loop9", - "quick-error 2.0.1", + "quick-error", "rav1e", "rayon", "rgb", @@ -2649,15 +1866,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "rdrand" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -dependencies = [ - "rand_core 0.3.1", -] - [[package]] name = "redox_syscall" version = "0.4.1" @@ -2703,68 +1911,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" - -[[package]] -name = "reqwest" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e333b1eb9fe677f6893a9efcb0d277a2d3edd83f358a236b657c32301dc6e5f6" -dependencies = [ - "async-compression", - "base64 0.21.7", - "bytes", - "cookie 0.17.0", - "cookie_store 0.20.0", - "encoding_rs", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "http-body-util", - "hyper 1.2.0", - "hyper-tls", - "hyper-util", - "ipnet", - "js-sys", - "log 0.4.21", - "mime 0.3.17", - "mime_guess 2.0.4", - "native-tls", - "once_cell", - "percent-encoding 2.3.1", - "pin-project-lite", - "rustls-pemfile", - "serde", - "serde_json", - "serde_urlencoded", - "sync_wrapper", - "system-configuration", - "tokio", - "tokio-native-tls", - "tokio-util", - "tower-service", - "url 2.5.0", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "winreg", -] - -[[package]] -name = "reqwest_cookie_store" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93ea5c6f30c19d766efe8d823c88f9abd1c56516648a0d4264ab2dc04cc19472" -dependencies = [ - "bytes", - "cookie_store 0.20.0", - "reqwest", - "url 2.5.0", -] +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "rgb" @@ -2790,32 +1939,13 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "rustc-demangle" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" - -[[package]] -name = "rustix" -version = "0.38.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" -dependencies = [ - "bitflags 2.5.0", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.52.0", -] - [[package]] name = "rustls" -version = "0.22.2" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e87c9956bd9807afa1f77e0f7594af32566e830e088a5576d27c5b6f30f49d41" +checksum = "99008d7ad0bbbea527ec27bddbc0e432c5b87d8175178cee68d2eec9c4a1813c" dependencies = [ - "log 0.4.21", + "log", "ring", "rustls-pki-types", "rustls-webpki", @@ -2823,20 +1953,11 @@ dependencies = [ "zeroize", ] -[[package]] -name = "rustls-pemfile" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" -dependencies = [ - "base64 0.21.7", -] - [[package]] name = "rustls-pki-types" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "868e20fada228fefaf6b652e00cc73623d54f8171e7352c18bb281571f2d92da" +checksum = "ecd36cc4259e3e4514335c4a138c6b43171a8d61d8f5c9348f9fc7529416f247" [[package]] name = "rustls-webpki" @@ -2888,60 +2009,22 @@ dependencies = [ name = "ryu" version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" - -[[package]] -name = "safe_arch" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f398075ce1e6a179b46f51bd88d0598b92b00d3551f1a2d4ac49e771b56ac354" -dependencies = [ - "bytemuck", -] - -[[package]] -name = "safemem" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" - -[[package]] -name = "schannel" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" -dependencies = [ - "windows-sys 0.52.0", -] - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] -name = "security-framework" -version = "2.9.2" +name = "safe_arch" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +checksum = "f398075ce1e6a179b46f51bd88d0598b92b00d3551f1a2d4ac49e771b56ac354" dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", + "bytemuck", ] [[package]] -name = "security-framework-sys" -version = "2.9.1" +name = "scopeguard" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" -dependencies = [ - "core-foundation-sys", - "libc", -] +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" @@ -2965,9 +2048,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.114" +version = "1.0.115" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" +checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd" dependencies = [ "itoa", "ryu", @@ -2983,18 +2066,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - [[package]] name = "signal-hook" version = "0.3.17" @@ -3053,43 +2124,18 @@ dependencies = [ "quote", ] -[[package]] -name = "siphasher" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" - [[package]] name = "siphasher" version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" -[[package]] -name = "slab" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg 1.1.0", -] - [[package]] name = "smallvec" version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" -[[package]] -name = "socket2" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - [[package]] name = "spin" version = "0.9.8" @@ -3129,17 +2175,6 @@ dependencies = [ "sqlite3-src", ] -[[package]] -name = "store" -version = "0.1.1" -source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#7e90c2fbc439f4c1a708433f1f50fe3168ec2aa3" -dependencies = [ - "dir", - "log 0.4.21", - "sqlite", - "user", -] - [[package]] name = "strsim" version = "0.11.0" @@ -3163,12 +2198,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "sync_wrapper" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" - [[package]] name = "sysinfo" version = "0.30.7" @@ -3184,27 +2213,6 @@ dependencies = [ "windows 0.52.0", ] -[[package]] -name = "system-configuration" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "system-configuration-sys", -] - -[[package]] -name = "system-configuration-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "system-deps" version = "6.2.2" @@ -3224,18 +2232,6 @@ version = "0.12.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" -[[package]] -name = "tempfile" -version = "3.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" -dependencies = [ - "cfg-if", - "fastrand", - "rustix", - "windows-sys 0.52.0", -] - [[package]] name = "thiserror" version = "1.0.58" @@ -3277,17 +2273,6 @@ dependencies = [ "weezl", ] -[[package]] -name = "time" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" -dependencies = [ - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi", -] - [[package]] name = "time" version = "0.3.34" @@ -3319,19 +2304,6 @@ dependencies = [ "time-core", ] -[[package]] -name = "tiny_http" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e22cb179b63e5fc2d0b5be237dc107da072e2407809ac70a8ce85b93fe8f562" -dependencies = [ - "ascii", - "chrono", - "chunked_transfer", - "log 0.4.21", - "url 1.7.2", -] - [[package]] name = "tinyvec" version = "1.6.0" @@ -3347,71 +2319,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" -[[package]] -name = "tokio" -version = "1.36.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" -dependencies = [ - "backtrace", - "bytes", - "libc", - "mio", - "num_cpus", - "parking_lot", - "pin-project-lite", - "signal-hook-registry", - "socket2", - "tokio-macros", - "windows-sys 0.48.0", -] - -[[package]] -name = "tokio-macros" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tokio-native-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" -dependencies = [ - "native-tls", - "tokio", -] - -[[package]] -name = "tokio-stream" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", - "tracing", -] - [[package]] name = "toml" version = "0.8.12" @@ -3457,134 +2364,25 @@ dependencies = [ "winnow 0.6.5", ] -[[package]] -name = "tower" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" -dependencies = [ - "futures-core", - "futures-util", - "pin-project", - "pin-project-lite", - "tokio", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "tower-layer" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" - -[[package]] -name = "tower-service" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" - -[[package]] -name = "tracing" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" -dependencies = [ - "log 0.4.21", - "pin-project-lite", - "tracing-core", -] - -[[package]] -name = "tracing-core" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" -dependencies = [ - "once_cell", -] - -[[package]] -name = "traitobject" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" - -[[package]] -name = "try-lock" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" - [[package]] name = "ttf-parser" version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17f77d76d837a7830fe1d4f12b7b4ba4192c1888001c7164257e4bc6d21d96b4" -[[package]] -name = "twoway" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59b11b2b5241ba34be09c3cc85a36e56e48f9888862e19cedf23336d35316ed1" -dependencies = [ - "memchr", -] - -[[package]] -name = "typeable" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" - -[[package]] -name = "typemap" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "653be63c80a3296da5551e1bfd2cca35227e13cdd08c6668903ae2f4f77aa1f6" -dependencies = [ - "unsafe-any", -] - [[package]] name = "typenum" version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" -[[package]] -name = "types" -version = "0.1.1" -source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#7e90c2fbc439f4c1a708433f1f50fe3168ec2aa3" -dependencies = [ - "dir", - "log 0.4.21", - "pan", - "rand 0.8.5", - "serde", - "sqlite", - "store", - "ureq", - "user", -] - -[[package]] -name = "unicase" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33" -dependencies = [ - "version_check 0.1.5", -] - [[package]] name = "unicase" version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" dependencies = [ - "version_check 0.9.4", + "version_check", ] [[package]] @@ -3620,15 +2418,6 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" -[[package]] -name = "unsafe-any" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30360d7979f5e9c6e6cea48af192ea8fab4afb3cf72597154b8f08935bc9c7f" -dependencies = [ - "traitobject", -] - [[package]] name = "untrusted" version = "0.9.0" @@ -3641,18 +2430,18 @@ version = "2.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11f214ce18d8b2cbe84ed3aa6486ed3f5b285cf8d8fbdbce9f3f767a724adc35" dependencies = [ - "base64 0.21.7", - "cookie 0.18.0", - "cookie_store 0.21.0", + "base64", + "cookie", + "cookie_store", "flate2", - "log 0.4.21", + "log", "once_cell", "rustls", "rustls-pki-types", "rustls-webpki", "serde", "serde_json", - "url 2.5.0", + "url", "webpki-roots", ] @@ -3666,17 +2455,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "url" -version = "1.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" -dependencies = [ - "idna 0.1.5", - "matches", - "percent-encoding 1.0.1", -] - [[package]] name = "url" version = "2.5.0" @@ -3685,7 +2463,7 @@ checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", "idna 0.5.0", - "percent-encoding 2.3.1", + "percent-encoding", ] [[package]] @@ -3694,38 +2472,12 @@ version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" -[[package]] -name = "user" -version = "0.1.1" -source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#7e90c2fbc439f4c1a708433f1f50fe3168ec2aa3" -dependencies = [ - "cookie_store 0.21.0", - "dir", - "error", - "log 0.4.21", - "login", - "serde", - "serde_json", - "ureq", -] - [[package]] name = "utf8parse" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" -[[package]] -name = "utils" -version = "0.1.1" -source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#7e90c2fbc439f4c1a708433f1f50fe3168ec2aa3" -dependencies = [ - "chrono", - "inquire", - "log 0.4.21", - "unicode-width", -] - [[package]] name = "v_frame" version = "0.3.8" @@ -3737,45 +2489,18 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "version-compare" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" -[[package]] -name = "version_check" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" - [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[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.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -3799,7 +2524,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", - "log 0.4.21", + "log", "once_cell", "proc-macro2", "quote", @@ -3807,18 +2532,6 @@ dependencies = [ "wasm-bindgen-shared", ] -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - [[package]] name = "wasm-bindgen-macro" version = "0.2.92" @@ -3848,16 +2561,6 @@ version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" -[[package]] -name = "web-sys" -version = "0.3.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - [[package]] name = "webpki-roots" version = "0.26.1" @@ -4103,28 +2806,18 @@ dependencies = [ "memchr", ] -[[package]] -name = "winreg" -version = "0.50.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] - [[package]] name = "xcap" -version = "0.0.5" +version = "0.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "696a57ff11f3b9553881d5d5dc69424e376e87e01cd389ce14e1d0e34cbaa53c" +checksum = "5956bff96dcf8bb25db82779dba3512c25b56fb8aa9376cc5a45eb71c3240b15" dependencies = [ "core-foundation", "core-graphics", "dbus", "image", - "log 0.4.21", - "percent-encoding 2.3.1", + "log", + "percent-encoding", "sysinfo", "thiserror", "windows 0.54.0", diff --git a/Cargo.toml b/Cargo.toml index 56e2662..ee935cb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,53 +6,6 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -activity = { git = "https://github.com/worksoup/cxsign.git", branch = "newsign" } -chrono = "0.4" clap = { version = "4.5", features = ["derive"] } -cookie_store = "0.20" -des = "0.8" -dir = { git = "https://github.com/worksoup/cxsign.git", branch = "newsign" } -directories = "5.0" -futures = "0.3" -hex-literal = "0.4" -hex = "0.4" -#image = "0.25" -inquire = "0.7" -lazy_static = "1.4" -login = { git = "https://github.com/worksoup/cxsign.git", branch = "newsign" } -percent-encoding = "2.3" -rand = "0.8" -reqwest = { version = "0.12", features = [ - "json", - "cookies", - "gzip", - "deflate", - "multipart", -] } -reqwest_cookie_store = "0.7" -rxing = "0.5" -# screenshots = "0.8" -# display-info = "0.5" -xcap = "0.0.5" -serde = "1.0" -serde_json = "1.0" -serde_derive = "1.0" -store = { git = "https://github.com/worksoup/cxsign.git", branch = "newsign" } -sqlite = "0.34" -tokio = { version = "1.35", features = ["full"] } -toml = "0.8" -types = { git = "https://github.com/worksoup/cxsign.git", branch = "newsign" } -tokio-stream = "0.1" -unicode-width = "0.1" -ureq = { version = "2.9", features = ["cookies", "json"] } -user = { git = "https://github.com/worksoup/cxsign.git", branch = "newsign" } -utils = { git = "https://github.com/worksoup/cxsign.git", branch = "newsign" } -num_enum = "0.7" -# url = "2.4" -# strfmt = "*" -# utf8_slice = "1.0" -# trauma = "2.2" -# thread_local = "1.1" -# ctrlc = "3.4" -# regex = "1.10" -# toml = "0.8" +cxsign = { git = "https://github.com/worksoup/cxsign.git", branch = "newsign" } +inquire = "0.7" \ No newline at end of file diff --git a/src/activity/mod.rs b/src/activity/mod.rs deleted file mode 100644 index 68ddada..0000000 --- a/src/activity/mod.rs +++ /dev/null @@ -1,92 +0,0 @@ -pub mod sign; -use crate::session::{course::Struct课程, Struct签到会话}; -use serde_derive::{Deserialize, Serialize}; -use sign::Struct签到; - -#[derive(Debug)] -pub enum Enum活动 { - 签到(Struct签到), - 非签到活动(Struct非签到活动), -} - -impl Enum活动 { - pub async fn 获取课程的所有活动( - 签到会话: &Struct签到会话, - c: Struct课程, - ) -> Result, reqwest::Error> { - let r = crate::protocol::active_list(签到会话, c.clone()).await?; - let r: GetActivityR = r.json().await.unwrap(); - let mut 活动列表 = Vec::new(); - if let Some(data) = r.data { - for ar in data.activeList { - if let Some(other_id) = ar.otherId { - let other_id_i64: i64 = other_id.parse().unwrap(); - if (0..=5).contains(&other_id_i64) { - let 活动id = ar.id.to_string(); - let detail = Struct签到::通过active_id获取签到信息( - 活动id.as_str(), - 签到会话, - ) - .await?; - 活动列表.push(Enum活动::签到(Struct签到 { - 活动id, - 签到名: ar.nameOne, - 课程: c.clone(), - other_id, - 状态码: ar.status, - 开始时间戳: (ar.startTime / 1000) as i64, - 签到信息: detail, - })) - } else { - 活动列表.push(Enum活动::非签到活动(Struct非签到活动 { - id: ar.id.to_string(), - name: ar.nameOne, - course: c.clone(), - status: ar.status, - start_time_secs: (ar.startTime / 1000) as i64, - })) - } - } else { - 活动列表.push(Enum活动::非签到活动(Struct非签到活动 { - id: ar.id.to_string(), - name: ar.nameOne, - course: c.clone(), - status: ar.status, - start_time_secs: (ar.startTime / 1000) as i64, - })) - } - } - } - Ok(活动列表) - } -} - -#[derive(Debug)] -pub struct Struct非签到活动 { - pub id: String, - pub name: String, - pub course: Struct课程, - pub status: i32, - pub start_time_secs: i64, -} - -#[derive(Deserialize, Serialize)] -#[allow(non_snake_case)] -struct ActivityRaw { - nameOne: String, - id: i64, - otherId: Option, - status: i32, - startTime: u64, -} - -#[derive(Deserialize, Serialize)] -#[allow(non_snake_case)] -struct Data { - activeList: Vec, -} - -#[derive(Deserialize, Serialize)] -struct GetActivityR { - data: Option, -} diff --git a/src/activity/sign.rs b/src/activity/sign.rs deleted file mode 100644 index 2b07bd0..0000000 --- a/src/activity/sign.rs +++ /dev/null @@ -1,444 +0,0 @@ -use crate::protocol; -use serde_derive::Deserialize; - -use crate::protocol::get_attend_info; -use crate::session::{course::Struct课程, Struct签到会话}; -use crate::utils::address::Struct位置; -use crate::utils::photo::Struct在线图片; -use crate::utils::获取unicode字符串定宽显示时应当设置的宽度; - -pub enum Enum签到类型 { - // 拍照签到 - 拍照签到, - // 普通签到 - 普通签到, - // 二维码签到 - 二维码签到, - // 手势签到 - 手势签到, - // 位置签到 - 位置签到, - // 签到码签到 - 签到码签到, - // 未知 - 非已知签到, -} - -#[derive(Debug, PartialEq, Eq, Hash)] -pub struct Struct签到 { - pub 活动id: String, - pub 签到名: String, - pub 课程: Struct课程, - pub other_id: String, - pub 状态码: i32, - pub 开始时间戳: i64, - pub 签到信息: Struct签到信息, -} - -#[derive(Debug)] -pub enum Enum签到结果 { - 成功, - 失败 { 失败信息: String }, -} - -#[derive(num_enum::FromPrimitive, num_enum::IntoPrimitive)] -#[repr(i64)] -pub enum Enum签到后状态 { - #[default] - 未签 = 0, - 签到成功 = 1, - 教师代签 = 2, - 请假 = 4, - 缺勤 = 5, - 病假 = 7, - 事假 = 8, - 迟到 = 9, - 早退 = 10, - 签到已过期 = 11, - 公假 = 12, -} - -impl Struct签到 { - pub async fn 获取签到后状态( - &self, - 签到会话: &Struct签到会话, - ) -> Result { - let r = get_attend_info(&签到会话, &self.活动id).await?; - #[derive(Deserialize)] - struct Data原始数据 { - #[allow(unused)] - status: i64, - } - #[derive(Deserialize)] - struct 原始数据 { - #[allow(unused)] - data: Data原始数据, - } - let r: 原始数据 = r.json().await.unwrap(); - Ok(r.data.status.into()) - } - pub fn speculate_type_by_text(text: &str) -> Enum签到类型 { - if text.contains("拍照") { - Enum签到类型::拍照签到 - } else if text.contains("位置") { - Enum签到类型::位置签到 - } else if text.contains("二维码") { - Enum签到类型::二维码签到 - } else if text.contains("手势") { - // ? - Enum签到类型::手势签到 - } else if text.contains("签到码") { - // ? - Enum签到类型::签到码签到 - } else { - Enum签到类型::普通签到 - } - } - pub fn 通过文本判断签到结果(text: &str) -> Enum签到结果 { - match text { - "success" => Enum签到结果::成功, - 信息 => Enum签到结果::失败 { - 失败信息: if 信息.is_empty() { - "错误信息为空,根据有限的经验,这通常意味着二维码签到的 `enc` 字段已经过期。" - } else { - 信息 - } - .into(), - }, - } - } - async fn 检查签到码是否正确( - session: &Struct签到会话, - active_id: &str, - signcode: &str, - ) -> Result { - #[derive(Deserialize)] - struct CheckR { - #[allow(unused)] - result: i64, - } - let CheckR { result } = crate::protocol::check_signcode(session, active_id, signcode) - .await? - .json() - .await - .unwrap(); - Ok(result == 1) - } -} - -#[derive(Debug)] -pub struct SignActivityRaw { - pub id: String, - pub name: String, - pub course: Struct课程, - pub other_id: String, - pub status: i32, - pub start_time_secs: i64, -} - -#[derive(Debug, PartialEq, Eq, Hash)] -pub struct Struct签到信息 { - is_photo: bool, - is_refresh_qrcode: bool, - c: String, -} - -impl Struct签到 { - pub fn display(&self, already_course: bool) { - let name_width = - 获取unicode字符串定宽显示时应当设置的宽度(self.签到名.as_str(), 12); - if already_course { - println!( - "id: {}, name: {:>width$}, status: {}, time: {}, ok: {}", - self.活动id, - self.签到名, - self.状态码, - chrono::DateTime::from_timestamp(self.开始时间戳, 0).unwrap(), - self.是否有效(), - width = name_width, - ); - } else { - println!( - "id: {}, name: {:>width$}, status: {}, time: {}, ok: {}, course: {}/{}", - self.活动id, - self.签到名, - self.状态码, - chrono::DateTime::from_timestamp(self.开始时间戳, 0).unwrap(), - self.是否有效(), - self.课程.get_课程号(), - self.课程.get_课程名(), - width = name_width, - ); - } - } - pub fn 是否有效(&self) -> bool { - let time = std::time::SystemTime::from( - chrono::DateTime::from_timestamp(self.开始时间戳, 0).unwrap(), - ); - let one_hour = std::time::Duration::from_secs(7200); - self.状态码 == 1 && std::time::SystemTime::now().duration_since(time).unwrap() < one_hour - } - - fn 是否为拍照签到(&self) -> bool { - self.签到信息.is_photo - } - - pub fn 二维码是否刷新(&self) -> bool { - self.签到信息.is_refresh_qrcode - } - - pub fn get_二维码签到时的c参数(&self) -> &str { - &self.签到信息.c - } - - pub async fn 通过active_id获取签到信息( - active_id: &str, - session: &Struct签到会话, - ) -> Result { - #[derive(Deserialize)] - #[allow(non_snake_case)] - struct GetSignDetailR { - ifPhoto: i64, - ifRefreshEwm: i64, - signCode: Option, - } - let r = protocol::sign_detail(session, active_id).await?; - let GetSignDetailR { - ifPhoto, - ifRefreshEwm, - signCode, - } = r.json().await?; - Ok(Struct签到信息 { - is_photo: ifPhoto > 0, - is_refresh_qrcode: ifRefreshEwm > 0, - c: if let Some(c) = signCode { c } else { "".into() }, - }) - } - async fn 预签到_analysis部分( - &self, - active_id: &str, - session: &Struct签到会话, - response_of_presign: reqwest::Response, - ) -> Result { - let response_of_analysis = protocol::analysis(session, active_id).await?; - let data = response_of_analysis.text().await.unwrap(); - let code = { - let start_of_code = data.find("code='+'").unwrap() + 8; - let data = &data[start_of_code..data.len()]; - let end_of_code = data.find('\'').unwrap(); - &data[0..end_of_code] - }; - #[cfg(debug_assertions)] - println!("code: {code:?}"); - let _response_of_analysis2 = protocol::analysis2(session, code).await?; - #[cfg(debug_assertions)] - println!( - "analysis 结果:{}", - _response_of_analysis2.text().await.unwrap() - ); - let presign_status = { - let html = response_of_presign.text().await.unwrap(); - #[cfg(debug_assertions)] - println!("预签到请求结果:{html}"); - if let Some(start_of_statuscontent_h1) = html.find("id=\"statuscontent\"") { - let html = &html[start_of_statuscontent_h1 + 19..html.len()]; - let end_of_statuscontent_h1 = html.find('<').unwrap(); - let id为statuscontent的h1的内容 = html[0..end_of_statuscontent_h1].trim(); - if id为statuscontent的h1的内容 == "签到成功" { - Enum签到结果::成功 - } else { - Enum签到结果::失败 { - 失败信息: id为statuscontent的h1的内容.into(), - } - } - } else { - Enum签到结果::失败 { - 失败信息: html.into(), - } - } - }; - tokio::time::sleep(std::time::Duration::from_millis(500)).await; - Ok(presign_status) - } - pub async fn 预签到( - &self, - session: &Struct签到会话, - ) -> Result { - let active_id = self.活动id.as_str(); - let uid = session.get_uid(); - let response_of_presign = - protocol::pre_sign(session, self.课程.clone(), active_id, uid, false, "", "").await?; - println!("用户[{}]预签到已请求。", session.get_用户真名()); - self.预签到_analysis部分(active_id, session, response_of_presign) - .await - } - pub async fn 预签到_对于有刷新二维码签到( - &self, - c: &str, - enc: &str, - session: &Struct签到会话, - ) -> Result { - let active_id = self.活动id.as_str(); - let uid = session.get_uid(); - let response_of_presign = - protocol::pre_sign(session, self.课程.clone(), active_id, uid, true, c, enc).await?; - println!("用户[{}]预签到已请求。", session.get_用户真名()); - self.预签到_analysis部分(active_id, session, response_of_presign) - .await - } - pub fn get_sign_type(&self) -> Enum签到类型 { - match self.other_id.parse::().unwrap_or_else(|e| { - eprintln!("{}", self.other_id); - eprintln!("{}", self.课程.get_课程名()); - panic!("{e}") - }) { - 0 => { - if self.是否为拍照签到() { - Enum签到类型::拍照签到 - } else { - Enum签到类型::普通签到 - } - } - 1 => Enum签到类型::非已知签到, - 2 => Enum签到类型::二维码签到, - 3 => Enum签到类型::手势签到, - 4 => Enum签到类型::位置签到, - 5 => Enum签到类型::签到码签到, - _ => Enum签到类型::非已知签到, - } - } -} - -impl Struct签到 { - pub async fn 作为普通签到处理( - &self, - session: &Struct签到会话, - ) -> Result { - let r = protocol::general_sign(session, self.活动id.as_str()).await?; - Ok(Self::通过文本判断签到结果( - &r.text().await.unwrap(), - )) - } - pub async fn 作为签到码签到处理( - &self, - session: &Struct签到会话, - signcode: &str, - ) -> Result { - if Self::检查签到码是否正确(session, &self.活动id, signcode).await? { - let r = protocol::signcode_sign(session, self.活动id.as_str(), signcode).await?; - Ok(Self::通过文本判断签到结果( - &r.text().await.unwrap(), - )) - } else { - Ok(Enum签到结果::失败 { - 失败信息: "签到码或手势不正确".into(), - }) - } - } - pub async fn 作为位置签到处理( - &self, - address: &Struct位置, - session: &Struct签到会话, - 是否限定位置: bool, - ) -> Result { - let r = - protocol::location_sign(session, address, self.活动id.as_str(), 是否限定位置).await?; - Ok(Self::通过文本判断签到结果( - &r.text().await.unwrap(), - )) - } - pub async fn 作为拍照签到处理( - &self, - photo: &Struct在线图片, - session: &Struct签到会话, - ) -> Result { - let r = protocol::photo_sign(session, self.活动id.as_str(), photo.get_object_id()).await?; - Ok(Self::通过文本判断签到结果( - &r.text().await.unwrap(), - )) - } - pub async fn 作为二维码签到处理( - &self, - enc: &str, - address: &Struct位置, - session: &Struct签到会话, - ) -> Result { - let r = protocol::qrcode_sign(session, enc, self.活动id.as_str(), address).await?; - Ok(Self::通过文本判断签到结果( - &r.text().await.unwrap(), - )) - } -} - -impl Struct签到 { - // pub async fn chat_group_pre_sign( - // &self, - // chat_id: &str, - // tuid: &str, - // session: &Struct签到会话, - // ) -> Result<(), reqwest::Error> { - // let id = self.活动id.as_str(); - // let uid = session.get_uid(); - // let _r = protocol::chat_group_pre_sign(session, id, uid, chat_id, tuid).await?; - - // Ok(()) - // } - // pub async fn chat_group_general_sign( - // &self, - // session: &Struct签到会话, - // ) -> Result<(), reqwest::Error> { - // let r = - // protocol::chat_group_general_sign(session, self.活动id.as_str(), session.get_uid()) - // .await?; - // println!("{:?}", r.text().await.unwrap()); - // Ok(()) - // } - // pub async fn chat_group_signcode_sign( - // &self, - // session: &Struct签到会话, - // signcode: &str, - // ) -> Result<(), reqwest::Error> { - // let r = protocol::chat_group_signcode_sign( - // session, - // self.活动id.as_str(), - // session.get_uid(), - // signcode, - // ) - // .await?; - // println!("{:?}", r.text().await.unwrap()); - // Ok(()) - // } - // pub async fn chat_group_location_sign( - // &self, - // address: &Struct位置, - // session: &Struct签到会话, - // ) -> Result<(), reqwest::Error> { - // let r = protocol::chat_group_location_sign( - // session, - // address.get_地址(), - // self.活动id.as_str(), - // session.get_uid(), - // address.get_纬度(), - // address.get_经度(), - // ) - // .await?; - // println!("{:?}", r.text().await.unwrap()); - // Ok(()) - // } - // pub async fn chat_group_photo_sign( - // &self, - // photo: &Struct在线图片, - // session: &Struct签到会话, - // ) -> Result<(), reqwest::Error> { - // let r = protocol::chat_group_photo_sign( - // session, - // self.活动id.as_str(), - // session.get_uid(), - // photo.get_object_id(), - // ) - // .await?; - // println!("{:?}", r.text().await.unwrap()); - - // Ok(()) - // } -} diff --git a/src/cli/location.rs b/src/cli/location.rs index 394829a..8812460 100644 --- a/src/cli/location.rs +++ b/src/cli/location.rs @@ -1,10 +1,27 @@ use std::path::PathBuf; -use crate::utils::{ - address::{Struct位置, 为数据库添加位置}, - sql::DataBase, +use cxsign::{ + store::{ + tables::{AliasTable, LocationTable}, + DataBase, DataBaseTableTrait, + }, + Location, }; +fn 为数据库添加位置(table: &LocationTable, course_id: i64, 位置: &Location) -> i64 { + // 为指定课程添加位置。 + let mut 位置id = 0_i64; + loop { + if table.has_location(位置id) { + 位置id += 1; + continue; + } + table.add_location_or(位置id, course_id, 位置, |_, _, _, _| {}); + break; + } + 位置id +} + pub struct Struct位置操作使用的信息 { pub location_id: Option, pub list: bool, @@ -21,6 +38,8 @@ pub struct Struct位置操作使用的信息 { } pub fn location(db: &DataBase, 位置操作使用的信息: Struct位置操作使用的信息) { + let location_table = LocationTable::from_ref(db); + let alias_table = AliasTable::from_ref(db); fn confirm(msg: &str) -> bool { inquire::Confirm::new(msg) .with_default(false) @@ -68,13 +87,13 @@ pub fn location(db: &DataBase, 位置操作使用的信息: Struct位置操作 } } let 位置id = 为数据库添加位置( - &db, + &location_table, course_id, - &Struct位置::从字符串解析(&new).unwrap_or_else(|e| panic!("{}", e)), + &Location::parse(&new).unwrap_or_else(|e| panic!("{}", e)), ); if let Some(alias) = alias { - db.add_alias_or(&alias, 位置id, |db, alias, 位置id| { - db.update_alias(alias, 位置id); + alias_table.add_alias_or(&alias, 位置id, |alias_table, alias, 位置id| { + alias_table.update_alias(alias, 位置id); }) } } else if let Some(import) = import { @@ -109,15 +128,19 @@ pub fn location(db: &DataBase, 位置操作使用的信息: Struct位置操作 "警告:第 {line_count} 行课程号解析出错,该位置将尝试添加为全局位置!" ); } - if let Ok(位置) = Struct位置::从字符串解析(data[1]) { - let 位置id = 为数据库添加位置(&db, course_id, &位置); + if let Ok(位置) = Location::parse(data[1]) { + let 位置id = 为数据库添加位置(&location_table, course_id, &位置); if data.len() > 2 { let 别名列表: Vec<_> = data[2].split('/').map(|s| s.trim()).collect(); for 别名 in 别名列表 { if !别名.is_empty() { - db.add_alias_or(别名, 位置id, |db, 别名, 位置id| { - db.update_alias(别名, 位置id); - }) + alias_table.add_alias_or( + 别名, + 位置id, + |alias_table, 别名, 位置id| { + alias_table.update_alias(别名, 位置id); + }, + ) } } } @@ -146,10 +169,10 @@ pub fn location(db: &DataBase, 位置操作使用的信息: Struct位置操作 "本行命令将被解释为导出位置。可同时起效的选项有 `-l, --list`, 其余选项将不起效。" ) } - let 位置列表 = db.获取所有位置(); + let 位置列表 = location_table.get_locations(); let mut contents = String::new(); for (位置id, 位置) in 位置列表 { - let aliases = db.get_aliases(位置id); + let aliases = alias_table.get_aliases(位置id); let mut aliases_contents = String::new(); if !aliases.is_empty() { aliases_contents.push_str(&aliases[0]); @@ -173,9 +196,9 @@ pub fn location(db: &DataBase, 位置操作使用的信息: Struct位置操作 "本行命令将被解释为设置别名。需要 `location_id` 参数。可同时起效的选项有 `-l, --list`, 其余选项将不起效。" ) } - if 位置id < 0 || db.是否存在为某id的位置(位置id) { - db.add_alias_or(alias, 位置id, |db, alias, 位置id| { - db.update_alias(alias, 位置id); + if 位置id < 0 || location_table.has_location(位置id) { + alias_table.add_alias_or(alias, 位置id, |alias_table, alias, 位置id| { + alias_table.update_alias(alias, 位置id); }); } else { eprintln!("警告:不能为不存在的位置添加别名!将不做任何事。") @@ -194,8 +217,8 @@ pub fn location(db: &DataBase, 位置操作使用的信息: Struct位置操作 "本行命令将被解释为删除别名。可同时起效的选项有 `-l, --list`, 其余选项将不起效。" ) } - if db.has_alias(&alias) { - db.delete_alias(&alias); + if alias_table.has_alias(&alias) { + alias_table.delete_alias(&alias); } else { eprintln!("警告:该别名并不存在,将不做任何事情。"); } @@ -205,24 +228,24 @@ pub fn location(db: &DataBase, 位置操作使用的信息: Struct位置操作 "本行命令将被解释为删除地址。可同时起效的选项有 `-l, --list`, 其余选项将不起效。" ) } - db.删除为某id的位置(位置id); + location_table.delete_location(位置id); } } else if remove_aliases || remove_locations { if course.is_some() && global { eprintln!("选项`-c, --course` 和 `-g, --global` 不会同时起效,将解释为前者。") } let 待操作位置列表: Vec<_> = if let Some(course_id) = course { - db.获取特定课程的位置和其id(course_id) + location_table.get_location_map_by_course(course_id) .keys() .map(|id| *id) .collect() } else if global { - db.获取所有位置() + location_table.get_locations() .keys() .filter_map(|id| if (*id) == -1 { Some(*id) } else { None }) .collect() } else { - db.获取所有位置().keys().map(|id| *id).collect() + location_table.get_locations().keys().map(|id| *id).collect() }; if !yes { let ans = confirm("警告:是否删除?"); @@ -252,9 +275,9 @@ pub fn location(db: &DataBase, 位置操作使用的信息: Struct位置操作 } } for 位置id in 待操作位置列表 { - let aliases = db.get_aliases(位置id); + let aliases = alias_table.get_aliases(位置id); for alias in aliases { - db.delete_alias(&alias); + alias_table.delete_alias(&alias); } } } else { @@ -264,14 +287,14 @@ pub fn location(db: &DataBase, 位置操作使用的信息: Struct位置操作 ) } for 位置id in 待操作位置列表 { - db.删除为某id的位置(位置id); + location_table.delete_location(位置id); } } } if list { if global { // 列出所有全局位置。 - let 位置列表 = db.获取所有位置(); + let 位置列表 = location_table.get_locations(); for 位置 in 位置列表 { if 位置.1 .0 == -1 { println!( @@ -279,31 +302,31 @@ pub fn location(db: &DataBase, 位置操作使用的信息: Struct位置操作 位置.0, 位置.1 .0, 位置.1 .1, - db.get_aliases(位置.0) + alias_table.get_aliases(位置.0) ) } } } else if let Some(course_id) = course { // 列出指定课程的位置。 - let 位置列表 = db.获取特定课程的位置和其id(course_id); + let 位置列表 = location_table.get_location_map_by_course(course_id); for 位置 in 位置列表 { println!( "位置id: {}, 位置: {},\n\t别名: {:?}", 位置.0, 位置.1, - db.get_aliases(位置.0) + alias_table.get_aliases(位置.0) ) } } else { // 列出所有位置。 - let 位置列表 = db.获取所有位置(); + let 位置列表 = location_table.get_locations(); for 位置 in 位置列表 { println!( "位置id: {}, 课程号: {}, 位置: {},\n\t别名: {:?}", 位置.0, 位置.1 .0, 位置.1 .1, - db.get_aliases(位置.0) + alias_table.get_aliases(位置.0) ) } } diff --git a/src/cli/mod.rs b/src/cli/mod.rs index ab10f8a..da4a35a 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -1,171 +1,22 @@ pub mod arg; pub mod location; -mod sign; -mod single_sign; -use crate::activity::sign::{Enum签到类型, Enum签到结果, Struct签到}; -use crate::utils; -use crate::utils::sign::截屏获取二维码签到所需参数; -use crate::{ - session::Struct签到会话, - utils::{address::Struct位置, sql::DataBase}, +use cxsign::{ + store::{tables::AccountTable, DataBase, DataBaseTableTrait}, + DefaultGestureOrSigncodeSignner, DefaultLocationSignner, DefaultNormalOrRawSignner, + DefaultPhotoSignner, DefaultQrCodeSignner, Session, Sign, SignResult, SignTrait, SignnerTrait, }; -use std::fs::DirEntry; -use std::{collections::HashMap, path::PathBuf}; +use std::collections::HashMap; use self::arg::CliArgs; +use crate::tools; -pub fn 通过目录决定图片路径(图片所在目录: &PathBuf) -> Option { - loop { - let 答案 = utils::请求确认("二维码图片是否就绪?", "本程序会读取 `--pic` 参数所指定的路径下最新修改的图片。你可以趁现在获取这张图片,然后按下回车进行签到。"); - if 答案 { - break; - } - } - let 图片路径 = if let Ok(图片所在目录) = std::fs::read_dir(图片所在目录) { - let mut 目录下所有文件: Vec = 图片所在目录 - .filter_map(|k| { - let r = k.as_ref().is_ok_and(|k| { - k.file_type().is_ok_and(|t| { - t.is_file() && { - let 文件名 = k.file_name(); - let 文件后缀名 = 文件名.to_str().unwrap().split('.').last().unwrap(); - 文件后缀名 == "png" || 文件后缀名 == "jpg" - } - }) - }); - if r { - Some(unsafe { k.unwrap_unchecked() }) - } else { - None - } - }) - .collect(); - if 目录下所有文件.is_empty() { - eprintln!("文件夹下没有图片!(只支持 `*.png` 文件或 `*.jpg` 文件。)"); - None - } else { - 目录下所有文件.sort_by(|a, b| { - b.metadata() - .unwrap() - .modified() - .unwrap() - .cmp(&a.metadata().unwrap().modified().unwrap()) - }); - Some(目录下所有文件[0].path()) - } - } else { - eprintln!("遍历文件夹失败!"); - None - }; - 图片路径 -} - -async fn 通过位置字符串决定位置( - db: &DataBase, - 位置字符串: &Option, -) -> Result { - if let Some(ref 位置字符串) = 位置字符串 { - let 位置字符串 = 位置字符串.trim(); - if let Ok(位置) = 位置字符串.parse() { - Ok(位置) - } else if let Some(位置) = db.获取为某别名的位置(位置字符串) { - Ok(位置) - } else if let Ok(位置id) = 位置字符串.parse() { - if db.是否存在为某id的位置(位置id) { - let (_, 位置) = db.获取为某id的位置(位置id); - Ok(位置) - } else { - Err(位置字符串.to_owned()) - } - } else { - Err(位置字符串.to_owned()) - } - } else { - Err("".to_string()) - } -} - -fn 打印对于sign无法获取二维码时的错误信息(sign: &Struct签到) { - eprintln!( - "所有用户在二维码签到[{}]中签到失败!二维码签到需要提供签到二维码!", - sign.签到名 - ); -} - -async fn qrcode_sign_by_pic_arg<'a>( - 签到: &Struct签到, - pic: &PathBuf, - db: &DataBase, - 位置: &Option, - sessions: &'a Vec<&Struct签到会话>, - 是否禁用随机偏移: bool, - 自动获取时的位置地址名: &str, -) -> Result, reqwest::Error> { - let mut 自动获取时的位置地址名2 = "".to_string(); - let 位置列表 = match 通过位置字符串决定位置(db, 位置).await { - Ok(位置) => { - vec![位置] - } - Err(位置字符串) => { - if 位置字符串.is_empty() { - let mut 位置列表 = db.获取特定课程的位置(签到.课程.get_课程号()); - let mut 全局位置列表 = db.获取特定课程的位置(-1); - 位置列表.append(&mut 全局位置列表); - 位置列表 - } else { - if 自动获取时的位置地址名.is_empty() { - 自动获取时的位置地址名2 = 位置字符串; - } else { - 自动获取时的位置地址名2 = 自动获取时的位置地址名.to_owned(); - } - vec![] - } - } - }; - let mut states = HashMap::new(); - if std::fs::metadata(pic).unwrap().is_dir() { - if let Some(pic) = 通过目录决定图片路径(pic) - && let Some(enc) = utils::sign::扫描路径中二维码并获取签到所需参数( - pic.to_str().unwrap(), - ) - { - states = sign::二维码签到( - 签到, - 签到.get_二维码签到时的c参数(), - &enc, - &位置列表, - sessions, - 是否禁用随机偏移, - &自动获取时的位置地址名2, - ) - .await?; - } else { - 打印对于sign无法获取二维码时的错误信息(签到); - } - } else if let Some(enc) = - utils::sign::扫描路径中二维码并获取签到所需参数(pic.to_str().unwrap()) - { - states = sign::二维码签到( - 签到, - 签到.get_二维码签到时的c参数(), - &enc, - &位置列表, - sessions, - 是否禁用随机偏移, - &自动获取时的位置地址名2, - ) - .await?; - } - Ok(states) -} - -async fn 区分签到类型并进行签到<'a>( - 签到: &Struct签到, +fn 区分签到类型并进行签到<'a>( + 签到: &mut Sign, db: &DataBase, - 签到会话列表: &'a Vec<&Struct签到会话>, + 签到会话列表: Vec<&Session>, 签到可能使用的信息: &CliArgs, -) -> Result<(), reqwest::Error> { +) -> Result<(), cxsign::Error> { let CliArgs { 位置字符串, 图片或图片路径: pic, @@ -173,132 +24,83 @@ async fn 区分签到类型并进行签到<'a>( 是否精确识别二维码, 是否禁用随机偏移, } = 签到可能使用的信息; - let 签到类型 = 签到.get_sign_type(); let mut 签到结果列表 = HashMap::new(); - - match 签到类型 { - Enum签到类型::拍照签到 => { - let pic = if let Some(pic) = pic - && let Ok(metadata) = std::fs::metadata(pic) - { - if metadata.is_dir() { - 通过目录决定图片路径(pic) - } else { - Some(pic.to_owned()) - } - } else { - None - }; - 签到结果列表 = sign::拍照签到(签到, &pic, 签到会话列表).await?; + let sessions = 签到会话列表.into_iter(); + match 签到 { + Sign::Photo(ps) => { + let signner = DefaultPhotoSignner::new(pic); + 签到结果列表 = signner.sign(ps, sessions)?; } - Enum签到类型::普通签到 => { - 签到结果列表 = sign::普通签到(签到, 签到会话列表).await?; + Sign::Normal(ns) => { + 签到结果列表 = DefaultNormalOrRawSignner.sign(ns, sessions)?; } - Enum签到类型::二维码签到 => { - let mut 自动获取时的位置地址名 = "".to_string(); - let 位置列表 = match 通过位置字符串决定位置(db, 位置字符串).await { - Ok(位置) => { - vec![位置] - } - Err(位置字符串) => { - if 位置字符串.is_empty() { - let mut 全局位置列表 = db.获取特定课程的位置(-1); - let mut 位置列表 = db.获取特定课程的位置(签到.课程.get_课程号()); - 位置列表.append(&mut 全局位置列表); - 位置列表 - } else { - 自动获取时的位置地址名 = 位置字符串; - vec![] - } - } - }; - // 如果有 pic 参数,那么使用它。 - if let Some(pic) = pic { - 签到结果列表 = qrcode_sign_by_pic_arg( - 签到, - pic, - db, - 位置字符串, - 签到会话列表, - *是否禁用随机偏移, - &自动获取时的位置地址名, - ) - .await?; - } - // 如果没有则试图截屏。 - else if let Some(enc) = - 截屏获取二维码签到所需参数(签到.二维码是否刷新(), *是否精确识别二维码) - { - 签到结果列表 = sign::二维码签到( - 签到, - 签到.get_二维码签到时的c参数(), - &enc, - &位置列表, - 签到会话列表, - *是否禁用随机偏移, - &自动获取时的位置地址名, - ) - .await?; - } - // 这下是真没有了。 - else { - 打印对于sign无法获取二维码时的错误信息(签到); - } + Sign::QrCode(qs) => { + let signner = DefaultQrCodeSignner::new( + db, + 位置字符串, + pic, + &None, + *是否精确识别二维码, + *是否禁用随机偏移, + ); + 签到结果列表 = signner.sign(qs, sessions)?; } - Enum签到类型::位置签到 => { - if let Ok(位置) = 通过位置字符串决定位置(db, 位置字符串).await { - println!("解析位置成功,将使用位置 `{}` 签到。", 位置); - 签到结果列表 = - sign::位置签到(签到, &vec![位置], false, 签到会话列表, *是否禁用随机偏移) - .await?; + Sign::Gesture(gs) => { + if let Some(signcode) = 签到码 { + let signner = DefaultGestureOrSigncodeSignner::new(signcode); + 签到结果列表 = signner.sign(gs, sessions)?; } else { - let mut 位置列表 = db.获取特定课程的位置(签到.课程.get_课程号()); - let mut 全局位置列表 = db.获取特定课程的位置(-1); - 位置列表.append(&mut 全局位置列表); - 签到结果列表 = - sign::位置签到(签到, &位置列表, true, 签到会话列表, *是否禁用随机偏移).await?; - }; + eprintln!( + "所有用户在手势签到[{}]中签到失败!需要提供签到码!", + gs.as_inner().name + ) + } } - Enum签到类型::非已知签到 => { - eprintln!("签到活动[{}]为无效签到类型!", 签到.签到名); + Sign::Location(ls) => { + let signner = DefaultLocationSignner::new(db, 位置字符串, *是否禁用随机偏移); + 签到结果列表 = signner.sign(ls, sessions)?; } - signcode_sign_type => { + Sign::Signcode(ss) => { if let Some(signcode) = 签到码 { - 签到结果列表 = sign::签到码签到(签到, signcode, 签到会话列表).await?; + let signner = DefaultGestureOrSigncodeSignner::new(signcode); + 签到结果列表 = signner.sign(ss, sessions)?; } else { - let sign_type_str = match signcode_sign_type { - Enum签到类型::手势签到 => "手势", - Enum签到类型::签到码签到 => "签到码", - _ => unreachable!(), - }; eprintln!( - "所有用户在{sign_type_str}签到[{}]中签到失败!需要提供签到码!", - 签到.签到名 + "所有用户在手势签到[{}]中签到失败!需要提供签到码!", + ss.as_inner().name ) } } - }; + Sign::Unknown(us) => { + eprintln!("签到活动[{}]为无效签到类型!", us.name); + 签到结果列表 = DefaultNormalOrRawSignner.sign(us, sessions)?; + } + } if !签到结果列表.is_empty() { - println!("签到活动[{}]签到结果:", 签到.签到名); + println!("签到活动[{}]签到结果:", 签到.as_inner().name); for (用户真名, 签到结果) in 签到结果列表 { - if let Enum签到结果::失败 { 失败信息 } = 签到结果 { - eprintln!("\t用户[{}]签到失败!失败信息:[{:?}]", 用户真名, 失败信息); + if let SignResult::Fail { msg } = 签到结果 { + eprintln!( + "\t用户[{}]签到失败!失败信息:[{:?}]", + 用户真名.get_stu_name(), + msg + ); } else { - println!("\t用户[{}]签到成功!", 用户真名,); + println!("\t用户[{}]签到成功!", 用户真名.get_stu_name(),); } } } Ok(()) } -pub async fn 签到( +pub fn 签到( db: &DataBase, active_id: Option, 账号列表字符串: Option, 签到可能使用的信息: CliArgs, -) -> Result<(), reqwest::Error> { +) -> Result<(), cxsign::Error> { let mut 是否指定accounts参数 = false; - let 数据库完整账号列表 = db.get_accounts(); + let 数据库完整账号列表 = AccountTable::from_ref(db).get_accounts(); let 签到所需的账号列表: Vec<&str> = if let Some(账号列表字符串) = &账号列表字符串 { 是否指定accounts参数 = true; @@ -306,15 +108,15 @@ pub async fn 签到( } else { 数据库完整账号列表.keys().map(|s| s.as_str()).collect() }; - let sessions = utils::account::通过账号获取签到会话(&db, &签到所需的账号列表).await; - let (有效签到列表, 其他签到列表) = utils::sign::获取所有签到(&sessions).await; + let sessions = tools::通过账号获取签到会话(&db, &签到所需的账号列表); + let (有效签到列表, 其他签到列表) = tools::获取所有签到(&sessions); let signs = if let Some(active_id) = active_id { let s1 = 有效签到列表 - .iter() - .find(|kv| kv.0.活动id == active_id.to_string()); + .into_iter() + .find(|kv| kv.0.as_inner().active_id == active_id.to_string()); let s2 = 其他签到列表 - .iter() - .find(|kv| kv.0.活动id == active_id.to_string()); + .into_iter() + .find(|kv| kv.0.as_inner().active_id == active_id.to_string()); let (签到_需要处理的, 所有sessions_对应于_签到_需要处理的) = { if let Some(s1) = s1 { s1 @@ -331,7 +133,7 @@ pub async fn 签到( let mut 账号对象_签到所需的_vec = Vec::new(); for (uname, session) in 所有sessions_对应于_签到_需要处理的 { if 签到所需的账号列表.contains(&uname.as_str()) { - 账号对象_签到所需的_vec.push(*session) + 账号对象_签到所需的_vec.push(session) } } let mut map = HashMap::new(); @@ -339,9 +141,9 @@ pub async fn 签到( map } else { let mut signs = HashMap::new(); - for (sign, full_sessions) in &有效签到列表 { + for (sign, full_sessions) in 有效签到列表 { let mut 账号对象_签到所需的_vec = Vec::new(); - for (uname, session) in full_sessions { + for (uname, session) in &full_sessions { if 签到所需的账号列表.contains(&uname.as_str()) { 账号对象_签到所需的_vec.push(*session) } @@ -350,9 +152,9 @@ pub async fn 签到( } signs }; - - for (sign, sessions) in signs { - 区分签到类型并进行签到(sign, db, &sessions, &签到可能使用的信息).await?; + let iter: Vec<(Sign, Vec<&Session>)> = signs.into_iter().collect(); + for (mut sign, sessions) in iter { + 区分签到类型并进行签到(&mut sign, db, sessions, &签到可能使用的信息)?; } Ok(()) } diff --git a/src/cli/sign.rs b/src/cli/sign.rs deleted file mode 100644 index 7941bbb..0000000 --- a/src/cli/sign.rs +++ /dev/null @@ -1,164 +0,0 @@ -use std::{collections::HashMap, path::PathBuf}; - -use futures::{stream::FuturesUnordered, StreamExt}; - -use crate::utils::address::Struct位置及范围; -use crate::{ - activity::sign::{Enum签到结果, Struct签到}, - session::Struct签到会话, - utils::{address::Struct位置, photo::Struct在线图片}, -}; - -use super::single_sign; - -//noinspection ALL -pub async fn 普通签到<'a>( - 签到: &Struct签到, - 签到会话列表: &'a Vec<&Struct签到会话>, -) -> Result, reqwest::Error> { - let mut 用户真名_签到结果_哈希表 = HashMap::new(); - let mut tasks = FuturesUnordered::new(); - for 签到会话 in 签到会话列表 { - tasks.push(single_sign::通用签到_单个账号(签到, 签到会话)); - } - while let Some(tmp) = tasks.next().await { - let (用户真名, 签到结果) = tmp?; - 用户真名_签到结果_哈希表.insert(用户真名, 签到结果); - } - Ok(用户真名_签到结果_哈希表) -} - -pub async fn 拍照签到<'a>( - 签到: &Struct签到, - pic: &Option, - 签到会话列表: &'a Vec<&Struct签到会话>, -) -> Result, reqwest::Error> { - let mut 用户真名_签到结果_哈希表 = HashMap::new(); - let mut 索引到在线图片 = HashMap::new(); - let mut 签到到索引 = HashMap::new(); - if let Some(pic) = &pic { - let 在线图片 = Struct在线图片::上传文件获取(签到会话列表[0], pic).await; - 索引到在线图片.insert(0, 在线图片); - for session in 签到会话列表 { - 签到到索引.insert(session, 0); - } - } else { - let mut 索引 = 0; - for 签到会话 in 签到会话列表 { - let 在线图片 = Struct在线图片::默认(签到会话).await; - if let Some(在线图片) = 在线图片 { - 索引到在线图片.insert(索引, 在线图片); - 索引 += 1; - } else { - 签到到索引.insert(签到会话, 索引); - } - } - } - let mut tasks = FuturesUnordered::new(); - for 签到会话 in 签到会话列表 { - tasks.push(single_sign::拍照签到_单个账号( - 签到, - &索引到在线图片[&签到到索引[签到会话]], - 签到会话, - )); - } - while let Some(tmp) = tasks.next().await { - let (用户名称, 签到结果) = tmp?; - 用户真名_签到结果_哈希表.insert(用户名称, 签到结果); - } - Ok(用户真名_签到结果_哈希表) -} - -pub async fn 二维码签到<'a>( - 签到: &Struct签到, - c: &str, - enc: &str, - 位置列表: &Vec, - 签到会话列表: &'a Vec<&Struct签到会话>, - 是否禁用随机偏移: bool, - 自动获取时的位置地址名: &str, -) -> Result, reqwest::Error> { - let mut 用户真名_签到结果_哈希表 = HashMap::new(); - let mut tasks = FuturesUnordered::new(); - let 预设位置列表 = Struct位置及范围::从log获取位置列表(签到会话列表[0], &签到.课程).await?; - let 预设位置 = 预设位置列表.get(&签到.活动id).map(|l| { - if 是否禁用随机偏移 { - l.获取位置() - } else { - l.获取随机偏移后的位置() - } - }); - let 预设位置 = 预设位置.map(|l| { - if 自动获取时的位置地址名.is_empty() { - l - } else { - Struct位置::new( - 自动获取时的位置地址名, - l.get_经度(), - l.get_纬度(), - l.get_海拔(), - ) - } - }); - for 签到会话 in 签到会话列表 { - tasks.push(single_sign::二维码签到_单个账号( - 签到, - c, - enc, - 预设位置.clone(), - 位置列表, - 签到会话, - )); - } - while let Some(tmp) = tasks.next().await { - let (用户真名, 签到结果) = tmp?; - 用户真名_签到结果_哈希表.insert(用户真名, 签到结果); - } - Ok(用户真名_签到结果_哈希表) -} - -pub async fn 位置签到<'a>( - 签到: &Struct签到, - 位置列表: &Vec, - 是否自动获取签到位置: bool, - 签到会话列表: &'a Vec<&Struct签到会话>, - 是否禁用随机偏移: bool, -) -> Result, reqwest::Error> { - let mut 用户真名_签到结果_哈希表 = HashMap::new(); - let mut tasks = FuturesUnordered::new(); - for 签到会话 in 签到会话列表 { - tasks.push(single_sign::位置签到_单个账号( - 签到, - 位置列表, - 是否自动获取签到位置, - 签到会话, - 是否禁用随机偏移, - )); - } - while let Some(tmp) = tasks.next().await { - let (name, state) = tmp?; - 用户真名_签到结果_哈希表.insert(name, state); - } - Ok(用户真名_签到结果_哈希表) -} - -pub async fn 签到码签到<'a>( - 签到: &Struct签到, - 签到码: &str, - 签到会话列表: &'a Vec<&Struct签到会话>, -) -> Result, reqwest::Error> { - let mut 用户真名_签到结果_哈希表 = HashMap::new(); - let mut tasks = FuturesUnordered::new(); - for 签到会话 in 签到会话列表 { - tasks.push(single_sign::签到码签到_单个账号( - 签到, - 签到码, - 签到会话, - )); - } - while let Some(tmp) = tasks.next().await { - let (用户真名, 签到结果) = tmp?; - 用户真名_签到结果_哈希表.insert(用户真名, 签到结果); - } - Ok(用户真名_签到结果_哈希表) -} diff --git a/src/cli/single_sign.rs b/src/cli/single_sign.rs deleted file mode 100644 index 4c10ad5..0000000 --- a/src/cli/single_sign.rs +++ /dev/null @@ -1,187 +0,0 @@ -use crate::activity::sign::{Enum签到结果, Struct签到}; -use crate::{ - session::Struct签到会话, - utils::{address::Struct位置, photo::Struct在线图片}, -}; - -pub async fn 拍照签到_单个账号<'a>( - sign: &Struct签到, - photo: &Struct在线图片, - session: &'a Struct签到会话, -) -> Result<(&'a str, Enum签到结果), reqwest::Error> { - Ok(( - session.get_用户真名(), - match sign.预签到(session).await? { - Enum签到结果::成功 => Enum签到结果::成功, - Enum签到结果::失败 { 失败信息: _ } => { - sign.作为拍照签到处理(&photo, session).await? - } - }, - )) -} - -pub async fn 通用签到_单个账号<'a>( - sign: &Struct签到, - session: &'a Struct签到会话, -) -> Result<(&'a str, Enum签到结果), reqwest::Error> { - Ok(( - session.get_用户真名(), - match sign.预签到(session).await? { - Enum签到结果::成功 => Enum签到结果::成功, - Enum签到结果::失败 { 失败信息: _ } => sign.作为普通签到处理(session).await?, - }, - )) -} - -pub async fn 二维码签到_单个账号<'a>( - sign: &Struct签到, - c: &str, - enc: &str, - 预设地址: Option, - 位置列表: &Vec, - session: &'a Struct签到会话, -) -> Result<(&'a str, Enum签到结果), reqwest::Error> { - Ok(( - session.get_用户真名(), - match if sign.二维码是否刷新() { - sign.预签到(session).await? - } else { - sign.预签到_对于有刷新二维码签到(c, enc, session).await? - } { - Enum签到结果::成功 => Enum签到结果::成功, - Enum签到结果::失败 { 失败信息: _ } => { - let mut state = Enum签到结果::失败 { - 失败信息: "所有位置均不可用".into(), - }; - let mut 需要再次尝试 = false; - if let Some(位置) = &预设地址 { - match sign.作为二维码签到处理(enc, 位置, session).await? { - r @ Enum签到结果::成功 => { - state = r; - } - Enum签到结果::失败 { 失败信息 } => { - eprintln!( - "用户[{}]在二维码签到[{}]中尝试位置[{}]时失败!失败信息:[{:?}]", - session.get_用户真名(), - sign.签到名, - 位置, - 失败信息 - ); - if 失败信息 == "您已签到过了".to_owned() { - state = Enum签到结果::成功; - } else { - 需要再次尝试 = true; - } - } - }; - } - if 需要再次尝试 { - for 位置 in 位置列表 { - match sign.作为二维码签到处理(enc, 位置, session).await? { - r @ Enum签到结果::成功 => { - state = r; - break; - } - Enum签到结果::失败 { 失败信息 } => { - eprintln!( - "用户[{}]在二维码签到[{}]中尝试位置[{}]时失败!失败信息:[{:?}]", - session.get_用户真名(), - sign.签到名, - 位置, - 失败信息 - ); - if 失败信息 == "您已签到过了".to_owned() { - state = Enum签到结果::成功; - break; - } - } - }; - } - } - state - } - }, - )) -} - -pub async fn 位置签到_单个账号<'a>( - 签到: &Struct签到, - 位置列表: &Vec, - 是否自动获取签到位置: bool, - 签到会话: &'a Struct签到会话, - 是否禁用随机偏移: bool, -) -> Result<(&'a str, Enum签到结果), reqwest::Error> { - Ok(( - 签到会话.get_用户真名(), - match 签到.预签到(签到会话).await? { - Enum签到结果::成功 => Enum签到结果::成功, - Enum签到结果::失败 { 失败信息 } => { - if 是否自动获取签到位置 - && let Some(位置及范围) = - crate::utils::address::在html文本中寻找位置及范围(&失败信息) - { - println!( - "用户[{}]已获取到教师指定的签到位置:{}, 要求范围:{} 米,将使用随机偏移后的位置签到。", - 签到会话.get_用户真名(), - 位置及范围.获取位置(), - 位置及范围.获取范围() - ); - let 位置 = if 是否禁用随机偏移 { - 位置及范围.获取位置() - } else { - 位置及范围.获取随机偏移后的位置() - }; - println!("用户[{}]签到使用位置:{}.", 签到会话.get_用户真名(), 位置); - 签到 - .作为位置签到处理(&位置, 签到会话, 是否自动获取签到位置) - .await? - } else { - let mut 签到结果 = Enum签到结果::失败 { - 失败信息: "所有位置均不可用".into(), - }; - for 位置 in 位置列表 { - match 签到 - .作为位置签到处理(位置, 签到会话, 是否自动获取签到位置) - .await? - { - r @ Enum签到结果::成功 => { - 签到结果 = r; - break; - } - Enum签到结果::失败 { 失败信息 } => { - eprintln!( - "用户[{}]在位置签到[{}]中尝试位置[{}]时失败!失败信息:[{:?}]", - 签到会话.get_用户真名(), - 签到.签到名, - 位置, - 失败信息 - ); - if 失败信息 == "您已签到过了".to_owned() { - 签到结果 = Enum签到结果::成功; - break; - } - } - }; - } - 签到结果 - } - } - }, - )) -} - -pub async fn 签到码签到_单个账号<'a>( - sign: &Struct签到, - signcode: &str, - session: &'a Struct签到会话, -) -> Result<(&'a str, Enum签到结果), reqwest::Error> { - Ok(( - session.get_用户真名(), - match sign.预签到(session).await? { - Enum签到结果::成功 => Enum签到结果::成功, - Enum签到结果::失败 { 失败信息: _ } => { - sign.作为签到码签到处理(session, signcode).await? - } - }, - )) -} diff --git a/src/main.rs b/src/main.rs index 5a358a0..628664d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,19 +6,22 @@ #![feature(let_chains)] mod cli; -mod protocol; -mod session; mod tools; use cli::{ arg::{AccCmds, Args, MainCmds}, location::Struct位置操作使用的信息, }; -use store::sql::{AccountTable, DataBase, DataBaseTableTrait}; -use types::{Course, CourseTable}; +use cxsign::{ + store::{ + tables::{AccountTable, CourseTable}, + DataBase, DataBaseTableTrait, + }, + utils::DIR, + Course, SignTrait, +}; -#[tokio::main] -async fn main() { +fn main() { let args = ::parse(); let Args { command, @@ -38,7 +41,7 @@ async fn main() { match acc_sub_cmd { AccCmds::Add { uname } => { // 添加账号。 - tools::account::添加账号(&db, uname, None).await; + tools::添加账号(&db, uname, None); } AccCmds::Remove { uname, yes } => { if !yes { @@ -60,7 +63,7 @@ async fn main() { if fresh { for (uname, (ref enc_pwd, _)) in accounts { table.delete_account(&uname); - tools::account::添加账号_使用加密过的密码_刷新时用_此时密码一定是存在的且为加密后的密码(&db, uname, enc_pwd).await; + tools::添加账号_使用加密过的密码_刷新时用_此时密码一定是存在的且为加密后的密码(&db, uname, enc_pwd); } } // 列出所有账号。 @@ -74,7 +77,7 @@ async fn main() { let table = CourseTable::from_ref(&db); if fresh { // 重新获取课程信息并缓存。 - let sessions = tools::account::通过账号获取签到会话( + let sessions = tools::通过账号获取签到会话( &db, &AccountTable::from_ref(&db) .get_accounts() @@ -82,7 +85,7 @@ async fn main() { .map(|s| s.as_str()) .collect(), ) - .await; + ; CourseTable::delete(&db); for (_, session) in sessions { let courses = Course::get_courses(&session).unwrap(); @@ -128,7 +131,7 @@ async fn main() { cli::location::location(&db, args) } MainCmds::List { course, all } => { - let sessions = tools::account::通过账号获取签到会话( + let sessions = tools::通过账号获取签到会话( &db, &AccountTable::from_ref(&db) .get_accounts() @@ -136,39 +139,39 @@ async fn main() { .map(|s| s.as_str()) .collect(), ) - .await; + ; let (available_sign_activities, other_sign_activities) = - utils::sign::获取所有签到(&sessions).await; + tools::获取所有签到(&sessions); if let Some(course) = course { // 列出指定课程的有效签到。 for a in available_sign_activities { - if a.0.课程.get_课程号() == course { - a.0.display(true); + if a.0.as_inner().course.get_id() == course { + println!("{}", a.0.as_inner().fmt_without_course_info()); } } if all { // 列出指定课程的所有签到。 for a in other_sign_activities { - if a.0.课程.get_课程号() == course { - a.0.display(true); + if a.0.as_inner().course.get_id() == course { + println!("{}", a.0.as_inner().fmt_without_course_info()); } } } } else { // 列出所有有效签到。 for a in available_sign_activities { - a.0.display(false); + println!("{}", a.0.as_inner()); } if all { // 列出所有签到。 for a in other_sign_activities { - a.0.display(false); + println!("{}", a.0.as_inner()); } } } } MainCmds::WhereIsConfig => { - println!("{:?}", std::ops::Deref::deref(&配置文件夹)); + println!("{}", &DIR.get_config_dir().to_str().unwrap()); } } } else { @@ -180,8 +183,8 @@ async fn main() { 是否禁用随机偏移: no_random_shift, }; cli::签到(&db, active_id, accounts, 签到可能使用的信息) - .await + .unwrap(); } - utils::打印当前时间(); + cxsign::utils::print_now(); } diff --git a/src/protocol/account_manage.rs b/src/protocol/account_manage.rs deleted file mode 100644 index 45395e1..0000000 --- a/src/protocol/account_manage.rs +++ /dev/null @@ -1,8 +0,0 @@ -use reqwest::{Client, Response}; - -// 账号设置页 -static ACCOUNT_MANAGE: &str = "http://passport2.chaoxing.com/mooc/accountManage"; - -pub async fn account_manage(client: &Client) -> Result { - client.get(ACCOUNT_MANAGE).send().await -} \ No newline at end of file diff --git a/src/protocol/active_list.rs b/src/protocol/active_list.rs deleted file mode 100644 index fcbab69..0000000 --- a/src/protocol/active_list.rs +++ /dev/null @@ -1,27 +0,0 @@ -use crate::session::course::Struct课程; -use reqwest::{Client, Response}; - -// 查询活动 -static ACTIVE_LIST: &str = "https://mobilelearn.chaoxing.com/v2/apis/active/student/activelist"; - -pub async fn active_list( - client: &Client, course: Struct课程 -) -> Result { - let url = { - let mut url = String::from(ACTIVE_LIST); - url.push_str("?fid=0&courseId="); - url.push_str(course.get_课程号().to_string().as_str()); - url.push_str("&classId="); - url.push_str(course.get_班级号().to_string().as_str()); - url.push_str("&showNotStartedActive=0&_="); - let time = std::time::SystemTime::now() - .duration_since(std::time::UNIX_EPOCH) - .unwrap() - .as_secs() - .to_string(); - url.push_str(time.as_str()); - url - }; - // println!("{url}"); - client.get(url).send().await -} diff --git a/src/protocol/analysis.rs b/src/protocol/analysis.rs deleted file mode 100644 index 3e70792..0000000 --- a/src/protocol/analysis.rs +++ /dev/null @@ -1,19 +0,0 @@ -use reqwest::{Client, Response}; - -// analysis -static ANALYSIS: &str = "https://mobilelearn.chaoxing.com/pptSign/analysis"; - -pub async fn analysis(client: &Client, active_id: &str) -> Result { - let url = ANALYSIS; - let url = format!("{url}?vs=1&DB_STRATEGY=RANDOM&aid={active_id}"); - client.get(url).send().await -} - -// analysis 2 -static ANALYSIS2: &str = "https://mobilelearn.chaoxing.com/pptSign/analysis2"; - -pub async fn analysis2(client: &Client, code: &str) -> Result { - let url = ANALYSIS2; - let url = format!("{url}?DB_STRATEGY=RANDOM&code={code}"); - client.get(url).send().await -} \ No newline at end of file diff --git a/src/protocol/back_clazz_data.rs b/src/protocol/back_clazz_data.rs deleted file mode 100644 index b201b7b..0000000 --- a/src/protocol/back_clazz_data.rs +++ /dev/null @@ -1,9 +0,0 @@ -use reqwest::{Client, Response}; - -// 获取课程 -static BACK_CLAZZ_DATA: &str = "http://mooc1-api.chaoxing.com/mycourse/backclazzdata"; - -pub async fn back_clazz_data(client: &Client) -> Result { - let url = String::from(BACK_CLAZZ_DATA) + "?view=json&rss=1"; - client.get(url).send().await -} \ No newline at end of file diff --git a/src/protocol/check_signcode.rs b/src/protocol/check_signcode.rs deleted file mode 100644 index 5210c17..0000000 --- a/src/protocol/check_signcode.rs +++ /dev/null @@ -1,16 +0,0 @@ -use reqwest::{Client, Response}; - -// 签到码检查 -static CHECK_SINGCODE: &str = - "https://mobilelearn.chaoxing.com/widget/sign/pcStuSignController/checkSignCode"; - -pub async fn check_signcode( - client: &Client, - active_id: &str, - signcode: &str, -) -> Result { - client - .get(String::from(CHECK_SINGCODE) + "?activeId=" + active_id + "&signCode=" + signcode) - .send() - .await -} diff --git a/src/protocol/get_attend_info.rs b/src/protocol/get_attend_info.rs deleted file mode 100644 index 071e150..0000000 --- a/src/protocol/get_attend_info.rs +++ /dev/null @@ -1,12 +0,0 @@ -use reqwest::{Client, Response}; - -// 获取签到之后的信息,例如签到时的 ip, UA, 时间等 -// 参见 "http://mobilelearn.chaoxing.com/page/sign/signIn?courseId={course_id}&classId={class_id}&activeId={active_id}&fid={??}" -static GET_ATTEND_INFO: &str = "http://mobilelearn.chaoxing.com/v2/apis/sign/getAttendInfo"; - -pub async fn get_attend_info(client: &Client, active_id: &str) -> Result { - client - .get(String::from(GET_ATTEND_INFO) + "?activeId=" + active_id + "&type=1") - .send() - .await -} \ No newline at end of file diff --git a/src/protocol/get_location_log.rs b/src/protocol/get_location_log.rs deleted file mode 100644 index bf41f10..0000000 --- a/src/protocol/get_location_log.rs +++ /dev/null @@ -1,18 +0,0 @@ -use crate::session::course::Struct课程; -use crate::session::Struct签到会话; -use reqwest::Response; - -// 获取位置信息列表 -static GET_LOCATION_LOG: &str = "http://mobilelearn.chaoxing.com/v2/apis/sign/getLocationLog"; - -pub async fn get_location_log( - session: &Struct签到会话, - 课程: &Struct课程, -) -> Result { - let url = format!( - "{GET_LOCATION_LOG}?DB_STRATEGY=COURSEID&STRATEGY_PARA=courseId&courseId={}&classId={}", - 课程.get_课程号(), - 课程.get_班级号() - ); - session.get(url).send().await -} diff --git a/src/protocol/login_enc.rs b/src/protocol/login_enc.rs deleted file mode 100644 index 0632d3b..0000000 --- a/src/protocol/login_enc.rs +++ /dev/null @@ -1,28 +0,0 @@ -use reqwest::header::HeaderMap; -use reqwest::{Client, Response}; - -// 非明文密码登录 -static LOGIN_ENC: &str = "http://passport2.chaoxing.com/fanyalogin"; - -pub async fn login_enc( - client: &Client, - uname: &str, - pwd_enc: &str, -) -> Result { - let body = format!("uname={uname}&password={pwd_enc}&fid=-1&t=true&refer=https%253A%252F%252Fi.chaoxing.com&forbidotherlogin=0&validate="); - let headers = { - let mut header = HeaderMap::new(); - header.insert( - "Content-Type", - "application/x-www-form-urlencoded".parse().unwrap(), - ); - header.insert("X-Requested-With", "XMLHttpRequest".parse().unwrap()); - header - }; - client - .post(LOGIN_ENC) - .headers(headers) - .body(body) - .send() - .await -} diff --git a/src/protocol/login_page.rs b/src/protocol/login_page.rs deleted file mode 100644 index 3f51dc0..0000000 --- a/src/protocol/login_page.rs +++ /dev/null @@ -1,9 +0,0 @@ -use reqwest::{Client, Response}; - -// 登录页 -static LOGIN_PAGE: &str = - "http://passport2.chaoxing.com/mlogin?fid=&newversion=true&refer=http%3A%2F%2Fi.chaoxing.com"; - -pub async fn login_page(client: &Client) -> Result { - client.get(LOGIN_PAGE).send().await -} diff --git a/src/protocol/mod.rs b/src/protocol/mod.rs deleted file mode 100644 index 4d2a6e8..0000000 --- a/src/protocol/mod.rs +++ /dev/null @@ -1,38 +0,0 @@ -mod account_manage; -mod active_list; -mod analysis; -mod back_clazz_data; -mod check_signcode; -mod get_attend_info; -mod get_location_log; -mod login_enc; -mod login_page; -mod other; -mod pan_chaoxing; -mod pan_list; -mod pan_token; -mod pan_upload; -mod ppt_sign; -mod pre_sign; -mod sign_detail; - -pub use account_manage::*; -pub use active_list::*; -pub use analysis::*; -pub use back_clazz_data::*; -pub use check_signcode::*; -pub use get_attend_info::*; -pub use get_location_log::*; -pub use login_enc::*; -pub use login_page::*; -pub use other::*; -pub use pan_chaoxing::*; -pub use pan_list::*; -pub use pan_token::*; -pub use pan_upload::*; -pub use ppt_sign::*; -pub use pre_sign::*; -pub use sign_detail::*; - -pub static UA: &str = "Mozilla/5.0 (iPhone; CPU iPhone OS 16_0_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 (schild:eaf4fb193ec970c0a9775e2a27b0232b) (device:iPhone11,2) Language/zh-Hans com.ssreader.ChaoXingStudy/ChaoXingStudy_3_6.0.2_ios_phone_202209281930_99 (@Kalimdor)_1665876591620212942"; -pub static QRCODE_PAT: &str = "https://mobilelearn.chaoxing.com/widget/sign/e"; diff --git a/src/protocol/other.rs b/src/protocol/other.rs deleted file mode 100644 index b5d841d..0000000 --- a/src/protocol/other.rs +++ /dev/null @@ -1,76 +0,0 @@ -// // web 聊天页 -// static WEB_IM: &str = "https://im.chaoxing.com/webim/me"; - -// // 无课程群聊的预签到 -// static CHAT_GROUP_PRE_SIGN: &str = "https://mobilelearn.chaoxing.com/sign/preStuSign"; -// pub async fn chat_group_pre_sign( -// client: &Client, -// active_id: &str, -// uid: &str, -// chat_id: &str, -// tuid: &str, -// ) -> Result { -// let url = CHAT_GROUP_PRE_SIGN; -// let url = format!("{url}?activeId={active_id}&code=&uid={uid}&courseId=null&classId=0&general=0&chatId={chat_id}&appType=0&tid={tuid}&atype=null&sys=0"); -// client.get(url).send().await -// } -// // 无课程群聊的签到 -// static CHAT_GROUP_SIGN: &str = "https://mobilelearn.chaoxing.com/sign/stuSignajax"; -// pub async fn chat_group_general_sign( -// client: &Client, -// active_id: &str, -// uid: &str, -// ) -> Result { -// let url = CHAT_GROUP_SIGN; -// let url = format!("{url}?activeId={active_id}&uid={uid}&clientip="); -// client.get(url).send().await -// } - -// pub async fn chat_group_photo_sign( -// client: &Client, -// active_id: &str, -// uid: &str, -// object_id: &str, -// ) -> Result { -// let url = CHAT_GROUP_SIGN; -// let url = format!("{url}?activeId={active_id}&uid={uid}&clientip=&useragent=&latitude=-1&longitude=-1&fid=0&objectId={object_id}"); -// client.get(url).send().await -// } -// pub async fn chat_group_location_sign( -// client: &Client, -// address: &str, -// active_id: &str, -// uid: &str, -// lat: &str, -// lon: &str, -// ) -> Result { -// let address = -// percent_encoding::utf8_percent_encode(address, percent_encoding::NON_ALPHANUMERIC) -// .to_string(); -// let body = format!( -// r#"address={address}&activeId={active_id}&uid={uid}&clientip=&useragent=&latitude={lat}&longitude={lon}&fid=&ifTiJiao=1"# -// ); -// let headers = { -// let mut h = HeaderMap::new(); -// h.insert( -// reqwest::header::CONTENT_TYPE, -// "application/x-www-form-urlencoded; charset=UTF-8" -// .parse() -// .unwrap(), -// ); -// h -// }; -// let url = PPT_SIGN; -// client.post(url).headers(headers).body(body).send().await -// } -// pub async fn chat_group_signcode_sign( -// client: &Client, -// active_id: &str, -// uid: &str, -// signcode: &str, -// ) -> Result { -// eprintln!("`chat_group_signcode_sign` 该函数需要测试!"); -// let url = CHAT_GROUP_SIGN; -// let url = format!("{url}?activeId={active_id}&uid={uid}&clientip=&signCode={signcode}"); -// client.get(url).send().await -// } diff --git a/src/protocol/pan_chaoxing.rs b/src/protocol/pan_chaoxing.rs deleted file mode 100644 index 0e5d20a..0000000 --- a/src/protocol/pan_chaoxing.rs +++ /dev/null @@ -1,9 +0,0 @@ -use reqwest::{Client, Response}; - -// 超星网盘页 -static PAN_CHAOXING: &str = "https://pan-yz.chaoxing.com"; - -pub async fn pan_chaoxing(client: &Client) -> Result { - let url = PAN_CHAOXING; - client.get(url).send().await -} diff --git a/src/protocol/pan_list.rs b/src/protocol/pan_list.rs deleted file mode 100644 index 30ba728..0000000 --- a/src/protocol/pan_list.rs +++ /dev/null @@ -1,14 +0,0 @@ -use reqwest::{Client, Response}; - -// 网盘列表 -static PAN_LIST: &str = "https://pan-yz.chaoxing.com/opt/listres"; - -pub async fn pan_list( - client: &Client, - parent_id: &str, - enc: &str, -) -> Result { - let url = PAN_LIST; - let url = format!("{url}?puid=0&shareid=0&parentId={parent_id}&page=1&size=50&enc={enc}"); - client.post(url).send().await -} \ No newline at end of file diff --git a/src/protocol/pan_token.rs b/src/protocol/pan_token.rs deleted file mode 100644 index 3e7c317..0000000 --- a/src/protocol/pan_token.rs +++ /dev/null @@ -1,8 +0,0 @@ -use reqwest::{Client, Response}; - -// 获取超星云盘的 token -static PAN_TOKEN: &str = "https://pan-yz.chaoxing.com/api/token/uservalid"; - -pub async fn pan_token(client: &Client) -> Result { - client.get(PAN_TOKEN).send().await -} \ No newline at end of file diff --git a/src/protocol/pan_upload.rs b/src/protocol/pan_upload.rs deleted file mode 100644 index bd05e29..0000000 --- a/src/protocol/pan_upload.rs +++ /dev/null @@ -1,19 +0,0 @@ -use reqwest::{Client, Response}; - -// 网盘上传接口 -static PAN_UPLOAD: &str = "https://pan-yz.chaoxing.com/upload"; - -pub async fn pan_upload( - client: &Client, - buffer: Vec, - uid: &str, - token: &str, - file_name: &str, -) -> Result { - let part = reqwest::multipart::Part::bytes(buffer).file_name(file_name.to_string()); - let form_data = reqwest::multipart::Form::new() - .part("file", part) - .text("puid", uid.to_string()); - let url = format!("{PAN_UPLOAD}?_from=mobilelearn&_token={token}"); - client.post(url).multipart(form_data).send().await -} \ No newline at end of file diff --git a/src/protocol/ppt_sign.rs b/src/protocol/ppt_sign.rs deleted file mode 100644 index 40c77c5..0000000 --- a/src/protocol/ppt_sign.rs +++ /dev/null @@ -1,90 +0,0 @@ -use crate::session::Struct签到会话; -use crate::utils::address::Struct位置; -use reqwest::Response; - -// 签到 -static PPT_SIGN: &str = "https://mobilelearn.chaoxing.com/pptSign/stuSignajax"; - -pub async fn general_sign( - session: &Struct签到会话, - active_id: &str, -) -> Result { - let uid = session.get_uid(); - let fid = session.get_fid(); - let stu_name = session.get_用户真名(); - let url = PPT_SIGN; - let url = format!("{url}?activeId={active_id}&uid={uid}&clientip=&latitude=-1&longitude=-1&appType=15&fid={fid}&name={stu_name}"); - session.get(url).send().await -} - -pub async fn photo_sign( - session: &Struct签到会话, - active_id: &str, - object_id: &str, -) -> Result { - let uid = session.get_uid(); - let fid = session.get_fid(); - let stu_name = session.get_用户真名(); - // NOTE 存疑。 - let name = percent_encoding::utf8_percent_encode(stu_name, percent_encoding::NON_ALPHANUMERIC) - .to_string(); - let url = PPT_SIGN; - let url = format!("{url}?activeId={active_id}&uid={uid}&clientip=&useragent=&latitude=-1&longitude=-1&appType=15&fid={fid}&objectId={object_id}&name={name}"); - session.get(url).send().await -} - -pub async fn qrcode_sign( - session: &Struct签到会话, - enc: &str, - active_id: &str, - 位置: &Struct位置, -) -> Result { - let address = 位置.get_地址(); - let lat = 位置.get_纬度(); - let lon = 位置.get_经度(); - let altitude = 位置.get_海拔(); - let url = PPT_SIGN; - let uid = session.get_uid(); - let fid = session.get_fid(); - let stu_name = session.get_用户真名(); - let location = format!( - r#"{{"result":"1","address":"{address}","latitude":{lat},"longitude":{lon},"altitude":{altitude}}}"# - ); - let location = - percent_encoding::utf8_percent_encode(&location, percent_encoding::NON_ALPHANUMERIC) - .to_string(); - let url = format!( - r#"{url}?enc={enc}&name={stu_name}&activeId={active_id}&uid={uid}&clientip=&location={location}&latitude=-1&longitude=-1&fid={fid}&appType=15"# - ); - session.get(url).send().await -} - -pub async fn location_sign( - session: &Struct签到会话, - 位置: &Struct位置, - active_id: &str, - 是否限定位置: bool, -) -> Result { - let address = 位置.get_地址(); - let lat = 位置.get_纬度(); - let lon = 位置.get_经度(); - let uid = session.get_uid(); - let fid = session.get_fid(); - let stu_name = session.get_用户真名(); - let if_tijiao = if 是否限定位置 { 1 } else { 0 }; - let url = format!("{PPT_SIGN}?name={stu_name}&address={address}&activeId={active_id}&uid={uid}&clientip=&latitude={lat}&longitude={lon}&fid={fid}&appType=15&ifTiJiao={if_tijiao}&validate="); - session.get(url).send().await -} - -pub async fn signcode_sign( - session: &Struct签到会话, - active_id: &str, - signcode: &str, -) -> Result { - let url = PPT_SIGN; - let uid = session.get_uid(); - let fid = session.get_fid(); - let stu_name = session.get_用户真名(); - let url = format!("{url}?activeId={active_id}&uid={uid}&clientip=&latitude=-1&longitude=-1&appType=15&fid={fid}&name={stu_name}&signCode={signcode}"); - session.get(url).send().await -} diff --git a/src/protocol/pre_sign.rs b/src/protocol/pre_sign.rs deleted file mode 100644 index 35513e5..0000000 --- a/src/protocol/pre_sign.rs +++ /dev/null @@ -1,34 +0,0 @@ -use crate::session::course::Struct课程; -use reqwest::{Client, Response}; - -// 预签到 -static PRE_SIGN: &str = "https://mobilelearn.chaoxing.com/newsign/preSign"; - -pub async fn pre_sign( - client: &Client, - course: Struct课程, - active_id: &str, - uid: &str, - is_qrcode_sign: bool, - c: &str, - enc: &str, -) -> Result { - let course_id = course.get_课程号(); - let class_id = course.get_班级号(); - let url = PRE_SIGN; - let url = if is_qrcode_sign { - let ex_args = format!("SIGNIN:aid={active_id}&source=15&Code={c}&enc={enc}"); - let ex_args = "&rcode=".to_owned() - + percent_encoding::utf8_percent_encode( - ex_args.as_str(), - percent_encoding::NON_ALPHANUMERIC, - ) - .to_string() - .as_str(); - format!("{url}?courseId={course_id}&classId={class_id}&activePrimaryId={active_id}&general=1&sys=1&ls=1&appType=15&&tid=&uid={uid}&ut=s&isTeacherViewOpen=0&rcode={ex_args}") - } else { - format!("{url}?courseId={course_id}&classId={class_id}&activePrimaryId={active_id}&general=1&sys=1&ls=1&appType=15&&tid=&uid={uid}&ut=s&isTeacherViewOpen=0") - }; - - client.get(url).send().await -} diff --git a/src/protocol/sign_detail.rs b/src/protocol/sign_detail.rs deleted file mode 100644 index 3675f13..0000000 --- a/src/protocol/sign_detail.rs +++ /dev/null @@ -1,11 +0,0 @@ -use reqwest::{Client, Response}; - -// 签到信息获取 -static SIGN_DETAIL: &str = "https://mobilelearn.chaoxing.com/newsign/signDetail"; - -pub async fn sign_detail(client: &Client, active_id: &str) -> Result { - client - .get(String::from(SIGN_DETAIL) + "?activePrimaryId=" + active_id + "&type=1") - .send() - .await -} \ No newline at end of file diff --git a/src/session/cookies.rs b/src/session/cookies.rs deleted file mode 100644 index b3692e8..0000000 --- a/src/session/cookies.rs +++ /dev/null @@ -1,158 +0,0 @@ -use cookie_store::Cookie; -#[allow(non_snake_case)] -#[derive(Debug)] -pub struct UserCookies { - // JSESSIONID: String, - // lv: String, - // uf: String, - // UID: String, - // vc: String, - // vc2: String, - // vc3: String, - // cx_p_token: String, - // p_auth_token: String, - // xxtenc: String, - // DSSTASH_LOG: String, - // route: String, - // _d: String, - fid: String, - _uid: String, -} - -impl UserCookies { - #[allow(non_snake_case)] - fn new_( - // JSESSIONID: &str, - // lv: &str, - // uf: &str, - // UID: &str, - // vc: &str, - // vc2: &str, - // vc3: &str, - // cx_p_token: &str, - // p_auth_token: &str, - // xxtenc: &str, - // DSSTASH_LOG: &str, - // route: &str, - // _d: &str, - fid: &str, - _uid: &str, - ) -> Self { - UserCookies { - // JSESSIONID: JSESSIONID.into(), - // lv: lv.into(), - // uf: uf.into(), - // UID: UID.into(), - // vc: vc.into(), - // vc2: vc2.into(), - // vc3: vc3.into(), - // cx_p_token: cx_p_token.into(), - // p_auth_token: p_auth_token.into(), - // xxtenc: xxtenc.into(), - // DSSTASH_LOG: DSSTASH_LOG.into(), - // route: route.into(), - // _d: _d.into(), - fid: fid.into(), - _uid: _uid.into(), - } - } - #[allow(non_snake_case)] - pub fn new(cookies: Vec) -> Self { - // let mut JSESSIONID = String::new(); - // let mut lv = String::new(); - // let mut uf = String::new(); - // let mut UID = String::new(); - // let mut vc = String::new(); - // let mut vc2 = String::new(); - // let mut vc3 = String::new(); - // let mut cx_p_token = String::new(); - // let mut p_auth_token = String::new(); - // let mut xxtenc = String::new(); - // let mut DSSTASH_LOG = String::new(); - // let mut route = String::new(); - // let mut _d = String::new(); - let mut fid = String::new(); - let mut _uid = String::new(); - for c in cookies { - match c.name() { - // "JSESSIONID" => { - // JSESSIONID = c.value().into(); - // } - // "lv" => { - // lv = c.value().into(); - // } - // "uf" => { - // uf = c.value().into(); - // } - // "UID" => { - // UID = c.value().into(); - // } - // "vc" => { - // vc = c.value().into(); - // } - // "vc2" => { - // vc2 = c.value().into(); - // } - // "vc3" => { - // vc3 = c.value().into(); - // } - // "cx_p_token" => { - // cx_p_token = c.value().into(); - // } - // "p_auth_token" => { - // p_auth_token = c.value().into(); - // } - // "xxtenc" => { - // xxtenc = c.value().into(); - // } - // "DSSTASH_LOG" => { - // DSSTASH_LOG = c.value().into(); - // } - // "route" => { - // route = c.value().into(); - // } - // "_d" => { - // _d = c.value().into(); - // } - "fid" => { - fid = c.value().into(); - } - "_uid" => { - _uid = c.value().into(); - } - _ => { - fid = c.value().into(); - } - } - } - UserCookies { - // JSESSIONID, - // lv, - // uf, - // UID, - // vc, - // vc2, - // vc3, - // cx_p_token, - // p_auth_token, - // xxtenc, - // DSSTASH_LOG, - // route, - // _d, - fid, - _uid, - } - } - pub fn get_uid(&self) -> &str { - &self._uid - } - pub fn get_fid(&self) -> &str { - &self.fid - } -} - -impl Default for UserCookies { - fn default() -> Self { - Self::new_("-1", "") - } -} diff --git a/src/session/course.rs b/src/session/course.rs deleted file mode 100644 index 02c6944..0000000 --- a/src/session/course.rs +++ /dev/null @@ -1,93 +0,0 @@ -use std::fmt::Display; - -use serde_derive::{Deserialize, Serialize}; -use serde_json::Value; - -#[derive(Debug, Clone, Hash, PartialEq, Eq)] -pub struct Struct课程 { - 课程号: i64, - 班级号: i64, - 任课教师: String, - 封面图url: String, - 课程名: String, -} - -impl Display for Struct课程 { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!( - f, - "课程号: {}, 课程名: {}, 任课教师: {}", - self.课程号, self.课程名, self.任课教师 - ) - } -} - -impl Struct课程 { - pub fn new( - course_id: i64, - class_id: i64, - teacherfactor: &str, - imageurl: &str, - name: &str, - ) -> Struct课程 { - Struct课程 { - 课程号: course_id, - 班级号: class_id, - 任课教师: teacherfactor.into(), - 封面图url: imageurl.into(), - 课程名: name.into(), - } - } - pub fn get_课程号(&self) -> i64 { - self.课程号 - } - pub fn get_班级号(&self) -> i64 { - self.班级号 - } - pub fn get_任课教师(&self) -> &str { - &self.任课教师 - } - pub fn get_封面图url(&self) -> &str { - &self.封面图url - } - pub fn get_课程名(&self) -> &str { - &self.课程名 - } -} - -#[derive(Deserialize, Serialize, Debug)] -pub struct CourseRaw { - #[serde(rename = "id")] - pub 课程号: i64, - #[serde(rename = "teacherfactor")] - pub 任课教师: String, - #[serde(rename = "imageurl")] - pub 封面图url: Option, - #[serde(rename = "name")] - pub 课程名: String, -} - -#[derive(Deserialize, Serialize, Debug)] -pub struct Courses { - pub data: Vec, -} - -#[derive(Deserialize, Serialize, Debug)] -pub struct CourseContent { - #[serde(rename = "course")] - pub 课程: Option, -} - -#[derive(Deserialize, Serialize, Debug)] -pub struct ClassRaw { - #[serde(rename = "key")] - pub 班级号: Value, - #[serde(rename = "content")] - pub content: CourseContent, -} - -#[derive(Deserialize, Serialize, Debug)] -pub struct GetCoursesR { - #[serde(rename = "channelList")] - pub channel_list: Vec, -} diff --git a/src/session/mod.rs b/src/session/mod.rs deleted file mode 100644 index 47aee9e..0000000 --- a/src/session/mod.rs +++ /dev/null @@ -1,259 +0,0 @@ -pub mod cookies; -pub mod course; - -use crate::activity::{ - sign::Struct签到, - {Enum活动, Struct非签到活动}, -}; -use crate::protocol; -use crate::protocol::UA; -use crate::session::course::{GetCoursesR, Struct课程}; -use crate::utils::配置文件夹; -use cookies::UserCookies; -use futures::{stream::FuturesUnordered, StreamExt}; -use reqwest::{Client, ClientBuilder}; -use serde_derive::Deserialize; -use std::{ - cmp::Ordering, - hash::Hash, - ops::{Deref, Index}, -}; - -#[derive(Debug)] -pub struct Struct签到会话 { - client: Client, - 用户真名: String, - cookies: UserCookies, -} - -impl PartialEq for Struct签到会话 { - fn eq(&self, other: &Self) -> bool { - self.get_uid() == other.get_uid() - } -} - -impl Eq for Struct签到会话 {} - -impl Hash for Struct签到会话 { - fn hash(&self, state: &mut H) { - self.get_uid().hash(state); - self.get_fid().hash(state); - self.get_用户真名().hash(state); - } -} - -impl Struct签到会话 { - pub async fn 从cookies文件加载>( - cookies路径: P, - ) -> Result { - let cookie_store = { - let cookies文件 = std::fs::File::open(cookies路径) - .map(std::io::BufReader::new) - .unwrap(); - reqwest_cookie_store::CookieStore::load_json(cookies文件).unwrap() - }; - let cookie_store = reqwest_cookie_store::CookieStoreMutex::new(cookie_store); - let cookie_store = std::sync::Arc::new(cookie_store); - let cookies = { - let store = cookie_store.lock().unwrap(); - let mut cookies = Vec::new(); - for c in store.iter_any() { - cookies.push(c.to_owned()) - } - cookies - }; - let cookies = UserCookies::new(cookies); - let client = Client::builder() - .user_agent(UA) - .cookie_provider(std::sync::Arc::clone(&cookie_store)) - .build() - .unwrap(); - let 用户真名 = Self::获取用户真名(&client).await?; - println!("用户[{}]加载 Cookies 成功!", 用户真名); - Ok(Struct签到会话 { - client, - 用户真名, - cookies, - }) - } - pub fn get_uid(&self) -> &str { - self.cookies.get_uid() - } - pub fn get_fid(&self) -> &str { - self.cookies.get_fid() - } - - pub fn get_用户真名(&self) -> &str { - &self.用户真名 - } - - pub async fn 通过账号密码登录( - 账号: &str, - 加密过的密码: &str, - ) -> Result { - let cookie_store = reqwest_cookie_store::CookieStore::new(None); - let cookie_store = reqwest_cookie_store::CookieStoreMutex::new(cookie_store); - let cookie_store = std::sync::Arc::new(cookie_store); - let client = ClientBuilder::new() - .user_agent(UA) - .cookie_provider(std::sync::Arc::clone(&cookie_store)) - .build()?; - let response = protocol::login_enc(&client, 账号, 加密过的密码).await?; - /// TODO: 存疑 - #[derive(Deserialize)] - struct LoginR { - url: Option, - msg1: Option, - msg2: Option, - status: bool, - } - let LoginR { - status, - url, - msg1, - msg2, - } = response.json().await.unwrap(); - let mut mes = Vec::new(); - if let Some(url) = url { - mes.push(url); - } - if let Some(msg1) = msg1 { - mes.push(msg1); - } - if let Some(msg2) = msg2 { - mes.push(msg2); - } - if !status { - for mes in mes { - eprintln!("{mes:?}"); - } - panic!("登录失败!"); - } - { - // Write store back to disk - let mut writer = std::fs::File::create(配置文件夹.join(账号.to_string() + ".json")) - .map(std::io::BufWriter::new) - .unwrap(); - let store = cookie_store.lock().unwrap(); - store.save_json(&mut writer).unwrap(); - } - let store = { - let s = cookie_store.clone(); - let s = s.lock().unwrap(); - let mut r = Vec::new(); - for s in s.iter_any() { - r.push(s.to_owned()); - } - r - }; - let cookies = UserCookies::new(store); - let 用户真名 = Self::获取用户真名(&client).await?; - println!("用户[{}]登录成功!", 用户真名); - Ok(Struct签到会话 { - client, - 用户真名, - cookies, - }) - } - - pub async fn 获取课程列表(&self) -> Result, reqwest::Error> { - // let r = protocol::back_clazz_data(self.deref()).await?; - // std::fs::write("C:\\Users\\15102\\Desktop\\1.json", format!("{}",r.text().await.unwrap())).unwrap(); - let r = protocol::back_clazz_data(self.deref()).await?; - let r: GetCoursesR = r.json().await.unwrap(); - let mut arr = Vec::new(); - for c in r.channel_list { - if let Some(data) = c.content.课程 { - for course in data.data { - if c.班级号.is_i64() { - arr.push(Struct课程::new( - course.课程号, - c.班级号.as_i64().unwrap(), - course.任课教师.as_str(), - course.封面图url.unwrap_or("".into()).as_str(), - course.课程名.as_str(), - )) - } - } - } - } - println!("用户[{}]已获取课程列表。", self.用户真名); - Ok(arr) - } - async fn 获取用户真名(client: &Client) -> Result { - let r = protocol::account_manage(client).await?; - let html_content = r.text().await?; - #[cfg(debug_assertions)] - println!("{html_content}"); - let e = html_content.find("colorBlue").unwrap(); - let html_content = html_content.index(e..html_content.len()).to_owned(); - let e = html_content.find('>').unwrap() + 1; - let html_content = html_content.index(e..html_content.len()).to_owned(); - let name = html_content - .index(0..html_content.find('<').unwrap()) - .trim(); - Ok(name.to_owned()) - } - pub async fn 获取网盘token(&self) -> Result { - let r = protocol::pan_token(self).await?; - #[derive(Deserialize)] - struct Tmp { - _token: String, - } - let r: Tmp = r.json().await.unwrap(); - Ok(r._token) - } - - pub async fn 上传在线图片( - &self, - buffer: Vec, - file_name: &str, - ) -> Result { - let token = self.获取网盘token().await?; - let r = protocol::pan_upload(self, buffer, self.get_uid(), &token, file_name).await?; - #[derive(Deserialize)] - #[allow(non_snake_case)] - struct Tmp { - objectId: String, - } - let tmp: Tmp = r.json().await.unwrap(); - Ok(tmp.objectId) - } -} - -impl Struct签到会话 { - pub async fn 遍历课程以获取所有活动( - &self, - ) -> Result<(Vec, Vec, Vec), reqwest::Error> { - let mut 有效签到列表 = Vec::new(); - let mut 其他签到列表 = Vec::new(); - let mut 非签到活动列表 = Vec::new(); - let mut tasks = FuturesUnordered::new(); - let 课程列表 = self.获取课程列表().await?; - for c in 课程列表 { - tasks.push(Enum活动::获取课程的所有活动(self, c)); - } - while let Some(item) = tasks.next().await { - for a in item? { - if let Enum活动::签到(签到) = a { - if 签到.是否有效() { - 有效签到列表.push(签到); - } else { - 其他签到列表.push(签到); - } - } else if let Enum活动::非签到活动(非签到活动) = a { - 非签到活动列表.push(非签到活动); - } - } - } - 有效签到列表.sort_by(|a1, a2| -> Ordering { a1.开始时间戳.cmp(&a2.开始时间戳) }); - Ok((有效签到列表, 其他签到列表, 非签到活动列表)) - } -} - -impl Deref for Struct签到会话 { - type Target = Client; - fn deref(&self) -> &Client { - &self.client - } -} diff --git a/src/tools/account.rs b/src/tools/account.rs deleted file mode 100644 index f1c95c3..0000000 --- a/src/tools/account.rs +++ /dev/null @@ -1,59 +0,0 @@ -use dir::DIR; -use std::collections::HashMap; - -use user::session::Session; - -use store::sql::{AccountTable, DataBase, DataBaseTableTrait}; -use types::{Course, CourseTable}; - -// 添加账号。TODO: 跳过输入密码阶段 -pub async fn 添加账号(db: &DataBase, uname: String, pwd: Option) { - let pwd = if let Some(pwd) = pwd { - pwd - } else { - inquire::Password::new("密码:") - .without_confirmation() - .prompt() - .unwrap() - }; - let enc_pwd = login::utils::des_enc(&pwd); - let session = Session::login(&dir::DIR, &uname, &enc_pwd).unwrap(); - let table = AccountTable::from_ref(&db); - let name = session.get_stu_name(); - table.add_account_or(&uname, &enc_pwd, name, AccountTable::update_account); - let courses = Course::get_courses(&session).unwrap(); - for c in courses { - let table = CourseTable::from_ref(&db); - table.add_course_or(&c, |_, _| {}); - } -} -pub async fn 添加账号_使用加密过的密码_刷新时用_此时密码一定是存在的且为加密后的密码( - db: &DataBase, - uname: String, - 加密过的密码: &str, -) { - let session = Session::login(&DIR, &uname, 加密过的密码).unwrap(); - let name = session.get_stu_name(); - let table = AccountTable::from_ref(&db); - table.add_account_or(&uname, 加密过的密码, name, AccountTable::update_account); - let courses = Course::get_courses(&session).unwrap(); - for c in courses { - let table = CourseTable::from_ref(&db); - table.add_course_or(&c, |_, _| {}); - } -} - -pub async fn 通过账号获取签到会话( - db: &DataBase, - 账号列表: &Vec<&str>, -) -> HashMap { - let mut s = HashMap::new(); - for 账号 in 账号列表 { - let table = AccountTable::from_ref(&db); - if table.has_account(账号) { - let 签到会话 = Session::load_json(&DIR, 账号).unwrap(); - s.insert(账号.to_string(), 签到会话); - } - } - s -} diff --git a/src/tools/address.rs b/src/tools/address.rs deleted file mode 100644 index 7f5988f..0000000 --- a/src/tools/address.rs +++ /dev/null @@ -1,234 +0,0 @@ -use std::collections::HashMap; -use std::f64::consts::PI; -use std::str::FromStr; - -use crate::protocol::get_location_log; -use crate::session::course::Struct课程; -use crate::session::Struct签到会话; -use rand::Rng; -use serde_derive::{Deserialize, Serialize}; - -#[derive(Debug, Clone)] -pub struct Struct位置 { - 地址: String, - 经度: String, - 纬度: String, - 海拔: String, -} - -#[derive(Debug, Clone, Deserialize, Serialize)] -struct Data { - #[serde(rename = "data")] - 位置及范围及签到id列表: Vec, -} - -#[derive(Debug, Clone, Deserialize, Serialize)] -struct Struct位置及范围及签到id { - #[serde(rename = "activeid")] - 签到id: i64, - #[serde(rename = "address")] - 地址: String, - #[serde(rename = "longitude")] - 经度: f64, - #[serde(rename = "latitude")] - 纬度: f64, - #[serde(rename = "locationrange")] - 范围: String, -} - -impl Struct位置及范围及签到id { - pub fn to_位置及范围(&self) -> Struct位置及范围 { - Struct位置及范围 { - 地址: self.地址.clone(), - 经度: self.经度.to_string(), - 纬度: self.纬度.to_string(), - 范围: self.范围.trim().parse().unwrap_or(100), - } - } -} - -#[derive(Debug, Clone, Deserialize, Serialize)] -pub struct Struct位置及范围 { - #[serde(rename = "address")] - 地址: String, - #[serde(rename = "longitude")] - 经度: String, - #[serde(rename = "latitude")] - 纬度: String, - #[serde(rename = "locationrange")] - 范围: u32, -} - -impl Struct位置及范围 { - pub async fn 从log获取位置列表( - 签到会话: &Struct签到会话, - 课程: &Struct课程, - ) -> Result, reqwest::Error> { - let r = get_location_log(签到会话, 课程).await?; - let data: Data = r.json().await.unwrap(); - let mut map = HashMap::new(); - for l in data.位置及范围及签到id列表 { - map.insert(l.签到id.to_string(), l.to_位置及范围()); - } - Ok(map) - } - pub fn 获取随机偏移后的位置(&self) -> Struct位置 { - const 地球半径: f64 = 6371393.0; - let Struct位置及范围 { - 地址, - 经度, - 纬度, - 范围, - } = self; - let f64_范围 = *范围 as f64; - let 纬度: f64 = 纬度.parse().unwrap(); - let 经度: f64 = 经度.parse().unwrap(); - let 纬度 = 纬度 * PI / 180.0; - let 经度 = 经度 * PI / 180.0; - let mut r = rand::thread_rng().gen_range(0..范围 * 3) as f64 / f64_范围 / 3.0; - let theta = rand::thread_rng().gen_range(0..360) as f64 * PI / 180.0; - r = f64_范围 / 地球半径 / (1.0 - theta.cos().powi(2) * 纬度.sin().powi(2)).sqrt() * r; - let 纬度 = (纬度 + r * theta.sin()) / PI * 180.0; - let 经度 = (经度 + r * theta.cos()) / PI * 180.0; - let 纬度 = format!("{:.6}", 纬度); - let 经度 = format!("{:.6}", 经度); - Struct位置 { - 地址: 地址.clone(), - 经度, - 纬度, - 海拔: "1108".into(), - } - } - pub fn 获取位置(&self) -> Struct位置 { - Struct位置 { - 地址: self.地址.clone(), - 经度: self.经度.clone(), - 纬度: self.纬度.clone(), - 海拔: "1108".to_string(), - } - } - pub fn 获取范围(&self) -> u32 { - self.范围 - } -} -impl FromStr for Struct位置 { - type Err = String; - - fn from_str(s: &str) -> Result { - Struct位置::从字符串解析(s).map_err(|e| e.to_owned()) - } -} -impl Struct位置 { - pub fn 从字符串解析(位置字符串: &str) -> Result { - let 位置字符串: Vec<&str> = 位置字符串.split(',').map(|item| item.trim()).collect(); - if 位置字符串.len() == 4 { - Ok(Self::new( - 位置字符串[0], - 位置字符串[1], - 位置字符串[2], - 位置字符串[3], - )) - } else { - Err("位置信息格式错误!格式为:`地址,经度,纬度,海拔`.") - } - } - pub fn new(地址: &str, 经度: &str, 纬度: &str, 海拔: &str) -> Struct位置 { - Struct位置 { - 地址: 地址.into(), - 经度: 经度.into(), - 纬度: 纬度.into(), - 海拔: 海拔.into(), - } - } - /// 地址。 - pub fn get_地址(&self) -> &str { - &self.地址 - } - /// 纬度。 - pub fn get_纬度(&self) -> &str { - &self.纬度 - } - /// 经度。 - pub fn get_经度(&self) -> &str { - &self.经度 - } - /// 海拔。 - pub fn get_海拔(&self) -> &str { - &self.海拔 - } -} - -impl std::fmt::Display for Struct位置 { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{},{},{},{}", self.地址, self.经度, self.纬度, self.海拔) - } -} - -pub fn 为数据库添加位置( - db: &super::sql::DataBase, - course_id: i64, - 位置: &Struct位置, -) -> i64 { - // 为指定课程添加位置。 - let mut 位置id = 0_i64; - loop { - if db.是否存在为某id的位置(位置id) { - 位置id += 1; - continue; - } - db.添加位置_失败后则(位置id, course_id, 位置, |_, _, _, _| {}); - break; - } - 位置id -} - -pub fn 在html文本中寻找位置及范围(html: &str) -> Option { - let p = vec![ - "id=\"locationText\"", - "id=\"locationLongitude\"", - "id=\"locationLatitude\"", - "id=\"locationRange\"", - ]; - let mut start = vec![None, None, None, None]; - let mut results1 = Vec::new(); - for i in 0..4 { - let s = html.find(p[i]); - start[i] = s; - if let Some(s) = s { - let r = &html[s + p[i].len()..html.len()]; - results1.push(r); - } else { - return None; - } - } - let mut results2 = Vec::new(); - for r in &results1 { - let s = r.find("value=\""); - if let Some(s) = s { - let r = &r[s + 7..r.len()]; - results2.push(r); - } else { - return None; - } - } - let mut results3 = Vec::new(); - for r in &results2 { - let e = r.find("\""); - if let Some(e) = e { - let r = &r[0..e]; - results3.push(r); - } else { - return None; - } - } - Some(Struct位置及范围 { - 地址: results3[0].to_owned(), - 经度: results3[1].to_owned(), - 纬度: results3[2].to_owned(), - 范围: if let Ok(s) = results3[3].trim_end_matches('米').parse() { - s - } else { - return None; - }, - }) -} diff --git a/src/tools/mod.rs b/src/tools/mod.rs index e8d6cce..a14d21c 100644 --- a/src/tools/mod.rs +++ b/src/tools/mod.rs @@ -1,115 +1,98 @@ -pub mod account; -pub mod address; -pub mod photo; -pub mod sign; -pub mod sql; - -use des::{ - cipher::{generic_array::GenericArray, BlockEncrypt, KeyInit}, - Des, +use cxsign::{ + store::{ + tables::{AccountTable, CourseTable}, + DataBase, DataBaseTableTrait, + }, + utils::DIR, + Course, Session, Sign, }; -use directories::ProjectDirs; -use lazy_static::lazy_static; -use std::path::PathBuf; -use unicode_width::UnicodeWidthStr; -lazy_static! { - pub static ref 配置文件夹: PathBuf = { - let is_testing = std::env::var("TEST_CXSIGN").is_ok(); - let binding = ProjectDirs::from("rt.lea", "worksoup", "cxsign").unwrap(); - let dir = if is_testing { - binding.config_dir().join("test").to_owned() - } else { - binding.config_dir().to_owned() - }; - let _ = std::fs::create_dir_all(dir.clone()); - dir - }; -} +use std::collections::{hash_map::OccupiedError, HashMap}; -pub fn 打印当前时间() { - let str = chrono::DateTime::::from(std::time::SystemTime::now()) - .format("%+") - .to_string(); - println!("{str}"); +// 添加账号。TODO: 跳过输入密码阶段 +pub fn 添加账号(db: &DataBase, uname: String, pwd: Option) { + let pwd = if let Some(pwd) = pwd { + pwd + } else { + inquire::Password::new("密码:") + .without_confirmation() + .prompt() + .unwrap() + }; + let enc_pwd = cxsign::utils::des_enc(&pwd); + let session = Session::login(&DIR, &uname, &enc_pwd).unwrap(); + let table = AccountTable::from_ref(&db); + let name = session.get_stu_name(); + table.add_account_or(&uname, &enc_pwd, name, AccountTable::update_account); + let courses = Course::get_courses(&session).unwrap(); + for c in courses { + let table = CourseTable::from_ref(&db); + table.add_course_or(&c, |_, _| {}); + } } - -pub fn 请求确认(询问文本: &str, 提示文本: &str) -> bool { - inquire::Confirm::new(询问文本) - .with_help_message(提示文本) - .with_default_value_formatter(&|v| if v { "是[默认]" } else { "否[默认]" }.into()) - .with_formatter(&|v| if v { "是" } else { "否" }.into()) - .with_parser(&|s| match inquire::Confirm::DEFAULT_PARSER(s) { - r @ Ok(_) => r, - Err(_) => { - if s == "是" { - Ok(true) - } else if s == "否" { - Ok(false) - } else { - Err(()) - } - } - }) - .with_error_message("请以\"y\", \"yes\"等表示“是”,\"n\", \"no\"等表示“否”。") - .with_default(true) - .prompt() - .unwrap() +pub fn 添加账号_使用加密过的密码_刷新时用_此时密码一定是存在的且为加密后的密码( + db: &DataBase, + uname: String, + 加密过的密码: &str, +) { + let session = Session::login(&DIR, &uname, 加密过的密码).unwrap(); + let name = session.get_stu_name(); + let table = AccountTable::from_ref(&db); + table.add_account_or(&uname, 加密过的密码, name, AccountTable::update_account); + let courses = Course::get_courses(&session).unwrap(); + for c in courses { + let table = CourseTable::from_ref(&db); + table.add_course_or(&c, |_, _| {}); + } } -pub fn des加密(密码文本: &str) -> String { - fn pkcs7填充(密码文本: &str) -> Vec<[u8; 8]> { - assert!(密码文本.len() > 7); - assert!(密码文本.len() < 17); - let mut r = Vec::new(); - let pwd = 密码文本.as_bytes(); - let len = pwd.len(); - let batch = len / 8; - let m = len % 8; - for i in 0..batch { - let mut a = [0u8; 8]; - a.copy_from_slice(&pwd[i * 8..8 + i * 8]); - r.push(a); +pub fn 通过账号获取签到会话( + db: &DataBase, + 账号列表: &Vec<&str>, +) -> HashMap { + let mut s = HashMap::new(); + for 账号 in 账号列表 { + let table = AccountTable::from_ref(&db); + if table.has_account(账号) { + let 签到会话 = Session::load_json(&DIR, 账号).unwrap(); + s.insert(账号.to_string(), 签到会话); } - let mut b = [0u8; 8]; - for i in 0..m { - b[i] = pwd[8 * batch + i]; - } - for item in b.iter_mut().skip(m) { - *item = (8 - m) as u8; - } - r.push(b); - // #[cfg(debug_assertions)] - // println!("{r:?}"); - r - } - let key = b"u2oh6Vu^".to_owned(); - let key = GenericArray::from(key); - let des = Des::new(&key); - let 填充分块后的密码 = pkcs7填充(密码文本); - let mut 加密后的数据块 = Vec::new(); - for 块 in 填充分块后的密码 { - let mut 块 = GenericArray::from(块); - des.encrypt_block(&mut 块); - let mut 块 = 块.to_vec(); - 加密后的数据块.append(&mut 块); } - hex::encode(加密后的数据块) + s } -pub fn 获取unicode字符串定宽显示时应当设置的宽度( - s: &str, - 希望显示的宽度: usize, -) -> usize { - if UnicodeWidthStr::width(s) > 希望显示的宽度 { - 希望显示的宽度 - } else { - UnicodeWidthStr::width(s) + 12 - s.len() +pub fn 获取所有签到( + sessions: &HashMap, +) -> ( + HashMap>, + HashMap>, +) { + let mut 有效签到 = HashMap::new(); + let mut 其他签到 = HashMap::new(); + for session in sessions { + let (available_sign_activities, other_sign_activities, _) = + cxsign::Activity::get_all_activities(session.1).unwrap(); + for sa in available_sign_activities { + let mut map = HashMap::new(); + map.insert(session.0, session.1); + if let Err(OccupiedError { + mut entry, + value: _, + }) = 有效签到.try_insert(sa, map) + { + entry.get_mut().insert(session.0, session.1); + } + } + for sa in other_sign_activities { + let mut map = HashMap::new(); + map.insert(session.0, session.1); + if let Err(OccupiedError { + mut entry, + value: _, + }) = 其他签到.try_insert(sa, map) + { + entry.get_mut().insert(session.0, session.1); + } + } } + (有效签到, 其他签到) } - -// mod test { -// #[test] -// fn test_des() { -// println!("{}", crate::tools::pwd_des("0123456789.")); -// } -// } diff --git a/src/tools/photo.rs b/src/tools/photo.rs deleted file mode 100644 index 58a5e52..0000000 --- a/src/tools/photo.rs +++ /dev/null @@ -1,81 +0,0 @@ -use crate::{protocol, session::Struct签到会话}; -use serde_derive::Deserialize; -use std::fs::File; -use std::io::Read; -use std::path::PathBuf; - -// TODO: 删除 unwrap -pub struct Struct在线图片 { - object_id: String, -} - -impl Struct在线图片 { - async fn 通过某种规则从网盘获取object_id( - session: &Struct签到会话, - p: impl Fn(&str) -> bool, - ) -> Result, reqwest::Error> { - let 响应 = protocol::pan_chaoxing(session).await?; - let 响应的文本 = 响应.text().await.unwrap(); - let start_of_enc = 响应的文本.find("enc =\"").unwrap() + 6; - let end_of_enc = 响应的文本[start_of_enc..响应的文本.len()] - .find('"') - .unwrap() - + start_of_enc; - let enc = &响应的文本[start_of_enc..end_of_enc]; - let start_of_root_dir = 响应的文本.find("_rootdir = \"").unwrap() + 12; - let end_of_root_dir = 响应的文本[start_of_root_dir..响应的文本.len()] - .find('"') - .unwrap() - + start_of_root_dir; - let parent_id = &响应的文本[start_of_root_dir..end_of_root_dir]; - let r = protocol::pan_list(session, parent_id, enc).await?; - #[derive(Deserialize)] - #[allow(non_snake_case)] - struct CloudFile { - name: String, - objectId: Option, - } - #[derive(Deserialize)] - struct TmpR { - list: Vec, - } - let r: TmpR = r.json().await?; - for item in r.list { - if p(&item.name) { - return Ok(item.objectId); - } - } - Ok(None) - } - pub fn get_object_id(&self) -> &str { - &self.object_id - } - pub async fn new(session: &Struct签到会话, buf: Vec, file_name: &str) -> Self { - let object_id = session.上传在线图片(buf, file_name).await.unwrap(); - Self { object_id } - } - pub async fn 默认(session: &Struct签到会话) -> Option { - Self::从网盘获取(session, |a| a == "1.png" || a == "1.jpg").await - } - pub async fn 从网盘获取( - session: &Struct签到会话, - p: impl Fn(&str) -> bool, - ) -> Option { - let object_id = Self::通过某种规则从网盘获取object_id(session, p) - .await - .unwrap(); - if let Some(object_id) = object_id { - Some(Self { object_id }) - } else { - None - } - } - pub async fn 上传文件获取(session: &Struct签到会话, path_buf: &PathBuf) -> Self { - let mut f = File::open(path_buf).unwrap(); - let file_name = path_buf.file_name().unwrap().to_str().unwrap(); - let size = f.metadata().unwrap().len() as usize; - let mut buffer = vec![0u8; size]; - let _ = f.read(&mut buffer).unwrap(); - Self::new(session, buffer, file_name).await - } -} diff --git a/src/tools/sign.rs b/src/tools/sign.rs deleted file mode 100644 index 5d79fe8..0000000 --- a/src/tools/sign.rs +++ /dev/null @@ -1,177 +0,0 @@ -use activity::sign::Sign; -use std::collections::{hash_map::OccupiedError, HashMap}; - -use rxing::{Point, PointU}; -use user::session::Session; - -use utils::inquire_confirm; - -pub async fn 获取所有签到( - sessions: &HashMap, -) -> ( - HashMap>, - HashMap>, -) { - let mut 有效签到 = HashMap::new(); - let mut 其他签到 = HashMap::new(); - for session in sessions { - let (available_sign_activities, other_sign_activities, _) = - activity::Activity::get_all_activities(session.1).unwrap(); - for sa in available_sign_activities { - let mut map = HashMap::new(); - map.insert(session.0, session.1); - if let Err(OccupiedError { - mut entry, - value: _, - }) = 有效签到.try_insert(sa, map) - { - entry.get_mut().insert(session.0, session.1); - } - } - for sa in other_sign_activities { - let mut map = HashMap::new(); - map.insert(session.0, session.1); - if let Err(OccupiedError { - mut entry, - value: _, - }) = 其他签到.try_insert(sa, map) - { - entry.get_mut().insert(session.0, session.1); - } - } - } - (有效签到, 其他签到) -} - -fn 从二维码扫描结果中获取签到所需参数(url: &str) -> Option { - // 在二维码图片中会有一个参数 `c`, 二维码预签到时需要。 - // 但是该参数似乎暂时可以从 `signDetail` 接口获取到。所以此处先注释掉。 - // let beg = r.find("&c=").unwrap(); - // let c = &r[beg + 3..beg + 9]; - // (c.to_owned(), enc.to_owned()) - // 有时二维码里没有参数,原因不明。 - let r = url - .find("&enc=") - .map(|beg| url[beg + 5..beg + 37].to_owned()); - if r.is_none() { - eprintln!("{url:?}中没有找到二维码!") - } - r -} - -pub fn 扫描路径中二维码并获取签到所需参数(pic_path: &str) -> Option { - let 扫描结果 = rxing::helpers::detect_multiple_in_file(pic_path).expect("decodes"); - 从二维码扫描结果中获取签到所需参数(扫描结果[0].getText()) -} - -fn 获取包含所有顶点的矩形(vertex: &Vec) -> (PointU, PointU) { - // let scale_factor = display.scale_factor(); - // println!("屏幕缩放:{scale_factor}"); - let mut x_max = vertex[0].x; - let mut x_min = x_max; - let mut y_max = vertex[0].y; - let mut y_min = y_max; - for p in vertex { - if p.x > x_max { - x_max = p.x - } - if p.y > y_max { - y_max = p.y - } - if p.x < x_min { - x_min = p.x - } - if p.y < y_min { - y_min = p.y - } - } - let lt = { - let x = x_min - 10.0; - let y = y_min - 10.0; - Point { x, y } - }; - let rb = { - let x = x_max + 10.0; - let y = y_max + 10.0; - Point { x, y } - }; - let wh = rb - lt; - (PointU::from(lt), PointU::from(wh)) -} - -fn 扫描图片中所有的二维码( - image: xcap::image::DynamicImage, - hints: &mut rxing::DecodingHintDictionary, -) -> rxing::common::Result> { - hints - .entry(rxing::DecodeHintType::TRY_HARDER) - .or_insert(rxing::DecodeHintValue::TryHarder(true)); - let reader = rxing::MultiFormatReader::default(); - let mut scanner = rxing::multi::GenericMultipleBarcodeReader::new(reader); - rxing::multi::MultipleBarcodeReader::decode_multiple_with_hints( - &mut scanner, - &mut rxing::BinaryBitmap::new(rxing::common::HybridBinarizer::new( - rxing::BufferedImageLuminanceSource::new(image), - )), - hints, - ) -} -pub fn 裁剪图片( - 原图: xcap::image::RgbaImage, - 左上顶点: PointU, - 宽高: PointU, -) -> xcap::image::DynamicImage { - xcap::image::DynamicImage::from(原图).crop(左上顶点.x, 左上顶点.y, 宽高.x, 宽高.y) -} - -pub fn 截屏获取二维码签到所需参数(is_refresh: bool, precise: bool) -> Option { - let 所有屏幕 = xcap::Monitor::all().unwrap_or_else(|e| panic!("{e:?}")); - // 在所有屏幕中寻找。 - if !precise && is_refresh { - if !请求确认( - "二维码图片是否就绪?", - "本程序将在屏幕上寻找签到二维码,待二维码刷新后按下回车进行签到。", - ) { - return None; - } - } - for 屏幕 in 所有屏幕 { - // 先截取整个屏幕。 - let 所截图片 = 屏幕.capture_image().unwrap_or_else(|e| panic!("{e:?}")); - println!("已截屏。"); - // 如果成功识别到二维码。 - let 扫描结果列表 = 扫描图片中所有的二维码( - xcap::image::DynamicImage::from(所截图片), - &mut HashMap::new(), - ); - let 扫描结果列表 = if let Ok(扫描结果列表) = 扫描结果列表 { - 扫描结果列表 - } else { - continue; - }; - // 在结果中寻找。 - for 扫描结果 in &扫描结果列表 { - let url = 扫描结果.getText(); - // 如果符合要求的二维码。 - if !url.contains(crate::protocol::QRCODE_PAT) && url.contains("&enc=") { - continue; - } - println!("存在签到二维码。"); - return if precise && is_refresh && 请求确认("二维码图片是否就绪?", "本程序已在屏幕上找到签到二维码。请不要改变该二维码的位置,待二维码刷新后按下回车进行签到。") { - // 如果是定时刷新的二维码,等待二维码刷新。 - let 二维码在屏幕上的位置 = 获取包含所有顶点的矩形(扫描结果.getPoints()); - println!("二维码位置:{:?}", 二维码在屏幕上的位置); - let 所截图片 = 屏幕 - .capture_image() - .unwrap_or_else(|e| panic!("{e:?}")); - let 所截图片 = 裁剪图片(所截图片, 二维码在屏幕上的位置.0, 二维码在屏幕上的位置.1); - let 扫描结果 = 扫描图片中所有的二维码(所截图片, &mut HashMap::new()).unwrap_or_else(|e| panic!("{e:?}")); - 从二维码扫描结果中获取签到所需参数(扫描结果[0].getText()) - } else { - // 如果不是精确截取的二维码,则不需要提示。 - 从二维码扫描结果中获取签到所需参数(url) - }; - } - } - None -} diff --git a/src/tools/sql.rs b/src/tools/sql.rs deleted file mode 100644 index 8905412..0000000 --- a/src/tools/sql.rs +++ /dev/null @@ -1,452 +0,0 @@ -use crate::session::course::Struct课程; -use crate::utils::address::Struct位置; -use sqlite::Connection; -use std::{collections::HashMap, fs::File, ops::Deref}; - -pub struct DataBase { - connection: Connection, -} -impl Deref for DataBase { - type Target = Connection; - - fn deref(&self) -> &Self::Target { - &self.connection - } -} -// self -impl DataBase { - pub fn new() -> Self { - let db_dir = crate::utils::配置文件夹.join("cx.db"); - if db_dir.metadata().is_err() { - File::create(db_dir.clone()).unwrap(); - } - let connection = Connection::open(db_dir.to_str().unwrap()).unwrap(); - let db = Self { connection }; - db.create_table_account(); - db.create_table_course(); - db.创建表pos(); - db.create_table_alias(); - db - } -} -// account -impl DataBase { - const CREATE_ACCOUNT_SQL: &'static str = - "CREATE TABLE account (uname CHAR (50) UNIQUE NOT NULL,pwd TEXT NOT NULL,name TEXT NOT NULL);"; - - fn has_table_account(&self) -> bool { - let mut query = self - .connection - .prepare("SELECT count(*) FROM sqlite_master WHERE type='table' AND name='account';") - .unwrap(); - query.next().unwrap(); - query.read::(0).unwrap() == 1 - } - - pub fn has_account(&self, uname: &str) -> bool { - let mut query = self - .connection - .prepare("SELECT count(*) FROM account WHERE uname=?;") - .unwrap(); - query.bind((1, uname)).unwrap(); - query.next().unwrap(); - query.read::(0).unwrap() > 0 - } - - pub fn delete_account(&self, uname: &str) { - if self.has_account(uname) { - let mut query = self - .connection - .prepare("DELETE FROM account WHERE uname=?;") - .unwrap(); - query.bind((1, uname)).unwrap(); - query.next().unwrap(); - } - std::fs::remove_file(super::配置文件夹.join(uname.to_string() + ".json")).unwrap(); - } - - pub fn add_account_or( - &self, - uname: &str, - pwd: &str, - name: &str, - or: O, - ) { - let mut query = self - .connection - .prepare("INSERT INTO account(uname,pwd,name) values(:uname,:pwd,:name);") - .unwrap(); - query - .bind::<&[(_, sqlite::Value)]>( - &[ - (":uname", uname.into()), - (":pwd", pwd.into()), - (":name", name.into()), - ][..], - ) - .unwrap(); - match query.next() { - Ok(_) => (), - Err(_) => or(self, uname, pwd, name), - }; - } - - pub fn update_account(&self, uname: &str, pwd: &str, name: &str) { - let mut query = self - .connection - .prepare("UPDATE account SET pwd=:pwd,name=:name WHERE uname=:uname;") - .unwrap(); - query - .bind::<&[(_, sqlite::Value)]>( - &[ - (":uname", uname.into()), - (":pwd", pwd.into()), - (":name", name.into()), - ][..], - ) - .unwrap(); - query.next().unwrap(); - } - - fn create_table_account(&self) { - if !self.has_table_account() { - self.connection.execute(Self::CREATE_ACCOUNT_SQL).unwrap(); - } - } - - pub fn get_accounts(&self) -> HashMap { - let mut query = self.connection.prepare("SELECT * FROM account;").unwrap(); - let mut accounts = HashMap::new(); - for c in query.iter() { - if let Ok(row) = c { - let uname: &str = row.read("uname"); - let pwd: &str = row.read("pwd"); - let name: &str = row.read("name"); - accounts.insert(uname.into(), (pwd.into(), name.into())); - } else { - eprintln!("账号解析行出错:{c:?}."); - } - } - if accounts.is_empty() { - eprintln!("无登录账号,请参照 [wiki](https://github.com/worksoup/cxsign/wiki/%E5%91%BD%E4%BB%A4%EF%BC%9A%E8%B4%A6%E5%8F%B7%E7%9B%B8%E5%85%B3#cxsign-account-add-12345678910) 登录!") - } - accounts - } -} -// course -impl DataBase { - const CREATE_COURSE_SQL: &'static str ="CREATE TABLE course (id INTEGER UNIQUE NOT NULL,clazzid INTEGER NOT NULL,name TEXT NOT NULL,teacher TEXT NOT NULL,image TEXT NOT NULL);"; - - fn has_table_course(&self) -> bool { - let mut query = self - .connection - .prepare("SELECT count(*) FROM sqlite_master WHERE type='table' AND name='course';") - .unwrap(); - query.next().unwrap(); - query.read::(0).unwrap() == 1 - } - pub fn add_course_or(&self, course: &Struct课程, or: O) { - let id: i64 = course.get_课程号(); - let clazzid: i64 = course.get_班级号(); - let name: &str = course.get_课程名(); - let teacher: &str = course.get_任课教师(); - let image: &str = course.get_封面图url(); - let mut query =self.connection.prepare("INSERT INTO course(id,clazzid,name,teacher,image) values(:id,:clazzid,:name,:teacher,:image);").unwrap(); - query - .bind::<&[(_, sqlite::Value)]>( - &[ - (":id", id.into()), - (":clazzid", clazzid.into()), - (":name", name.into()), - (":teacher", teacher.into()), - (":image", image.into()), - ][..], - ) - .unwrap(); - match query.next() { - Ok(_) => (), - Err(_) => or(self, course), - } - } - pub fn delete_all_course(&self) { - let mut query = self.connection.prepare("DELETE FROM course;").unwrap(); - query.next().unwrap(); - println!("已删除旧的课程信息。"); - } - fn create_table_course(&self) { - if !self.has_table_course() { - self.connection.execute(Self::CREATE_COURSE_SQL).unwrap(); - } - } - pub fn get_courses(&self) -> HashMap { - let mut query = self.connection.prepare("SELECT * FROM course;").unwrap(); - let mut courses = HashMap::new(); - for c in query.iter() { - if let Ok(row) = c { - let id = row.read("id"); - let clazzid = row.read("clazzid"); - let teacher = row.read::<&str, _>("teacher"); - let image = row.read::<&str, _>("image"); - let name = row.read::<&str, _>("name"); - courses.insert(id, Struct课程::new(id, clazzid, teacher, image, name)); - } else { - eprintln!("课程解析行出错:{c:?}."); - } - } - courses - } -} -// 位置 -impl DataBase { - const CREATE_POS_SQL: &'static str ="CREATE TABLE pos(posid INTEGER UNIQUE NOT NULL,courseid INTEGER NOT NULL,addr TEXT NOT NULL,lon TEXT NOT NULL,lat TEXT NOT NULL,alt TEXT NOT NULL);"; - - fn 是否存在表pos(&self) -> bool { - let mut query = self - .connection - .prepare("SELECT count(*) FROM sqlite_master WHERE type='table' AND name='pos';") - .unwrap(); - query.next().unwrap(); - query.read::(0).unwrap() == 1 - } - pub fn 是否存在为某id的位置(&self, 位置id: i64) -> bool { - let mut query = self - .connection - .prepare("SELECT count(*) FROM pos WHERE posid=?;") - .unwrap(); - query.bind((1, 位置id)).unwrap(); - query.next().unwrap(); - query.read::(0).unwrap() > 0 - } - pub fn 添加位置_失败后则( - &self, - 位置id: i64, - course_id: i64, - 位置: &Struct位置, - or: O, - ) { - let addr = 位置.get_地址(); - let lat = 位置.get_纬度(); - let lon = 位置.get_经度(); - let alt = 位置.get_海拔(); - let mut query =self.connection.prepare("INSERT INTO pos(posid,courseid,addr,lat,lon,alt) values(:posid,:courseid,:addr,:lat,:lon,:alt);").unwrap(); - query - .bind::<&[(_, sqlite::Value)]>( - &[ - (":posid", 位置id.into()), - (":courseid", course_id.into()), - (":addr", addr.into()), - (":lat", lat.into()), - (":lon", lon.into()), - (":alt", alt.into()), - ][..], - ) - .unwrap(); - match query.next() { - Ok(_) => (), - Err(_) => or(self, 位置id, course_id, 位置), - } - } - pub fn 删除为某id的位置(&self, 位置id: i64) { - self.connection - .execute("DELETE FROM pos WHERE posid=".to_string() + 位置id.to_string().as_str() + ";") - .unwrap(); - let aliases = self.get_aliases(位置id); - for alias in aliases { - self.delete_alias(&alias) - } - } - // pub fn 删除所有位置(&self) { - // self.connection.execute("DELETE FROM pos;").unwrap(); - // self.删除所有别名(); - // } - fn 创建表pos(&self) { - if !self.是否存在表pos() { - self.connection.execute(Self::CREATE_POS_SQL).unwrap(); - } - } - pub fn 获取所有位置(&self) -> HashMap { - let mut query = self.connection.prepare("SELECT * FROM pos;").unwrap(); - let mut 位置列表 = HashMap::new(); - for c in query.iter() { - if let Ok(row) = c { - let 位置id = row.read("posid"); - let 地址 = row.read("addr"); - let 纬度 = row.read("lat"); - let 经度 = row.read("lon"); - let 海拔 = row.read("alt"); - let 课程号 = row.read("courseid"); - 位置列表.insert(位置id, (课程号, Struct位置::new(地址, 经度, 纬度, 海拔))); - } else { - eprintln!("位置解析行出错:{c:?}."); - } - } - 位置列表 - } - pub fn 获取为某id的位置(&self, 位置id: i64) -> (i64, Struct位置) { - let mut query = self - .connection - .prepare("SELECT * FROM pos WHERE posid=?;") - .unwrap(); - query.bind((1, 位置id)).unwrap(); - let c: Vec = query - .iter() - .filter_map(|e| if let Ok(e) = e { Some(e) } else { None }) - .collect(); - let row = &c[0]; - let addr = row.read("addr"); - let lat = row.read("lat"); - let lon = row.read("lon"); - let alt = row.read("alt"); - let courseid = row.read("courseid"); - (courseid, Struct位置::new(addr, lon, lat, alt)) - } - pub fn 获取特定课程的位置和其id( - &self, - course_id: i64, - ) -> HashMap { - let mut query = self - .connection - .prepare("SELECT * FROM pos WHERE courseid=?;") - .unwrap(); - query.bind((1, course_id)).unwrap(); - let mut 位置列表 = HashMap::new(); - for c in query.iter() { - if let Ok(row) = c { - let 位置id = row.read("posid"); - let 地址 = row.read("addr"); - let 纬度 = row.read("lat"); - let 经度 = row.read("lon"); - let 海拔 = row.read("alt"); - 位置列表.insert(位置id, Struct位置::new(地址, 经度, 纬度, 海拔)); - } else { - eprintln!("位置解析行出错:{c:?}."); - } - } - 位置列表 - } - pub fn 获取特定课程的位置(&self, course_id: i64) -> Vec { - let mut query = self - .connection - .prepare("SELECT * FROM pos WHERE courseid=?;") - .unwrap(); - query.bind((1, course_id)).unwrap(); - let mut 位置列表 = Vec::new(); - for c in query.iter() { - if let Ok(row) = c { - let addr = row.read("addr"); - let lat = row.read("lat"); - let lon = row.read("lon"); - let alt = row.read("alt"); - 位置列表.push(Struct位置::new(addr, lon, lat, alt)); - } else { - eprintln!("位置解析行出错:{c:?}."); - } - } - 位置列表 - } -} - -// alias -impl DataBase { - const CREATE_ALIAS_SQL: &'static str = - "CREATE TABLE alias (name CHAR (50) UNIQUE NOT NULL,posid INTEGER NOT NULL);"; - - fn has_table_alias(&self) -> bool { - let mut query = self - .connection - .prepare("SELECT count(*) FROM sqlite_master WHERE type='table' AND name='alias';") - .unwrap(); - query.next().unwrap(); - query.read::(0).unwrap() == 1 - } - - pub fn has_alias(&self, alias: &str) -> bool { - let mut query = self - .connection - .prepare("SELECT count(*) FROM alias WHERE name=?;") - .unwrap(); - query.bind((1, alias)).unwrap(); - query.next().unwrap(); - query.read::(0).unwrap() > 0 - } - - pub fn delete_alias(&self, alias: &str) { - let mut query = self - .connection - .prepare("DELETE FROM alias WHERE name=?;") - .unwrap(); - query.bind((1, alias)).unwrap(); - query.next().unwrap(); - } - - // pub fn 删除所有别名(&self) { - // self.connection.execute("DELETE FROM alias;").unwrap(); - // } - - pub fn add_alias_or(&self, 别名: &str, 位置id: i64, or: O) { - let mut query = self - .connection - .prepare("INSERT INTO alias(name,posid) values(:name,:posid);") - .unwrap(); - query - .bind::<&[(_, sqlite::Value)]>(&[(":name", 别名.into()), (":posid", 位置id.into())][..]) - .unwrap(); - match query.next() { - Ok(_) => (), - Err(_) => or(self, 别名, 位置id), - }; - } - pub fn update_alias(&self, alias: &str, 位置id: i64) { - let mut query = self - .connection - .prepare("UPDATE alias SET name=:name,posid=:posid WHERE name=:name;") - .unwrap(); - query - .bind::<&[(_, sqlite::Value)]>( - &[(":name", alias.into()), (":posid", 位置id.into())][..], - ) - .unwrap(); - query.next().unwrap(); - } - - fn create_table_alias(&self) { - if !self.has_table_alias() { - self.connection.execute(Self::CREATE_ALIAS_SQL).unwrap(); - } - } - pub fn 获取为某别名的位置(&self, alias: &str) -> Option { - if self.has_alias(alias) { - let mut query = self - .connection - .prepare("SELECT * FROM alias WHERE name=?;") - .unwrap(); - query.bind((1, alias)).unwrap(); - let c: Vec = query - .iter() - .filter_map(|e| if let Ok(e) = e { Some(e) } else { None }) - .collect(); - let row = &c[0]; - let 位置id: i64 = row.read("posid"); - Some(self.获取为某id的位置(位置id).1) - } else { - None - } - } - pub fn get_aliases(&self, 位置id: i64) -> Vec { - let mut query = self - .connection - .prepare("SELECT * FROM alias WHERE posid=?;") - .unwrap(); - query.bind((1, 位置id)).unwrap(); - let mut aliases = Vec::new(); - for c in query.iter() { - if let Ok(row) = c { - let name: &str = row.read("name"); - aliases.push(name.to_owned()); - } else { - eprintln!("位置解析行出错:{c:?}."); - } - } - aliases - } -} From c5da8768f90564762ef5812b4858f2427dfc6488 Mon Sep 17 00:00:00 2001 From: worksoup <2055038075@qq.com> Date: Thu, 28 Mar 2024 21:13:55 +0800 Subject: [PATCH 05/17] =?UTF-8?q?=09=E4=BF=AE=E6=94=B9=EF=BC=9A=20=20=20?= =?UTF-8?q?=20=20README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 42 ++++-------------------------------------- 1 file changed, 4 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index 10b5ee5..0115301 100644 --- a/README.md +++ b/README.md @@ -1,41 +1,7 @@ -# cxsign -X星签到的命令行工具,可以为每个课程添加单独的地点。支持多个账号签到。支持普通签到、拍照签到、二维码签到、位置签到、二维码位置签到、手势签到、签到码签到。 +# devsign -## 注意事项 +这里是 `newsign` 的实际使用示例。 -**本项目使用的网络 API 均来源于网络公开资料。** +本仓库的代码行将会随着 `newsign` 库的完善不断减少。 -**本项目不提供任何现实中的网络服务,仅提供相关功能实现的参考,请勿用于任何实际用途。** - -本项目以 `AGPL-3.0` 协议开源。同时包含如下附加协议: -+ **本项目仅供学习和研究使用,严禁商用。** -+ 不得广泛传播(严禁包括但不限于网盘分享、群组分享等一次性或持续性多人分享行为)。 -+ 严禁任何不以学习研究为目的个人分享行为。 - -## 特别注意 - -**请注意账号安全**: - -虽然输入密码时不会在命令行界面显示任何字符,但是密码依然被缓存本地数据库中且存在被解密的风险。 - -请注意保护登录者的账号密码。 - - > - 如果让他人登录你的账号,请仔细甄别其是否值得信任; - > - 如果你登录了其他人的账号,请牢记:能力越大,责任越大,同时不要辜负他人对你的信任; - > - 你的账号不论供自己登录还是供他人登录、不论是否使用本软件或其他第三方软件登录,都推荐为其设置一个单独的、别于其他账号甚至完全无关的、不常用的密码,防止该密码被盗取后用于登录其他平台账号或猜出你设置密码的风格。 - > - > 另:为了账号安全,请不要使用 Debug 版本。 - - (TODO: 考虑是否有必要为数据库添加主密码。) - -**本项目目前主要在 Windows 下测试**: - -本项目使用跨平台库, 但由于各位同学都只用 Windows, 所以主要在 Windows 上测试。 - -我也在自己的电脑上测试,故在 Linux 上也应当有良好支持。 - -## 使用方法 -见 [Wiki](https://github.com/worksoup/cxsign/wiki). - -## 建议、问题、反馈 -欢迎发 issues 和 pr. +功能上将大体与 `cxsign` 保持一致。 \ No newline at end of file From bedf584585e2f9d27ab6614fbcbd91bb259c9537 Mon Sep 17 00:00:00 2001 From: worksoup <2055038075@qq.com> Date: Fri, 29 Mar 2024 13:12:02 +0800 Subject: [PATCH 06/17] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E8=AE=A9=E6=88=91=E5=9B=B0=E6=83=91=E7=9A=84=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cli/mod.rs | 26 ++++++++------------------ src/main.rs | 25 ++++--------------------- src/tools/mod.rs | 15 --------------- 3 files changed, 12 insertions(+), 54 deletions(-) diff --git a/src/cli/mod.rs b/src/cli/mod.rs index da4a35a..5e90b7a 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -100,15 +100,13 @@ pub fn 签到( 签到可能使用的信息: CliArgs, ) -> Result<(), cxsign::Error> { let mut 是否指定accounts参数 = false; - let 数据库完整账号列表 = AccountTable::from_ref(db).get_accounts(); - let 签到所需的账号列表: Vec<&str> = if let Some(账号列表字符串) = &账号列表字符串 - { + let account_table = AccountTable::from_ref(db); + let sessions = if let Some(账号列表字符串) = &账号列表字符串 { 是否指定accounts参数 = true; - 账号列表字符串.split(",").map(|a| a.trim()).collect() + account_table.get_sessions_by_accounts_str(账号列表字符串) } else { - 数据库完整账号列表.keys().map(|s| s.as_str()).collect() + account_table.get_sessions() }; - let sessions = tools::通过账号获取签到会话(&db, &签到所需的账号列表); let (有效签到列表, 其他签到列表) = tools::获取所有签到(&sessions); let signs = if let Some(active_id) = active_id { let s1 = 有效签到列表 @@ -130,24 +128,16 @@ pub fn 签到( } } }; - let mut 账号对象_签到所需的_vec = Vec::new(); - for (uname, session) in 所有sessions_对应于_签到_需要处理的 { - if 签到所需的账号列表.contains(&uname.as_str()) { - 账号对象_签到所需的_vec.push(session) - } - } + let 账号对象_签到所需的_vec = 所有sessions_对应于_签到_需要处理的 + .into_values() + .collect::>(); let mut map = HashMap::new(); map.insert(签到_需要处理的, 账号对象_签到所需的_vec); map } else { let mut signs = HashMap::new(); for (sign, full_sessions) in 有效签到列表 { - let mut 账号对象_签到所需的_vec = Vec::new(); - for (uname, session) in &full_sessions { - if 签到所需的账号列表.contains(&uname.as_str()) { - 账号对象_签到所需的_vec.push(*session) - } - } + let 账号对象_签到所需的_vec = full_sessions.into_values().collect::>(); signs.insert(sign, 账号对象_签到所需的_vec); } signs diff --git a/src/main.rs b/src/main.rs index 628664d..2da4270 100644 --- a/src/main.rs +++ b/src/main.rs @@ -77,15 +77,8 @@ fn main() { let table = CourseTable::from_ref(&db); if fresh { // 重新获取课程信息并缓存。 - let sessions = tools::通过账号获取签到会话( - &db, - &AccountTable::from_ref(&db) - .get_accounts() - .keys() - .map(|s| s.as_str()) - .collect(), - ) - ; + let account_table = AccountTable::from_ref(&db); + let sessions = account_table.get_sessions(); CourseTable::delete(&db); for (_, session) in sessions { let courses = Course::get_courses(&session).unwrap(); @@ -131,15 +124,7 @@ fn main() { cli::location::location(&db, args) } MainCmds::List { course, all } => { - let sessions = tools::通过账号获取签到会话( - &db, - &AccountTable::from_ref(&db) - .get_accounts() - .keys() - .map(|s| s.as_str()) - .collect(), - ) - ; + let sessions = AccountTable::from_ref(&db).get_sessions(); let (available_sign_activities, other_sign_activities) = tools::获取所有签到(&sessions); if let Some(course) = course { @@ -182,9 +167,7 @@ fn main() { 是否精确识别二维码: precisely, 是否禁用随机偏移: no_random_shift, }; - cli::签到(&db, active_id, accounts, 签到可能使用的信息) - - .unwrap(); + cli::签到(&db, active_id, accounts, 签到可能使用的信息).unwrap(); } cxsign::utils::print_now(); } diff --git a/src/tools/mod.rs b/src/tools/mod.rs index a14d21c..2c95c11 100644 --- a/src/tools/mod.rs +++ b/src/tools/mod.rs @@ -45,21 +45,6 @@ pub fn 添加账号_使用加密过的密码_刷新时用_此时密码一定是 } } -pub fn 通过账号获取签到会话( - db: &DataBase, - 账号列表: &Vec<&str>, -) -> HashMap { - let mut s = HashMap::new(); - for 账号 in 账号列表 { - let table = AccountTable::from_ref(&db); - if table.has_account(账号) { - let 签到会话 = Session::load_json(&DIR, 账号).unwrap(); - s.insert(账号.to_string(), 签到会话); - } - } - s -} - pub fn 获取所有签到( sessions: &HashMap, ) -> ( From cff998ddf5147c3c98b29358d2a2df93c3f4cf49 Mon Sep 17 00:00:00 2001 From: worksoup <2055038075@qq.com> Date: Sat, 30 Mar 2024 00:43:25 +0800 Subject: [PATCH 07/17] =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E4=BD=BF=E7=94=A8=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 47 ++++++++++++++++++++++++++++++++++------------- Cargo.toml | 7 +++++-- src/cli/mod.rs | 28 ++++++++++++++++------------ src/main.rs | 21 +++++++++++++++++---- src/tools/mod.rs | 40 +--------------------------------------- 5 files changed, 73 insertions(+), 70 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4534b92..1118912 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -560,7 +560,6 @@ checksum = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" [[package]] name = "cxsign" version = "0.1.1" -source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#96d89fec9f809cc324cada4070dd34c2182a358a" dependencies = [ "cxsign_app", ] @@ -571,15 +570,17 @@ version = "0.1.2" dependencies = [ "clap", "cxsign 0.1.1", + "env_logger", "inquire", + "log", ] [[package]] name = "cxsign_activity" version = "0.1.1" -source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#96d89fec9f809cc324cada4070dd34c2182a358a" dependencies = [ "chrono", + "cxsign_store", "cxsign_types", "cxsign_user", "cxsign_utils", @@ -593,7 +594,6 @@ dependencies = [ [[package]] name = "cxsign_app" version = "0.1.1" -source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#96d89fec9f809cc324cada4070dd34c2182a358a" dependencies = [ "cxsign_activity", "cxsign_dir", @@ -612,7 +612,6 @@ dependencies = [ [[package]] name = "cxsign_dir" version = "0.1.1" -source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#96d89fec9f809cc324cada4070dd34c2182a358a" dependencies = [ "directories", "lazy_static", @@ -621,7 +620,6 @@ dependencies = [ [[package]] name = "cxsign_error" version = "0.1.1" -source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#96d89fec9f809cc324cada4070dd34c2182a358a" dependencies = [ "thiserror", "ureq", @@ -630,7 +628,6 @@ dependencies = [ [[package]] name = "cxsign_login" version = "0.1.1" -source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#96d89fec9f809cc324cada4070dd34c2182a358a" dependencies = [ "cookie_store", "cxsign_error", @@ -645,7 +642,6 @@ dependencies = [ [[package]] name = "cxsign_pan" version = "0.1.1" -source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#96d89fec9f809cc324cada4070dd34c2182a358a" dependencies = [ "log", "mime_guess", @@ -656,7 +652,6 @@ dependencies = [ [[package]] name = "cxsign_store" version = "0.1.1" -source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#96d89fec9f809cc324cada4070dd34c2182a358a" dependencies = [ "cxsign_dir", "cxsign_user", @@ -667,7 +662,6 @@ dependencies = [ [[package]] name = "cxsign_types" version = "0.1.1" -source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#96d89fec9f809cc324cada4070dd34c2182a358a" dependencies = [ "cxsign_dir", "cxsign_pan", @@ -683,7 +677,6 @@ dependencies = [ [[package]] name = "cxsign_user" version = "0.1.1" -source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#96d89fec9f809cc324cada4070dd34c2182a358a" dependencies = [ "cookie_store", "cxsign_dir", @@ -698,7 +691,6 @@ dependencies = [ [[package]] name = "cxsign_utils" version = "0.1.1" -source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#96d89fec9f809cc324cada4070dd34c2182a358a" dependencies = [ "chrono", "inquire", @@ -832,6 +824,29 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569" +[[package]] +name = "env_filter" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a009aa4810eb158359dda09d0c87378e4bbb89b5a801f016885a4707ba24f7ea" +dependencies = [ + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b35839ba51819680ba087cd351788c9a3c476841207e0b8cee0b04722343b9" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "humantime", + "log", +] + [[package]] name = "equivalent" version = "1.0.1" @@ -1014,6 +1029,12 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "iana-time-zone" version = "0.1.60" @@ -1363,9 +1384,9 @@ dependencies = [ [[package]] name = "nalgebra" -version = "0.32.4" +version = "0.32.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4541eb06dce09c0241ebbaab7102f0a01a0c8994afed2e5d0d66775016e25ac2" +checksum = "3ea4908d4f23254adda3daa60ffef0f1ac7b8c3e9a864cf3cc154b251908a2ef" dependencies = [ "approx", "matrixmultiply", diff --git a/Cargo.toml b/Cargo.toml index ee935cb..532dcab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,5 +7,8 @@ edition = "2021" [dependencies] clap = { version = "4.5", features = ["derive"] } -cxsign = { git = "https://github.com/worksoup/cxsign.git", branch = "newsign" } -inquire = "0.7" \ No newline at end of file +# cxsign = { git = "https://github.com/worksoup/cxsign.git", branch = "newsign" } +cxsign = { path = "../newsign/" } +env_logger = "0.11" +inquire = "0.7" +log = "0.4" diff --git a/src/cli/mod.rs b/src/cli/mod.rs index 5e90b7a..05b4a48 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -2,19 +2,21 @@ pub mod arg; pub mod location; use cxsign::{ - store::{tables::AccountTable, DataBase, DataBaseTableTrait}, - DefaultGestureOrSigncodeSignner, DefaultLocationSignner, DefaultNormalOrRawSignner, + store::{ + tables::{AccountTable, ExcludeTable}, + DataBase, DataBaseTableTrait, + }, + Activity, DefaultGestureOrSigncodeSignner, DefaultLocationSignner, DefaultNormalOrRawSignner, DefaultPhotoSignner, DefaultQrCodeSignner, Session, Sign, SignResult, SignTrait, SignnerTrait, }; use std::collections::HashMap; use self::arg::CliArgs; -use crate::tools; fn 区分签到类型并进行签到<'a>( 签到: &mut Sign, db: &DataBase, - 签到会话列表: Vec<&Session>, + 签到会话列表: &Vec, 签到可能使用的信息: &CliArgs, ) -> Result<(), cxsign::Error> { let CliArgs { @@ -107,7 +109,12 @@ pub fn 签到( } else { account_table.get_sessions() }; - let (有效签到列表, 其他签到列表) = tools::获取所有签到(&sessions); + let (有效签到列表, 其他签到列表, _) = Activity::get_all_activities( + ExcludeTable::from_ref(db), + sessions.values().into_iter(), + false, + ) + .unwrap(); let signs = if let Some(active_id) = active_id { let s1 = 有效签到列表 .into_iter() @@ -128,23 +135,20 @@ pub fn 签到( } } }; - let 账号对象_签到所需的_vec = 所有sessions_对应于_签到_需要处理的 - .into_values() - .collect::>(); + let 账号对象_签到所需的_vec = 所有sessions_对应于_签到_需要处理的; let mut map = HashMap::new(); map.insert(签到_需要处理的, 账号对象_签到所需的_vec); map } else { let mut signs = HashMap::new(); for (sign, full_sessions) in 有效签到列表 { - let 账号对象_签到所需的_vec = full_sessions.into_values().collect::>(); + let 账号对象_签到所需的_vec = full_sessions; signs.insert(sign, 账号对象_签到所需的_vec); } signs }; - let iter: Vec<(Sign, Vec<&Session>)> = signs.into_iter().collect(); - for (mut sign, sessions) in iter { - 区分签到类型并进行签到(&mut sign, db, sessions, &签到可能使用的信息)?; + for (mut sign, sessions) in signs.into_iter() { + 区分签到类型并进行签到(&mut sign, db, &sessions, &签到可能使用的信息)?; } Ok(()) } diff --git a/src/main.rs b/src/main.rs index 2da4270..8cb3715 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,14 +14,17 @@ use cli::{ }; use cxsign::{ store::{ - tables::{AccountTable, CourseTable}, + tables::{AccountTable, AliasTable, CourseTable, ExcludeTable, LocationTable}, DataBase, DataBaseTableTrait, }, utils::DIR, - Course, SignTrait, + Activity, Course, SignTrait, }; fn main() { + let mut builder = env_logger::Builder::from_default_env(); + builder.target(env_logger::Target::Stdout); + builder.init(); let args = ::parse(); let Args { command, @@ -34,6 +37,11 @@ fn main() { no_random_shift, } = args; let db = DataBase::default(); + db.add_table::(); + db.add_table::(); + db.add_table::(); + db.add_table::(); + db.add_table::(); if let Some(sub_cmd) = command { match sub_cmd { MainCmds::Account { command, fresh } => { @@ -125,8 +133,13 @@ fn main() { } MainCmds::List { course, all } => { let sessions = AccountTable::from_ref(&db).get_sessions(); - let (available_sign_activities, other_sign_activities) = - tools::获取所有签到(&sessions); + let (available_sign_activities, other_sign_activities, _) = + Activity::get_all_activities( + ExcludeTable::from_ref(&db), + sessions.values().into_iter(), + all, + ) + .unwrap(); if let Some(course) = course { // 列出指定课程的有效签到。 for a in available_sign_activities { diff --git a/src/tools/mod.rs b/src/tools/mod.rs index 2c95c11..243cff3 100644 --- a/src/tools/mod.rs +++ b/src/tools/mod.rs @@ -4,9 +4,8 @@ use cxsign::{ DataBase, DataBaseTableTrait, }, utils::DIR, - Course, Session, Sign, + Course, Session, }; -use std::collections::{hash_map::OccupiedError, HashMap}; // 添加账号。TODO: 跳过输入密码阶段 pub fn 添加账号(db: &DataBase, uname: String, pwd: Option) { @@ -44,40 +43,3 @@ pub fn 添加账号_使用加密过的密码_刷新时用_此时密码一定是 table.add_course_or(&c, |_, _| {}); } } - -pub fn 获取所有签到( - sessions: &HashMap, -) -> ( - HashMap>, - HashMap>, -) { - let mut 有效签到 = HashMap::new(); - let mut 其他签到 = HashMap::new(); - for session in sessions { - let (available_sign_activities, other_sign_activities, _) = - cxsign::Activity::get_all_activities(session.1).unwrap(); - for sa in available_sign_activities { - let mut map = HashMap::new(); - map.insert(session.0, session.1); - if let Err(OccupiedError { - mut entry, - value: _, - }) = 有效签到.try_insert(sa, map) - { - entry.get_mut().insert(session.0, session.1); - } - } - for sa in other_sign_activities { - let mut map = HashMap::new(); - map.insert(session.0, session.1); - if let Err(OccupiedError { - mut entry, - value: _, - }) = 其他签到.try_insert(sa, map) - { - entry.get_mut().insert(session.0, session.1); - } - } - } - (有效签到, 其他签到) -} From 43e9d6c7c77d85c064c7b44ef7ec72fc26f3e5f2 Mon Sep 17 00:00:00 2001 From: worksoup <2055038075@qq.com> Date: Sat, 30 Mar 2024 18:16:50 +0800 Subject: [PATCH 08/17] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cli/arg/mod.rs | 1 + src/cli/mod.rs | 106 +++++++++++++++++++++++++++------------------ src/main.rs | 2 +- 3 files changed, 65 insertions(+), 44 deletions(-) diff --git a/src/cli/arg/mod.rs b/src/cli/arg/mod.rs index f15156b..fa0edc5 100644 --- a/src/cli/arg/mod.rs +++ b/src/cli/arg/mod.rs @@ -148,6 +148,7 @@ pub enum AccCmds { }, } +#[derive(Clone)] pub struct CliArgs { pub 位置字符串: Option, pub 图片或图片路径: Option, diff --git a/src/cli/mod.rs b/src/cli/mod.rs index 05b4a48..0ffea79 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -7,18 +7,29 @@ use cxsign::{ DataBase, DataBaseTableTrait, }, Activity, DefaultGestureOrSigncodeSignner, DefaultLocationSignner, DefaultNormalOrRawSignner, - DefaultPhotoSignner, DefaultQrCodeSignner, Session, Sign, SignResult, SignTrait, SignnerTrait, + DefaultPhotoSignner, DefaultQrCodeSignner, RawSign, Session, Sign, SignResult, SignTrait, + SignnerTrait, }; +use log::{info, warn}; use std::collections::HashMap; use self::arg::CliArgs; fn 区分签到类型并进行签到<'a>( - 签到: &mut Sign, + 签到: RawSign, db: &DataBase, 签到会话列表: &Vec, 签到可能使用的信息: &CliArgs, ) -> Result<(), cxsign::Error> { + let sign_name = 签到.name.clone(); + let mut 签到 = if 签到会话列表.is_empty() { + warn!("无法判断签到[{sign_name}]的签到类型。"); + Sign::Unknown(签到) + } else { + info!("成功判断签到[{sign_name}]的签到类型。"); + 签到.to_sign(&签到会话列表[0]) + }; + let 签到 = &mut 签到; let CliArgs { 位置字符串, 图片或图片路径: pic, @@ -30,51 +41,56 @@ fn 区分签到类型并进行签到<'a>( let sessions = 签到会话列表.into_iter(); match 签到 { Sign::Photo(ps) => { - let signner = DefaultPhotoSignner::new(pic); - 签到结果列表 = signner.sign(ps, sessions)?; + info!("签到[{sign_name}]为拍照签到。"); + 签到结果列表 = DefaultPhotoSignner::new(&pic).sign(ps, sessions)?; } Sign::Normal(ns) => { + info!("签到[{sign_name}]为普通签到。"); 签到结果列表 = DefaultNormalOrRawSignner.sign(ns, sessions)?; } Sign::QrCode(qs) => { - let signner = DefaultQrCodeSignner::new( - db, - 位置字符串, - pic, + info!("签到[{sign_name}]为二维码签到。"); + 签到结果列表 = DefaultQrCodeSignner::new( + &db, + &位置字符串, + &pic, &None, *是否精确识别二维码, *是否禁用随机偏移, - ); - 签到结果列表 = signner.sign(qs, sessions)?; + ) + .sign(qs, sessions)?; } Sign::Gesture(gs) => { + info!("签到[{sign_name}]为手势签到。"); if let Some(signcode) = 签到码 { - let signner = DefaultGestureOrSigncodeSignner::new(signcode); - 签到结果列表 = signner.sign(gs, sessions)?; + 签到结果列表 = + DefaultGestureOrSigncodeSignner::new(&signcode).sign(gs, sessions)?; } else { - eprintln!( + warn!( "所有用户在手势签到[{}]中签到失败!需要提供签到码!", gs.as_inner().name ) } } Sign::Location(ls) => { - let signner = DefaultLocationSignner::new(db, 位置字符串, *是否禁用随机偏移); - 签到结果列表 = signner.sign(ls, sessions)?; + info!("签到[{sign_name}]为位置签到。"); + 签到结果列表 = DefaultLocationSignner::new(&db, &位置字符串, *是否禁用随机偏移) + .sign(ls, sessions)?; } Sign::Signcode(ss) => { + info!("签到[{sign_name}]为签到码签到。"); if let Some(signcode) = 签到码 { - let signner = DefaultGestureOrSigncodeSignner::new(signcode); - 签到结果列表 = signner.sign(ss, sessions)?; + 签到结果列表 = + DefaultGestureOrSigncodeSignner::new(&signcode).sign(ss, sessions)?; } else { - eprintln!( + warn!( "所有用户在手势签到[{}]中签到失败!需要提供签到码!", ss.as_inner().name ) } } Sign::Unknown(us) => { - eprintln!("签到活动[{}]为无效签到类型!", us.name); + warn!("签到[{}]为无效签到类型!", us.name); 签到结果列表 = DefaultNormalOrRawSignner.sign(us, sessions)?; } } @@ -82,13 +98,13 @@ fn 区分签到类型并进行签到<'a>( println!("签到活动[{}]签到结果:", 签到.as_inner().name); for (用户真名, 签到结果) in 签到结果列表 { if let SignResult::Fail { msg } = 签到结果 { - eprintln!( + warn!( "\t用户[{}]签到失败!失败信息:[{:?}]", 用户真名.get_stu_name(), msg ); } else { - println!("\t用户[{}]签到成功!", 用户真名.get_stu_name(),); + info!("\t用户[{}]签到成功!", 用户真名.get_stu_name(),); } } } @@ -96,36 +112,38 @@ fn 区分签到类型并进行签到<'a>( } pub fn 签到( - db: &DataBase, + db: DataBase, active_id: Option, 账号列表字符串: Option, 签到可能使用的信息: CliArgs, ) -> Result<(), cxsign::Error> { - let mut 是否指定accounts参数 = false; - let account_table = AccountTable::from_ref(db); - let sessions = if let Some(账号列表字符串) = &账号列表字符串 { - 是否指定accounts参数 = true; - account_table.get_sessions_by_accounts_str(账号列表字符串) + let account_table = AccountTable::from_ref(&db); + let (sessions, 是否指定accounts参数) = if let Some(账号列表字符串) = &账号列表字符串 + { + ( + account_table.get_sessions_by_accounts_str(账号列表字符串), + true, + ) } else { - account_table.get_sessions() + (account_table.get_sessions(), false) }; let (有效签到列表, 其他签到列表, _) = Activity::get_all_activities( - ExcludeTable::from_ref(db), + ExcludeTable::from_ref(&db), sessions.values().into_iter(), false, ) .unwrap(); let signs = if let Some(active_id) = active_id { - let s1 = 有效签到列表 - .into_iter() - .find(|kv| kv.0.as_inner().active_id == active_id.to_string()); - let s2 = 其他签到列表 - .into_iter() - .find(|kv| kv.0.as_inner().active_id == active_id.to_string()); - let (签到_需要处理的, 所有sessions_对应于_签到_需要处理的) = { - if let Some(s1) = s1 { + let (签到_需要处理的, 账号对象_签到所需的_vec) = { + if let Some(s1) = 有效签到列表 + .into_iter() + .find(|kv| kv.0.as_inner().active_id == active_id.to_string()) + { s1 - } else if let Some(s2) = s2 { + } else if let Some(s2) = 其他签到列表 + .into_iter() + .find(|kv| kv.0.as_inner().active_id == active_id.to_string()) + { s2 } else { if 是否指定accounts参数 { @@ -135,20 +153,22 @@ pub fn 签到( } } }; - let 账号对象_签到所需的_vec = 所有sessions_对应于_签到_需要处理的; let mut map = HashMap::new(); map.insert(签到_需要处理的, 账号对象_签到所需的_vec); map } else { let mut signs = HashMap::new(); - for (sign, full_sessions) in 有效签到列表 { - let 账号对象_签到所需的_vec = full_sessions; + for (sign, 账号对象_签到所需的_vec) in 有效签到列表 { signs.insert(sign, 账号对象_签到所需的_vec); } signs }; - for (mut sign, sessions) in signs.into_iter() { - 区分签到类型并进行签到(&mut sign, db, &sessions, &签到可能使用的信息)?; + if signs.is_empty() { + warn!("签到列表为空!"); + } + for (sign, sessions) in signs.into_iter() { + 区分签到类型并进行签到(sign, &db, &sessions, &签到可能使用的信息) + .unwrap_or_else(|e| warn!("{e}")); } Ok(()) } diff --git a/src/main.rs b/src/main.rs index 8cb3715..15a1538 100644 --- a/src/main.rs +++ b/src/main.rs @@ -180,7 +180,7 @@ fn main() { 是否精确识别二维码: precisely, 是否禁用随机偏移: no_random_shift, }; - cli::签到(&db, active_id, accounts, 签到可能使用的信息).unwrap(); + cli::签到(db, active_id, accounts, 签到可能使用的信息).unwrap(); } cxsign::utils::print_now(); } From c8356223fba572682640b7a6cbe059471f2b46ba Mon Sep 17 00:00:00 2001 From: worksoup <2055038075@qq.com> Date: Sat, 30 Mar 2024 18:36:28 +0800 Subject: [PATCH 09/17] =?UTF-8?q?=E5=90=AF=E7=94=A8=20log=20=E9=97=A8?= =?UTF-8?q?=E9=9D=A2=E7=9A=84=20release=5Fmax=5Flevel=5Fwarn=20feature.=20?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=90=AF=E7=94=A8=20env=5Flogger=20=E7=9A=84?= =?UTF-8?q?=20info=20=E7=BA=A7=E5=88=AB=E7=9A=84=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E4=BB=A5=E4=BD=9C=E4=B8=BA=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.toml | 2 +- src/cli/mod.rs | 2 +- src/main.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 532dcab..2a5ce08 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,4 +11,4 @@ clap = { version = "4.5", features = ["derive"] } cxsign = { path = "../newsign/" } env_logger = "0.11" inquire = "0.7" -log = "0.4" +log = { version = "0.4", features = ["release_max_level_info"] } diff --git a/src/cli/mod.rs b/src/cli/mod.rs index 0ffea79..dd51b38 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -104,7 +104,7 @@ fn 区分签到类型并进行签到<'a>( msg ); } else { - info!("\t用户[{}]签到成功!", 用户真名.get_stu_name(),); + println!("\t用户[{}]签到成功!", 用户真名.get_stu_name(),); } } } diff --git a/src/main.rs b/src/main.rs index 15a1538..4cdc0be 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,7 +22,8 @@ use cxsign::{ }; fn main() { - let mut builder = env_logger::Builder::from_default_env(); + let env = env_logger::Env::default().filter_or("RUST_LOG", "info"); + let mut builder = env_logger::Builder::from_env(env); builder.target(env_logger::Target::Stdout); builder.init(); let args = ::parse(); @@ -182,5 +183,4 @@ fn main() { }; cli::签到(db, active_id, accounts, 签到可能使用的信息).unwrap(); } - cxsign::utils::print_now(); } From 89cbb335d9382bb95a8e1610c24e88336f69f885 Mon Sep 17 00:00:00 2001 From: worksoup <2055038075@qq.com> Date: Sat, 30 Mar 2024 18:59:47 +0800 Subject: [PATCH 10/17] =?UTF-8?q?=09=E4=BF=AE=E6=94=B9=EF=BC=9A=20=20=20?= =?UTF-8?q?=20=20Cargo.lock?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1118912..fb5452c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2210,9 +2210,9 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "syn" -version = "2.0.55" +version = "2.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "002a1b3dbf967edfafc32655d0f377ab0bb7b994aa1d32c8cc7e9b8bf3ebb8f0" +checksum = "11a6ae1e52eb25aab8f3fb9fca13be982a373b8f1157ca14b897a825ba4a2d35" dependencies = [ "proc-macro2", "quote", @@ -2829,9 +2829,9 @@ dependencies = [ [[package]] name = "xcap" -version = "0.0.6" +version = "0.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5956bff96dcf8bb25db82779dba3512c25b56fb8aa9376cc5a45eb71c3240b15" +checksum = "67a93952e626469db74885009cb4a3b9df9a281a03b2f16e3c3a3f0b5d0a408a" dependencies = [ "core-foundation", "core-graphics", From ce1758a1005c35b8e8125e0c9245a87d0827dba1 Mon Sep 17 00:00:00 2001 From: LEART Date: Sat, 30 Mar 2024 21:36:39 +0800 Subject: [PATCH 11/17] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cli/mod.rs | 2 +- src/main.rs | 58 +++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 46 insertions(+), 14 deletions(-) diff --git a/src/cli/mod.rs b/src/cli/mod.rs index dd51b38..342a834 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -164,7 +164,7 @@ pub fn 签到( signs }; if signs.is_empty() { - warn!("签到列表为空!"); + warn!("签到列表为空。"); } for (sign, sessions) in signs.into_iter() { 区分签到类型并进行签到(sign, &db, &sessions, &签到可能使用的信息) diff --git a/src/main.rs b/src/main.rs index 4cdc0be..b4dc6ce 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,7 +20,24 @@ use cxsign::{ utils::DIR, Activity, Course, SignTrait, }; +use log::warn; +const NOTICE: &str = r#" + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 列出签到时会默认排除从未发过签到或最后一次签到在 160 天 + 之前的课程。 + + 如有需要,请使用 `cxsign list -a` 命令强制列出所有签到 + 或使用 `cxsign list -c ` 列出特定课程的签 + 到,此时将会刷新排除列表。 + + 注意,`cxsign list -a` 耗时十几秒到数分钟不等。不过后者 + 耗时较短。 + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +"#; fn main() { let env = env_logger::Env::default().filter_or("RUST_LOG", "info"); let mut builder = env_logger::Builder::from_env(env); @@ -134,29 +151,41 @@ fn main() { } MainCmds::List { course, all } => { let sessions = AccountTable::from_ref(&db).get_sessions(); - let (available_sign_activities, other_sign_activities, _) = - Activity::get_all_activities( - ExcludeTable::from_ref(&db), - sessions.values().into_iter(), - all, - ) - .unwrap(); if let Some(course) = course { + let (a, n) = if let Some(course) = + CourseTable::from_ref(&db).get_courses().get(&course) + && let Some(session) = sessions.values().next() + && let Ok((a, n, _)) = Activity::get_course_activities( + ExcludeTable::from_ref(&db), + session, + course, + ) { + (a, n) + } else { + (vec![], vec![]) + }; // 列出指定课程的有效签到。 - for a in available_sign_activities { - if a.0.as_inner().course.get_id() == course { - println!("{}", a.0.as_inner().fmt_without_course_info()); + for a in a { + if a.course.get_id() == course { + println!("{}", a.fmt_without_course_info()); } } if all { // 列出指定课程的所有签到。 - for a in other_sign_activities { - if a.0.as_inner().course.get_id() == course { - println!("{}", a.0.as_inner().fmt_without_course_info()); + for a in n { + if a.course.get_id() == course { + println!("{}", a.fmt_without_course_info()); } } } } else { + let (available_sign_activities, other_sign_activities, _) = + Activity::get_all_activities( + ExcludeTable::from_ref(&db), + sessions.values().into_iter(), + all, + ) + .unwrap(); // 列出所有有效签到。 for a in available_sign_activities { println!("{}", a.0.as_inner()); @@ -166,6 +195,8 @@ fn main() { for a in other_sign_activities { println!("{}", a.0.as_inner()); } + } else { + warn!("{NOTICE}"); } } } @@ -181,6 +212,7 @@ fn main() { 是否精确识别二维码: precisely, 是否禁用随机偏移: no_random_shift, }; + warn!("{NOTICE}"); cli::签到(db, active_id, accounts, 签到可能使用的信息).unwrap(); } } From fee9470453a768494c771241fb088b1cd34826ae Mon Sep 17 00:00:00 2001 From: LEART Date: Sat, 30 Mar 2024 21:38:19 +0800 Subject: [PATCH 12/17] =?UTF-8?q?=E6=8F=90=E5=8D=87=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 2 +- Cargo.toml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fb5452c..c5918b5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -566,7 +566,7 @@ dependencies = [ [[package]] name = "cxsign" -version = "0.1.2" +version = "0.2.0" dependencies = [ "clap", "cxsign 0.1.1", diff --git a/Cargo.toml b/Cargo.toml index 2a5ce08..f4a854c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,14 +1,14 @@ [package] name = "cxsign" -version = "0.1.2" +version = "0.2.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] clap = { version = "4.5", features = ["derive"] } -# cxsign = { git = "https://github.com/worksoup/cxsign.git", branch = "newsign" } -cxsign = { path = "../newsign/" } +cxsign = { git = "https://github.com/worksoup/cxsign.git", branch = "newsign" } +# cxsign = { path = "../newsign/" } env_logger = "0.11" inquire = "0.7" log = { version = "0.4", features = ["release_max_level_info"] } From 63cf0eecdfe8e357acd1ffafc9ae1278e3eff76e Mon Sep 17 00:00:00 2001 From: LEART Date: Sat, 30 Mar 2024 21:39:12 +0800 Subject: [PATCH 13/17] modified: Cargo.lock --- Cargo.lock | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index c5918b5..ab69bac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -560,6 +560,7 @@ checksum = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" [[package]] name = "cxsign" version = "0.1.1" +source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#760b03d100af3776a1525fd5ed5b900e5758d761" dependencies = [ "cxsign_app", ] @@ -578,6 +579,7 @@ dependencies = [ [[package]] name = "cxsign_activity" version = "0.1.1" +source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#760b03d100af3776a1525fd5ed5b900e5758d761" dependencies = [ "chrono", "cxsign_store", @@ -594,6 +596,7 @@ dependencies = [ [[package]] name = "cxsign_app" version = "0.1.1" +source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#760b03d100af3776a1525fd5ed5b900e5758d761" dependencies = [ "cxsign_activity", "cxsign_dir", @@ -612,6 +615,7 @@ dependencies = [ [[package]] name = "cxsign_dir" version = "0.1.1" +source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#760b03d100af3776a1525fd5ed5b900e5758d761" dependencies = [ "directories", "lazy_static", @@ -620,6 +624,7 @@ dependencies = [ [[package]] name = "cxsign_error" version = "0.1.1" +source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#760b03d100af3776a1525fd5ed5b900e5758d761" dependencies = [ "thiserror", "ureq", @@ -628,6 +633,7 @@ dependencies = [ [[package]] name = "cxsign_login" version = "0.1.1" +source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#760b03d100af3776a1525fd5ed5b900e5758d761" dependencies = [ "cookie_store", "cxsign_error", @@ -642,6 +648,7 @@ dependencies = [ [[package]] name = "cxsign_pan" version = "0.1.1" +source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#760b03d100af3776a1525fd5ed5b900e5758d761" dependencies = [ "log", "mime_guess", @@ -652,6 +659,7 @@ dependencies = [ [[package]] name = "cxsign_store" version = "0.1.1" +source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#760b03d100af3776a1525fd5ed5b900e5758d761" dependencies = [ "cxsign_dir", "cxsign_user", @@ -662,6 +670,7 @@ dependencies = [ [[package]] name = "cxsign_types" version = "0.1.1" +source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#760b03d100af3776a1525fd5ed5b900e5758d761" dependencies = [ "cxsign_dir", "cxsign_pan", @@ -677,6 +686,7 @@ dependencies = [ [[package]] name = "cxsign_user" version = "0.1.1" +source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#760b03d100af3776a1525fd5ed5b900e5758d761" dependencies = [ "cookie_store", "cxsign_dir", @@ -691,6 +701,7 @@ dependencies = [ [[package]] name = "cxsign_utils" version = "0.1.1" +source = "git+https://github.com/worksoup/cxsign.git?branch=newsign#760b03d100af3776a1525fd5ed5b900e5758d761" dependencies = [ "chrono", "inquire", From 5918d607fd858d8fb659df8008eb8e9a3d55a19d Mon Sep 17 00:00:00 2001 From: worksoup <2055038075@qq.com> Date: Mon, 1 Apr 2024 09:32:24 +0800 Subject: [PATCH 14/17] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E6=B3=A8=E6=84=8F=E4=BA=8B=E9=A1=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 57 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0115301..d5857a1 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,60 @@ -# devsign +# cxsign -这里是 `newsign` 的实际使用示例。 +X 星签到的命令行工具,可以为每个课程添加单独的地点。支持多个账号签到。支持普通签到、拍照签到、二维码签到、位置签到、二维码位置签到、手势签到、签到码签到。 -本仓库的代码行将会随着 `newsign` 库的完善不断减少。 +## 注意事项 -功能上将大体与 `cxsign` 保持一致。 \ No newline at end of file +**本项目使用的网络 API 均来源于网络公开资料。** + +**本项目不提供任何现实中的网络服务,仅提供相关功能实现的参考,请勿用于任何实际用途。** + +本项目以 `AGPL-3.0` 协议开源。同时包含如下附加协议: + +- **本项目仅供学习和研究使用,严禁商用。** +- 不得广泛传播(严禁包括但不限于网盘分享、群组分享等一次性或持续性多人分享行为)。 +- 严禁任何不以学习研究为目的个人分享行为。 + +## 特别注意 + +**请注意账号安全**: + +虽然输入密码时不会在命令行界面显示任何字符,但是密码依然被缓存本地数据库中且存在被解密的风险。 + +请注意保护登录者的账号密码。 + +> - 如果让他人登录你的账号,请仔细甄别其是否值得信任; +> - 如果你登录了其他人的账号,请牢记:能力越大,责任越大,同时不要辜负他人对你的信任; +> - 你的账号不论供自己登录还是供他人登录、不论是否使用本软件或其他第三方软件登录,都推荐为其设置一个单独的、别于其他账号甚至完全无关的、不常用的密码,防止该密码被盗取后用于登录其他平台账号或猜出你设置密码的风格。 +> +> 另:为了账号安全,请不要使用 Debug 版本。 + +(TODO: 考虑是否有必要为数据库添加主密码。) + +**本项目目前主要在 Windows 下测试**: + +本项目使用跨平台库, 但由于各位同学都只用 Windows, 所以主要在 Windows 上测试。 + +我也在自己的电脑上测试,故在 Linux 上也应当有良好支持。 + +## 其他注意 + +- 本项目在没有账号登录的情况下会进行有限的提示,请注意登录你要操作的账号。 + +- 相较于旧版,本项目的新版本添加了一个排除列表,在第一次运行时会将**超过数月未发签到**或**还没发过签到**的课程添加进排除列表中,这些课程将不会获取他们签到。 + + 如果他们这时新发了签到,本项目将不会获取之。这时需要使用`cxsign list -a` 命令强制列出所有签到或使用 `cxsign list -c ` 列出特定课程的签到,此时将会刷新排除列表。 + + 注意,由于 `cxsign list -a` 命令在旧版本中会出现线程数量过多的现象,新版限制了线程数量,所以该命令耗时较长,为十几秒到数分钟不等。 + + 所以如果只有单个课程新发了签到,建议: + + - 先使用 `cxsign course` 列出所有课程。如果你的课程有变动,请添加 `-f, --fresh` 选项。课程太多可以搭配 ripgrep 等使用。 + - 然后使用 `cxsign list -c `(注意是**课程号**)列出特定课程的签到,这时本项目会强制获取该课程的签到,如果有新的签到则会将其列出,并将该课程移出排除列表。 + +## 使用方法 + +见 [Wiki](https://github.com/worksoup/cxsign/wiki). + +## 建议、问题、反馈 + +欢迎发 issues 和 pr. From b76d616f97b5f5eeb2dfc505d51e8b1aba59e3e7 Mon Sep 17 00:00:00 2001 From: worksoup <2055038075@qq.com> Date: Mon, 1 Apr 2024 09:41:15 +0800 Subject: [PATCH 15/17] =?UTF-8?q?=09=E4=BF=AE=E6=94=B9=EF=BC=9A=20=20=20?= =?UTF-8?q?=20=20Cargo.lock?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ab69bac..9d8f2b2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1091,9 +1091,9 @@ dependencies = [ [[package]] name = "image" -version = "0.25.0" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9b4f005360d32e9325029b38ba47ebd7a56f3316df09249368939562d518645" +checksum = "fd54d660e773627692c524beaad361aca785a4f9f5730ce91f42aabe5bce3d11" dependencies = [ "bytemuck", "byteorder", @@ -1280,13 +1280,12 @@ checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] name = "libredox" -version = "0.0.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ "bitflags 2.5.0", "libc", - "redox_syscall", ] [[package]] @@ -1909,9 +1908,9 @@ dependencies = [ [[package]] name = "redox_users" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" +checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" dependencies = [ "getrandom", "libredox", From 9d687ff75f8dbcebd43ec50374d8e58cc0659228 Mon Sep 17 00:00:00 2001 From: worksoup <2055038075@qq.com> Date: Mon, 1 Apr 2024 14:21:39 +0800 Subject: [PATCH 16/17] LICENSE HEADER --- Cargo.toml | 15 +++++++++++++++ LICENSE | 2 +- licenserc.toml | 47 +++++++++++++++++++++++++++++++++++++++++++++ src/cli/arg/mod.rs | 15 +++++++++++++++ src/cli/location.rs | 15 +++++++++++++++ src/cli/mod.rs | 15 +++++++++++++++ src/main.rs | 15 +++++++++++++++ src/tools/mod.rs | 15 +++++++++++++++ 8 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 licenserc.toml diff --git a/Cargo.toml b/Cargo.toml index f4a854c..6f37912 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,18 @@ +# Copyright (C) 2024 worksoup +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + [package] name = "cxsign" version = "0.2.0" diff --git a/LICENSE b/LICENSE index 70d6fe4..3972c30 100644 --- a/LICENSE +++ b/LICENSE @@ -630,7 +630,7 @@ state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - Copyright (C) 2023 worksoup + Copyright (C) 2024 This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published diff --git a/licenserc.toml b/licenserc.toml new file mode 100644 index 0000000..e7e3d3d --- /dev/null +++ b/licenserc.toml @@ -0,0 +1,47 @@ +# Copyright (C) 2024 worksoup +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +inlineHeader = """ +Copyright (C) ${inceptionYear} ${copyrightOwner} + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published +by the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +""" + +excludes = [ + # Plain text files AS IS + "*.txt", + + # Test files + "fmt/tests/content/**", + "tests/load_header_path/**", + + # Generated files + ".github/workflows/release.yml", +] + +[properties] +inceptionYear = 2024 +copyrightOwner = "worksoup " diff --git a/src/cli/arg/mod.rs b/src/cli/arg/mod.rs index fa0edc5..db5b8a7 100644 --- a/src/cli/arg/mod.rs +++ b/src/cli/arg/mod.rs @@ -1,3 +1,18 @@ +// Copyright (C) 2024 worksoup +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published +// by the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + use clap::{Parser, Subcommand}; use std::path::PathBuf; #[derive(Parser, Debug)] diff --git a/src/cli/location.rs b/src/cli/location.rs index 8812460..bdc92b8 100644 --- a/src/cli/location.rs +++ b/src/cli/location.rs @@ -1,3 +1,18 @@ +// Copyright (C) 2024 worksoup +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published +// by the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + use std::path::PathBuf; use cxsign::{ diff --git a/src/cli/mod.rs b/src/cli/mod.rs index 342a834..58fb6f4 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -1,3 +1,18 @@ +// Copyright (C) 2024 worksoup +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published +// by the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + pub mod arg; pub mod location; diff --git a/src/main.rs b/src/main.rs index b4dc6ce..4ff00f2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,18 @@ +// Copyright (C) 2024 worksoup +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published +// by the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + #![feature(ascii_char)] #![feature(lint_reasons)] #![feature(async_closure)] diff --git a/src/tools/mod.rs b/src/tools/mod.rs index 243cff3..5b29483 100644 --- a/src/tools/mod.rs +++ b/src/tools/mod.rs @@ -1,3 +1,18 @@ +// Copyright (C) 2024 worksoup +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published +// by the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + use cxsign::{ store::{ tables::{AccountTable, CourseTable}, From 650189d9ba6a48d61951f3b5e33b7f5ebb2820f8 Mon Sep 17 00:00:00 2001 From: worksoup <2055038075@qq.com> Date: Mon, 1 Apr 2024 16:57:45 +0800 Subject: [PATCH 17/17] =?UTF-8?q?=09=E4=BF=AE=E6=94=B9=EF=BC=9A=20=20=20?= =?UTF-8?q?=20=20licenserc.toml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- licenserc.toml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/licenserc.toml b/licenserc.toml index e7e3d3d..e90c65a 100644 --- a/licenserc.toml +++ b/licenserc.toml @@ -31,15 +31,6 @@ along with this program. If not, see . """ excludes = [ - # Plain text files AS IS - "*.txt", - - # Test files - "fmt/tests/content/**", - "tests/load_header_path/**", - - # Generated files - ".github/workflows/release.yml", ] [properties]