diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml index b6139b6e..0362476f 100644 --- a/.github/workflows/CD.yml +++ b/.github/workflows/CD.yml @@ -21,6 +21,12 @@ jobs: if: github.base_ref == 'main' run: curl -L "docs.google.com/spreadsheets/d/${{ secrets.SHEET_ID }}/gviz/tq?tqx=out:csv&sheet=Ukrainian" -o table.csv + - uses: actions/upload-artifact@v3 + if: inputs.upload-artifact + with: + name: table + path: table.csv + - uses: dawidd6/action-download-artifact@v2 with: pr: ${{github.event.pull_request.number}} @@ -42,10 +48,8 @@ jobs: if: github.base_ref == 'main' && startsWith(github.ref, 'refs/tags/') steps: - uses: actions/checkout@v3 - - uses: dawidd6/action-download-artifact@v2 + - uses: actions/download-artifact@v3 with: - pr: ${{github.event.pull_request.number}} - workflow: CI.yml name: table - uses: dawidd6/action-download-artifact@v2 with: @@ -77,7 +81,7 @@ jobs: with: pr: ${{github.event.pull_request.number}} workflow: CI.yml - name: table + name: apk - name: send telegram message on push uses: appleboy/telegram-action@master @@ -85,7 +89,7 @@ jobs: with: to: ${{ secrets.TELEGRAM_TO }} token: ${{ secrets.TELEGRAM_TOKEN }} - document: table.csv + document: app-release.apk message: | ${{ github.actor }} created commit: Commit message: ${{ github.event.commits[0].message }} diff --git a/.github/workflows/build_flutter_apk.yml b/.github/workflows/build_flutter_apk.yml index c5d05872..5334ec94 100644 --- a/.github/workflows/build_flutter_apk.yml +++ b/.github/workflows/build_flutter_apk.yml @@ -20,7 +20,7 @@ jobs: working-directory: app steps: - uses: actions/checkout@v3 - - uses: extractions/setup-just@v1 + # - uses: extractions/setup-just@v1 - uses: subosito/flutter-action@v2 with: channel: "stable" @@ -37,13 +37,15 @@ jobs: - uses: baptiste0928/cargo-install@v2 with: crate: flutter_rust_bridge_codegen - - uses: baptiste0928/cargo-install@v2 - with: - crate: cargo-ndk + version: 2.0.0-dev.32 + # - uses: baptiste0928/cargo-install@v2 + # with: + # crate: cargo-ndk - uses: baptiste0928/cargo-install@v2 with: crate: cargo-expand - - run: just && flutter build apk --release + # - run: flutter_rust_bridge_codegen build && flutter build apk --release + - run: flutter build apk --release env: SHEET_ID: ${{ secrets.SHEET_ID }} - uses: actions/upload-artifact@v3 diff --git a/Cargo.lock b/Cargo.lock index ec07440a..5b72a3e6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,45 +19,96 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aho-corasick" -version = "1.0.5" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c378d78423fdad8089616f827526ee33c19f2fddbd5de1629152c9593ba4783" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] [[package]] name = "allo-isolate" -version = "0.1.20" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f56b7997817c178b853573e8bdfb6c3afe02810b43f17d766d6703560074b0c3" +checksum = "f2f5a5fd28223e6f3cafb7d9cd685f51eafdd71d33ca1229f8316925d5957240" dependencies = [ "anyhow", "atomic", "backtrace", - "chrono", ] [[package]] -name = "android-tzdata" -version = "0.1.1" +name = "android_log-sys" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" +checksum = "5ecc8056bf6ab9892dcd53216c83d1597487d7dacac16c8df6b877d127df9937" [[package]] -name = "android_system_properties" -version = "0.1.5" +name = "android_logger" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +checksum = "c494134f746c14dc653a35a4ea5aca24ac368529da5370ecf41fe0341c35772f" dependencies = [ - "libc", + "android_log-sys", + "env_logger 0.10.2", + "log", + "once_cell", +] + +[[package]] +name = "anstream" +version = "0.6.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" + +[[package]] +name = "anstyle-parse" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" +dependencies = [ + "anstyle", + "windows-sys 0.52.0", ] [[package]] name = "anyhow" -version = "1.0.75" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" [[package]] name = "aquamarine" @@ -74,13 +125,13 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.73" +version = "0.1.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" +checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.60", ] [[package]] @@ -91,15 +142,15 @@ checksum = "c59bdb34bc650a32731b31bd8f0829cc15d24a708ee31559e0bb34f2bc320cba" [[package]] name = "autocfg" -version = "1.1.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" dependencies = [ "addr2line", "cc", @@ -112,9 +163,15 @@ dependencies = [ [[package]] name = "base64" -version = "0.21.4" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bincode" @@ -133,9 +190,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "bot" @@ -144,11 +201,11 @@ dependencies = [ "anyhow", "first_aid_bot_core", "futures", - "itertools 0.10.5", + "itertools 0.12.1", "log", "pretty_env_logger", "rand", - "redis 0.23.3", + "redis 0.25.3", "serde", "teloxide", "tokio", @@ -162,30 +219,33 @@ checksum = "832133bbabbbaa9fbdba793456a2827627a7d2b8fb96032fa1e7666d7895832b" [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "bytemuck" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" +checksum = "5d6d68c57235a3a081186990eca2867354726650f42f7516ca50c28d6281fd15" [[package]] -name = "bytes" +name = "byteorder" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cc" -version = "1.0.83" +version = "1.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] +checksum = "065a29261d53ba54260972629f9ca6bffa69bac13cd1fed61420f7fa68b9f8bd" [[package]] name = "cfg-if" @@ -195,23 +255,24 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ - "android-tzdata", - "iana-time-zone", - "js-sys", "num-traits", - "wasm-bindgen", - "windows-targets", ] +[[package]] +name = "colorchoice" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" + [[package]] name = "combine" -version = "4.6.6" +version = "4.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" dependencies = [ "bytes", "futures-core", @@ -233,18 +294,18 @@ dependencies = [ [[package]] name = "const_format" -version = "0.2.31" +version = "0.2.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c990efc7a285731f9a4378d81aff2f0e85a2c8781a05ef0f8baa8dac54d0ff48" +checksum = "e3a214c7af3d04997541b18d432afaff4c455e79e2029079647e72fc2bd27673" dependencies = [ "const_format_proc_macros", ] [[package]] name = "const_format_proc_macros" -version = "0.2.31" +version = "0.2.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e026b6ce194a874cb9cf32cd5772d1ef9767cc8fcb5765948d74f37a9d8b2bf6" +checksum = "c7f6ff08fd20f4f299298a28e2dfa8a8ba1036e6cd2460ac1de7b425d76f2500" dependencies = [ "proc-macro2", "quote", @@ -259,9 +320,9 @@ 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", @@ -269,15 +330,15 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "csv" -version = "1.2.2" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "626ae34994d3d8d668f4269922248239db4ae42d538b14c398b74a52208e8086" +checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe" dependencies = [ "csv-core", "itoa", @@ -330,14 +391,35 @@ dependencies = [ ] [[package]] -name = "dart-sys" -version = "4.0.2" +name = "dart-sys-fork" +version = "4.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d8b5680b5c2cc52f50acb2457d9b3a3b58adcca785db13a0e3655626f601de6" +checksum = "933dafff26172b719bb9695dd3715a1e7792f62dcdc8a5d4c740db7e0fedee8b" dependencies = [ "cc", ] +[[package]] +name = "dashmap" +version = "4.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e77a43b28d0668df09411cb0bc9a8c2adc40f9a048afe863e05fd43251e8e39c" +dependencies = [ + "cfg-if", + "num_cpus", +] + +[[package]] +name = "delegate-attr" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51aac4c99b2e6775164b412ea33ae8441b2fde2dbf05a20bc0052a63d08c475b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.60", +] + [[package]] name = "derive_more" version = "0.99.17" @@ -362,24 +444,34 @@ dependencies = [ [[package]] name = "either" -version = "1.9.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" [[package]] name = "encoding_rs" -version = "0.8.33" +version = "0.8.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" dependencies = [ "cfg-if", ] +[[package]] +name = "env_filter" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a009aa4810eb158359dda09d0c87378e4bbb89b5a801f016885a4707ba24f7ea" +dependencies = [ + "log", + "regex", +] + [[package]] name = "env_logger" -version = "0.10.0" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" +checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" dependencies = [ "humantime", "is-terminal", @@ -388,6 +480,25 @@ dependencies = [ "termcolor", ] +[[package]] +name = "env_logger" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b35839ba51819680ba087cd351788c9a3c476841207e0b8cee0b04722343b9" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "humantime", + "log", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "erasable" version = "1.2.1" @@ -400,30 +511,19 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ - "cc", "libc", + "windows-sys 0.52.0", ] [[package]] name = "fastrand" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" +checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" [[package]] name = "first_aid_bot_core" @@ -433,11 +533,11 @@ dependencies = [ "bytes", "const_format", "csv", - "env_logger", + "env_logger 0.11.3", "indexmap", "log", "regex", - "reqwest", + "reqwest 0.12.4", "serde", "test-log", "tokio", @@ -445,35 +545,41 @@ dependencies = [ [[package]] name = "flutter_rust_bridge" -version = "1.82.0" +version = "2.0.0-dev.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a23db02978984f7832254240b32fd92aa7ac085c159ad5684a8f8274ba636cb4" +checksum = "34014207992d96657886c50c90ab503bb4581cc9c2b1ea7ffad2ec12400032da" dependencies = [ "allo-isolate", + "android_logger", "anyhow", - "backtrace", "build-target", "bytemuck", - "cc", - "chrono", + "byteorder", "console_error_panic_hook", - "dart-sys", + "dart-sys-fork", + "delegate-attr", "flutter_rust_bridge_macros", + "futures", "js-sys", "lazy_static", - "libc", - "log", - "parking_lot", + "oslog", "threadpool", + "tokio", "wasm-bindgen", + "wasm-bindgen-futures", "web-sys", ] [[package]] name = "flutter_rust_bridge_macros" -version = "1.82.1" +version = "2.0.0-dev.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef4736aac920ca50be2c7747a46494d3740ca88bc49a6654b031d6f396282f3" +checksum = "fd250246955bb9548a99733859946a5721289ec152de5fcc6eb03da7d3143dd1" +dependencies = [ + "hex", + "quote", + "syn 2.0.60", +] [[package]] name = "fnv" @@ -498,18 +604,18 @@ 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", ] [[package]] name = "futures" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -522,9 +628,9 @@ dependencies = [ [[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", @@ -532,15 +638,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -549,38 +655,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-macro" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.60", ] [[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", @@ -596,9 +702,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.10" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" dependencies = [ "cfg-if", "libc", @@ -607,22 +713,41 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.0" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" + +[[package]] +name = "h2" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 0.2.12", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] [[package]] name = "h2" -version = "0.3.21" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" +checksum = "816ec7294445779408f36fe57bc5b7fc1cf59664059096c65f905c1c61f58069" dependencies = [ "bytes", "fnv", "futures-core", "futures-sink", "futures-util", - "http", + "http 1.1.0", "indexmap", "slab", "tokio", @@ -632,9 +757,9 @@ 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 = "heck" @@ -644,15 +769,32 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "hex" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "http" -version = "0.2.9" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ "bytes", "fnv", @@ -661,12 +803,35 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "http", + "http 0.2.12", + "pin-project-lite", +] + +[[package]] +name = "http-body" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +dependencies = [ + "bytes", + "http 1.1.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" +dependencies = [ + "bytes", + "futures-core", + "http 1.1.0", + "http-body 1.0.0", "pin-project-lite", ] @@ -690,28 +855,48 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.27" +version = "0.14.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" dependencies = [ "bytes", "futures-channel", "futures-core", "futures-util", - "h2", - "http", - "http-body", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", "httparse", "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.9", + "socket2", "tokio", "tower-service", "tracing", "want", ] +[[package]] +name = "hyper" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2 0.4.4", + "http 1.1.0", + "http-body 1.0.0", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + [[package]] name = "hyper-tls" version = "0.5.0" @@ -719,33 +904,46 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes", - "hyper", + "hyper 0.14.28", "native-tls", "tokio", "tokio-native-tls", ] [[package]] -name = "iana-time-zone" -version = "0.1.57" +name = "hyper-tls" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows", + "bytes", + "http-body-util", + "hyper 1.3.1", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", ] [[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" +name = "hyper-util" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" dependencies = [ - "cc", + "bytes", + "futures-channel", + "futures-util", + "http 1.1.0", + "http-body 1.0.0", + "hyper 1.3.1", + "pin-project-lite", + "socket2", + "tokio", + "tower", + "tower-service", + "tracing", ] [[package]] @@ -756,9 +954,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -766,31 +964,37 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.3" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ - "autocfg", + "equivalent", "hashbrown", ] [[package]] name = "ipnet" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "is-terminal" -version = "0.4.9" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" dependencies = [ "hermit-abi", - "rustix", - "windows-sys", + "libc", + "windows-sys 0.52.0", ] +[[package]] +name = "is_terminal_polyfill" +version = "1.70.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" + [[package]] name = "itertools" version = "0.9.0" @@ -802,24 +1006,24 @@ dependencies = [ [[package]] name = "itertools" -version = "0.10.5" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" dependencies = [ "either", ] [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "js-sys" -version = "0.3.64" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] @@ -832,37 +1036,36 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.149" +version = "0.2.154" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" +checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" [[package]] name = "linux-raw-sys" -version = "0.4.10" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] -name = "lock_api" -version = "0.4.10" +name = "log" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" -dependencies = [ - "autocfg", - "scopeguard", -] +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] -name = "log" -version = "0.4.20" +name = "matchers" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "mime" @@ -882,32 +1085,22 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.8.8" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", "wasi", - "windows-sys", -] - -[[package]] -name = "native" -version = "0.1.0" -dependencies = [ - "first_aid_bot_core", - "flutter_rust_bridge", - "openssl", - "tokio", + "windows-sys 0.48.0", ] [[package]] @@ -934,11 +1127,21 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c96aba5aa877601bb3f6dd6a63a969e1f82e60646e81e71b14496995e9853c91" +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + [[package]] name = "num-traits" -version = "0.2.16" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -955,26 +1158,26 @@ dependencies = [ [[package]] name = "object" -version = "0.32.1" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "openssl" -version = "0.10.57" +version = "0.10.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" +checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.5.0", "cfg-if", "foreign-types", "libc", @@ -991,7 +1194,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.60", ] [[package]] @@ -1002,18 +1205,18 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "300.1.5+3.1.3" +version = "300.2.3+3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "559068e4c12950d7dcaa1857a61725c0d38d4fc03ff8e070ab31a75d6e316491" +checksum = "5cff92b6f71555b61bb9315f7c64da3ca43d87531622120fea0195fc761b4843" dependencies = [ "cc", ] [[package]] name = "openssl-sys" -version = "0.9.93" +version = "0.9.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" +checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" dependencies = [ "cc", "libc", @@ -1023,59 +1226,53 @@ dependencies = [ ] [[package]] -name = "parking_lot" -version = "0.12.1" +name = "oslog" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "8343ce955f18e7e68c0207dd0ea776ec453035685395ababd2ea651c569728b3" dependencies = [ - "lock_api", - "parking_lot_core", + "cc", + "dashmap", + "log", ] [[package]] -name = "parking_lot_core" -version = "0.9.8" +name = "overload" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-targets", -] +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[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 = "pin-project" -version = "1.1.3" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.3" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.60", ] [[package]] name = "pin-project-lite" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -1085,9 +1282,9 @@ 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 = "ppv-lite86" @@ -1101,7 +1298,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "865724d4dbe39d9f3dd3b52b88d859d66bcb2d6a0acfd5ea68a65fb66d4bdc1c" dependencies = [ - "env_logger", + "env_logger 0.10.2", "log", ] @@ -1131,18 +1328,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.67" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" +checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.33" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -1208,9 +1405,9 @@ dependencies = [ [[package]] name = "redis" -version = "0.23.3" +version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f49cdc0bb3f412bf8e7d1bd90fe1d9eb10bc5c399ba90973c14662a27b3f8ba" +checksum = "6472825949c09872e8f2c50bde59fcefc17748b6be5c90fd67cd8b4daca73bfd" dependencies = [ "async-trait", "bytes", @@ -1221,66 +1418,72 @@ dependencies = [ "pin-project-lite", "ryu", "sha1_smol", - "socket2 0.4.9", + "socket2", "tokio", "tokio-util", "url", ] [[package]] -name = "redox_syscall" -version = "0.3.5" +name = "regex" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ - "bitflags 1.3.2", + "aho-corasick", + "memchr", + "regex-automata 0.4.6", + "regex-syntax 0.8.3", ] [[package]] -name = "regex" -version = "1.9.5" +name = "regex-automata" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "697061221ea1b4a94a624f67d0ae2bfe4e22b8a17b6a192afb11046542cc8c47" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", + "regex-syntax 0.6.29", ] [[package]] name = "regex-automata" -version = "0.3.8" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2f401f4955220693b56f8ec66ee9c78abffd8d1c4f23dc41a23839eb88f0795" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", - "regex-syntax", + "regex-syntax 0.8.3", ] [[package]] name = "regex-syntax" -version = "0.7.5" +version = "0.6.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "reqwest" -version = "0.11.20" +version = "0.11.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" dependencies = [ - "base64", + "base64 0.21.7", "bytes", "encoding_rs", "futures-core", "futures-util", - "h2", - "http", - "http-body", - "hyper", - "hyper-tls", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.28", + "hyper-tls 0.5.0", "ipnet", "js-sys", "log", @@ -1290,9 +1493,12 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", + "rustls-pemfile 1.0.4", "serde", "serde_json", "serde_urlencoded", + "sync_wrapper", + "system-configuration", "tokio", "tokio-native-tls", "tokio-util", @@ -1302,7 +1508,59 @@ dependencies = [ "wasm-bindgen-futures", "wasm-streams", "web-sys", - "winreg", + "winreg 0.50.0", +] + +[[package]] +name = "reqwest" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" +dependencies = [ + "base64 0.22.1", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2 0.4.4", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", + "hyper 1.3.1", + "hyper-tls 0.6.0", + "hyper-util", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls-pemfile 2.1.2", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "system-configuration", + "tokio", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg 0.52.0", +] + +[[package]] +name = "rust_lib_app" +version = "0.1.0" +dependencies = [ + "anyhow", + "first_aid_bot_core", + "flutter_rust_bridge", + "openssl", ] [[package]] @@ -1322,30 +1580,55 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.19" +version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "745ecfa778e66b2b63c88a61cb36e0eea109e803b0b86bf9879fbc77c70e86ed" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.5.0", "errno", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +dependencies = [ + "base64 0.21.7", +] + +[[package]] +name = "rustls-pemfile" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" +dependencies = [ + "base64 0.22.1", + "rustls-pki-types", ] +[[package]] +name = "rustls-pki-types" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "beb461507cee2c2ff151784c52762cf4d9ff6a61f3e80968600ed24fa837fa54" + [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] name = "schannel" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" dependencies = [ - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -1356,9 +1639,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "security-framework" -version = "2.9.2" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +checksum = "770452e37cad93e0a50d5abc3990d2bc351c36d0328f86cefec2f2fb206eaef6" dependencies = [ "bitflags 1.3.2", "core-foundation", @@ -1369,9 +1652,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.1" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +checksum = "41f3cc463c0ef97e11c3461a9d3787412d30e8e7eb907c79180c4a57bf7c04ef" dependencies = [ "core-foundation-sys", "libc", @@ -1379,35 +1662,35 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.18" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" [[package]] name = "serde" -version = "1.0.188" +version = "1.0.200" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +checksum = "ddc6f9cc94d67c0e21aaf7eda3a010fd3af78ebf6e096aa6e2e13c79749cce4f" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.188" +version = "1.0.200" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +checksum = "856f046b9400cee3c8c94ed572ecdb752444c24528c035cd35882aad6f492bcb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.60", ] [[package]] name = "serde_json" -version = "1.0.107" +version = "1.0.116" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" dependencies = [ "itoa", "ryu", @@ -1453,11 +1736,20 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012" +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + [[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", ] @@ -1473,28 +1765,18 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" -version = "0.4.9" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" dependencies = [ "libc", - "winapi", -] - -[[package]] -name = "socket2" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" -dependencies = [ - "libc", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -1516,15 +1798,42 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.37" +version = "2.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8" +checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "take_mut" version = "0.2.2" @@ -1583,7 +1892,7 @@ dependencies = [ "once_cell", "pin-project", "rc-box", - "reqwest", + "reqwest 0.11.27", "serde", "serde_json", "serde_with_macros", @@ -1611,55 +1920,75 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.8.0" +version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", "fastrand", - "redox_syscall", "rustix", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "termcolor" -version = "1.3.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ "winapi-util", ] [[package]] name = "test-log" -version = "0.2.12" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9601d162c1d77e62c1ea0bc8116cd1caf143ce3af947536c3c9052a1677fe0c" +checksum = "3dffced63c2b5c7be278154d76b479f9f9920ed34e7574201407f0b14e2bbb93" +dependencies = [ + "env_logger 0.11.3", + "test-log-macros", + "tracing-subscriber", +] + +[[package]] +name = "test-log-macros" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5999e24eaa32083191ba4e425deb75cdf25efefabe5aaccb7446dd0d4122a3f5" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.60", ] [[package]] name = "thiserror" -version = "1.0.48" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7" +checksum = "f0126ad08bff79f29fc3ae6a55cc72352056dfff61e3ff8bb7129476d44b23aa" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.48" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" +checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.60", +] + +[[package]] +name = "thread_local" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +dependencies = [ + "cfg-if", + "once_cell", ] [[package]] @@ -1688,9 +2017,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.32.0" +version = "1.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" +checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" dependencies = [ "backtrace", "bytes", @@ -1699,20 +2028,20 @@ dependencies = [ "num_cpus", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.4", + "socket2", "tokio-macros", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] name = "tokio-macros" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.60", ] [[package]] @@ -1727,9 +2056,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" +checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" dependencies = [ "futures-core", "pin-project-lite", @@ -1738,9 +2067,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.9" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" +checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" dependencies = [ "bytes", "futures-core", @@ -1750,6 +2079,28 @@ dependencies = [ "tracing", ] +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite", + "tokio", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + [[package]] name = "tower-service" version = "0.3.2" @@ -1758,29 +2109,58 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[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", + "log", "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", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", ] [[package]] name = "try-lock" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "unicase" @@ -1793,9 +2173,9 @@ dependencies = [ [[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" @@ -1805,9 +2185,9 @@ 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", ] @@ -1820,9 +2200,9 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "url" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", "idna", @@ -1830,15 +2210,27 @@ dependencies = [ "serde", ] +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + [[package]] name = "uuid" -version = "1.4.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" +checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" dependencies = [ "getrandom", ] +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + [[package]] name = "vcpkg" version = "0.2.15" @@ -1874,9 +2266,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -1884,24 +2276,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.87" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.60", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.37" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" dependencies = [ "cfg-if", "js-sys", @@ -1911,9 +2303,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1921,28 +2313,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.60", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "wasm-streams" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4609d447824375f43e1ffbc051b50ad8f4b3ae8219680c94452ea05eb240ac7" +checksum = "b65dc4c90b63b118468cf747d8bf3566c1913ef60be765b5730ead9e0a3ba129" dependencies = [ "futures-util", "js-sys", @@ -1953,9 +2345,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.64" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" dependencies = [ "js-sys", "wasm-bindgen", @@ -1979,11 +2371,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" dependencies = [ - "winapi", + "windows-sys 0.52.0", ] [[package]] @@ -1993,21 +2385,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "windows" +name = "windows-sys" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets", + "windows-targets 0.48.5", ] [[package]] name = "windows-sys" -version = "0.48.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets", + "windows-targets 0.52.5", ] [[package]] @@ -2016,13 +2408,29 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +dependencies = [ + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", ] [[package]] @@ -2031,42 +2439,90 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" + [[package]] name = "windows_i686_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +[[package]] +name = "windows_i686_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" + [[package]] name = "windows_i686_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[package]] +name = "windows_i686_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" + [[package]] name = "winreg" version = "0.50.0" @@ -2074,5 +2530,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ "cfg-if", - "windows-sys", + "windows-sys 0.48.0", +] + +[[package]] +name = "winreg" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", ] diff --git a/Cargo.toml b/Cargo.toml index a6df4a84..36eaf5b1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ resolver = "2" members = [ "core", "bot", - "app/native" + "app/rust" ] [workspace.dependencies] diff --git a/app/.editorconfig b/app/.editorconfig deleted file mode 100644 index 9d4c2fa8..00000000 --- a/app/.editorconfig +++ /dev/null @@ -1,2 +0,0 @@ -[*.dart] -indent_size = 2 diff --git a/app/.gitignore b/app/.gitignore index 09360f32..29a3a501 100644 --- a/app/.gitignore +++ b/app/.gitignore @@ -8,6 +8,7 @@ .buildlog/ .history .svn/ +migrate_working_dir/ # IntelliJ related *.iml @@ -26,13 +27,10 @@ .dart_tool/ .flutter-plugins .flutter-plugins-dependencies -.packages .pub-cache/ .pub/ /build/ -# Web related - # Symbolication related app.*.symbols @@ -43,9 +41,3 @@ app.*.map.json /android/app/debug /android/app/profile /android/app/release -native/target -xcuserdata -jniLibs - -Cargo.lock -pubspec.lock diff --git a/app/.metadata b/app/.metadata index 8e89d4de..d2765fcb 100644 --- a/app/.metadata +++ b/app/.metadata @@ -1,11 +1,11 @@ # This file tracks properties of this Flutter project. # Used by Flutter tool to assess capabilities and perform upgrades etc. # -# This file should be version controlled. +# This file should be version controlled and should not be manually edited. version: - revision: 9944297138845a94256f1cf37beb88ff9a8e811a - channel: stable + revision: "54e66469a933b60ddf175f858f82eaeb97e48c8d" + channel: "stable" project_type: app @@ -13,26 +13,26 @@ project_type: app migration: platforms: - platform: root - create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a - base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a + create_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d + base_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d - platform: android - create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a - base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a + create_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d + base_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d - platform: ios - create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a - base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a + create_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d + base_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d - platform: linux - create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a - base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a + create_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d + base_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d - platform: macos - create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a - base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a + create_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d + base_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d - platform: web - create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a - base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a + create_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d + base_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d - platform: windows - create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a - base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a + create_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d + base_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d # User provided section diff --git a/app/analysis_options.yaml b/app/analysis_options.yaml index 61b6c4de..0d290213 100644 --- a/app/analysis_options.yaml +++ b/app/analysis_options.yaml @@ -13,8 +13,7 @@ linter: # The lint rules applied to this project can be customized in the # section below to disable rules from the `package:flutter_lints/flutter.yaml` # included above or to enable additional rules. A list of all available lints - # and their documentation is published at - # https://dart-lang.github.io/linter/lints/index.html. + # and their documentation is published at https://dart.dev/lints. # # Instead of disabling a lint rule for the entire project in the # section below, it can also be suppressed for a single line of code diff --git a/app/android/app/build.gradle b/app/android/app/build.gradle index 35d5f7cd..4319dee7 100644 --- a/app/android/app/build.gradle +++ b/app/android/app/build.gradle @@ -1,3 +1,9 @@ +plugins { + id "com.android.application" + id "kotlin-android" + id "dev.flutter.flutter-gradle-plugin" +} + def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { @@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) { } } -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' @@ -21,12 +22,9 @@ if (flutterVersionName == null) { flutterVersionName = '1.0' } -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - android { - compileSdkVersion flutter.compileSdkVersion + namespace "com.example.app" + compileSdk flutter.compileSdkVersion ndkVersion flutter.ndkVersion compileOptions { @@ -44,7 +42,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.example.first_aid_robot" + applicationId "com.example.app" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. minSdkVersion flutter.minSdkVersion @@ -66,36 +64,4 @@ flutter { source '../..' } -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" -} - -[ - Debug: null, - Profile: '--release', - Release: '--release' -].each { - def taskPostfix = it.key - def profileMode = it.value - tasks.whenTaskAdded { task -> - if (task.name == "javaPreCompile$taskPostfix") { - task.dependsOn "cargoBuild$taskPostfix" - } - } - tasks.register("cargoBuild$taskPostfix", Exec) { - workingDir "../../native" - // environment ANDROID_NDK_HOME: "$ANDROID_NDK" - commandLine 'cargo', 'ndk', - // the 2 ABIs below are used by real Android devices - '-t', 'armeabi-v7a', - '-t', 'arm64-v8a', - // the below 2 ABIs are usually used for Android simulators, - // add or remove these ABIs as needed. - // '-t', 'x86', - // '-t', 'x86_64', - '-o', '../android/app/src/main/jniLibs', 'build' - if (profileMode != null) { - args profileMode - } - } -} +dependencies {} diff --git a/app/android/app/src/debug/AndroidManifest.xml b/app/android/app/src/debug/AndroidManifest.xml index be6a24e8..399f6981 100644 --- a/app/android/app/src/debug/AndroidManifest.xml +++ b/app/android/app/src/debug/AndroidManifest.xml @@ -1,5 +1,4 @@ - + + + + + + + diff --git a/app/android/app/src/main/kotlin/com/example/app/MainActivity.kt b/app/android/app/src/main/kotlin/com/example/app/MainActivity.kt new file mode 100644 index 00000000..026d9a93 --- /dev/null +++ b/app/android/app/src/main/kotlin/com/example/app/MainActivity.kt @@ -0,0 +1,5 @@ +package com.example.app + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() diff --git a/app/android/app/src/main/kotlin/com/example/flutter_rust_bridge_template/MainActivity.kt b/app/android/app/src/main/kotlin/com/example/flutter_rust_bridge_template/MainActivity.kt deleted file mode 100644 index 606233bf..00000000 --- a/app/android/app/src/main/kotlin/com/example/flutter_rust_bridge_template/MainActivity.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.example.first_aid_robot - -import io.flutter.embedding.android.FlutterActivity - -class MainActivity: FlutterActivity() { -} diff --git a/app/android/app/src/profile/AndroidManifest.xml b/app/android/app/src/profile/AndroidManifest.xml index be6a24e8..399f6981 100644 --- a/app/android/app/src/profile/AndroidManifest.xml +++ b/app/android/app/src/profile/AndroidManifest.xml @@ -1,5 +1,4 @@ - + - + - first_aid_robot + app diff --git a/app/web/manifest.json b/app/web/manifest.json index 39ebea07..5620a335 100644 --- a/app/web/manifest.json +++ b/app/web/manifest.json @@ -1,6 +1,6 @@ { - "name": "first_aid_robot", - "short_name": "first_aid_robot", + "name": "app", + "short_name": "app", "start_url": ".", "display": "standalone", "background_color": "#0175C2", diff --git a/app/windows/CMakeLists.txt b/app/windows/CMakeLists.txt index fb2cf3c0..19c9efd2 100644 --- a/app/windows/CMakeLists.txt +++ b/app/windows/CMakeLists.txt @@ -1,14 +1,14 @@ # Project-level configuration. cmake_minimum_required(VERSION 3.14) -project(first_aid_robot LANGUAGES CXX) +project(app LANGUAGES CXX) # The name of the executable created for the application. Change this to change # the on-disk name of your application. -set(BINARY_NAME "first_aid_robot") +set(BINARY_NAME "app") # Explicitly opt in to modern CMake behaviors to avoid warnings with recent # versions of CMake. -cmake_policy(SET CMP0063 NEW) +cmake_policy(VERSION 3.14...3.25) # Define build configuration option. get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) @@ -52,11 +52,11 @@ add_subdirectory(${FLUTTER_MANAGED_DIR}) # Application build; see runner/CMakeLists.txt. add_subdirectory("runner") + # Generated plugin build rules, which manage building the plugins and adding # them to the application. include(flutter/generated_plugins.cmake) -include(./rust.cmake) # === Installation === # Support files are copied into place next to the executable, so that it can @@ -87,6 +87,12 @@ if(PLUGIN_BUNDLED_LIBRARIES) COMPONENT Runtime) endif() +# Copy the native assets provided by the build.dart from all packages. +set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") +install(DIRECTORY "${NATIVE_ASSETS_DIR}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + # Fully re-copy the assets directory on each build to avoid having stale files # from a previous install. set(FLUTTER_ASSET_DIR_NAME "flutter_assets") diff --git a/app/windows/flutter/CMakeLists.txt b/app/windows/flutter/CMakeLists.txt index 930d2071..903f4899 100644 --- a/app/windows/flutter/CMakeLists.txt +++ b/app/windows/flutter/CMakeLists.txt @@ -10,6 +10,11 @@ include(${EPHEMERAL_DIR}/generated_config.cmake) # https://github.com/flutter/flutter/issues/57146. set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") +# Set fallback configurations for older versions of the flutter tool. +if (NOT DEFINED FLUTTER_TARGET_PLATFORM) + set(FLUTTER_TARGET_PLATFORM "windows-x64") +endif() + # === Flutter Library === set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") @@ -92,7 +97,7 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" - windows-x64 $ + ${FLUTTER_TARGET_PLATFORM} $ VERBATIM ) add_custom_target(flutter_assemble DEPENDS diff --git a/app/windows/flutter/generated_plugins.cmake b/app/windows/flutter/generated_plugins.cmake index b93c4c30..b8dbf170 100644 --- a/app/windows/flutter/generated_plugins.cmake +++ b/app/windows/flutter/generated_plugins.cmake @@ -6,6 +6,7 @@ list(APPEND FLUTTER_PLUGIN_LIST ) list(APPEND FLUTTER_FFI_PLUGIN_LIST + rust_lib_app ) set(PLUGIN_BUNDLED_LIBRARIES) diff --git a/app/windows/runner/Runner.rc b/app/windows/runner/Runner.rc index d2cb051d..7cd9f359 100644 --- a/app/windows/runner/Runner.rc +++ b/app/windows/runner/Runner.rc @@ -90,12 +90,12 @@ BEGIN BLOCK "040904e4" BEGIN VALUE "CompanyName", "com.example" "\0" - VALUE "FileDescription", "first_aid_robot" "\0" + VALUE "FileDescription", "app" "\0" VALUE "FileVersion", VERSION_AS_STRING "\0" - VALUE "InternalName", "first_aid_robot" "\0" - VALUE "LegalCopyright", "Copyright (C) 2023 com.example. All rights reserved." "\0" - VALUE "OriginalFilename", "first_aid_robot.exe" "\0" - VALUE "ProductName", "first_aid_robot" "\0" + VALUE "InternalName", "app" "\0" + VALUE "LegalCopyright", "Copyright (C) 2024 com.example. All rights reserved." "\0" + VALUE "OriginalFilename", "app.exe" "\0" + VALUE "ProductName", "app" "\0" VALUE "ProductVersion", VERSION_AS_STRING "\0" END END diff --git a/app/windows/runner/flutter_window.cpp b/app/windows/runner/flutter_window.cpp index b25e363e..955ee303 100644 --- a/app/windows/runner/flutter_window.cpp +++ b/app/windows/runner/flutter_window.cpp @@ -31,6 +31,11 @@ bool FlutterWindow::OnCreate() { this->Show(); }); + // Flutter can complete the first frame before the "show window" callback is + // registered. The following call ensures a frame is pending to ensure the + // window is shown. It is a no-op if the first frame hasn't completed yet. + flutter_controller_->ForceRedraw(); + return true; } diff --git a/app/windows/runner/main.cpp b/app/windows/runner/main.cpp index 33b51b85..bc9bfa31 100644 --- a/app/windows/runner/main.cpp +++ b/app/windows/runner/main.cpp @@ -27,7 +27,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, FlutterWindow window(project); Win32Window::Point origin(10, 10); Win32Window::Size size(1280, 720); - if (!window.Create(L"first_aid_robot", origin, size)) { + if (!window.Create(L"app", origin, size)) { return EXIT_FAILURE; } window.SetQuitOnClose(true); diff --git a/app/windows/runner/utils.cpp b/app/windows/runner/utils.cpp index f5bf9fa0..b2b08734 100644 --- a/app/windows/runner/utils.cpp +++ b/app/windows/runner/utils.cpp @@ -47,16 +47,17 @@ std::string Utf8FromUtf16(const wchar_t* utf16_string) { } int target_length = ::WideCharToMultiByte( CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, - -1, nullptr, 0, nullptr, nullptr); + -1, nullptr, 0, nullptr, nullptr) + -1; // remove the trailing null character + int input_length = (int)wcslen(utf16_string); std::string utf8_string; - if (target_length == 0 || target_length > utf8_string.max_size()) { + if (target_length <= 0 || target_length > utf8_string.max_size()) { return utf8_string; } utf8_string.resize(target_length); int converted_length = ::WideCharToMultiByte( CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, - -1, utf8_string.data(), - target_length, nullptr, nullptr); + input_length, utf8_string.data(), target_length, nullptr, nullptr); if (converted_length == 0) { return std::string(); } diff --git a/app/windows/runner/win32_window.cpp b/app/windows/runner/win32_window.cpp index 041a3855..60608d0f 100644 --- a/app/windows/runner/win32_window.cpp +++ b/app/windows/runner/win32_window.cpp @@ -60,7 +60,7 @@ class WindowClassRegistrar { public: ~WindowClassRegistrar() = default; - // Returns the singleton registar instance. + // Returns the singleton registrar instance. static WindowClassRegistrar* GetInstance() { if (!instance_) { instance_ = new WindowClassRegistrar(); diff --git a/app/windows/runner/win32_window.h b/app/windows/runner/win32_window.h index c86632d8..e901dde6 100644 --- a/app/windows/runner/win32_window.h +++ b/app/windows/runner/win32_window.h @@ -77,7 +77,7 @@ class Win32Window { // OS callback called by message pump. Handles the WM_NCCREATE message which // is passed when the non-client area is being created and enables automatic // non-client DPI scaling so that the non-client area automatically - // responsponds to changes in DPI. All other messages are handled by + // responds to changes in DPI. All other messages are handled by // MessageHandler. static LRESULT CALLBACK WndProc(HWND const window, UINT const message, diff --git a/app/windows/rust.cmake b/app/windows/rust.cmake deleted file mode 100644 index a7c53217..00000000 --- a/app/windows/rust.cmake +++ /dev/null @@ -1,21 +0,0 @@ -# We include Corrosion inline here, but ideally in a project with -# many dependencies we would need to install Corrosion on the system. -# See instructions on https://github.com/AndrewGaspar/corrosion#cmake-install -# Once done, uncomment this line: -# find_package(Corrosion REQUIRED) - -include(FetchContent) - -FetchContent_Declare( - Corrosion - GIT_REPOSITORY https://github.com/AndrewGaspar/corrosion.git - GIT_TAG origin/master # Optionally specify a version tag or branch here -) - -FetchContent_MakeAvailable(Corrosion) - -corrosion_import_crate(MANIFEST_PATH ../native/Cargo.toml IMPORTED_CRATES imported_crates) -target_link_libraries(${BINARY_NAME} PRIVATE ${imported_crates}) -foreach(imported_crate ${imported_crates}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) -endforeach() diff --git a/bot/Cargo.toml b/bot/Cargo.toml index 48439224..62f1b8c6 100644 --- a/bot/Cargo.toml +++ b/bot/Cargo.toml @@ -10,9 +10,9 @@ first_aid_bot_core = { path = "../core" } pretty_env_logger = "0.5" teloxide = { version = "0.12", features = ["macros", "redis-storage", "bincode-serializer", "throttle"] } -redis = { version = "0.23", features = ["tokio-comp"] } +redis = { version = "0.25", features = ["tokio-comp"] } rand = "0.8" -itertools = "0.10" +itertools = "0.12" futures = "0.3" anyhow = { workspace = true } diff --git a/bot/src/bot/dialogue/commands.rs b/bot/src/bot/dialogue/commands.rs index f3214b53..0bf268b9 100644 --- a/bot/src/bot/dialogue/commands.rs +++ b/bot/src/bot/dialogue/commands.rs @@ -3,8 +3,8 @@ use super::prelude::start_endpoint; use crate::bot::dialogue::logic::send_state; use crate::bot::FirstAidStorage; use crate::bot::{FABot, FADialogue}; -use crate::REDIS_USERS_SET_KEY; -use anyhow::{Context, Error}; +use crate::{DataGetState, DATA, REDIS_CONN, REDIS_USERS_SET_KEY}; +use anyhow::{anyhow, Context, Error}; use first_aid_bot_core::prelude::*; use redis::{aio::MultiplexedConnection, AsyncCommands}; use teloxide::dispatching::DpHandlerDescription; @@ -34,12 +34,10 @@ pub async fn commands_handler( bot: FABot, msg: Message, cmd: FACommands, - data: &'static Data, - conn: MultiplexedConnection, dialogue: FADialogue, ) -> anyhow::Result<()> { match cmd { - FACommands::Start => start_endpoint(bot, msg, data, dialogue, conn).await, + FACommands::Start => start_endpoint(bot, msg, dialogue).await, } } @@ -47,17 +45,19 @@ pub async fn maintainer_commands_handler( bot: FABot, msg: Message, cmd: MaintainerCommands, - data: &Data, - mut conn: MultiplexedConnection, ) -> anyhow::Result<()> { let id = msg.chat.id; match cmd { MaintainerCommands::GetNumber => { + let mut conn = REDIS_CONN + .get() + .ok_or_else(|| anyhow!("Redis connection is not initialized"))? + .clone(); let n = conn.scard::<_, i32>(REDIS_USERS_SET_KEY).await?; bot.send_message(id, n.to_string()).await?; Ok(()) } - MaintainerCommands::Test => test(data, &bot, &msg).await, + MaintainerCommands::Test => test(&bot, &msg).await, MaintainerCommands::GifTest => easter_egg(&bot, &msg).await, } } @@ -89,11 +89,11 @@ async fn recursive_test(fs: &Fs, ctx: FAContext, bot: &FABot, msg: &Message) -> Ok(()) } -async fn test(data: &Data, bot: &FABot, msg: &Message) -> anyhow::Result<()> { +async fn test(bot: &FABot, msg: &Message) -> anyhow::Result<()> { for lang in Lang::iter() { let context = Vec::new(); let ctx = FAContext { lang, context }; - recursive_test(&*data.get().await?.get_state(&ctx)?, ctx, bot, msg).await?; + recursive_test(&*DATA.get_state(&ctx).await?, ctx, bot, msg).await?; } Ok(()) diff --git a/bot/src/bot/dialogue/endpoints.rs b/bot/src/bot/dialogue/endpoints.rs index 738fcdfb..4e8a7467 100644 --- a/bot/src/bot/dialogue/endpoints.rs +++ b/bot/src/bot/dialogue/endpoints.rs @@ -1,42 +1,33 @@ use super::commands::easter_egg; -use super::logic::{is_admin, move_to_state, process_broadcast, state_transition}; -use crate::bot::{FABot, FADialogue, State}; +use super::logic::{is_admin, move_to_state, process_broadcast, transition_logic}; +use crate::bot::{FABot, FADialogue}; +use crate::{DataGetState, DATA}; use anyhow::{bail, Result}; use first_aid_bot_core::prelude::*; use rand::random; -use redis::aio::MultiplexedConnection; use teloxide::{requests::Requester, types::Message}; -pub async fn start_endpoint( - bot: FABot, - msg: Message, - data: &'static Data, - dialogue: FADialogue, - mut conn: MultiplexedConnection, -) -> Result<()> { +pub async fn start_endpoint(bot: FABot, msg: Message, dialogue: FADialogue) -> Result<()> { if is_admin(&msg) && random::() % 50 == 0 { easter_egg(&bot, &msg).await?; } - let fs = data.get().await?.get_state(&FAContext::default())?; - move_to_state(&bot, &msg, &dialogue, &fs, FAContext::default(), &mut conn).await + let ctx = FAContext::default(); + move_to_state(&bot, &msg, &dialogue, &*DATA.get_state(&ctx).await?, ctx).await } -pub async fn handle_endpoint( +pub async fn transition_endpoint( bot: FABot, msg: Message, dialogue: FADialogue, - data: &'static Data, - mut conn: MultiplexedConnection, (lang, context): (String, Vec), ) -> Result<()> { let f = || async { let lang = lang.as_str().try_into()?; - let ctx = FAContext { lang, context }; - state_transition(&bot, &msg, &dialogue, ctx, data, &mut conn).await + transition_logic(&bot, &msg, &dialogue, FAContext { lang, context }).await }; if let Err(e) = f().await { - start_endpoint(bot, msg, data, dialogue, conn).await?; + start_endpoint(bot, msg, dialogue).await?; bail!(e); } Ok(()) @@ -46,16 +37,14 @@ pub async fn broadcast_endpoint( bot: FABot, msg: Message, dialogue: FADialogue, - mut conn: MultiplexedConnection, message: Option, ) -> Result<()> { if !is_admin(&msg) { let _ = bot .send_message(msg.chat.id, "WTF you are not an admin bye") .await; - dialogue.update(State::Start).await?; - return Ok(()); + return start_endpoint(bot, msg, dialogue).await; } - process_broadcast(&bot, &msg, &dialogue, message, &mut conn).await?; + process_broadcast(&bot, &msg, &dialogue, message).await?; Ok(()) } diff --git a/bot/src/bot/dialogue/logic/bot_logic.rs b/bot/src/bot/dialogue/logic/bot_logic.rs index 43e3c68c..aed938cf 100644 --- a/bot/src/bot/dialogue/logic/bot_logic.rs +++ b/bot/src/bot/dialogue/logic/bot_logic.rs @@ -1,9 +1,31 @@ -use super::{helpers::send_state, is_admin, log_to_redis::log_to_redis, process_broadcast}; +use super::keyboard::make_keyboard; +use super::{log_to_redis::log_to_redis, process_broadcast}; use crate::bot::{FABot, FADialogue, State}; -use anyhow::{anyhow, Context}; +use crate::{DataGetState, DATA, MAINTAINER_USERNAMES}; +use anyhow::{anyhow, Context, Result}; use first_aid_bot_core::prelude::*; -use redis::aio::MultiplexedConnection; use teloxide::prelude::*; +use teloxide::types::ParseMode::Html; + +pub async fn send_state(bot: &FABot, msg: &Message, ctx: &FAContext, fs: &Fs) -> Result<()> { + let _ = log_to_redis(msg, ctx).await; + let id = msg.chat.id; + if let Some(link) = &fs.link { + let link = format!(""); + bot.send_message(id, link).parse_mode(Html).await?; + } + + let keys = fs.next_states.keys().map(AsRef::as_ref).collect::>(); + let kbd = make_keyboard(&keys, ctx.lang, ctx.depth(), is_admin(msg)); + bot.send_message(id, &fs.message).reply_markup(kbd).await?; + Ok(()) +} + +pub fn is_admin(msg: &Message) -> bool { + msg.from() + .and_then(|user| user.username.as_ref()) + .is_some_and(|username| MAINTAINER_USERNAMES.contains(&username.as_str())) +} pub async fn move_to_state( bot: &FABot, @@ -11,15 +33,15 @@ pub async fn move_to_state( dialogue: &FADialogue, fs: &Fs, mut ctx: FAContext, - conn: &mut MultiplexedConnection, ) -> anyhow::Result<()> { - let err = format!("Error while moving into {ctx}"); - let _ = log_to_redis(msg, &ctx, conn).await; - send_state(bot, msg, &ctx, fs).await.context(err.clone())?; + send_state(bot, msg, &ctx, fs) + .await + .context(format!("Error while sending {ctx}"))?; if fs.next_states.is_empty() { ctx.home(); - let _ = log_to_redis(msg, &ctx, conn).await; - send_state(bot, msg, &ctx, fs).await.context(err)?; + send_state(bot, msg, &ctx, fs) + .await + .context(format!("Error while sending {ctx}"))?; } let lang = ctx.lang.to_string(); let context = ctx.context; @@ -27,15 +49,13 @@ pub async fn move_to_state( Ok(()) } -pub async fn state_transition( +pub async fn transition_logic( bot: &FABot, msg: &Message, dialogue: &FADialogue, mut ctx: FAContext, - data: &'static Data, - conn: &mut MultiplexedConnection, ) -> anyhow::Result<()> { - let fs = data.get().await?.get_state(&ctx)?; + let fs = DATA.get_state(&ctx).await?; match msg.text() { Some(text) if text == ctx.lang.details().button_home => ctx.home(), Some(text) if text == ctx.lang.details().button_back => ctx.back(), @@ -47,7 +67,7 @@ pub async fn state_transition( } Some(text) if text == ctx.lang.details().broadcast && is_admin(msg) => { dialogue.update(State::Broadcast { message: None }).await?; - return process_broadcast(bot, msg, dialogue, None, conn).await; + return process_broadcast(bot, msg, dialogue, None).await; } _ => { bot.send_message(msg.chat.id, ctx.lang.details().use_buttons_text) @@ -56,6 +76,6 @@ pub async fn state_transition( } } - let new_fs = data.get().await?.get_state(&ctx)?; - move_to_state(bot, msg, dialogue, &new_fs, ctx, conn).await + let new_fs = DATA.get_state(&ctx).await?; + move_to_state(bot, msg, dialogue, &new_fs, ctx).await } diff --git a/bot/src/bot/dialogue/logic/broadcast.rs b/bot/src/bot/dialogue/logic/broadcast.rs index d25b90dc..be4c225b 100644 --- a/bot/src/bot/dialogue/logic/broadcast.rs +++ b/bot/src/bot/dialogue/logic/broadcast.rs @@ -3,10 +3,11 @@ use crate::bot::FABot; use crate::bot::FADialogue; use crate::bot::State; use crate::BROADCAST_ENABLED; +use crate::REDIS_CONN; use anyhow::{anyhow, Result}; use first_aid_bot_core::prelude::Lang; use futures::{stream, StreamExt}; -use redis::{aio::MultiplexedConnection, AsyncCommands}; +use redis::AsyncCommands; use teloxide::prelude::*; const MSG_DISABLED: &str = "Аля, ні"; @@ -28,7 +29,6 @@ pub async fn process_broadcast( msg: &Message, dialogue: &FADialogue, message: Option, - conn: &mut MultiplexedConnection, ) -> Result<()> { let text = msg.text().ok_or_else(|| anyhow!("No text unfortunately"))?; let id = msg.chat.id; @@ -42,7 +42,7 @@ pub async fn process_broadcast( match message { None if text == MSG_BROADCASTING => wait_for_message(bot, id).await, None => ask_to_confirm(bot, id, text, dialogue).await, - Some(msg) => broadcast_if_confirmed(text, bot, id, &msg, conn, dialogue).await, + Some(msg) => broadcast_if_confirmed(text, bot, id, &msg, dialogue).await, } } @@ -51,12 +51,15 @@ async fn broadcast_if_confirmed( bot: &FABot, id: ChatId, message: &str, - conn: &mut MultiplexedConnection, dialogue: &FADialogue, ) -> Result<()> { if text == MSG_CONFIRM { bot.send_message(id, MSG_BROADCASTING).await?; + let mut conn = REDIS_CONN + .get() + .ok_or_else(|| anyhow!("No connection"))? + .clone(); stream::iter(conn.keys::<_, Vec>("user_*").await?) .for_each(|user_id| async move { if let Err(err) = send_to_user(bot, &user_id, message).await { diff --git a/bot/src/bot/dialogue/logic/helpers.rs b/bot/src/bot/dialogue/logic/helpers.rs deleted file mode 100644 index 541c9048..00000000 --- a/bot/src/bot/dialogue/logic/helpers.rs +++ /dev/null @@ -1,26 +0,0 @@ -use super::keyboard::make_keyboard; -use crate::bot::FABot; -use crate::MAINTAINER_USERNAMES; -use anyhow::Result; -use first_aid_bot_core::prelude::*; -use teloxide::prelude::*; -use teloxide::types::ParseMode::Html; - -pub async fn send_state(bot: &FABot, msg: &Message, ctx: &FAContext, fs: &Fs) -> Result<()> { - let id = msg.chat.id; - if let Some(link) = &fs.link { - let link = format!(""); - bot.send_message(id, link).parse_mode(Html).await?; - } - - let keys = fs.next_states.keys().map(AsRef::as_ref).collect::>(); - let kbd = make_keyboard(&keys, ctx.lang, ctx.depth(), is_admin(msg)); - bot.send_message(id, &fs.message).reply_markup(kbd).await?; - Ok(()) -} - -pub fn is_admin(msg: &Message) -> bool { - msg.from() - .and_then(|user| user.username.as_ref()) - .is_some_and(|username| MAINTAINER_USERNAMES.contains(&username.as_str())) -} diff --git a/bot/src/bot/dialogue/logic/log_to_redis.rs b/bot/src/bot/dialogue/logic/log_to_redis.rs index 600d63d2..35b98278 100644 --- a/bot/src/bot/dialogue/logic/log_to_redis.rs +++ b/bot/src/bot/dialogue/logic/log_to_redis.rs @@ -1,12 +1,16 @@ -use crate::bot::Message; +use crate::{bot::Message, REDIS_CONN}; use anyhow::{anyhow, Context, Result}; use first_aid_bot_core::prelude::FAContext; -use redis::{aio::MultiplexedConnection as MC, AsyncCommands}; +use redis::AsyncCommands; use std::time::{SystemTime, UNIX_EPOCH}; const ERR: &str = "Error writing a user to the redis db."; -pub async fn log_to_redis(msg: &Message, ctx: &FAContext, conn: &mut MC) -> Result<()> { +pub async fn log_to_redis(msg: &Message, ctx: &FAContext) -> Result<()> { + let mut conn = REDIS_CONN + .get() + .ok_or_else(|| anyhow!("No connection"))? + .clone(); let err = || anyhow!("Cannot get id from user"); let id = msg.from().ok_or_else(err)?.id.0.to_string(); // TODO: Remove it when we'll have dashboards <21-06-22, astadnik> // diff --git a/bot/src/bot/dialogue/logic/mod.rs b/bot/src/bot/dialogue/logic/mod.rs index 28fbd83f..1dc3e1b6 100644 --- a/bot/src/bot/dialogue/logic/mod.rs +++ b/bot/src/bot/dialogue/logic/mod.rs @@ -1,10 +1,8 @@ mod bot_logic; mod broadcast; -mod helpers; mod keyboard; mod log_to_redis; -pub use bot_logic::{move_to_state, state_transition}; +pub use bot_logic::{move_to_state, transition_logic}; pub use broadcast::process_broadcast; -pub use helpers::is_admin; -pub use helpers::send_state; +pub use bot_logic::{is_admin, send_state}; diff --git a/bot/src/bot/dialogue/mod.rs b/bot/src/bot/dialogue/mod.rs index bcf92c6e..1d31c0f3 100644 --- a/bot/src/bot/dialogue/mod.rs +++ b/bot/src/bot/dialogue/mod.rs @@ -4,5 +4,5 @@ mod logic; pub mod prelude { pub use super::commands::{get_commands_branch, get_maintainer_commands_branch, FACommands}; - pub use super::endpoints::{broadcast_endpoint, handle_endpoint, start_endpoint}; + pub use super::endpoints::{broadcast_endpoint, transition_endpoint, start_endpoint}; } diff --git a/bot/src/bot/init_connections.rs b/bot/src/bot/init_connections.rs new file mode 100644 index 00000000..5d7185b5 --- /dev/null +++ b/bot/src/bot/init_connections.rs @@ -0,0 +1,35 @@ +use std::sync::Arc; + +use crate::REDIS_URLS; +use anyhow::{anyhow, Result}; +use first_aid_bot_core::prelude::Data; +use futures::future::join_all; +use redis::{aio::MultiplexedConnection, Client}; +use teloxide::dispatching::dialogue::{serializer::Bincode, RedisStorage}; + +async fn connect_to_redis() -> Result<(MultiplexedConnection, Arc>)> { + join_all(REDIS_URLS.into_iter().map(|url| async move { + let connection = Client::open(url)?.get_multiplexed_tokio_connection().await; + anyhow::Ok((connection?, RedisStorage::open(url, Bincode).await?)) + })) + .await + .into_iter() + .flatten() + .next() + .ok_or(anyhow!("No redis connection")) +} + +async fn init_data() -> Result { + if cfg!(debug_assertions) { + Ok(Data::dynamic()) + } else { + Data::cached() + } +} + +pub async fn init_connections() -> Result<(MultiplexedConnection, Arc>, Data)> +{ + let (redis_conn, storage) = connect_to_redis().await?; + let data = init_data().await?; + Ok((redis_conn, storage, data)) +} diff --git a/bot/src/bot/mod.rs b/bot/src/bot/mod.rs index 1a5b880b..fe786321 100644 --- a/bot/src/bot/mod.rs +++ b/bot/src/bot/mod.rs @@ -1,4 +1,5 @@ mod dialogue; +mod init_connections; mod report_error; mod run; @@ -11,6 +12,7 @@ pub type FABot = DefaultParseMode>; pub type FirstAidStorage = RedisStorage; pub mod prelude { pub use super::run::run_bot; + pub use super::init_connections::init_connections; } #[derive(Clone, serde::Serialize, serde::Deserialize, Default)] diff --git a/bot/src/bot/run.rs b/bot/src/bot/run.rs index 8012d6ce..caa03234 100644 --- a/bot/src/bot/run.rs +++ b/bot/src/bot/run.rs @@ -1,29 +1,16 @@ +use std::sync::Arc; + use crate::bot::dialogue::prelude::*; use crate::bot::report_error::FAErrorHandler; -use crate::bot::State; -use crate::REDIS_URLS; -use anyhow::{anyhow, Ok, Result}; -use first_aid_bot_core::prelude::Data; -use futures::future::join_all; -use redis::{aio::MultiplexedConnection, Client}; -use std::sync::Arc; -use teloxide::dispatching::dialogue::{serializer::Bincode, RedisStorage}; +use crate::bot::{FirstAidStorage, State}; +use anyhow::{Ok, Result}; +use teloxide::dispatching::dialogue::serializer::Bincode; +use teloxide::dispatching::dialogue::RedisStorage; use teloxide::dptree::case; use teloxide::prelude::*; use teloxide::{adaptors::throttle::Limits, types::ParseMode, utils::command::BotCommands}; -use super::FirstAidStorage; - -pub async fn connect_to_redis() -> Result<(MultiplexedConnection, Arc)> { - let results = join_all(REDIS_URLS.into_iter().map(|url| async move { - let connection = Client::open(url)?.get_multiplexed_tokio_connection().await; - Ok((connection?, RedisStorage::open(url, Bincode).await?)) - })); - let error = anyhow!("No redis connection"); - results.await.into_iter().flatten().next().ok_or(error) -} - -pub async fn run_bot(data: &'static Data) -> Result<()> { +pub async fn run_bot(storage: Arc>) -> Result<()> { log::info!("Starting dialogue_bot..."); let bot = Bot::from_env() @@ -32,18 +19,16 @@ pub async fn run_bot(data: &'static Data) -> Result<()> { bot.set_my_commands(FACommands::bot_commands()).await?; - let (conn, storage) = connect_to_redis().await?; - let handler = Update::filter_message() .branch(get_commands_branch()) .branch(get_maintainer_commands_branch()) .enter_dialogue::() .branch(case![State::Start].endpoint(start_endpoint)) - .branch(case![State::Dialogue { lang, context }].endpoint(handle_endpoint)) + .branch(case![State::Dialogue { lang, context }].endpoint(transition_endpoint)) .branch(case![State::Broadcast { message }].endpoint(broadcast_endpoint)); Dispatcher::builder(bot.clone(), handler) - .dependencies(dptree::deps![data, conn, storage]) + .dependencies(dptree::deps![storage]) .error_handler(FAErrorHandler::new(bot)) .enable_ctrlc_handler() .build() diff --git a/bot/src/main.rs b/bot/src/main.rs index 770ce8ea..80249342 100644 --- a/bot/src/main.rs +++ b/bot/src/main.rs @@ -2,9 +2,10 @@ mod bot; use crate::bot::prelude::*; use anyhow::{anyhow, Result}; use first_aid_bot_core::prelude::*; -use std::sync::OnceLock; - +use redis::aio::MultiplexedConnection; +use std::{borrow::Cow, sync::OnceLock}; pub use teloxide::types::UserId; + const MAINTAINER_IDS: [teloxide::types::UserId; 1] = [UserId(131_596_643)]; const MAINTAINER_USERNAMES: [&str; 2] = ["astadnik", "Oleksa_Lev"]; const REDIS_URLS: [&str; 2] = ["redis://redis:6379", "redis://127.0.0.1:6379"]; @@ -12,18 +13,36 @@ const REDIS_USERS_SET_KEY: &str = "all_users"; const BROADCAST_ENABLED: bool = false; static DATA: OnceLock = OnceLock::new(); +static REDIS_CONN: OnceLock = OnceLock::new(); + +pub trait DataGetState { + fn get_state( + &self, + ctx: &FAContext, + ) -> impl std::future::Future>> + Send; +} + +impl DataGetState for OnceLock { + async fn get_state(&self, ctx: &FAContext) -> Result> { + self.get() + .ok_or_else(|| anyhow!("Data is not initialized"))? + .get() + .await? + .get_state(ctx) + } +} #[tokio::main] async fn main() -> Result<()> { pretty_env_logger::init_timed(); let commit = option_env!("GITHUB_SHA").unwrap_or("unknown"); log::info!("Starting bot on commit {commit} ..."); - let data = if cfg!(debug_assertions) { - Data::dynamic() - } else { - Data::cached()? - }; - DATA.set(data).map_err(|_| anyhow!("OnceLock is already initialized"))?; + let (redis_conn, storage, data) = init_connections().await?; + DATA.set(data) + .map_err(|_| anyhow!("OnceLock is already initialized"))?; + REDIS_CONN + .set(redis_conn) + .map_err(|_| anyhow!("OnceLock is already initialized"))?; - run_bot(DATA.get().ok_or(anyhow!("OnceLock is not initialized"))?).await + run_bot(storage).await } diff --git a/core/Cargo.toml b/core/Cargo.toml index e53a63fe..237fd03c 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -11,18 +11,18 @@ crate-type = ["staticlib", "cdylib", "rlib"] [dependencies] # # Load the data -csv = "1.2" -bytes = "1.5" -reqwest = { version = "0.11"} -indexmap = "1.9" +csv = "1.3" +bytes = "1.6" +reqwest = { version = "0.12"} +indexmap = "2.2" anyhow = { workspace = true } tokio = { workspace = true } log = { workspace = true } serde = { workspace = true, features = ["derive"] } const_format = "0.2" -regex = "1.9.5" +regex = "1.10.4" [dev-dependencies] -env_logger = "0.10" +env_logger = "0.11" test-log = "0.2" diff --git a/core/src/model/data.rs b/core/src/model/data.rs index 400c25cc..090f0af5 100644 --- a/core/src/model/data.rs +++ b/core/src/model/data.rs @@ -15,9 +15,13 @@ impl Data { } pub fn cached() -> Result { log::info!("Cached data!"); - Ok(Self { - data: Some(get_data_from_file("table.csv")?), - }) + let data = Some(get_data_from_file("table.csv")?); + Ok(Self { data }) + } + pub async fn download() -> Result { + log::info!("Downloading data!"); + let data = Some(get_data_from_web().await?); + Ok(Self { data }) } pub async fn get(&self) -> Result> { Ok(match self.data { @@ -27,14 +31,12 @@ impl Data { } } -pub type Cfs<'a> = Cow<'a, Fs>; - pub trait CowMultLangFsExt<'a> { - fn get_state(self, ctx: &FAContext) -> Result>; + fn get_state(self, ctx: &FAContext) -> Result>; } impl<'a> CowMultLangFsExt<'a> for Cow<'a, MultilangFs> { - fn get_state(self, ctx: &FAContext) -> Result> { + fn get_state(self, ctx: &FAContext) -> Result> { let err_lang = anyhow!("No such lang: {}", ctx.lang); let err_ctx = |key| move || anyhow!("Cannot find {key} for context {:?}", ctx.context); match self { @@ -47,7 +49,7 @@ impl<'a> CowMultLangFsExt<'a> for Cow<'a, MultilangFs> { Cow::Owned(mut v) => { Ok(Cow::Owned(ctx.context.iter().try_fold( v.remove(&ctx.lang).ok_or(err_lang)?, - |mut fs, key| fs.next_states.remove(key).ok_or_else(err_ctx(key)), + |mut fs, key| fs.next_states.swap_remove(key).ok_or_else(err_ctx(key)), )?)) } } diff --git a/core/src/model/mod.rs b/core/src/model/mod.rs index f40c85a0..0c12ed70 100644 --- a/core/src/model/mod.rs +++ b/core/src/model/mod.rs @@ -3,7 +3,7 @@ mod finite_state; mod lang; pub mod prelude { - pub use super::data::{Cfs, CowMultLangFsExt, Data}; + pub use super::data::{CowMultLangFsExt, Data}; pub use super::finite_state::{Fs, MultilangFs}; pub use super::lang::Lang; pub use super::{get_data_from_file, get_data_from_web}; @@ -62,7 +62,7 @@ pub fn get_data_from_file(filename: &str) -> anyhow::Result { } pub async fn get_data_from_web() -> anyhow::Result { - let sheet_id = option_env!("SHEET_ID").ok_or_else(|| anyhow!("SHEET_ID is not set"))?; + let sheet_id = env!("SHEET_ID"); assert!(Lang::iter().count() == 1, "Only one language is supported"); let lang = Lang::iter().next().unwrap(); let sheet_name = lang.name();