diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..d4b3cf1 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,25 @@ +version: 2 +updates: + - package-ecosystem: "cargo" + directory: "/" + schedule: + interval: "monthly" + day: "sunday" + commit-message: + prefix: "chore(dep): " + groups: + deps: + patterns: + - "*" + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" + day: "sunday" + commit-message: + prefix: "chore(dep): " + groups: + deps: + patterns: + - "*" diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index 004dc18..563233f 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -13,7 +13,7 @@ jobs: matrix: os: [macOS-latest, ubuntu-latest] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: components: clippy diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ace9f74..1b86e39 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,11 +11,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout sources - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install stable toolchain uses: actions-rs/toolchain@v1 with: toolchain: stable - - uses: katyo/publish-crates@v1 + - uses: katyo/publish-crates@v2 with: registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }} diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 4c80eeb..ee47a77 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -2,9 +2,9 @@ name: leetcode-cli on: push: - branches: [ master ] + branches: [master] pull_request: - branches: [ master ] + branches: [master] jobs: build: @@ -14,7 +14,7 @@ jobs: os: [macOS-latest, ubuntu-latest] steps: - name: Checkout the source code - uses: actions/checkout@v1 + uses: actions/checkout@v4 - name: Set nightly toolchain uses: actions-rs/toolchain@v1 with: @@ -22,13 +22,12 @@ jobs: - name: Environment run: | if [[ "$(uname)" == 'Darwin' ]]; then - brew update brew install sqlite3 else sudo apt-get update -y sudo apt-get install -y libsqlite3-dev libdbus-1-dev fi - name: Build - run: cargo build --release --locked + run: cargo build --release --all-features - name: Run tests - run: cargo test + run: cargo test --release --all-features diff --git a/.gitignore b/.gitignore index d97f62e..67e0e9c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .DS_Store .idea .direnv/ +/result diff --git a/Cargo.lock b/Cargo.lock index b0217c9..1f5144f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,15 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 + +[[package]] +name = "addr2line" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +dependencies = [ + "gimli", +] [[package]] name = "adler" @@ -9,86 +18,80 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] -name = "aes" -version = "0.7.5" +name = "adler2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures", - "opaque-debug", -] +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] name = "aho-corasick" -version = "1.0.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] [[package]] name = "anstream" -version = "0.3.2" +version = "0.6.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", - "is-terminal", + "is_terminal_polyfill", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.1" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" [[package]] name = "anstyle-parse" -version = "0.2.1" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" +checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "1.0.1" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" +checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" dependencies = [ "anstyle", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "anyhow" -version = "1.0.71" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" +checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" [[package]] name = "async-compression" -version = "0.4.0" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0122885821398cc923ece939e24d1056a2384ee719432397fa9db87230ff11" +checksum = "fec134f64e2bc57411226dfc4e52dec859ddfc7e711fc5e07b612584f000e4aa" dependencies = [ "flate2", "futures-core", @@ -97,123 +100,82 @@ dependencies = [ "tokio", ] -[[package]] -name = "async-io" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" -dependencies = [ - "async-lock", - "autocfg", - "cfg-if", - "concurrent-queue", - "futures-lite", - "log", - "parking", - "polling", - "rustix", - "slab", - "socket2", - "waker-fn", -] - -[[package]] -name = "async-lock" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa24f727524730b077666307f2734b4a1a1c57acb79193127dcc8914d5242dd7" -dependencies = [ - "event-listener", -] - [[package]] name = "async-trait" -version = "0.1.68" +version = "0.1.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" +checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn", ] [[package]] -name = "atty" -version = "0.2.14" +name = "atomic-waker" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", -] +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "base64" -version = "0.21.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" - -[[package]] -name = "bitflags" -version = "1.3.2" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] -name = "block-buffer" -version = "0.9.0" +name = "backtrace" +version = "0.3.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" dependencies = [ - "generic-array", + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide 0.7.4", + "object", + "rustc-demangle", ] [[package]] -name = "block-modes" -version = "0.8.1" +name = "base64" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cb03d1bed155d89dce0f845b7899b18a9a163e148fd004e1c28421a783e2d8e" -dependencies = [ - "block-padding", - "cipher", -] +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] -name = "block-padding" -version = "0.2.1" +name = "bitflags" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bumpalo" -version = "3.13.0" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.4.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" [[package]] name = "cc" -version = "1.0.79" +version = "1.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +checksum = "50d2eb3cd3d1bf4529e31c215ee6f93ec5a3d536d9f578f93d9d33ee19562932" +dependencies = [ + "shlex", +] [[package]] name = "cfg-if" @@ -222,80 +184,67 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] -name = "cipher" -version = "0.3.0" +name = "cfg_aliases" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" -dependencies = [ - "generic-array", -] +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "clap" -version = "4.3.8" +version = "4.5.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9394150f5b4273a1763355bd1c2ec54cc5a2593f790587bcd6b2c947cfa9211" +checksum = "fd60e63e9be68e5fb56422e397cf9baddded06dae1d2e523401542383bc72a9f" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.3.8" +version = "4.5.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a78fbdd3cc2914ddf37ba444114bc7765bbdcb55ec9cbe6fa054f0137400717" +checksum = "89cc6392a1f72bbeb820d71f32108f61fdaf18bc526e1d23954168a67759ef51" dependencies = [ "anstream", "anstyle", - "bitflags", "clap_lex", - "once_cell", "strsim", ] [[package]] -name = "clap_lex" -version = "0.5.0" +name = "clap_complete" +version = "4.5.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" +checksum = "1a554639e42d0c838336fc4fbedb9e2df3ad1fa4acda149f9126b4ccfcd7900f" +dependencies = [ + "clap", +] [[package]] -name = "colorchoice" -version = "1.0.0" +name = "clap_lex" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] -name = "colored" -version = "2.0.0" +name = "colorchoice" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3616f750b84d8f0de8a58bda93e08e2a81ad3f523089b05f1dffecab48c6cbd" -dependencies = [ - "atty", - "lazy_static", - "winapi", -] +checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" [[package]] -name = "concurrent-queue" -version = "2.2.0" +name = "colored" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62ec6771ecfa0762d24683ee5a32ad78487a3d3afdc0fb8cae19d2c5deb50b7c" +checksum = "fde0e0ec90c9dfb3b4b1a0891a7dcd0e2bffde2f7efed5fe7c9bb00e5bfb915e" dependencies = [ - "crossbeam-utils", + "windows-sys 0.59.0", ] -[[package]] -name = "convert_case" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" - [[package]] name = "core-foundation" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", "libc", @@ -303,103 +252,102 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.4" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] -name = "cpufeatures" -version = "0.2.8" +name = "crc32fast" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03e69e28e9f7f77debdedbaafa2866e1de9ba56df55a8bd7cfc724c25a09987c" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" dependencies = [ - "libc", + "cfg-if", ] [[package]] -name = "crc32fast" -version = "1.3.2" +name = "cssparser" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "b7c66d1cd8ed61bf80b38432613a7a2f09401ab8d0501110655f8b341484a3e3" dependencies = [ - "cfg-if", + "cssparser-macros", + "dtoa-short", + "itoa", + "phf", + "smallvec", ] [[package]] -name = "crossbeam-utils" -version = "0.8.16" +name = "cssparser-macros" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" dependencies = [ - "cfg-if", + "quote", + "syn", ] [[package]] -name = "crypto-mac" -version = "0.11.1" +name = "darling" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ - "generic-array", - "subtle", + "darling_core", + "darling_macro", ] [[package]] -name = "cssparser" -version = "0.27.2" +name = "darling_core" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "754b69d351cdc2d8ee09ae203db831e005560fc6030da058f86ad60c92a9cb0a" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" dependencies = [ - "cssparser-macros", - "dtoa-short", - "itoa 0.4.8", - "matches", - "phf 0.8.0", + "fnv", + "ident_case", "proc-macro2", "quote", - "smallvec", - "syn 1.0.109", + "strsim", + "syn", ] [[package]] -name = "cssparser-macros" -version = "0.6.1" +name = "darling_macro" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ + "darling_core", "quote", - "syn 2.0.22", + "syn", ] [[package]] -name = "derivative" -version = "2.2.0" +name = "deranged" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", + "powerfmt", ] [[package]] name = "derive_more" -version = "0.99.17" +version = "0.99.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" dependencies = [ - "convert_case", "proc-macro2", "quote", - "rustc_version", - "syn 1.0.109", + "syn", ] [[package]] name = "diesel" -version = "2.1.0" +version = "2.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7a532c1f99a0f596f6960a60d1e119e91582b24b39e2d83a190e61262c3ef0c" +checksum = "ff3e1edb1f37b4953dd5176916347289ed43d7119cc2e6c7c3f7849ff44ea506" dependencies = [ "diesel_derives", "libsqlite3-sys", @@ -408,168 +356,150 @@ dependencies = [ [[package]] name = "diesel_derives" -version = "2.1.0" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74398b79d81e52e130d991afeed9c86034bb1b7735f46d2f5bf7deb261d80303" +checksum = "e7f2c3de51e2ba6bf2a648285696137aaf0f5f487bcbea93972fe8a364e131a4" dependencies = [ "diesel_table_macro_syntax", + "dsl_auto_type", "proc-macro2", "quote", - "syn 2.0.22", + "syn", ] [[package]] name = "diesel_table_macro_syntax" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc5557efc453706fed5e4fa85006fe9817c224c3f480a34c7e5959fd700921c5" -dependencies = [ - "syn 2.0.22", -] - -[[package]] -name = "digest" -version = "0.9.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +checksum = "209c735641a413bc68c4923a9d6ad4bcb3ca306b794edaa7eb0b3228a99ffb25" dependencies = [ - "generic-array", + "syn", ] [[package]] name = "dirs" -version = "4.0.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" +checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" dependencies = [ "dirs-sys", ] [[package]] name = "dirs-sys" -version = "0.3.7" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" +checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" dependencies = [ "libc", + "option-ext", "redox_users", - "winapi", + "windows-sys 0.59.0", +] + +[[package]] +name = "dsl_auto_type" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5d9abe6314103864cc2d8901b7ae224e0ab1a103a0a416661b4097b0779b607" +dependencies = [ + "darling", + "either", + "heck", + "proc-macro2", + "quote", + "syn", ] [[package]] name = "dtoa" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65d09067bfacaa79114679b279d7f5885b53295b1e2cfb4e79c8e4bd3d633169" +checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" [[package]] name = "dtoa-short" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbaceec3c6e4211c79e7b1800fb9680527106beb2f9c51904a3210c03a448c74" +checksum = "cd1511a7b6a56299bd043a9c167a6d2bfb37bf84a6dfceaba651168adfb43c87" dependencies = [ "dtoa", ] [[package]] name = "ego-tree" -version = "0.6.2" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a68a4904193147e0a8dec3314640e6db742afd5f6e634f428a6af230d9b3591" +checksum = "b2972feb8dffe7bc8c5463b1dacda1b0dfbed3710e50f977d965429692d74cd8" [[package]] -name = "encoding_rs" -version = "0.8.32" +name = "either" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" -dependencies = [ - "cfg-if", -] +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] -name = "enumflags2" -version = "0.6.4" +name = "encoding_rs" +version = "0.8.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83c8d82922337cd23a15f88b70d8e4ef5f11da38dd7cdb55e84dd5de99695da0" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" dependencies = [ - "enumflags2_derive", - "serde", + "cfg-if", ] [[package]] -name = "enumflags2_derive" -version = "0.6.4" +name = "env_filter" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "946ee94e3dbf58fdd324f9ce245c7b238d46a66f00e86a020b71996349e46cce" +checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab" dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", + "log", + "regex", ] [[package]] name = "env_logger" -version = "0.9.3" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" +checksum = "dcaee3d8e3cfc3fd92428d477bc97fc29ec8716d180c0d74c643bb26166660e0" dependencies = [ - "atty", + "anstream", + "anstyle", + "env_filter", "humantime", "log", - "regex", - "termcolor", ] [[package]] name = "equivalent" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88bffebc5d80432c9b140ee17875ff173a8ab62faad5b257da912bd2f6c1c0a1" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ - "cc", "libc", + "windows-sys 0.52.0", ] -[[package]] -name = "event-listener" -version = "2.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" - [[package]] name = "fastrand" -version = "1.9.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" -dependencies = [ - "instant", -] +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" [[package]] name = "flate2" -version = "1.0.26" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" +checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253" dependencies = [ "crc32fast", - "miniz_oxide", + "miniz_oxide 0.8.0", ] [[package]] @@ -595,9 +525,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ "percent-encoding", ] @@ -612,108 +542,43 @@ dependencies = [ "new_debug_unreachable", ] -[[package]] -name = "futures" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", - "futures-sink", ] [[package]] name = "futures-core" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" - -[[package]] -name = "futures-executor" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" - -[[package]] -name = "futures-lite" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" -dependencies = [ - "fastrand", - "futures-core", - "futures-io", - "memchr", - "parking", - "pin-project-lite", - "waker-fn", -] - -[[package]] -name = "futures-macro" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.22", -] +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ - "futures-channel", "futures-core", - "futures-io", - "futures-macro", - "futures-sink", "futures-task", - "memchr", "pin-project-lite", "pin-utils", - "slab", ] [[package]] @@ -725,60 +590,57 @@ 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", -] - [[package]] name = "getopts" version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" dependencies = [ - "unicode-width", + "unicode-width 0.1.14", ] [[package]] name = "getrandom" -version = "0.1.16" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", - "wasi 0.9.0+wasi-snapshot-preview1", + "wasi 0.11.0+wasi-snapshot-preview1", ] [[package]] name = "getrandom" -version = "0.2.10" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +checksum = "43a49c392881ce6d5c3b8cb70f98717b7c07aabbdff06687b9030dbfbe2725f8" dependencies = [ "cfg-if", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi 0.13.3+wasi-0.2.2", + "windows-targets 0.52.6", ] +[[package]] +name = "gimli" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" + [[package]] name = "h2" -version = "0.3.19" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d357c7ae988e7d2182f7d7871d0b963962420b0678b0997ce7de72001aeab782" +checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" dependencies = [ + "atomic-waker", "bytes", "fnv", "futures-core", "futures-sink", - "futures-util", "http", - "indexmap 1.9.3", + "indexmap", "slab", "tokio", "tokio-util", @@ -787,107 +649,75 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.12.3" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" [[package]] -name = "hashbrown" -version = "0.14.0" +name = "heck" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" -version = "0.1.19" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] -name = "hermit-abi" -version = "0.2.6" +name = "html5ever" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +checksum = "2e15626aaf9c351bc696217cbe29cb9b5e86c43f8a46b5e2f5c6c5cf7cb904ce" dependencies = [ - "libc", + "log", + "mac", + "markup5ever", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "hermit-abi" -version = "0.3.1" +name = "http" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +dependencies = [ + "bytes", + "fnv", + "itoa", +] [[package]] -name = "hkdf" -version = "0.11.0" +name = "http-body" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01706d578d5c281058480e673ae4086a9f4710d8df1ad80a5b03e39ece5f886b" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ - "digest", - "hmac", + "bytes", + "http", ] [[package]] -name = "hmac" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" -dependencies = [ - "crypto-mac", - "digest", -] - -[[package]] -name = "html5ever" -version = "0.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bea68cab48b8459f17cf1c944c67ddc572d272d9f2b274140f223ecb1da4a3b7" -dependencies = [ - "log", - "mac", - "markup5ever", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "http" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" -dependencies = [ - "bytes", - "fnv", - "itoa 1.0.6", -] - -[[package]] -name = "http-body" -version = "0.4.5" +name = "http-body-util" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", + "futures-util", "http", + "http-body", "pin-project-lite", ] [[package]] name = "httparse" -version = "1.8.0" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" - -[[package]] -name = "httpdate" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" +checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" [[package]] name = "humantime" @@ -897,191 +727,212 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.26" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab302d72a6f11a3b910431ff93aae7e773078c769f0a3ef15fb9ec692ed147d4" +checksum = "cc2b571658e38e0c01b1fdca3bbbe93c00d3d71693ff2770043f8c29bc7d6f80" dependencies = [ "bytes", "futures-channel", - "futures-core", "futures-util", "h2", "http", "http-body", "httparse", - "httpdate", - "itoa 1.0.6", + "itoa", "pin-project-lite", - "socket2", + "smallvec", "tokio", - "tower-service", - "tracing", "want", ] +[[package]] +name = "hyper-rustls" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" +dependencies = [ + "futures-util", + "http", + "hyper", + "hyper-util", + "rustls", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", +] + [[package]] name = "hyper-tls" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", + "http-body-util", "hyper", + "hyper-util", "native-tls", "tokio", "tokio-native-tls", + "tower-service", ] [[package]] -name = "idna" -version = "0.4.0" +name = "hyper-util" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +checksum = "b1c293b6b3d21eca78250dc7dbebd6b9210ec5530e038cbfe0661b5c47ab06e8" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "base64", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http", + "http-body", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "system-configuration", + "tokio", + "tower-service", + "tracing", + "windows-registry", ] [[package]] -name = "indexmap" -version = "1.9.3" +name = "ident_case" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] -name = "indexmap" -version = "2.0.0" +name = "idna" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ - "equivalent", - "hashbrown 0.14.0", + "unicode-bidi", + "unicode-normalization", ] [[package]] -name = "indoc" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa799dd5ed20a7e349f3b4639aa80d74549c81716d9ec4f994c9b5815598306" - -[[package]] -name = "instant" -version = "0.1.12" +name = "indexmap" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c" dependencies = [ - "cfg-if", + "equivalent", + "hashbrown", ] [[package]] -name = "io-lifetimes" -version = "1.0.11" +name = "indoc" +version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi 0.3.1", - "libc", - "windows-sys 0.48.0", -] +checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" [[package]] name = "ipnet" -version = "2.7.2" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12b6ee2129af8d4fb011108c73d99a1b83a85977f23b82460c0ae2e25bb4b57f" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] -name = "is-terminal" -version = "0.4.7" +name = "iri-string" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" +checksum = "dbc5ebe9c3a1a7a5127f920a418f7585e9e758e911d0466ed004f393b0e380b2" dependencies = [ - "hermit-abi 0.3.1", - "io-lifetimes", - "rustix", - "windows-sys 0.48.0", + "memchr", + "serde", ] [[package]] -name = "itoa" -version = "0.4.8" +name = "is_terminal_polyfill" +version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "itoa" -version = "1.0.6" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "js-sys" -version = "0.3.64" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" dependencies = [ + "once_cell", "wasm-bindgen", ] [[package]] name = "keyring" -version = "1.2.1" +version = "3.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba264b266563c1363dcce004776cbf198d7422a4262f77f4ca285bf26ae30955" +checksum = "1961983669d57bdfe6c0f3ef8e4c229b5ef751afcc7d87e4271d2f71f6ccfa8b" dependencies = [ - "byteorder", - "secret-service", - "security-framework", - "winapi", + "log", ] -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - [[package]] name = "leetcode-cli" -version = "0.4.1" +version = "0.4.7" dependencies = [ "anyhow", "async-trait", "clap", + "clap_complete", "colored", "diesel", "dirs", "env_logger", "keyring", "log", - "nix 0.24.3", + "nix", "openssl", "pyo3", - "rand 0.8.5", + "rand 0.9.1", "regex", "reqwest", "scraper", "serde", "serde_json", + "thiserror", "tokio", "toml", + "unicode-width 0.2.0", ] [[package]] name = "libc" -version = "0.2.146" +version = "0.2.172" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" + +[[package]] +name = "libredox" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags", + "libc", +] [[package]] name = "libsqlite3-sys" -version = "0.26.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc22eff61b133b115c6e8c74e818c628d6d5e7a502afea6f64dee076dd94326" +checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" dependencies = [ "pkg-config", "vcpkg", @@ -1089,15 +940,15 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.3.8" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "lock_api" -version = "0.4.10" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", "scopeguard", @@ -1105,9 +956,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.19" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] name = "mac" @@ -1117,35 +968,29 @@ checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" [[package]] name = "markup5ever" -version = "0.11.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2629bb1404f3d34c2e921f21fd34ba00b206124c81f65c50b43b6aaefeb016" +checksum = "82c88c6129bd24319e62a0359cb6b958fa7e8be6e19bb1663bc396b90883aca5" dependencies = [ "log", - "phf 0.10.1", - "phf_codegen 0.10.0", + "phf", + "phf_codegen", "string_cache", "string_cache_codegen", "tendril", ] -[[package]] -name = "matches" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" - [[package]] name = "memchr" -version = "2.5.0" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "memoffset" -version = "0.6.5" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" dependencies = [ "autocfg", ] @@ -1158,31 +1003,40 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" dependencies = [ "adler", ] +[[package]] +name = "miniz_oxide" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +dependencies = [ + "adler2", +] + [[package]] name = "mio" -version = "0.8.8" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ + "hermit-abi", "libc", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "native-tls" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" dependencies = [ - "lazy_static", "libc", "log", "openssl", @@ -1194,156 +1048,50 @@ dependencies = [ "tempfile", ] -[[package]] -name = "nb-connect" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1bb540dc6ef51cfe1916ec038ce7a620daf3a111e2502d745197cd53d6bca15" -dependencies = [ - "libc", - "socket2", -] - [[package]] name = "new_debug_unreachable" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" - -[[package]] -name = "nix" -version = "0.22.3" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4916f159ed8e5de0082076562152a76b7a1f64a01fd9d1e0fea002c37624faf" -dependencies = [ - "bitflags", - "cc", - "cfg-if", - "libc", - "memoffset", -] +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" [[package]] name = "nix" -version = "0.24.3" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" +checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6" dependencies = [ "bitflags", "cfg-if", + "cfg_aliases", "libc", - "memoffset", -] - -[[package]] -name = "nodrop" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" - -[[package]] -name = "num" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43db66d1170d347f9a065114077f7dccb00c1b9478c89384490a3425279a4606" -dependencies = [ - "num-bigint", - "num-complex", - "num-integer", - "num-iter", - "num-rational", - "num-traits", -] - -[[package]] -name = "num-bigint" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-complex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-integer" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-iter" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" -dependencies = [ - "autocfg", - "num-bigint", - "num-integer", - "num-traits", ] [[package]] -name = "num-traits" -version = "0.2.15" +name = "num-conv" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" -dependencies = [ - "autocfg", -] +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[package]] -name = "num_cpus" -version = "1.15.0" +name = "object" +version = "0.36.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9" dependencies = [ - "hermit-abi 0.2.6", - "libc", + "memchr", ] [[package]] name = "once_cell" -version = "1.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" - -[[package]] -name = "opaque-debug" -version = "0.3.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "openssl" -version = "0.10.55" +version = "0.10.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "345df152bc43501c5eb9e4654ff05f794effb78d4efe3d53abc158baddc0703d" +checksum = "8505734d46c8ab1e19a1dce3aef597ad87dcb4c37e7188231769bd6bd51cebf8" dependencies = [ "bitflags", "cfg-if", @@ -1362,7 +1110,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn", ] [[package]] @@ -1373,9 +1121,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.90" +version = "0.9.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374533b0e45f3a7ced10fcaeccca020e66656bc03dac384f852e4e5a7a8104a6" +checksum = "90096e2e47630d78b7d1c20952dc621f957103f8bc2c8359ec81290d75238571" dependencies = [ "cc", "libc", @@ -1384,16 +1132,16 @@ dependencies = [ ] [[package]] -name = "parking" -version = "2.1.0" +name = "option-ext" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14f2252c834a40ed9bb5422029649578e63aa341ac401f74e719dd1afda8394e" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] name = "parking_lot" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", "parking_lot_core", @@ -1401,120 +1149,99 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.8" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.3.5", + "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.52.6", ] [[package]] name = "percent-encoding" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "phf" -version = "0.8.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" +checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" dependencies = [ "phf_macros", - "phf_shared 0.8.0", - "proc-macro-hack", -] - -[[package]] -name = "phf" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" -dependencies = [ - "phf_shared 0.10.0", + "phf_shared 0.11.2", ] [[package]] name = "phf_codegen" -version = "0.8.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbffee61585b0411840d3ece935cce9cb6321f01c45477d30066498cd5e1a815" +checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a" dependencies = [ - "phf_generator 0.8.0", - "phf_shared 0.8.0", + "phf_generator 0.11.2", + "phf_shared 0.11.2", ] [[package]] -name = "phf_codegen" +name = "phf_generator" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd" +checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" dependencies = [ - "phf_generator 0.10.0", "phf_shared 0.10.0", + "rand 0.8.5", ] [[package]] name = "phf_generator" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526" -dependencies = [ - "phf_shared 0.8.0", - "rand 0.7.3", -] - -[[package]] -name = "phf_generator" -version = "0.10.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" +checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" dependencies = [ - "phf_shared 0.10.0", + "phf_shared 0.11.2", "rand 0.8.5", ] [[package]] name = "phf_macros" -version = "0.8.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f6fde18ff429ffc8fe78e2bf7f8b7a5a5a6e2a8b58bc5a9ac69198bbda9189c" +checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" dependencies = [ - "phf_generator 0.8.0", - "phf_shared 0.8.0", - "proc-macro-hack", + "phf_generator 0.11.2", + "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 1.0.109", + "syn", ] [[package]] name = "phf_shared" -version = "0.8.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7" +checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" dependencies = [ "siphasher", ] [[package]] name = "phf_shared" -version = "0.10.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" dependencies = [ "siphasher", ] [[package]] name = "pin-project-lite" -version = "0.2.9" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -1524,82 +1251,57 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] -name = "polling" -version = "2.8.0" +name = "portable-atomic" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" -dependencies = [ - "autocfg", - "bitflags", - "cfg-if", - "concurrent-queue", - "libc", - "log", - "pin-project-lite", - "windows-sys 0.48.0", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "da544ee218f0d287a911e9c99a39a8c9bc8fcad3cb8db5959940044ecfc67265" [[package]] -name = "precomputed-hash" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" - -[[package]] -name = "proc-macro-crate" -version = "0.1.5" +name = "powerfmt" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" -dependencies = [ - "toml", -] +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] -name = "proc-macro-crate" -version = "1.3.1" +name = "ppv-lite86" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" dependencies = [ - "once_cell", - "toml_edit", + "zerocopy 0.7.35", ] [[package]] -name = "proc-macro-hack" -version = "0.5.20+deprecated" +name = "precomputed-hash" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" [[package]] name = "proc-macro2" -version = "1.0.63" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] [[package]] name = "pyo3" -version = "0.16.6" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0220c44442c9b239dd4357aa856ac468a4f5e1f0df19ddb89b2522952eb4c6ca" +checksum = "f239d656363bcee73afef85277f1b281e8ac6212a1d42aa90e55b90ed43c47a4" dependencies = [ - "cfg-if", "indoc", "libc", - "parking_lot", + "memoffset", + "once_cell", + "portable-atomic", "pyo3-build-config", "pyo3-ffi", "pyo3-macros", @@ -1608,9 +1310,9 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.16.6" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c819d397859445928609d0ec5afc2da5204e0d0f73d6bf9e153b04e83c9cdc2" +checksum = "755ea671a1c34044fa165247aaf6f419ca39caa6003aee791a0df2713d8f1b6d" dependencies = [ "once_cell", "target-lexicon", @@ -1618,9 +1320,9 @@ dependencies = [ [[package]] name = "pyo3-ffi" -version = "0.16.6" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca882703ab55f54702d7bfe1189b41b0af10272389f04cae38fe4cd56c65f75f" +checksum = "fc95a2e67091e44791d4ea300ff744be5293f394f1bafd9f78c080814d35956e" dependencies = [ "libc", "pyo3-build-config", @@ -1628,50 +1330,38 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.16.6" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "568749402955ad7be7bad9a09b8593851cd36e549ac90bfd44079cea500f3f21" +checksum = "a179641d1b93920829a62f15e87c0ed791b6c8db2271ba0fd7c2686090510214" dependencies = [ "proc-macro2", "pyo3-macros-backend", "quote", - "syn 1.0.109", + "syn", ] [[package]] name = "pyo3-macros-backend" -version = "0.16.6" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "611f64e82d98f447787e82b8e7b0ebc681e1eb78fc1252668b2c605ffb4e1eb8" +checksum = "9dff85ebcaab8c441b0e3f7ae40a6963ecea8a9f5e74f647e33fcf5ec9a1e89e" dependencies = [ + "heck", "proc-macro2", + "pyo3-build-config", "quote", - "syn 1.0.109", + "syn", ] [[package]] name = "quote" -version = "1.0.28" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" 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", - "rand_pcg", -] - [[package]] name = "rand" version = "0.8.5" @@ -1684,13 +1374,13 @@ dependencies = [ ] [[package]] -name = "rand_chacha" -version = "0.2.2" +name = "rand" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97" dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", + "rand_chacha 0.9.0", + "rand_core 0.9.0", ] [[package]] @@ -1704,75 +1394,71 @@ dependencies = [ ] [[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom 0.2.10", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" +name = "rand_chacha" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" dependencies = [ - "rand_core 0.5.1", + "ppv-lite86", + "rand_core 0.9.0", ] [[package]] -name = "rand_pcg" -version = "0.2.1" +name = "rand_core" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "rand_core 0.5.1", + "getrandom 0.2.15", ] [[package]] -name = "redox_syscall" -version = "0.2.16" +name = "rand_core" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +checksum = "b08f3c9802962f7e1b25113931d94f43ed9725bebc59db9d0c3e9a23b67e15ff" dependencies = [ - "bitflags", + "getrandom 0.3.1", + "zerocopy 0.8.14", ] [[package]] name = "redox_syscall" -version = "0.3.5" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" dependencies = [ "bitflags", ] [[package]] name = "redox_users" -version = "0.4.3" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" +checksum = "dd6f9d3d47bdd2ad6945c5015a226ec6155d0bcdfd8f7cd29f86b71f8de99d2b" dependencies = [ - "getrandom 0.2.10", - "redox_syscall 0.2.16", + "getrandom 0.2.15", + "libredox", "thiserror", ] [[package]] name = "regex" -version = "1.8.4" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" dependencies = [ "aho-corasick", "memchr", @@ -1781,15 +1467,15 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.7.2" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" -version = "0.11.18" +version = "0.12.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" +checksum = "e98ff6b0dbbe4d5a37318f433d4fc82babd21631f194d370409ceb2e40b2f0b5" dependencies = [ "async-compression", "base64", @@ -1800,8 +1486,11 @@ dependencies = [ "h2", "http", "http-body", + "http-body-util", "hyper", + "hyper-rustls", "hyper-tls", + "hyper-util", "ipnet", "js-sys", "log", @@ -1810,111 +1499,137 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", + "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", + "sync_wrapper", "tokio", "tokio-native-tls", "tokio-util", + "tower", + "tower-http", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "winreg", ] [[package]] -name = "rustc_version" -version = "0.4.0" +name = "ring" +version = "0.17.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ - "semver", + "cc", + "cfg-if", + "getrandom 0.2.15", + "libc", + "spin", + "untrusted", + "windows-sys 0.52.0", ] +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + [[package]] name = "rustix" -version = "0.37.20" +version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ "bitflags", "errno", - "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] -name = "ryu" -version = "1.0.13" +name = "rustls" +version = "0.23.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" +dependencies = [ + "once_cell", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +checksum = "229a4a4c221013e7e1f1a043678c5cc39fe5171437c88fb47151a21e6f5b5c79" +dependencies = [ + "zeroize", +] [[package]] -name = "schannel" -version = "0.1.21" +name = "rustls-webpki" +version = "0.102.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" +checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e" dependencies = [ - "windows-sys 0.42.0", + "ring", + "rustls-pki-types", + "untrusted", ] [[package]] -name = "scoped-tls" -version = "1.0.1" +name = "rustversion" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "schannel" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +dependencies = [ + "windows-sys 0.52.0", +] [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "scraper" -version = "0.13.0" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5684396b456f3eb69ceeb34d1b5cb1a2f6acf7ca4452131efa3ba0ee2c2d0a70" +checksum = "527e65d9d888567588db4c12da1087598d0f6f8b346cc2c5abc91f05fc2dffe2" dependencies = [ "cssparser", "ego-tree", "getopts", "html5ever", - "matches", + "precomputed-hash", "selectors", - "smallvec", "tendril", ] -[[package]] -name = "secret-service" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1da5c423b8783185fd3fecd1c8796c267d2c089d894ce5a93c280a5d3f780a2" -dependencies = [ - "aes", - "block-modes", - "hkdf", - "lazy_static", - "num", - "rand 0.8.5", - "serde", - "sha2", - "zbus", - "zbus_macros", - "zvariant", - "zvariant_derive", -] - [[package]] name = "security-framework" -version = "2.9.1" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ "bitflags", "core-foundation", @@ -1925,9 +1640,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.0" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f51d0c0d83bec45f16480d0ce0058397a69e48fcdc52d1dc8855fb68acbd31a7" +checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" dependencies = [ "core-foundation-sys", "libc", @@ -1935,70 +1650,62 @@ dependencies = [ [[package]] name = "selectors" -version = "0.22.0" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df320f1889ac4ba6bc0cdc9c9af7af4bd64bb927bccdf32d81140dc1f9be12fe" +checksum = "fd568a4c9bb598e291a08244a5c1f5a8a6650bee243b5b0f8dbb3d9cc1d87fe8" dependencies = [ "bitflags", "cssparser", "derive_more", "fxhash", "log", - "matches", - "phf 0.8.0", - "phf_codegen 0.8.0", + "new_debug_unreachable", + "phf", + "phf_codegen", "precomputed-hash", "servo_arc", "smallvec", - "thin-slice", ] -[[package]] -name = "semver" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" - [[package]] name = "serde" -version = "1.0.164" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.164" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn", ] [[package]] name = "serde_json" -version = "1.0.99" +version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46266871c240a00b8f503b877622fe33430b3c7d963bdc0f2adc511e54a1eae3" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" dependencies = [ - "itoa 1.0.6", + "itoa", + "memchr", "ryu", "serde", ] [[package]] -name = "serde_repr" -version = "0.1.12" +name = "serde_spanned" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcec881020c684085e55a25f7fd888954d56609ef363479dc5a1305eb0d40cab" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.22", + "serde", ] [[package]] @@ -2008,85 +1715,77 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ "form_urlencoded", - "itoa 1.0.6", + "itoa", "ryu", "serde", ] [[package]] name = "servo_arc" -version = "0.1.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d98238b800e0d1576d8b6e3de32827c2d74bee68bb97748dcf5071fb53965432" +checksum = "ae65c4249478a2647db249fb43e23cec56a2c8974a427e7bd8cb5a1d0964921a" dependencies = [ - "nodrop", "stable_deref_trait", ] [[package]] -name = "sha2" -version = "0.9.9" +name = "shlex" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" -dependencies = [ - "block-buffer", - "cfg-if", - "cpufeatures", - "digest", - "opaque-debug", -] +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" dependencies = [ "libc", ] [[package]] name = "siphasher" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" [[package]] name = "slab" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] [[package]] name = "smallvec" -version = "1.10.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" -version = "0.4.9" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" dependencies = [ "libc", - "winapi", + "windows-sys 0.52.0", ] [[package]] -name = "stable_deref_trait" -version = "1.2.0" +name = "spin" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] -name = "static_assertions" -version = "1.1.0" +name = "stable_deref_trait" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "string_cache" @@ -2116,21 +1815,21 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "subtle" -version = "2.4.1" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "1.0.109" +version = "2.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" dependencies = [ "proc-macro2", "quote", @@ -2138,34 +1837,52 @@ dependencies = [ ] [[package]] -name = "syn" -version = "2.0.22" +name = "sync_wrapper" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2efbeae7acf4eabd6bcdcbd11c92f45231ddda7539edc7806bd1a04a03b24616" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", + "futures-core", +] + +[[package]] +name = "system-configuration" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" +dependencies = [ + "bitflags", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", ] [[package]] name = "target-lexicon" -version = "0.12.8" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1c7f239eb94671427157bd93b3694320f3668d4e1eff08c7285366fd777fac" +checksum = "e502f78cdbb8ba4718f566c418c52bc729126ffd16baee5baa718cf25dd5a69a" [[package]] name = "tempfile" -version = "3.6.0" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" +checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" dependencies = [ - "autocfg", "cfg-if", "fastrand", - "redox_syscall 0.3.5", + "once_cell", "rustix", - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] @@ -2179,48 +1896,36 @@ dependencies = [ "utf-8", ] -[[package]] -name = "termcolor" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "thin-slice" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c" - [[package]] name = "thiserror" -version = "1.0.40" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.40" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn", ] [[package]] name = "time" -version = "0.3.22" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ - "itoa 1.0.6", + "deranged", + "itoa", + "num-conv", + "powerfmt", "serde", "time-core", "time-macros", @@ -2228,24 +1933,25 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.9" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "372950940a5f07bf38dbe211d7283c9e6d7327df53794992d293e534c733d09b" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ + "num-conv", "time-core", ] [[package]] name = "tinyvec" -version = "1.6.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" dependencies = [ "tinyvec_macros", ] @@ -2258,32 +1964,31 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.28.2" +version = "1.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2" +checksum = "75ef51a33ef1da925cea3e4eb122833cb377c61439ca401b770f54902b806779" dependencies = [ - "autocfg", + "backtrace", "bytes", "libc", "mio", - "num_cpus", "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "tokio-macros" -version = "2.1.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn", ] [[package]] @@ -2296,122 +2001,191 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +dependencies = [ + "rustls", + "rustls-pki-types", + "tokio", +] + [[package]] name = "tokio-util" -version = "0.7.8" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" dependencies = [ "bytes", "futures-core", "futures-sink", "pin-project-lite", "tokio", - "tracing", ] [[package]] name = "toml" -version = "0.5.11" +version = "0.8.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +checksum = "05ae329d1f08c4d17a59bed7ff5b5a769d062e64a62d34a3261b219e62cd5aae" dependencies = [ "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", ] [[package]] name = "toml_datetime" -version = "0.6.3" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +checksum = "3da5db5a963e24bc68be8b17b6fa82814bb22ee8660f192bb182771d498f09a3" +dependencies = [ + "serde", +] [[package]] name = "toml_edit" -version = "0.19.11" +version = "0.22.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266f016b7f039eec8a1a80dfe6156b633d208b9fccca5e4db1d6775b0c4e34a7" +checksum = "310068873db2c5b3e7659d2cc35d21855dbafa50d1ce336397c666e3cb08137e" dependencies = [ - "indexmap 2.0.0", + "indexmap", + "serde", + "serde_spanned", "toml_datetime", + "toml_write", "winnow", ] +[[package]] +name = "toml_write" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfb942dfe1d8e29a7ee7fcbde5bd2b9a25fb89aa70caea2eba3bee836ff41076" + +[[package]] +name = "tower" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fdb0c213ca27a9f57ab69ddb290fd80d970922355b83ae380b395d3986b8a2e" +dependencies = [ + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "iri-string", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + [[package]] name = "tower-service" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.37" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", "pin-project-lite", "tracing-core", ] [[package]] name = "tracing-core" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", ] [[package]] name = "try-lock" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" - -[[package]] -name = "typenum" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "unicode-bidi" -version = "0.3.13" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" -version = "1.0.9" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" dependencies = [ "tinyvec", ] [[package]] name = "unicode-width" -version = "0.1.10" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + +[[package]] +name = "unicode-width" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" [[package]] name = "unindent" -version = "0.1.11" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce" + +[[package]] +name = "untrusted" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1766d682d402817b5ac4490b3c3002d91dfa0d22812f341609f97b08757359c" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.4.0" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", "idna", @@ -2426,9 +2200,9 @@ checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" [[package]] name = "utf8parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "vcpkg" @@ -2436,18 +2210,6 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "waker-fn" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" - [[package]] name = "want" version = "0.3.1" @@ -2459,46 +2221,50 @@ dependencies = [ [[package]] name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" +version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" +version = "0.13.3+wasi-0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +checksum = "26816d2e1a4a36a2940b96c5296ce403917633dff8f3440e9b236ed6f6bacad2" +dependencies = [ + "wit-bindgen-rt", +] [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" dependencies = [ "cfg-if", + "once_cell", + "rustversion", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.87" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" dependencies = [ "bumpalo", "log", - "once_cell", "proc-macro2", "quote", - "syn 2.0.22", + "syn", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.37" +version = "0.4.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" dependencies = [ "cfg-if", "js-sys", @@ -2508,9 +2274,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2518,262 +2284,278 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] [[package]] name = "web-sys" -version = "0.3.64" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" dependencies = [ "js-sys", "wasm-bindgen", ] [[package]] -name = "winapi" -version = "0.3.9" +name = "windows-link" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] +checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" [[package]] -name = "winapi-i686-pc-windows-gnu" +name = "windows-registry" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +checksum = "4286ad90ddb45071efd1a66dfa43eb02dd0dfbae1545ad6cc3c51cf34d7e8ba3" +dependencies = [ + "windows-result", + "windows-strings", + "windows-targets 0.53.0", +] [[package]] -name = "winapi-util" -version = "0.1.5" +name = "windows-result" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252" dependencies = [ - "winapi", + "windows-link", ] [[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" +name = "windows-strings" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +checksum = "87fa48cc5d406560701792be122a10132491cff9d0aeb23583cc2dcafc847319" +dependencies = [ + "windows-link", +] [[package]] name = "windows-sys" -version = "0.42.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", + "windows-targets 0.52.6", ] [[package]] name = "windows-sys" -version = "0.48.0" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows-targets", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] name = "windows-targets" -version = "0.48.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +checksum = "b1e4c7e8ceaaf9cb7d7507c974735728ab453b67ef8f18febdd7c11fe59dca8b" dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", + "windows_aarch64_gnullvm 0.53.0", + "windows_aarch64_msvc 0.53.0", + "windows_i686_gnu 0.53.0", + "windows_i686_gnullvm 0.53.0", + "windows_i686_msvc 0.53.0", + "windows_x86_64_gnu 0.53.0", + "windows_x86_64_gnullvm 0.53.0", + "windows_x86_64_msvc 0.53.0", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.2" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" [[package]] name = "windows_aarch64_msvc" -version = "0.42.2" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" [[package]] name = "windows_i686_gnu" -version = "0.42.2" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" [[package]] name = "windows_i686_msvc" -version = "0.42.2" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" [[package]] name = "windows_x86_64_gnu" -version = "0.42.2" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.2" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" [[package]] name = "windows_x86_64_msvc" -version = "0.42.2" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" [[package]] name = "winnow" -version = "0.4.7" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca0ace3845f0d96209f0375e6d367e3eb87eb65d27d445bdc9f1843a26f39448" +checksum = "9e27d6ad3dac991091e4d35de9ba2d2d00647c5d0fc26c5496dee55984ae111b" dependencies = [ "memchr", ] [[package]] -name = "winreg" -version = "0.10.1" +name = "wit-bindgen-rt" +version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c" dependencies = [ - "winapi", + "bitflags", ] [[package]] -name = "zbus" -version = "1.9.3" +name = "zerocopy" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cbeb2291cd7267a94489b71376eda33496c1b9881adf6b36f26cc2779f3fc49" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "async-io", "byteorder", - "derivative", - "enumflags2", - "fastrand", - "futures", - "nb-connect", - "nix 0.22.3", - "once_cell", - "polling", - "scoped-tls", - "serde", - "serde_repr", - "zbus_macros", - "zvariant", + "zerocopy-derive 0.7.35", ] [[package]] -name = "zbus_macros" -version = "1.9.3" +name = "zerocopy" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa3959a7847cf95e3d51e312856617c5b1b77191176c65a79a5f14d778bbe0a6" +checksum = "a367f292d93d4eab890745e75a778da40909cab4d6ff8173693812f79c4a2468" dependencies = [ - "proc-macro-crate 0.1.5", - "proc-macro2", - "quote", - "syn 1.0.109", + "zerocopy-derive 0.8.14", ] [[package]] -name = "zvariant" -version = "2.10.0" +name = "zerocopy-derive" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a68c7b55f2074489b7e8e07d2d0a6ee6b4f233867a653c664d8020ba53692525" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ - "byteorder", - "enumflags2", - "libc", - "serde", - "static_assertions", - "zvariant_derive", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "zvariant_derive" -version = "2.10.0" +name = "zerocopy-derive" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4ca5e22593eb4212382d60d26350065bf2a02c34b85bc850474a74b589a3de9" +checksum = "d3931cb58c62c13adec22e38686b559c86a30565e16ad6e8510a337cedc611e1" dependencies = [ - "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 1.0.109", + "syn", ] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/Cargo.toml b/Cargo.toml index 62c2cd8..00d0fb6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ path = "src/bin/lc.rs" [package] name = "leetcode-cli" -version = "0.4.1" +version = "0.4.7" authors = ["clearloop "] edition = "2021" description = "Leetcode command-line interface in rust." @@ -16,34 +16,37 @@ keywords = ["cli", "games", "leetcode"] readme = './README.md' [dependencies] -async-trait = "0.1.56" -tokio = { version = "1.19.2", features = ["full"] } -clap = { version = "4.1.8", features = ["cargo"] } -colored = "2.0.0" -dirs = "4.0.0" -env_logger = "0.9.0" -keyring = "1.2.0" -log = "0.4.17" -openssl = "0.10.41" -pyo3 = { version = "0.16.5", optional = true } -rand = "0.8.5" -serde = { version = "1.0.139", features = ["derive"] } -serde_json = "1.0.82" -toml = "0.5.9" -regex = "1.6.0" -scraper = "0.13.0" -anyhow = "1.0.71" +async-trait = "0.1.88" +tokio = { version = "1.45.1", features = ["full"] } +clap = { version = "4.5.39", features = ["cargo"] } +colored = "3.0.0" +dirs = "6.0.0" +env_logger = "0.11.6" +keyring = "3.6.2" +log = "0.4.27" +openssl = "0.10.73" +pyo3 = { version = "0.25.0", optional = true } +rand = "0.9.1" +serde = { version = "1.0.219", features = ["derive"] } +serde_json = "1.0.140" +toml = "0.8.22" +regex = "1.11.1" +scraper = "0.23.1" +anyhow = "1.0.98" +clap_complete = "4.5.52" +thiserror = "2.0.12" +unicode-width = "0.2" [dependencies.diesel] -version = "2.0.3" +version = "2.2.10" features = ["sqlite"] [dependencies.reqwest] -version = "0.11.11" +version = "0.12.18" features = ["gzip", "json"] [features] pym = ["pyo3"] [target.'cfg(target_family = "unix")'.dependencies] -nix = "0.24.1" +nix = { version = "0.30.1", features = [ "signal" ] } diff --git a/README.md b/README.md index 4e68afc..315587a 100644 --- a/README.md +++ b/README.md @@ -20,9 +20,30 @@ cargo install leetcode-cli ``` +
+Shell completions + +For Bash and Zsh (by default picks up `$SHELL` from environment) + +```sh +eval "$(leetcode completions)" +``` + +Copy the line above to `.bash_profile` or `.zshrc` + +You may also obtain specific shell configuration using. + +```sh +leetcode completions fish +``` + +If no argument is provided, the shell is inferred from the `SHELL` environment variable. + +
+ ## Usage -**Make sure you have logged in to `leetcode.com` with `Chrome`**. See [Cookies](#cookies) for why you need to do this first. +**Make sure you have logged in to `leetcode.com` with `Firefox`**. See [Cookies](#cookies) for why you need to do this first. ```sh leetcode 0.4.0 @@ -43,20 +64,63 @@ SUBCOMMANDS: list List problems [aliases: l] pick Pick a problem [aliases: p] stat Show simple chart about submissions [aliases: s] - test Edit question by id [aliases: t] + test Test question by id [aliases: t] help Prints this message or the help of the given subcommand(s) ``` ## Example -For example, given this config (could be found at `~/.leetcode/leetcode.toml`): +To configure leetcode-cli, create a file at `~/.leetcode/leetcode.toml`): + +```toml +[code] +editor = 'emacs' +# Optional parameter +editor_args = ['-nw'] +# Optional environment variables (ex. [ "XDG_DATA_HOME=...", "XDG_CONFIG_HOME=...", "XDG_STATE_HOME=..." ]) +editor_envs = [] +lang = 'rust' +edit_code_marker = false +start_marker = "" +end_marker = "" +# if include problem description +comment_problem_desc = false +# comment syntax +comment_leading = "" +test = true + +[cookies] +csrf = '' +session = '' +# leetcode.com or leetcode.cn +site = "leetcode.com" + +[storage] +cache = 'Problems' +code = 'code' +root = '~/.leetcode' +scripts = 'scripts' +``` + +
+ Configuration Explanation ```toml [code] editor = 'emacs' # Optional parameter -editor-args = ['-nw'] +editor_args = ['-nw'] +# Optional environment variables (ex. [ "XDG_DATA_HOME=...", "XDG_CONFIG_HOME=...", "XDG_STATE_HOME=..." ]) +editor_envs = [] lang = 'rust' +edit_code_marker = true +start_marker = "start_marker" +end_marker = "end_marker" +# if include problem description +comment_problem_desc = true +# comment syntax +comment_leading = "//" +test = true [cookies] csrf = '' @@ -69,6 +133,75 @@ root = '~/.leetcode' scripts = 'scripts' ``` +If we change the configuration as shown previously, we will get the following code after `leetcode edit 15`. + +```rust +// Category: algorithms +// Level: Medium +// Percent: 32.90331% + +// Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0. +// +// Notice that the solution set must not contain duplicate triplets. +// +//   +// Example 1: +// +// Input: nums = [-1,0,1,2,-1,-4] +// Output: [[-1,-1,2],[-1,0,1]] +// Explanation: +// nums[0] + nums[1] + nums[2] = (-1) + 0 + 1 = 0. +// nums[1] + nums[2] + nums[4] = 0 + 1 + (-1) = 0. +// nums[0] + nums[3] + nums[4] = (-1) + 2 + (-1) = 0. +// The distinct triplets are [-1,0,1] and [-1,-1,2]. +// Notice that the order of the output and the order of the triplets does not matter. +// +// +// Example 2: +// +// Input: nums = [0,1,1] +// Output: [] +// Explanation: The only possible triplet does not sum up to 0. +// +// +// Example 3: +// +// Input: nums = [0,0,0] +// Output: [[0,0,0]] +// Explanation: The only possible triplet sums up to 0. +// +// +//   +// Constraints: +// +// +// 3 <= nums.length <= 3000 +// -10⁵ <= nums[i] <= 10⁵ +// + +// start_marker +impl Solution { +pub fn three_sum(nums: Vec) -> Vec> { + + } + +} +// end_marker + +``` + +
+ +
+ +Some linting tools/lsps will throw errors unless the necessary libraries are imported. leetcode-cli can generate this boilerplate automatically if the `inject_before` key is set. Similarly, if you want to test out your code locally, you can automate that with `inject_after`. For c++ this might look something like: + +```toml +[code] +inject_before = ["#include", "using namespace std;"] +inject_after = ["int main() {\n Solution solution;\n\n}"] +``` + #### 1. pick ```sh @@ -168,26 +301,47 @@ csrf = "..." session = "..." ``` -For Example, using Chrome (after logging in to LeetCode): +For Example, using Firefox (after logging in to LeetCode): #### Step 1 -Open Chrome and navigate to the link below: +Open Firefox, press F12, and click `Storage` tab. -```sh -chrome://settings/cookies/detail?site=leetcode.com -``` +#### Step 2 + +Expand `Cookies` tab on the left and select https://leetcode.com. #### Step 2 -Copy `Content` from `LEETCODE_SESSION` and `csrftoken` to `session` and `csrf` in your configuration file, respectively: +Copy `Value` from `LEETCODE_SESSION` and `csrftoken` to `session` and `csrf` in your configuration file, respectively: ```toml [cookies] -csrf = "${csrftoken}" -session = "${LEETCODE_SESSION}" +csrf = '' +session = '' ``` +#### Environment variables + +The cookies can also be overridden by environment variables, which might be useful to exclude the sensitive information from the configuration file `leetcode.toml`. To do this, you can leave the `csrf` and `session` fields empty in the configuration file and override cookies settings via the environment variables `LEETCODE_CSRF`, `LEETCODE_SESSION`, and `LEETCODE_SITE`: + +```toml +[cookies] +csrf = '' +session = '' +site = 'leetcode.com' +``` + +Then set the environment variables: + +```bash +export LEETCODE_CSRF='' +export LEETCODE_SESSION='' +export LEETCODE_SITE='leetcode.cn' # or 'leetcode.com' +``` + +Note that `cookies.site` in still required in the `leetcode.toml` to avoid exception during configuration file parsing, but can be overridden using environment variables. + ## Programmable If you want to filter LeetCode questions using custom Python scripts, add the following to your the configuration file: diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..034e848 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,21 @@ +# Security Policy + +## Supported Versions + +Use this section to tell people about which versions of your project are +currently being supported with security updates. + +| Version | Supported | +| ------- | ------------------ | +| 5.1.x | :white_check_mark: | +| 5.0.x | :x: | +| 4.0.x | :white_check_mark: | +| < 4.0 | :x: | + +## Reporting a Vulnerability + +Use this section to tell people how to report a vulnerability. + +Tell them where to go, how often they can expect to get an update on a +reported vulnerability, what to expect if the vulnerability is accepted or +declined, etc. diff --git a/flake.lock b/flake.lock index 02323b6..8d2d0df 100644 --- a/flake.lock +++ b/flake.lock @@ -1,12 +1,32 @@ { "nodes": { + "naersk": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1721727458, + "narHash": "sha256-r/xppY958gmZ4oTfLiHN0ZGuQ+RSTijDblVgVLFi1mw=", + "owner": "nix-community", + "repo": "naersk", + "rev": "3fb418eaf352498f6b6c30592e3beb63df42ef11", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "naersk", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1665634984, - "narHash": "sha256-zwXeMc96BD9iFxSB/SLr3dI8iYpqM+seX9qy6bGV+cw=", + "lastModified": 1728538411, + "narHash": "sha256-f0SBJz1eZ2yOuKUr5CA9BHULGXVSn6miBuUWdTyhUhU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "cfea568da97a2668ef3cb3fc42eaacfb0e706807", + "rev": "b69de56fac8c2b6f8fd27f2eca01dcda8e0a4221", "type": "github" }, "original": { @@ -18,17 +38,57 @@ }, "root": { "inputs": { + "naersk": "naersk", "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay", "utils": "utils" } }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1728700003, + "narHash": "sha256-Ox1pvEHxLK6lAdaKQW21Zvk65SPDag+cD8YA444R/og=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "fc1e58ebabe0cef4442eedea07556ff0c9eafcfe", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "utils": { + "inputs": { + "systems": "systems" + }, "locked": { - "lastModified": 1659877975, - "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index d9ce06a..936e777 100644 --- a/flake.nix +++ b/flake.nix @@ -1,41 +1,72 @@ { description = "Leet your code in command-line."; - inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - inputs.utils.url = "github:numtide/flake-utils"; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + utils.url = "github:numtide/flake-utils"; - outputs = { self, nixpkgs, utils, ... }: + naersk = { + url = "github:nix-community/naersk"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { + self, + nixpkgs, + utils, + naersk, + rust-overlay, + ... + }: utils.lib.eachDefaultSystem (system: let - pkgs = import nixpkgs { inherit system; }; + overlays = [ (import rust-overlay) ]; + + pkgs = (import nixpkgs) { + inherit system overlays; + }; + + toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; + + naersk' = pkgs.callPackage naersk { + cargo = toolchain; + rustc = toolchain; + clippy = toolchain; + }; nativeBuildInputs = with pkgs; [ pkg-config ]; + darwinBuildInputs = pkgs.lib.optionals pkgs.stdenv.isDarwin [ + pkgs.darwin.apple_sdk.frameworks.Security + pkgs.darwin.apple_sdk.frameworks.SystemConfiguration + ]; + buildInputs = with pkgs; [ openssl dbus sqlite - ] ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ]; + ] ++ darwinBuildInputs; - - package = with pkgs; rustPlatform.buildRustPackage rec { + package = naersk'.buildPackage rec { pname = "leetcode-cli"; - version = "0.3.11"; - src = fetchCrate { - inherit pname version; - sha256 = "sha256-DHtIhiRPRGuO6Rf1d9f8r0bMOHqAaJleUvYNyPiX6mc="; - }; - cargoSha256 = "sha256-Suk/nQ+JcoD9HO9x1lYp+p4qx0DZ9dt0p5jPz0ZQB+k="; + version = "git"; + + src = ./.; + doCheck = true; # run `cargo test` on build inherit buildInputs nativeBuildInputs; - # a nightly compiler is required unless we use this cheat code. - RUSTC_BOOTSTRAP = 0; + buildNoDefaultFeatures = true; - # CFG_RELEASE = "${rustPlatform.rust.rustc.version}-stable"; - CFG_RELEASE_CHANNEL = "stable"; + buildFeatures = "git"; meta = with pkgs.lib; { description = "Leet your code in command-line."; @@ -44,9 +75,16 @@ maintainers = with maintainers; [ congee ]; mainProgram = "leetcode"; }; + + # Env vars + # a nightly compiler is required unless we use this cheat code. + RUSTC_BOOTSTRAP = 0; + + # CFG_RELEASE = "${rustPlatform.rust.rustc.version}-stable"; + CFG_RELEASE_CHANNEL = "stable"; }; in - { + { defaultPackage = package; overlay = final: prev: { leetcode-cli = package; }; @@ -55,11 +93,7 @@ inherit nativeBuildInputs; buildInputs = buildInputs ++ [ - rustc - cargo - rustfmt - clippy - rust-analyzer + toolchain cargo-edit cargo-bloat cargo-audit diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..2a19081 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,10 @@ +[toolchain] +channel = "stable" +components = [ + "rustc", + "cargo", + "rustfmt", + "clippy", + "rust-analyzer", +] +profile = "minimal" diff --git a/rustfmt.toml b/rustfmt.toml index dcbebe6..79f8a99 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1 +1,2 @@ -tab_spaces = 4 \ No newline at end of file +edition = "2021" +tab_spaces = 4 diff --git a/src/cache/mod.rs b/src/cache/mod.rs index 03e138e..3250bf6 100644 --- a/src/cache/mod.rs +++ b/src/cache/mod.rs @@ -23,16 +23,13 @@ pub fn conn(p: String) -> SqliteConnection { /// Condition submit or test #[derive(Clone, Debug)] +#[derive(Default)] pub enum Run { Test, + #[default] Submit, } -impl Default for Run { - fn default() -> Self { - Run::Submit - } -} /// Requests if data not download #[derive(Clone)] @@ -114,9 +111,7 @@ impl Cache { pub fn get_problem(&self, rfid: i32) -> Result { let p: Problem = problems.filter(fid.eq(rfid)).first(&mut self.conn()?)?; if p.category != "algorithms" { - return Err(Error::FeatureError( - "Not support database and shell questions for now".to_string(), - )); + return Err(anyhow!("No support for database and shell questions yet").into()); } Ok(p) @@ -128,9 +123,7 @@ impl Cache { .filter(name.eq(problem_name)) .first(&mut self.conn()?)?; if p.category != "algorithms" { - return Err(Error::FeatureError( - "Not support database and shell questions for now".to_string(), - )); + return Err(anyhow!("No support for database and shell questions yet").into()); } Ok(p.fid) } @@ -173,9 +166,7 @@ impl Cache { ); if target.category != "algorithms" { - return Err(Error::FeatureError( - "Not support database and shell questions for now".to_string(), - )); + return Err(anyhow!("No support for database and shell questions yet").into()); } let mut rdesc = Question::default(); @@ -255,7 +246,7 @@ impl Cache { rfid: i32, test_case: Option, ) -> Result<(HashMap<&'static str, String>, [String; 2]), Error> { - trace!("pre run code..."); + trace!("pre-run code..."); use crate::helper::code_path; use std::fs::File; use std::io::Read; @@ -356,7 +347,7 @@ impl Cache { ) -> Result { trace!("Exec problem filter —— Test or Submit"); let (json, [url, refer]) = self.pre_run_code(run.clone(), rfid, test_case).await?; - trace!("Pre run code result {:#?}, {}, {}", json, url, refer); + trace!("Pre-run code result {:#?}, {}, {}", json, url, refer); let text = self .0 @@ -367,7 +358,7 @@ impl Cache { .await?; let run_res: RunCode = serde_json::from_str(&text).map_err(|e| { - anyhow!("json error: {e}, plz double check your session and csrf config.") + anyhow!("JSON error: {e}, please double check your session and csrf config.") })?; trace!("Run code result {:#?}", run_res); diff --git a/src/cache/models.rs b/src/cache/models.rs index 12c512e..9b28482 100644 --- a/src/cache/models.rs +++ b/src/cache/models.rs @@ -1,4 +1,6 @@ //! Leetcode data models +use unicode_width::UnicodeWidthStr; +use unicode_width::UnicodeWidthChar; use super::schemas::{problems, tags}; use crate::helper::HTML; use colored::Colorize; @@ -54,7 +56,7 @@ impl Problem { static DONE: &str = " ✔"; static ETC: &str = "..."; static LOCK: &str = "🔒"; -static NDONE: &str = "✘"; +static NDONE: &str = " ✘"; static SPACE: &str = " "; impl std::fmt::Display for Problem { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { @@ -98,14 +100,27 @@ impl std::fmt::Display for Problem { } } - if self.name.len() < 60_usize { + let name_width = UnicodeWidthStr::width(self.name.as_str()); + let target_width = 60; + if name_width <= target_width { name.push_str(&self.name); - name.push_str(&SPACE.repeat(60 - &self.name.len())); + name.push_str(&SPACE.repeat(target_width - name_width)); } else { - name.push_str(&self.name[..49]); - name = name.trim_end().to_string(); - name.push_str(ETC); - name.push_str(&SPACE.repeat(60 - name.len())); + // truncate carefully to target width - 3 (because "..." will take some width) + let mut truncated = String::new(); + let mut current_width = 0; + for c in self.name.chars() { + let char_width = UnicodeWidthChar::width(c).unwrap_or(0); + if current_width + char_width > target_width - 3 { + break; + } + truncated.push(c); + current_width += char_width; + } + truncated.push_str(ETC); // add "..." + let truncated_width = UnicodeWidthStr::width(truncated.as_str()); + truncated.push_str(&SPACE.repeat(target_width - truncated_width)); + name = truncated; } level = match self.level { @@ -154,7 +169,7 @@ impl Question { let desc = self.content.render(); let mut res = desc.lines().fold("\n".to_string(), |acc, e| { - acc + " " + conf.code.comment_leading.as_str() + " " + e + "\n" + acc + "" + conf.code.comment_leading.as_str() + " " + e + "\n" }); res += " \n"; diff --git a/src/cache/parser.rs b/src/cache/parser.rs index dbbc87e..329455d 100644 --- a/src/cache/parser.rs +++ b/src/cache/parser.rs @@ -10,9 +10,17 @@ pub fn problem(problems: &mut Vec, v: Value) -> Option<()> { let total_acs = stat.get("total_acs")?.as_f64()? as f32; let total_submitted = stat.get("total_submitted")?.as_f64()? as f32; + let fid_obj = stat.get("frontend_question_id")?; + let fid = match fid_obj.as_i64() { + // Handle on leetcode-com + Some(s) => s as i32, + // Handle on leetcode-cn + None => fid_obj.as_str()?.split(' ').last()?.parse::().ok()?, + }; + problems.push(Problem { category: v.get("category_slug")?.as_str()?.to_string(), - fid: stat.get("frontend_question_id")?.as_i64()? as i32, + fid, id: stat.get("question_id")?.as_i64()? as i32, level: p.get("difficulty")?.as_object()?.get("level")?.as_i64()? as i32, locked: p.get("paid_only")?.as_bool()?, @@ -89,17 +97,20 @@ pub fn tags(v: Value) -> Option> { /// daily parser pub fn daily(v: Value) -> Option { trace!("Parse daily..."); - v.as_object()? - .get("data")? - .as_object()? - .get("activeDailyCodingChallengeQuestion")? - .as_object()? - .get("question")? - .as_object()? - .get("questionFrontendId")? - .as_str()? - .parse() - .ok() + let v_obj = v.as_object()?.get("data")?.as_object()?; + match v_obj.get("activeDailyCodingChallengeQuestion") { + // Handle on leetcode-com + Some(v) => v, + // Handle on leetcode-cn + None => v_obj.get("todayRecord")?.as_array()?.first()?, + } + .as_object()? + .get("question")? + .as_object()? + .get("questionFrontendId")? + .as_str()? + .parse() + .ok() } /// user parser diff --git a/src/cli.rs b/src/cli.rs index 90d1756..63107a2 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -1,13 +1,13 @@ //! Clap Commanders use crate::{ cmds::{ - Command, DataCommand, EditCommand, ExecCommand, ListCommand, PickCommand, StatCommand, - TestCommand, + completion_handler, Command, CompletionCommand, DataCommand, EditCommand, ExecCommand, + ListCommand, PickCommand, StatCommand, TestCommand, }, err::Error, flag::{Debug, Flag}, }; -use clap::{crate_name, crate_version}; +use clap::crate_version; use log::LevelFilter; /// This should be called before calling any cli method or printing any output. @@ -26,7 +26,8 @@ pub fn reset_signal_pipe_handler() { /// Get matches pub async fn main() -> Result<(), Error> { reset_signal_pipe_handler(); - let m = clap::Command::new(crate_name!()) + + let mut cmd = clap::Command::new("leetcode") .version(crate_version!()) .about("May the Code be with You 👻") .subcommands(vec![ @@ -37,10 +38,12 @@ pub async fn main() -> Result<(), Error> { PickCommand::usage().display_order(5), StatCommand::usage().display_order(6), TestCommand::usage().display_order(7), + CompletionCommand::usage().display_order(8), ]) .arg(Debug::usage()) - .arg_required_else_help(true) - .get_matches(); + .arg_required_else_help(true); + + let m = cmd.clone().get_matches(); if m.get_flag("debug") { Debug::handler()?; @@ -59,6 +62,7 @@ pub async fn main() -> Result<(), Error> { Some(("pick", sub_m)) => Ok(PickCommand::handler(sub_m).await?), Some(("stat", sub_m)) => Ok(StatCommand::handler(sub_m).await?), Some(("test", sub_m)) => Ok(TestCommand::handler(sub_m).await?), + Some(("completions", sub_m)) => Ok(completion_handler(sub_m, &mut cmd)?), _ => Err(Error::MatchError), } } diff --git a/src/cmds/completions.rs b/src/cmds/completions.rs new file mode 100644 index 0000000..bc675de --- /dev/null +++ b/src/cmds/completions.rs @@ -0,0 +1,59 @@ +//! Completions command + +use super::Command; +use crate::err::Error; +use async_trait::async_trait; +use clap::{Arg, ArgAction, ArgMatches, Command as ClapCommand}; +use clap_complete::{generate, Generator, Shell}; + +/// Abstract shell completions command +/// +/// ```sh +/// Generate shell Completions + +/// USAGE: +/// leetcode completions + +/// ARGUMENTS: +/// [possible values: bash, elvish, fish, powershell, zsh] +/// ``` +pub struct CompletionCommand; + +#[async_trait] +impl Command for CompletionCommand { + /// `pick` usage + fn usage() -> ClapCommand { + ClapCommand::new("completions") + .about("Generate shell Completions") + .visible_alias("c") + .arg( + Arg::new("shell") + .action(ArgAction::Set) + .value_parser(clap::value_parser!(Shell)), + ) + } + + async fn handler(_m: &ArgMatches) -> Result<(), Error> { + // defining custom handler to print the completions. Handler method signature limits taking + // other params. We need &ArgMatches and &mut ClapCommand to generate completions. + println!("Don't use this handler. Does not implement the functionality to print completions. Use completions_handler() below."); + Ok(()) + } +} + +fn get_completions_string(gen: G, cmd: &mut ClapCommand) -> Result { + let mut v: Vec = Vec::new(); + let name = cmd.get_name().to_string(); + generate(gen, cmd, name, &mut v); + Ok(String::from_utf8(v)?) +} + +pub fn completion_handler(m: &ArgMatches, cmd: &mut ClapCommand) -> Result<(), Error> { + let shell = *m.get_one::("shell").unwrap_or( + // if shell value is not provided try to get from the environment + &Shell::from_env().ok_or(Error::MatchError)?, + ); + let completions = get_completions_string(shell, cmd)?; + println!("{}", completions); + Ok(()) +} diff --git a/src/cmds/edit.rs b/src/cmds/edit.rs index 9be45ec..f611d6c 100644 --- a/src/cmds/edit.rs +++ b/src/cmds/edit.rs @@ -1,8 +1,10 @@ //! Edit command use super::Command; -use crate::Error; +use crate::{Error, Result}; +use anyhow::anyhow; use async_trait::async_trait; -use clap::{Arg, ArgMatches, Command as ClapCommand}; +use clap::{Arg, ArgAction, ArgGroup, ArgMatches, Command as ClapCommand}; +use std::collections::HashMap; /// Abstract `edit` command /// @@ -27,7 +29,7 @@ impl Command for EditCommand { /// `edit` usage fn usage() -> ClapCommand { ClapCommand::new("edit") - .about("Edit question by id") + .about("Edit question") .visible_alias("e") .arg( Arg::new("lang") @@ -39,21 +41,46 @@ impl Command for EditCommand { .arg( Arg::new("id") .num_args(1) - .required(true) .value_parser(clap::value_parser!(i32)) .help("question id"), ) + .arg( + Arg::new("daily") + .short('d') + .long("daily") + .help("Edit today's daily challenge") + .action(ArgAction::SetTrue), + ) + .group( + ArgGroup::new("question-id") + .args(["id", "daily"]) + .multiple(false) + .required(true), + ) } /// `edit` handler - async fn handler(m: &ArgMatches) -> Result<(), crate::Error> { + async fn handler(m: &ArgMatches) -> Result<()> { use crate::{cache::models::Question, Cache}; use std::fs::File; use std::io::Write; use std::path::Path; - let id = *m.get_one::("id").ok_or(Error::NoneError)?; let cache = Cache::new()?; + + let daily = m.get_one::("daily").unwrap_or(&false); + let daily_id = if *daily { + Some(cache.get_daily_problem_id().await?) + } else { + None + }; + + let id = m + .get_one::("id") + .copied() + .or(daily_id) + .ok_or(Error::NoneError)?; + let problem = cache.get_problem(id)?; let mut conf = cache.to_owned().0.conf; @@ -93,6 +120,11 @@ impl Command for EditCommand { file_code.write_all(p_desc_comment.as_bytes())?; file_code.write_all(question_desc.as_bytes())?; } + if let Some(inject_before) = &conf.code.inject_before { + for line in inject_before { + file_code.write_all((line.to_string() + "\n").as_bytes())?; + } + } if conf.code.edit_code_marker { file_code.write_all( (conf.code.comment_leading.clone() @@ -112,6 +144,11 @@ impl Command for EditCommand { .as_bytes(), )?; } + if let Some(inject_after) = &conf.code.inject_after { + for line in inject_after { + file_code.write_all((line.to_string() + "\n").as_bytes())?; + } + } if test_flag { let mut file_tests = File::create(&test_path)?; @@ -123,13 +160,14 @@ impl Command for EditCommand { // if language is not found in the list of supported languges clean up files if !flag { std::fs::remove_file(&path)?; + if test_flag { std::fs::remove_file(&test_path)?; } - return Err(crate::Error::FeatureError(format!( - "This question doesn't support {}, please try another", - &lang - ))); + + return Err( + anyhow!("This question doesn't support {lang}, please try another").into(), + ); } } @@ -151,8 +189,36 @@ impl Command for EditCommand { args.extend_from_slice(&editor_args); } + // Set environment variables for editor + // + // for example: + // + // ```toml + // [code] + // editor = "nvim" + // editor_envs = [ "XDG_DATA_HOME=...", "XDG_CONFIG_HOME=...", "XDG_STATE_HOME=..." ] + // ``` + // + // ```rust + // Command::new("nvim").envs(&[ ("XDG_DATA_HOME", "..."), ("XDG_CONFIG_HOME", "..."), ("XDG_STATE_HOME", "..."), ]); + // ``` + let mut envs: HashMap = Default::default(); + if let Some(editor_envs) = &conf.code.editor_envs { + for env in editor_envs.iter() { + let parts: Vec<&str> = env.split('=').collect(); + if parts.len() == 2 { + let name = parts[0].trim(); + let value = parts[1].trim(); + envs.insert(name.to_string(), value.to_string()); + } else { + return Err(anyhow!("Invalid editor environment variable: {env}").into()); + } + } + } + args.push(path); std::process::Command::new(conf.code.editor) + .envs(envs) .args(args) .status()?; Ok(()) diff --git a/src/cmds/exec.rs b/src/cmds/exec.rs index f25f9b4..d6538f8 100644 --- a/src/cmds/exec.rs +++ b/src/cmds/exec.rs @@ -1,8 +1,8 @@ //! Exec command use super::Command; -use crate::Error; +use crate::{Error, Result}; use async_trait::async_trait; -use clap::{Arg, ArgMatches, Command as ClapCommand}; +use clap::{Arg, ArgAction, ArgGroup, ArgMatches, Command as ClapCommand}; /// Abstract Exec Command /// @@ -36,14 +36,40 @@ impl Command for ExecCommand { .value_parser(clap::value_parser!(i32)) .help("question id"), ) + .arg( + Arg::new("daily") + .short('d') + .long("daily") + .help("Exec today's daily challenge") + .action(ArgAction::SetTrue), + ) + .group( + ArgGroup::new("question-id") + .args(["id", "daily"]) + .multiple(false) + .required(true), + ) } /// `exec` handler - async fn handler(m: &ArgMatches) -> Result<(), crate::Error> { + async fn handler(m: &ArgMatches) -> Result<()> { use crate::cache::{Cache, Run}; - let id: i32 = *m.get_one::("id").ok_or(Error::NoneError)?; let cache = Cache::new()?; + + let daily = m.get_one::("daily").unwrap_or(&false); + let daily_id = if *daily { + Some(cache.get_daily_problem_id().await?) + } else { + None + }; + + let id = m + .get_one::("id") + .copied() + .or(daily_id) + .ok_or(Error::NoneError)?; + let res = cache.exec_problem(id, Run::Submit, None).await?; println!("{}", res); diff --git a/src/cmds/list.rs b/src/cmds/list.rs index 9c46df9..ae6df47 100644 --- a/src/cmds/list.rs +++ b/src/cmds/list.rs @@ -184,7 +184,6 @@ impl Command for ListCommand { .get_many::("range") .ok_or(Error::NoneError)? .copied() - .into_iter() .collect(); ps.retain(|x| num_range[0] <= x.fid && x.fid <= num_range[1]); } diff --git a/src/cmds/mod.rs b/src/cmds/mod.rs index 7bf957f..1124532 100644 --- a/src/cmds/mod.rs +++ b/src/cmds/mod.rs @@ -24,6 +24,7 @@ pub trait Command { async fn handler(m: &ArgMatches) -> Result<(), Error>; } +mod completions; mod data; mod edit; mod exec; @@ -31,6 +32,7 @@ mod list; mod pick; mod stat; mod test; +pub use completions::{completion_handler, CompletionCommand}; pub use data::DataCommand; pub use edit::EditCommand; pub use exec::ExecCommand; diff --git a/src/cmds/pick.rs b/src/cmds/pick.rs index 967e205..aba8166 100644 --- a/src/cmds/pick.rs +++ b/src/cmds/pick.rs @@ -1,5 +1,6 @@ //! Pick command use super::Command; +use crate::cache::models::Problem; use crate::err::Error; use async_trait::async_trait; use clap::{Arg, ArgAction, ArgMatches, Command as ClapCommand}; @@ -129,23 +130,21 @@ impl Command for PickCommand { crate::helper::filter(&mut problems, query.to_string()); } - let daily_id = if m.contains_id("daily") { + let daily = m.get_one::("daily").unwrap_or(&false); + let daily_id = if *daily { Some(cache.get_daily_problem_id().await?) } else { None }; let fid = match m.contains_id("name") { - //check for name specified + // check for name specified, or closest name true => { - match m.get_one::("name").map(|name| name) { - Some(quesname) => match cache.get_problem_id_from_name(quesname) { - Ok(p) => p, - Err(_) => 1, - }, + match m.get_one::("name") { + Some(quesname) => closest_named_problem(&problems, quesname).unwrap_or(1), None => { // Pick random without specify id - let problem = &problems[rand::thread_rng().gen_range(0..problems.len())]; + let problem = &problems[rand::rng().random_range(0..problems.len())]; problem.fid } } @@ -156,7 +155,7 @@ impl Command for PickCommand { .or(daily_id) .unwrap_or_else(|| { // Pick random without specify id - let problem = &problems[rand::thread_rng().gen_range(0..problems.len())]; + let problem = &problems[rand::rng().random_range(0..problems.len())]; problem.fid }) } @@ -168,7 +167,7 @@ impl Command for PickCommand { Ok(q) => println!("{}", q.desc()), Err(e) => { eprintln!("{:?}", e); - if let Error::NetworkError(_) = e { + if let Error::Reqwest(_) = e { Self::handler(m).await?; } } @@ -177,3 +176,69 @@ impl Command for PickCommand { Ok(()) } } + +// Returns the closest problem according to a scoring algorithm +// taking into account both the longest common subsequence and the size +// problem string (to compensate for smaller strings having smaller lcs). +// Returns None if there are no problems in the problem list +fn closest_named_problem(problems: &Vec, lookup_name: &str) -> Option { + let max_name_size: usize = problems.iter().map(|p| p.name.len()).max()?; + // Init table to the max name length of all the problems to share + // the same table allocation + let mut table: Vec = vec![0; (max_name_size + 1) * (lookup_name.len() + 1)]; + + // this is guaranteed because of the earlier max None propegation + assert!(!problems.is_empty()); + let mut max_score = 0; + let mut current_problem = &problems[0]; + for problem in problems { + // In case bug becomes bugged, always return the matching string + if problem.name == lookup_name { + return Some(problem.fid); + } + + let this_lcs = longest_common_subsequence(&mut table, &problem.name, lookup_name); + let this_score = this_lcs * (max_name_size - problem.name.len()); + + if this_score > max_score { + max_score = this_score; + current_problem = problem; + } + } + + Some(current_problem.fid) +} + +// Longest commong subsequence DP approach O(nm) space and time. Table must be at least +// (text1.len() + 1) * (text2.len() + 1) length or greater and is mutated every call +fn longest_common_subsequence(table: &mut [usize], text1: &str, text2: &str) -> usize { + assert!(table.len() >= (text1.len() + 1) * (text2.len() + 1)); + let height: usize = text1.len() + 1; + let width: usize = text2.len() + 1; + + // initialize base cases to 0 + for i in 0..height { + table[i * width + (width - 1)] = 0; + } + for j in 0..width { + table[((height - 1) * width) + j] = 0; + } + + let mut i: usize = height - 1; + let mut j: usize; + for c0 in text1.chars().rev() { + i -= 1; + j = width - 1; + for c1 in text2.chars().rev() { + j -= 1; + if c0.to_lowercase().next() == c1.to_lowercase().next() { + table[i * width + j] = 1 + table[(i + 1) * width + j + 1]; + } else { + let a = table[(i + 1) * width + j]; + let b = table[i * width + j + 1]; + table[i * width + j] = std::cmp::max(a, b); + } + } + } + table[0] +} diff --git a/src/cmds/stat.rs b/src/cmds/stat.rs index 913064a..4b463da 100644 --- a/src/cmds/stat.rs +++ b/src/cmds/stat.rs @@ -81,7 +81,7 @@ impl Command for StatCommand { ); // lines - for (i, l) in vec![(easy, easy_ac), (medium, medium_ac), (hard, hard_ac)] + for (i, l) in [(easy, easy_ac), (medium, medium_ac), (hard, hard_ac)] .iter() .enumerate() { diff --git a/src/cmds/test.rs b/src/cmds/test.rs index af72014..6d36920 100644 --- a/src/cmds/test.rs +++ b/src/cmds/test.rs @@ -1,8 +1,8 @@ //! Test command use super::Command; -use crate::Error; +use crate::{Error, Result}; use async_trait::async_trait; -use clap::{Arg, ArgMatches, Command as ClapCommand}; +use clap::{Arg, ArgAction, ArgGroup, ArgMatches, Command as ClapCommand}; /// Abstract Test Command /// @@ -27,12 +27,11 @@ impl Command for TestCommand { /// `test` usage fn usage() -> ClapCommand { ClapCommand::new("test") - .about("Test question by id") + .about("Test a question") .visible_alias("t") .arg( Arg::new("id") .num_args(1) - .required(true) .value_parser(clap::value_parser!(i32)) .help("question id"), ) @@ -42,18 +41,45 @@ impl Command for TestCommand { .required(false) .help("custom testcase"), ) + .arg( + Arg::new("daily") + .short('d') + .long("daily") + .help("Test today's daily challenge") + .action(ArgAction::SetTrue), + ) + .group( + ArgGroup::new("question-id") + .args(["id", "daily"]) + .multiple(false) + .required(true), + ) } /// `test` handler - async fn handler(m: &ArgMatches) -> Result<(), Error> { + async fn handler(m: &ArgMatches) -> Result<()> { use crate::cache::{Cache, Run}; - let id: i32 = *m.get_one::("id").ok_or(Error::NoneError)?; + + let cache = Cache::new()?; + + let daily = m.get_one::("daily").unwrap_or(&false); + let daily_id = if *daily { + Some(cache.get_daily_problem_id().await?) + } else { + None + }; + + let id = m + .get_one::("id") + .copied() + .or(daily_id) + .ok_or(Error::NoneError)?; + let testcase = m.get_one::("testcase"); let case_str: Option = match testcase { Some(case) => Option::from(case.replace("\\n", "\n")), _ => None, }; - let cache = Cache::new()?; let res = cache.exec_problem(id, Run::Test, case_str).await?; println!("{}", res); diff --git a/src/config/code.rs b/src/config/code.rs index 0384608..b842657 100644 --- a/src/config/code.rs +++ b/src/config/code.rs @@ -16,12 +16,18 @@ pub struct Code { pub editor: String, #[serde(rename(serialize = "editor-args"), alias = "editor-args", default)] pub editor_args: Option>, + #[serde(rename(serialize = "editor-envs"), alias = "editor-envs", default)] + pub editor_envs: Option>, #[serde(default, skip_serializing)] pub edit_code_marker: bool, #[serde(default, skip_serializing)] pub start_marker: String, #[serde(default, skip_serializing)] pub end_marker: String, + #[serde(rename(serialize = "inject_before"), alias = "inject_before", default)] + pub inject_before: Option>, + #[serde(rename(serialize = "inject_after"), alias = "inject_after", default)] + pub inject_after: Option>, #[serde(default, skip_serializing)] pub comment_problem_desc: bool, #[serde(default, skip_serializing)] @@ -40,9 +46,12 @@ impl Default for Code { Self { editor: "vim".into(), editor_args: None, + editor_envs: None, edit_code_marker: false, start_marker: "".into(), end_marker: "".into(), + inject_before: None, + inject_after: None, comment_problem_desc: false, comment_leading: "".into(), test: true, diff --git a/src/config/cookies.rs b/src/config/cookies.rs index d03cd4a..8492780 100644 --- a/src/config/cookies.rs +++ b/src/config/cookies.rs @@ -1,15 +1,88 @@ //! Cookies in config use serde::{Deserialize, Serialize}; +use std::{ + fmt::{self, Display}, + str::FromStr, +}; + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub enum LeetcodeSite { + #[serde(rename = "leetcode.com")] + LeetcodeCom, + #[serde(rename = "leetcode.cn")] + LeetcodeCn, +} + +impl FromStr for LeetcodeSite { + type Err = String; + fn from_str(s: &str) -> Result { + match s { + "leetcode.com" => Ok(LeetcodeSite::LeetcodeCom), + "leetcode.cn" => Ok(LeetcodeSite::LeetcodeCn), + _ => Err("Invalid site key".to_string()), + } + } +} + +impl Display for LeetcodeSite { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let s = match self { + LeetcodeSite::LeetcodeCom => "leetcode.com", + LeetcodeSite::LeetcodeCn => "leetcode.cn", + }; + + write!(f, "{s}") + } +} /// Cookies settings -#[derive(Default, Clone, Debug, Deserialize, Serialize)] +#[derive(Clone, Debug, Deserialize, Serialize)] pub struct Cookies { pub csrf: String, pub session: String, + pub site: LeetcodeSite, +} + +impl Default for Cookies { + fn default() -> Self { + Self { + csrf: "".to_string(), + session: "".to_string(), + site: LeetcodeSite::LeetcodeCom, + } + } } -impl std::string::ToString for Cookies { - fn to_string(&self) -> String { - format!("LEETCODE_SESSION={};csrftoken={};", self.session, self.csrf) +impl Display for Cookies { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!( + f, + "LEETCODE_SESSION={};csrftoken={};", + self.session, self.csrf + ) + } +} + +/// Override cookies from environment variables +pub const LEETCODE_CSRF_ENV: &str = "LEETCODE_CSRF"; +pub const LEETCODE_SESSION_ENV: &str = "LEETCODE_SESSION"; +pub const LEETCODE_SITE_ENV: &str = "LEETCODE_SITE"; + +impl Cookies { + /// Load cookies from environment variables, overriding any existing values + /// if the environment variables are set. + pub fn with_env_override(mut self) -> Self { + if let Ok(csrf) = std::env::var(LEETCODE_CSRF_ENV) { + self.csrf = csrf; + } + if let Ok(session) = std::env::var(LEETCODE_SESSION_ENV) { + self.session = session; + } + if let Ok(site) = std::env::var(LEETCODE_SITE_ENV) { + if let Ok(leetcode_site) = LeetcodeSite::from_str(&site) { + self.site = leetcode_site; + } + } + self } } diff --git a/src/config/mod.rs b/src/config/mod.rs index d2e7d1d..f3f5e40 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -7,7 +7,7 @@ //! + Use `leetcode config` to update it use crate::{ config::{code::Code, cookies::Cookies, storage::Storage, sys::Sys}, - Error, + Error, Result, }; use serde::{Deserialize, Serialize}; use std::{fs, path::Path}; @@ -17,6 +17,8 @@ mod cookies; mod storage; mod sys; +pub use cookies::LeetcodeSite; + /// Sync with `~/.leetcode/leetcode.toml` #[derive(Clone, Debug, Default, Deserialize, Serialize)] pub struct Config { @@ -28,14 +30,14 @@ pub struct Config { } impl Config { - fn write_default(p: impl AsRef) -> Result<(), crate::Error> { + fn write_default(p: impl AsRef) -> Result<()> { fs::write(p.as_ref(), toml::ser::to_string_pretty(&Self::default())?)?; Ok(()) } /// Locate lc's config file - pub fn locate() -> Result { + pub fn locate() -> Result { let conf = Self::root()?.join("leetcode.toml"); if !conf.is_file() { @@ -44,7 +46,19 @@ impl Config { let s = fs::read_to_string(&conf)?; match toml::from_str::(&s) { - Ok(config) => Ok(config), + Ok(mut config) => { + // Override config.cookies with environment variables + config.cookies = config.cookies.with_env_override(); + + match config.cookies.site { + cookies::LeetcodeSite::LeetcodeCom => Ok(config), + cookies::LeetcodeSite::LeetcodeCn => { + let mut config = config; + config.sys.urls = sys::Urls::new_with_leetcode_cn(); + Ok(config) + } + } + } Err(e) => { let tmp = Self::root()?.join("leetcode.tmp.toml"); Self::write_default(tmp)?; @@ -54,7 +68,7 @@ impl Config { } /// Get root path of leetcode-cli - pub fn root() -> Result { + pub fn root() -> Result { let dir = dirs::home_dir().ok_or(Error::NoneError)?.join(".leetcode"); if !dir.is_dir() { info!("Generate root dir at {:?}.", &dir); @@ -65,7 +79,7 @@ impl Config { } /// Sync new config to config.toml - pub fn sync(&self) -> Result<(), Error> { + pub fn sync(&self) -> Result<()> { let home = dirs::home_dir().ok_or(Error::NoneError)?; let conf = home.join(".leetcode/leetcode.toml"); fs::write(conf, toml::ser::to_string_pretty(&self)?)?; diff --git a/src/config/storage.rs b/src/config/storage.rs index 72a01fc..0395b1f 100644 --- a/src/config/storage.rs +++ b/src/config/storage.rs @@ -1,5 +1,5 @@ //! Storage in config. -use crate::Error; +use crate::{Error, Result}; use serde::{Deserialize, Serialize}; use std::{fs, path::PathBuf}; @@ -27,7 +27,7 @@ impl Default for Storage { impl Storage { /// convert root path - pub fn root(&self) -> Result { + pub fn root(&self) -> Result { let home = dirs::home_dir() .ok_or(Error::NoneError)? .to_string_lossy() @@ -37,7 +37,7 @@ impl Storage { } /// get cache path - pub fn cache(&self) -> Result { + pub fn cache(&self) -> Result { let root = PathBuf::from(self.root()?); if !root.exists() { info!("Generate cache dir at {:?}.", &root); @@ -48,7 +48,7 @@ impl Storage { } /// get code path - pub fn code(&self) -> Result { + pub fn code(&self) -> Result { let root = &self.root()?; let p = PathBuf::from(root).join(&self.code); if !PathBuf::from(&p).exists() { @@ -59,13 +59,13 @@ impl Storage { } /// get scripts path - pub fn scripts(mut self) -> Result { + pub fn scripts(mut self) -> Result { let root = &self.root()?; if self.scripts.is_none() { self.scripts = Some("scripts".into()); } - let p = PathBuf::from(root).join(&self.scripts.ok_or(Error::NoneError)?); + let p = PathBuf::from(root).join(self.scripts.ok_or(Error::NoneError)?); if !PathBuf::from(&p).exists() { std::fs::create_dir(&p)? } diff --git a/src/config/sys.rs b/src/config/sys.rs index 7c6f77e..02a8458 100644 --- a/src/config/sys.rs +++ b/src/config/sys.rs @@ -52,6 +52,25 @@ impl Default for Urls { } impl Urls { + pub fn new_with_leetcode_cn() -> Self { + Self { + base: "https://leetcode.cn".into(), + graphql: "https://leetcode.cn/graphql".into(), + login: "https://leetcode.cn/accounts/login/".into(), + problems: "https://leetcode.cn/api/problems/$category/".into(), + problem: "https://leetcode.cn/problems/$slug/description/".into(), + tag: "https://leetcode.cn/tag/$slug/".into(), + test: "https://leetcode.cn/problems/$slug/interpret_solution/".into(), + session: "https://leetcode.cn/session/".into(), + submit: "https://leetcode.cn/problems/$slug/submit/".into(), + submissions: "https://leetcode.cn/submissions/detail/$id/".into(), + submission: "https://leetcode.cn/submissions/detail/$id/".into(), + verify: "https://leetcode.cn/submissions/detail/$id/check/".into(), + favorites: "https://leetcode.cn/list/api/questions".into(), + favorite_delete: "https://leetcode.cn/list/api/questions/$hash/$id".into(), + } + } + /// problem url with specific `$slug` pub fn problem(&self, slug: &str) -> String { self.problem.replace("$slug", slug) diff --git a/src/err.rs b/src/err.rs index 6421cfd..cf256cf 100644 --- a/src/err.rs +++ b/src/err.rs @@ -1,163 +1,91 @@ //! Errors in leetcode-cli use crate::cmds::{Command, DataCommand}; +use anyhow::anyhow; use colored::Colorize; -use std::fmt; -// fixme: use this_error -/// Error enum +#[cfg(debug_assertions)] +const CONFIG: &str = "~/.leetcode/leetcode.tmp.toml"; +#[cfg(not(debug_assertions))] +const CONFIG: &str = "~/.leetcode/leetcode_tmp.toml"; + +/// Leetcode result. +pub type Result = std::result::Result; + +/// Leetcode cli errors +#[derive(thiserror::Error, Debug)] pub enum Error { + #[error("Nothing matched")] MatchError, + #[error("Download {0} failed, please try again")] DownloadError(String), - NetworkError(String), - ParseError(String), - CacheError(String), - FeatureError(String), - ScriptError(String), + #[error(transparent)] + Reqwest(#[from] reqwest::Error), + #[error(transparent)] + HeaderName(#[from] reqwest::header::InvalidHeaderName), + #[error(transparent)] + HeaderValue(#[from] reqwest::header::InvalidHeaderValue), + #[error( + "Your leetcode cookies seems expired, \ + {} \ + Either you can handwrite your `LEETCODE_SESSION` and `csrf` into `leetcode.toml`, \ + more info please checkout this: \ + https://github.com/clearloop/leetcode-cli/blob/master/README.md#cookies", + "please make sure you have logined in leetcode.com with chrome. ".yellow().bold() + )] CookieError, + #[error( + "Your leetcode account lacks a premium subscription, which the given problem requires.\n \ + If this looks like a mistake, please open a new issue at: {}", + "https://github.com/clearloop/leetcode-cli/".underline() + )] PremiumError, - DecryptError, - SilentError, + #[error(transparent)] + Utf8(#[from] std::string::FromUtf8Error), + #[error( + "json from response parse failed, please open a new issue at: {}.", + "https://github.com/clearloop/leetcode-cli/".underline() + )] NoneError, + #[error( + "Parse config file failed, \ + leetcode-cli has just generated a new leetcode.toml at {}, \ + the current one at {} seems missing some keys, Please compare \ + the new file and add the missing keys.\n", + CONFIG, + "~/.leetcode/leetcode.toml".yellow().bold().underline(), + )] + Config(#[from] toml::de::Error), + #[error("Maybe you not login on the Chrome, you can login and retry")] ChromeNotLogin, - Anyhow(anyhow::Error), -} - -impl std::fmt::Debug for Error { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let e = "error:".bold().red(); - match self { - Error::CacheError(s) => write!(f, "{} {}, please try again", e, s), - Error::CookieError => write!( - f, - "{} \ - Your leetcode cookies seems expired, \ - {} \ - Either you can handwrite your `LEETCODE_SESSION` and `csrf` into `leetcode.toml`, \ - more info please checkout this: \ - https://github.com/clearloop/leetcode-cli/blob/master/README.md#cookies", - e, - "please make sure you have logined in leetcode.com with chrome. " - .yellow() - .bold(), - ), - Error::PremiumError => write!( - f, - "{} \ - Your leetcode account lacks a premium subscription, which the given problem requires.\n \ - If this looks like a mistake, please open a new issue at: {}", - e, - "https://github.com/clearloop/leetcode-cli/".underline()), - Error::DownloadError(s) => write!(f, "{} Download {} failed, please try again", e, s), - Error::NetworkError(s) => write!(f, "{} {}, please try again", e, s), - Error::ParseError(s) => write!(f, "{} {}", e, s), - Error::FeatureError(s) => write!(f, "{} {}", e, s), - Error::MatchError => write!(f, "{} Nothing matches", e), - Error::DecryptError => write!(f, "{} openssl decrypt failed", e), - Error::ScriptError(s) => write!(f, "{} {}", e, s), - Error::SilentError => write!(f, ""), - Error::NoneError => write!(f, - "json from response parse failed, please open a new issue at: {}.", - "https://github.com/clearloop/leetcode-cli/".underline(), - ), - Error::ChromeNotLogin => write!(f, "maybe you not login on the Chrome, you can login and retry."), - Error::Anyhow(e) => write!(f, "{} {}", e, e), - } - } -} - -// network -impl std::convert::From for Error { - fn from(err: reqwest::Error) -> Self { - Error::NetworkError(err.to_string()) - } + #[error(transparent)] + ParseInt(#[from] std::num::ParseIntError), + #[error(transparent)] + Json(#[from] serde_json::Error), + #[error(transparent)] + Toml(#[from] toml::ser::Error), + #[error(transparent)] + Io(#[from] std::io::Error), + #[error(transparent)] + Anyhow(#[from] anyhow::Error), + #[error(transparent)] + Keyring(#[from] keyring::Error), + #[error(transparent)] + OpenSSL(#[from] openssl::error::ErrorStack), + #[cfg(feature = "pym")] + #[error(transparent)] + Pyo3(#[from] pyo3::PyErr), } -// nums -impl std::convert::From for Error { - fn from(err: std::num::ParseIntError) -> Self { - Error::ParseError(err.to_string()) - } -} - -// sql impl std::convert::From for Error { fn from(err: diesel::result::Error) -> Self { match err { diesel::result::Error::NotFound => { - println!("NotFound, you may update cache, and try it again\r\n"); DataCommand::usage().print_help().unwrap_or(()); - Error::SilentError + Error::Anyhow(anyhow!( + "NotFound, you may update cache, and try it again\r\n" + )) } - _ => Error::CacheError(err.to_string()), + _ => Error::Anyhow(anyhow!("{err}")), } } } - -// serde -impl std::convert::From for Error { - fn from(err: serde_json::Error) -> Self { - Error::ParseError(err.to_string()) - } -} - -// toml -impl std::convert::From for Error { - fn from(_err: toml::de::Error) -> Self { - #[cfg(debug_assertions)] - let err_msg = format!( - "{}, {}{}{}{}{}{}", - _err, - "Parse config file failed, ", - "leetcode-cli has just generated a new leetcode.toml at ", - "~/.leetcode/leetcode.tmp.toml,".green().bold().underline(), - " the current one at ", - "~/.leetcode/leetcode.toml".yellow().bold().underline(), - " seems missing some keys, Please compare the new file and add the missing keys.\n", - ); - #[cfg(not(debug_assertions))] - let err_msg = format!( - "{}{}{}{}{}{}", - "Parse config file failed, ", - "leetcode-cli has just generated a new leetcode.toml at ", - "~/.leetcode/leetcode_tmp.toml,".green().bold().underline(), - " the current one at ", - "~/.leetcode/leetcode.toml".yellow().bold().underline(), - " seems missing some keys, Please compare the new file and add the missing keys.\n", - ); - Error::ParseError(err_msg.trim_start().into()) - } -} - -impl std::convert::From for Error { - fn from(err: toml::ser::Error) -> Self { - Error::ParseError(err.to_string()) - } -} - -// io -impl std::convert::From for Error { - fn from(err: std::io::Error) -> Self { - Error::CacheError(err.to_string()) - } -} - -// openssl -impl std::convert::From for Error { - fn from(_: openssl::error::ErrorStack) -> Self { - Error::DecryptError - } -} - -impl From for Error { - fn from(err: anyhow::Error) -> Self { - Error::Anyhow(err) - } -} - -// pyo3 -#[cfg(feature = "pym")] -impl std::convert::From for Error { - fn from(_: pyo3::PyErr) -> Self { - Error::ScriptError("Python script went Error".to_string()) - } -} diff --git a/src/helper.rs b/src/helper.rs index db1a77e..321828c 100644 --- a/src/helper.rs +++ b/src/helper.rs @@ -1,8 +1,10 @@ //! A set of helper traits -pub use self::digit::Digit; -pub use self::file::{code_path, load_script, test_cases_path}; -pub use self::filter::{filter, squash}; -pub use self::html::HTML; +pub use self::{ + digit::Digit, + file::{code_path, load_script, test_cases_path}, + filter::{filter, squash}, + html::HTML, +}; /// Convert i32 to specific digits string. mod digit { @@ -78,14 +80,15 @@ mod filter { } /// Squash questions and ids - pub fn squash(ps: &mut Vec, ids: Vec) -> Result<(), crate::Error> { + pub fn squash(ps: &mut Vec, ids: Vec) -> crate::Result<()> { use std::collections::HashMap; let mut map: HashMap = HashMap::new(); ids.iter().for_each(|x| { map.insert(x.to_string(), true).unwrap_or_default(); }); - ps.retain(|x| map.get(&x.id.to_string()).is_some()); + + ps.retain(|x| map.contains_key(&x.id.to_string())); Ok(()) } } @@ -164,7 +167,7 @@ mod html { mod file { /// Convert file suffix from language type - pub fn suffix(l: &str) -> Result<&'static str, crate::Error> { + pub fn suffix(l: &str) -> crate::Result<&'static str> { match l { "bash" => Ok("sh"), "c" => Ok("c"), @@ -191,7 +194,7 @@ mod file { use crate::{cache::models::Problem, Error}; /// Generate test cases path by fid - pub fn test_cases_path(problem: &Problem) -> Result { + pub fn test_cases_path(problem: &Problem) -> crate::Result { let conf = crate::config::Config::locate()?; let mut path = format!("{}/{}.tests.dat", conf.storage.code()?, conf.code.pick); @@ -201,7 +204,7 @@ mod file { } /// Generate code path by fid - pub fn code_path(problem: &Problem, l: Option) -> Result { + pub fn code_path(problem: &Problem, l: Option) -> crate::Result { let conf = crate::config::Config::locate()?; let mut lang = conf.code.lang; if l.is_some() { @@ -222,7 +225,7 @@ mod file { } /// Load python scripts - pub fn load_script(module: &str) -> Result { + pub fn load_script(module: &str) -> crate::Result { use std::fs::File; use std::io::Read; let conf = crate::config::Config::locate()?; diff --git a/src/lib.rs b/src/lib.rs index 4bc2a53..39a89e6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -248,4 +248,4 @@ pub mod pym; // re-exports pub use cache::Cache; pub use config::Config; -pub use err::Error; +pub use err::{Error, Result}; diff --git a/src/plugins/chrome.rs b/src/plugins/chrome.rs index 8ccc6f7..0825300 100644 --- a/src/plugins/chrome.rs +++ b/src/plugins/chrome.rs @@ -1,8 +1,9 @@ -use crate::{cache, Error}; +use crate::{cache, Error, Result}; +use anyhow::anyhow; use diesel::prelude::*; use keyring::Entry; use openssl::{hash, pkcs5, symm}; -use std::collections::HashMap; +use std::{collections::HashMap, fmt::Display}; /// LeetCode Cookies Schema mod schema { @@ -33,14 +34,18 @@ pub struct Ident { session: String, } -impl std::string::ToString for Ident { - fn to_string(&self) -> String { - format!("LEETCODE_SESSION={};csrftoken={};", self.session, self.csrf) +impl Display for Ident { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!( + f, + "LEETCODE_SESSION={};csrftoken={};", + self.session, self.csrf + ) } } /// Get cookies from chrome storage -pub fn cookies() -> Result { +pub fn cookies() -> Result { let ccfg = crate::config::Config::locate()?.cookies; if !ccfg.csrf.is_empty() && !ccfg.session.is_empty() { return Ok(Ident { @@ -63,17 +68,17 @@ pub fn cookies() -> Result { debug!("Chrome Cookies path is {:?}", &p); let mut conn = cache::conn(p.to_string_lossy().to_string()); let res = cookies - .filter(host_key.like("%leetcode.com")) + .filter(host_key.like(format!("#{}", ccfg.site))) .load::(&mut conn) .expect("Loading cookies from google chrome failed."); debug!("res {:?}", &res); if res.is_empty() { - return Err(crate::Error::CookieError); + return Err(Error::CookieError); } // Get system password - let ring = Entry::new("Chrome Safe Storage", "Chrome"); + let ring = Entry::new("Chrome Safe Storage", "Chrome")?; let pass = ring.get_password().expect("Get Password failed"); // Decode cookies @@ -94,7 +99,7 @@ pub fn cookies() -> Result { } /// Decode cookies from chrome -fn decode_cookies(pass: &str, v: Vec) -> Result { +fn decode_cookies(pass: &str, v: Vec) -> Result { let mut key = [0_u8; 16]; match std::env::consts::OS { "macos" => { @@ -117,18 +122,14 @@ fn decode_cookies(pass: &str, v: Vec) -> Result { ) .expect("pbkdf2 hmac went error."); } - _ => { - return Err(crate::Error::FeatureError( - "only supports OSX or Linux for now".to_string(), - )) - } + _ => return Err(anyhow!("only supports OSX or Linux for now").into()), } chrome_decrypt(v, key) } /// Decrypt chrome cookie value with aes-128-cbc -fn chrome_decrypt(v: Vec, key: [u8; 16]) -> Result { +fn chrome_decrypt(v: Vec, key: [u8; 16]) -> Result { // : \u16 let iv = vec![32_u8; 16]; let mut decrypter = symm::Crypter::new( diff --git a/src/plugins/leetcode.rs b/src/plugins/leetcode.rs index 5f0106f..ec8a924 100644 --- a/src/plugins/leetcode.rs +++ b/src/plugins/leetcode.rs @@ -1,8 +1,7 @@ use self::req::{Json, Mode, Req}; use crate::{ config::{self, Config}, - err::Error, - // plugins::chrome, + Result, }; use reqwest::{ header::{HeaderMap, HeaderName, HeaderValue}, @@ -20,31 +19,24 @@ pub struct LeetCode { impl LeetCode { /// Parse reqwest headers - fn headers(mut headers: HeaderMap, ts: Vec<(&str, &str)>) -> Result { + fn headers(mut headers: HeaderMap, ts: Vec<(&str, &str)>) -> Result { for (k, v) in ts.into_iter() { - let name = HeaderName::from_str(k); - let value = HeaderValue::from_str(v); - if name.is_err() || value.is_err() { - return Err(Error::ParseError("http header parse failed".to_string())); - } - - headers.insert(name.unwrap(), value.unwrap()); + let name = HeaderName::from_str(k)?; + let value = HeaderValue::from_str(v)?; + headers.insert(name, value); } Ok(headers) } /// New LeetCode client - pub fn new() -> Result { + pub fn new() -> Result { let conf = config::Config::locate()?; let (cookie, csrf) = if conf.cookies.csrf.is_empty() || conf.cookies.session.is_empty() { let cookies = super::chrome::cookies()?; (cookies.to_string(), cookies.csrf) } else { - ( - conf.cookies.clone().to_string(), - conf.cookies.clone().csrf, - ) + (conf.cookies.clone().to_string(), conf.cookies.clone().csrf) }; let default_headers = LeetCode::headers( HeaderMap::new(), @@ -69,7 +61,7 @@ impl LeetCode { } /// Get category problems - pub async fn get_category_problems(self, category: &str) -> Result { + pub async fn get_category_problems(self, category: &str) -> Result { trace!("Requesting {} problems...", &category); let url = &self.conf.sys.urls.problems(category); @@ -86,7 +78,7 @@ impl LeetCode { .await } - pub async fn get_question_ids_by_tag(self, slug: &str) -> Result { + pub async fn get_question_ids_by_tag(self, slug: &str) -> Result { trace!("Requesting {} ref problems...", &slug); let url = &self.conf.sys.urls.graphql; let mut json: Json = HashMap::new(); @@ -94,15 +86,13 @@ impl LeetCode { json.insert("variables", r#"{"slug": "$slug"}"#.replace("$slug", slug)); json.insert( "query", - vec![ - "query getTopicTag($slug: String!) {", + ["query getTopicTag($slug: String!) {", " topicTag(slug: $slug) {", " questions {", " questionId", " }", " }", - "}", - ] + "}"] .join("\n"), ); @@ -119,7 +109,7 @@ impl LeetCode { .await } - pub async fn get_user_info(self) -> Result { + pub async fn get_user_info(self) -> Result { trace!("Requesting user info..."); let url = &self.conf.sys.urls.graphql; let mut json: Json = HashMap::new(); @@ -149,24 +139,41 @@ impl LeetCode { } /// Get daily problem - pub async fn get_question_daily(self) -> Result { + pub async fn get_question_daily(self) -> Result { trace!("Requesting daily problem..."); let url = &self.conf.sys.urls.graphql; let mut json: Json = HashMap::new(); - json.insert("operationName", "daily".to_string()); - json.insert( - "query", - vec![ - "query daily {", - " activeDailyCodingChallengeQuestion {", - " question {", - " questionFrontendId", - " }", - " }", - "}", - ] - .join("\n"), - ); + + match self.conf.cookies.site { + config::LeetcodeSite::LeetcodeCom => { + json.insert("operationName", "daily".to_string()); + json.insert( + "query", + ["query daily {", + " activeDailyCodingChallengeQuestion {", + " question {", + " questionFrontendId", + " }", + " }", + "}"] + .join("\n"), + ); + } + config::LeetcodeSite::LeetcodeCn => { + json.insert("operationName", "questionOfToday".to_string()); + json.insert( + "query", + ["query questionOfToday {", + " todayRecord {", + " question {", + " questionFrontendId", + " }", + " }", + "}"] + .join("\n"), + ); + } + } Req { default_headers: self.default_headers, @@ -182,14 +189,13 @@ impl LeetCode { } /// Get specific problem detail - pub async fn get_question_detail(self, slug: &str) -> Result { + pub async fn get_question_detail(self, slug: &str) -> Result { trace!("Requesting {} detail...", &slug); let refer = self.conf.sys.urls.problem(slug); let mut json: Json = HashMap::new(); json.insert( "query", - vec![ - "query getQuestionDetail($titleSlug: String!) {", + ["query getQuestionDetail($titleSlug: String!) {", " question(titleSlug: $titleSlug) {", " content", " stats", @@ -200,8 +206,7 @@ impl LeetCode { " metaData", " translatedContent", " }", - "}", - ] + "}"] .join("\n"), ); @@ -219,14 +224,14 @@ impl LeetCode { json: Some(json), mode: Mode::Post, name: "get_problem_detail", - url: self.conf.sys.urls.graphql.into(), + url: self.conf.sys.urls.graphql, } .send(&self.client) .await } /// Send code to judge - pub async fn run_code(self, j: Json, url: String, refer: String) -> Result { + pub async fn run_code(self, j: Json, url: String, refer: String) -> Result { info!("Sending code to judge..."); Req { default_headers: self.default_headers, @@ -242,7 +247,7 @@ impl LeetCode { } /// Get the result of submission / testing - pub async fn verify_result(self, id: String) -> Result { + pub async fn verify_result(self, id: String) -> Result { trace!("Verifying result..."); let url = self.conf.sys.urls.verify(&id); diff --git a/src/pym.rs b/src/pym.rs index dfb409b..43dd81b 100644 --- a/src/pym.rs +++ b/src/pym.rs @@ -1,26 +1,27 @@ //! This module is for python scripts. //! //! Seems like some error exists now, welocome pr to fix this : ) -use crate::cache::Cache; -use crate::helper::load_script; +use crate::{cache::Cache, helper::load_script, Result}; use pyo3::prelude::*; +use std::ffi::CString; /// Exec python scripts as filter -pub fn exec(module: &str) -> Result, crate::Error> { +pub fn exec(module: &str) -> Result> { + pyo3::prepare_freethreaded_python(); let script = load_script(&module)?; let cache = Cache::new()?; - // pygil - let gil = Python::acquire_gil(); - let py = gil.python(); - let pym = PyModule::from_code(py, &script, "plan.py", "plan")?; - // args let sps = serde_json::to_string(&cache.get_problems()?)?; let stags = serde_json::to_string(&cache.get_tags()?)?; - // ret - let res: Vec = pym.call1("plan", (sps, stags))?.extract()?; - - Ok(res) + // pygil + Python::with_gil(|py| { + let script_cstr = CString::new(script.as_str())?; + let filename_cstr = CString::new("plan.py")?; + let module_name_cstr = CString::new("plan")?; + let pym = PyModule::from_code(py, &script_cstr, &filename_cstr, &module_name_cstr)?; + pym.getattr("plan")?.call1((sps, stags))?.extract() + }) + .map_err(Into::into) } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy