diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 3e33086a..27d7222b 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -68,16 +68,7 @@ jobs: steps: - uses: actions/checkout@v4 - #- name: ⚡ Cache - # uses: actions/cache@v2 - # with: - # path: | - # ~/.cargo/registry - # ~/.cargo/git - # node_modules - # ./docs/openapi/node_modules - # target - # key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: configure GPG key if: (github.ref == 'refs/heads/master' || github.event_name == 'push') && github.repository == 'mCaptcha/mCaptcha' @@ -110,8 +101,7 @@ jobs: run: make env: POSTGRES_DATABASE_URL: "${{ env.POSTGRES_DATABASE_URL }}" - MARIA_DATABASE_URL: - "${{ env.MARIA_DATABASE_URL }}" + MARIA_DATABASE_URL: "${{ env.MARIA_DATABASE_URL }}" # - name: build frontend # run: make frontend diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..3c032078 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +18 diff --git a/Cargo.lock b/Cargo.lock index 26cb8e4b..905832ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10,7 +10,7 @@ checksum = "f728064aca1c318585bf4bb04ffcfac9e75e508ab4e8b1bd9ba5dfe04e2cbed5" dependencies = [ "actix-rt", "actix_derive", - "bitflags", + "bitflags 1.3.2", "bytes", "crossbeam-channel", "futures-core", @@ -19,7 +19,7 @@ dependencies = [ "futures-util", "log", "once_cell", - "parking_lot 0.12.1", + "parking_lot", "pin-project-lite", "smallvec", "tokio", @@ -44,7 +44,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "617a8268e3537fe1d8c9ead925fca49ef6400927ee7bc26750e90ecee14ce4b8" dependencies = [ - "bitflags", + "bitflags 1.3.2", "bytes", "futures-core", "futures-sink", @@ -82,7 +82,7 @@ dependencies = [ "actix-utils", "ahash 0.8.3", "base64 0.21.2", - "bitflags", + "bitflags 1.3.2", "brotli", "bytes", "bytestring", @@ -119,9 +119,9 @@ dependencies = [ "actix-utils", "actix-web", "futures-util", - "serde 1.0.147", + "serde", "serde_json", - "time 0.3.22", + "time", ] [[package]] @@ -131,7 +131,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "465a6172cf69b960917811022d8f29bc0b7fa1398bc4f78b3c466673db1213b6" dependencies = [ "quote", - "syn", + "syn 1.0.94", ] [[package]] @@ -143,7 +143,7 @@ dependencies = [ "bytestring", "http", "regex", - "serde 1.0.147", + "serde", "tracing", ] @@ -246,12 +246,12 @@ dependencies = [ "once_cell", "pin-project-lite", "regex", - "serde 1.0.147", + "serde", "serde_json", "serde_urlencoded", "smallvec", "socket2", - "time 0.3.22", + "time", "url", ] @@ -263,7 +263,7 @@ dependencies = [ "actix-router", "proc-macro2", "quote", - "syn", + "syn 1.0.94", ] [[package]] @@ -275,7 +275,7 @@ dependencies = [ "actix-router", "proc-macro2", "quote", - "syn", + "syn 1.0.94", ] [[package]] @@ -286,7 +286,7 @@ checksum = "6d44b8fee1ced9671ba043476deddef739dd0959bf77030b26b738cc591737a7" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.94", ] [[package]] @@ -386,6 +386,12 @@ dependencies = [ "alloc-no-stdlib", ] +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + [[package]] name = "ammonia" version = "3.3.0" @@ -411,7 +417,7 @@ version = "0.2.2" source = "git+https://github.com/realaravinth/argon2-creds?branch=master#9f43fd564448cae609d148a700de91e2aea6474c" dependencies = [ "ammonia", - "derive_builder", + "derive_builder 0.11.1", "derive_more", "lazy_static", "rand", @@ -427,12 +433,6 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" -[[package]] -name = "arrayvec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" - [[package]] name = "arrayvec" version = "0.7.4" @@ -447,16 +447,16 @@ checksum = "ed6aa3524a2dfcf9fe180c51eae2b58738348d819517ceadf95789c51fff7600" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.94", ] [[package]] name = "atoi" -version = "0.4.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "616896e05fc0e2649463a93a15183c6a16bf03413a7af88ef1285ddedfa9cda5" +checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" dependencies = [ - "num-traits 0.2.15", + "num-traits", ] [[package]] @@ -504,7 +504,7 @@ dependencies = [ "percent-encoding", "pin-project-lite", "rand", - "serde 1.0.147", + "serde", "serde_json", "serde_urlencoded", "tokio", @@ -525,12 +525,6 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "base-x" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" - [[package]] name = "base64" version = "0.13.1" @@ -561,7 +555,7 @@ version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" dependencies = [ - "serde 1.0.147", + "serde", ] [[package]] @@ -570,6 +564,15 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +dependencies = [ + "serde", +] + [[package]] name = "blake2b_simd" version = "1.0.1" @@ -577,7 +580,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c2f0dc9a68c6317d884f97cc36cf5a3d20ba14ce404227df55e1af708ab04bc" dependencies = [ "arrayref", - "arrayvec 0.7.4", + "arrayvec", "constant_time_eq 0.2.6", ] @@ -644,10 +647,10 @@ version = "0.2.0" source = "git+https://github.com/realaravinth/cache-buster#7ca4545722fb99be30698a5e72c7d982a70fa11f" dependencies = [ "data-encoding", - "derive_builder", + "derive_builder 0.11.1", "mime", "mime_guess", - "serde 1.0.147", + "serde", "serde_json", "sha2", "walkdir", @@ -694,31 +697,28 @@ dependencies = [ [[package]] name = "config" -version = "0.11.0" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1b9d958c2b1368a663f05538fc1b5975adce1e19f435acceae987aceeeb369" +checksum = "d379af7f68bfc21714c6c7dea883544201741d2ce8274bb12fa54f89507f52a7" dependencies = [ + "async-trait", + "json5", "lazy_static", - "nom 5.1.3", + "nom", + "pathdiff", + "ron", "rust-ini", - "serde 1.0.147", - "serde-hjson", + "serde", "serde_json", - "toml", + "toml 0.5.11", "yaml-rust", ] [[package]] name = "const-oid" -version = "0.7.1" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" - -[[package]] -name = "const_fn" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbdcdcb6d86f71c5e97409ad45898af11cbc995b4ee8112d59095a28d376c935" +checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" [[package]] name = "constant_time_eq" @@ -752,7 +752,7 @@ dependencies = [ "rand", "sha2", "subtle", - "time 0.3.22", + "time", "version_check", ] @@ -783,18 +783,18 @@ dependencies = [ [[package]] name = "crc" -version = "2.1.0" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49fc9a695bca7f35f5f4c15cddc84415f66a74ea78eef08e90c5024f2b540e23" +checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe" dependencies = [ "crc-catalog", ] [[package]] name = "crc-catalog" -version = "1.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccaeedb56da03b09f598226e25e80088cb4cd25f316e6e4df7d695f0feeb1403" +checksum = "9cace84e55f07e7301bae1c519df89cdad8cc3cd868413d3fdbdeca9ff3db484" [[package]] name = "crc16" @@ -840,16 +840,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "crypto-bigint" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" -dependencies = [ - "generic-array", - "subtle", -] - [[package]] name = "crypto-common" version = "0.1.6" @@ -876,8 +866,18 @@ version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f2c43f534ea4b0b049015d00269734195e6d3f0f6635cb692251aca6f9f8b3c" dependencies = [ - "darling_core", - "darling_macro", + "darling_core 0.12.4", + "darling_macro 0.12.4", +] + +[[package]] +name = "darling" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" +dependencies = [ + "darling_core 0.14.4", + "darling_macro 0.14.4", ] [[package]] @@ -891,7 +891,21 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn", + "syn 1.0.94", +] + +[[package]] +name = "darling_core" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 1.0.94", ] [[package]] @@ -900,9 +914,20 @@ version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29b5acf0dea37a7f66f7b25d2c5e93fd46f8f6968b1a5d7a3e02e97768afc95a" dependencies = [ - "darling_core", + "darling_core 0.12.4", "quote", - "syn", + "syn 1.0.94", +] + +[[package]] +name = "darling_macro" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" +dependencies = [ + "darling_core 0.14.4", + "quote", + "syn 1.0.94", ] [[package]] @@ -917,7 +942,7 @@ version = "0.1.0" dependencies = [ "async-trait", "libmcaptcha", - "serde 1.0.147", + "serde", "serde_json", "thiserror", "url", @@ -951,13 +976,13 @@ dependencies = [ [[package]] name = "der" -version = "0.5.1" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" +checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" dependencies = [ "const-oid", - "crypto-bigint", "pem-rfc7468", + "zeroize", ] [[package]] @@ -966,7 +991,16 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11d918e7dabe374a51dae0f29d818fece3b218b8b4eabec3bc4d42c537e7ed8f" dependencies = [ - "derive_builder_macro", + "derive_builder_macro 0.11.1", +] + +[[package]] +name = "derive_builder" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d67778784b508018359cbc8696edb3db78160bab2c2a28ba7f56ef6932997f8" +dependencies = [ + "derive_builder_macro 0.12.0", ] [[package]] @@ -975,10 +1009,22 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f712c2d4e52d5fcae53584e461dcb92fb2202e144ebf83ab0ba4360d18b767c7" dependencies = [ - "darling", + "darling 0.12.4", "proc-macro2", "quote", - "syn", + "syn 1.0.94", +] + +[[package]] +name = "derive_builder_core" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c11bdc11a0c47bc7d37d582b5285da6849c96681023680b906673c5707af7b0f" +dependencies = [ + "darling 0.14.4", + "proc-macro2", + "quote", + "syn 1.0.94", ] [[package]] @@ -987,8 +1033,18 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8a2ac71b4a9a590dde6cee3ca4687aca5e7ce06f4ee297c5a959de5f1e42b2e" dependencies = [ - "derive_builder_core", - "syn", + "derive_builder_core 0.11.1", + "syn 1.0.94", +] + +[[package]] +name = "derive_builder_macro" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebcda35c7a396850a55ffeac740804b40ffec779b98fffbb1738f4033f0ee79e" +dependencies = [ + "derive_builder_core 0.12.0", + "syn 1.0.94", ] [[package]] @@ -1000,8 +1056,8 @@ dependencies = [ "convert_case", "proc-macro2", "quote", - "rustc_version 0.4.0", - "syn", + "rustc_version", + "syn 1.0.94", ] [[package]] @@ -1011,41 +1067,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", "subtle", ] [[package]] -name = "dirs" -version = "4.0.0" +name = "dlv-list" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" -dependencies = [ - "dirs-sys", -] +checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257" [[package]] -name = "dirs-sys" -version = "0.3.7" +name = "dotenvy" +version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - -[[package]] -name = "discard" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" - -[[package]] -name = "dotenv" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" +checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" [[package]] name = "either" @@ -1053,7 +1090,7 @@ version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" dependencies = [ - "serde 1.0.147", + "serde", ] [[package]] @@ -1094,6 +1131,12 @@ dependencies = [ "termcolor", ] +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "errno" version = "0.3.1" @@ -1115,6 +1158,17 @@ dependencies = [ "libc", ] +[[package]] +name = "etcetera" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943" +dependencies = [ + "cfg-if", + "home", + "windows-sys 0.48.0", +] + [[package]] name = "event-listener" version = "2.5.3" @@ -1152,6 +1206,17 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "flume" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" +dependencies = [ + "futures-core", + "futures-sink", + "spin 0.9.8", +] + [[package]] name = "fnv" version = "1.0.7" @@ -1236,13 +1301,13 @@ dependencies = [ [[package]] name = "futures-intrusive" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a604f7a68fbf8103337523b1fadc8ade7361ee3f112f7c680ad179651616aed5" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" dependencies = [ "futures-core", "lock_api", - "parking_lot 0.11.2", + "parking_lot", ] [[package]] @@ -1259,7 +1324,7 @@ checksum = "3eb14ed937631bd8b8b8977f2c198443447a8355b6e3ca599f38c975e5a963b6" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.94", ] [[package]] @@ -1341,7 +1406,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap", + "indexmap 1.9.3", "slab", "tokio", "tokio-util", @@ -1350,26 +1415,30 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.11.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ "ahash 0.7.6", ] [[package]] name = "hashbrown" -version = "0.12.3" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +checksum = "7dfda62a12f55daeae5015f81b0baea145391cb4520f86c248fc615d72640d12" +dependencies = [ + "ahash 0.8.3", + "allocator-api2", +] [[package]] name = "hashlink" -version = "0.7.0" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7249a3129cbc1ffccd74857f81464a323a152173cdb134e0fd81bc803b29facf" +checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" dependencies = [ - "hashbrown 0.11.2", + "hashbrown 0.14.1", ] [[package]] @@ -1451,7 +1520,7 @@ dependencies = [ "markup5ever", "proc-macro2", "quote", - "syn", + "syn 1.0.94", ] [[package]] @@ -1539,6 +1608,16 @@ dependencies = [ "hashbrown 0.12.3", ] +[[package]] +name = "indexmap" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" +dependencies = [ + "equivalent", + "hashbrown 0.14.1", +] + [[package]] name = "inout" version = "0.1.3" @@ -1570,9 +1649,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.10.5" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" dependencies = [ "either", ] @@ -1607,6 +1686,17 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "json5" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96b0db21af676c1ce64250b5f40f3ce2cf27e4e47cb91ed91eb6fe9350b430c1" +dependencies = [ + "pest", + "pest_derive", + "serde", +] + [[package]] name = "language-tags" version = "0.3.2" @@ -1619,7 +1709,7 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" dependencies = [ - "spin", + "spin 0.5.2", ] [[package]] @@ -1640,7 +1730,7 @@ dependencies = [ "idna 0.3.0", "mime", "native-tls", - "nom 7.1.3", + "nom", "once_cell", "quoted_printable", "socket2", @@ -1648,19 +1738,6 @@ dependencies = [ "tokio-native-tls", ] -[[package]] -name = "lexical-core" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe" -dependencies = [ - "arrayvec 0.5.2", - "bitflags", - "cfg-if", - "ryu", - "static_assertions", -] - [[package]] name = "libc" version = "0.2.147" @@ -1680,19 +1757,30 @@ source = "git+https://github.com/mCaptcha/libmcaptcha?tag=0.2.3#6bc0d11f8839d18c dependencies = [ "actix", "crossbeam-channel", - "derive_builder", + "derive_builder 0.11.1", "derive_more", "log", "num_cpus", - "pow_sha256 0.3.1 (git+https://github.com/mcaptcha/pow_sha256)", + "pow_sha256", "pretty_env_logger", "rand", "redis", - "serde 1.0.147", + "serde", "serde_json", "tokio", ] +[[package]] +name = "libsqlite3-sys" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afc22eff61b133b115c6e8c74e818c628d6d5e7a502afea6f64dee076dd94326" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + [[package]] name = "linked-hash-map" version = "0.5.6" @@ -1798,23 +1886,23 @@ dependencies = [ "db-core", "db-sqlx-maria", "db-sqlx-postgres", - "derive_builder", + "derive_builder 0.11.1", "derive_more", "futures", "lazy_static", "lettre", "libmcaptcha", "log", + "mcaptcha_pow_sha256", "mime", "mime_guess", "num_cpus", "openssl", - "pow_sha256 0.3.1 (git+https://github.com/mcaptcha/pow_sha256?tag=0.3.1)", "pretty_env_logger", "rand", "rust-embed", "sailfish", - "serde 1.0.147", + "serde", "serde_json", "sqlx", "tokio", @@ -1824,6 +1912,19 @@ dependencies = [ "validator", ] +[[package]] +name = "mcaptcha_pow_sha256" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da77f893cceca2fb8f47064749c8a12013a71a56a1c97adc975bf6b053d4bd51" +dependencies = [ + "bincode", + "derive_builder 0.12.0", + "num", + "serde", + "sha2", +] + [[package]] name = "md-5" version = "0.10.5" @@ -1906,17 +2007,6 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" -[[package]] -name = "nom" -version = "5.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08959a387a676302eebf4ddbcbc611da04285579f76f88ee0506c63b1a61dd4b" -dependencies = [ - "lexical-core", - "memchr", - "version_check", -] - [[package]] name = "nom" version = "7.1.3" @@ -1933,23 +2023,12 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43db66d1170d347f9a065114077f7dccb00c1b9478c89384490a3425279a4606" dependencies = [ - "num-bigint 0.4.3", + "num-bigint", "num-complex", "num-integer", "num-iter", "num-rational", - "num-traits 0.2.15", -] - -[[package]] -name = "num-bigint" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3" -dependencies = [ - "autocfg", - "num-integer", - "num-traits 0.2.15", + "num-traits", ] [[package]] @@ -1960,8 +2039,8 @@ checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" dependencies = [ "autocfg", "num-integer", - "num-traits 0.2.15", - "serde 1.0.147", + "num-traits", + "serde", ] [[package]] @@ -1975,7 +2054,7 @@ dependencies = [ "libm", "num-integer", "num-iter", - "num-traits 0.2.15", + "num-traits", "rand", "smallvec", "zeroize", @@ -1987,8 +2066,8 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d" dependencies = [ - "num-traits 0.2.15", - "serde 1.0.147", + "num-traits", + "serde", ] [[package]] @@ -1998,7 +2077,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" dependencies = [ "autocfg", - "num-traits 0.2.15", + "num-traits", ] [[package]] @@ -2009,7 +2088,7 @@ checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" dependencies = [ "autocfg", "num-integer", - "num-traits 0.2.15", + "num-traits", ] [[package]] @@ -2020,17 +2099,8 @@ checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", "num-integer", - "num-traits 0.2.15", - "serde 1.0.147", -] - -[[package]] -name = "num-traits" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" -dependencies = [ - "num-traits 0.2.15", + "num-traits", + "serde", ] [[package]] @@ -2080,7 +2150,7 @@ version = "0.10.55" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "345df152bc43501c5eb9e4654ff05f794effb78d4efe3d53abc158baddc0703d" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if", "foreign-types", "libc", @@ -2097,7 +2167,7 @@ checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.94", ] [[package]] @@ -2129,14 +2199,13 @@ dependencies = [ ] [[package]] -name = "parking_lot" -version = "0.11.2" +name = "ordered-multimap" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +checksum = "ccd746e37177e1711c20dd619a1620f34f5c8b569c53590a72dedd5344d8924a" dependencies = [ - "instant", - "lock_api", - "parking_lot_core 0.8.6", + "dlv-list", + "hashbrown 0.12.3", ] [[package]] @@ -2146,21 +2215,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.8", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" -dependencies = [ - "cfg-if", - "instant", - "libc", - "redox_syscall 0.2.16", - "smallvec", - "winapi", + "parking_lot_core", ] [[package]] @@ -2183,10 +2238,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" [[package]] -name = "pem-rfc7468" -version = "0.3.1" +name = "pathdiff" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01de5d978f34aa4b2296576379fcc416034702fd94117c56ffd8a1a767cefb30" +checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" + +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" dependencies = [ "base64ct", ] @@ -2197,6 +2258,51 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +[[package]] +name = "pest" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c022f1e7b65d6a24c0dbbd5fb344c66881bc01f3e5ae74a1c8100f2f985d98a4" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35513f630d46400a977c4cb58f78e1bfbe01434316e60c37d27b9ad6139c66d8" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc9fc1b9e7057baba189b5c626e2d6f40681ae5b6eb064dc7c7834101ec8123a" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "pest_meta" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1df74e9e7ec4053ceb980e7c0c8bd3594e977fde1af91daba9c928e8e8c6708d" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + [[package]] name = "phf" version = "0.10.1" @@ -2249,24 +2355,23 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkcs1" -version = "0.3.3" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a78f66c04ccc83dd4486fd46c33896f4e17b24a7a3a6400dedc48ed0ddd72320" +checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" dependencies = [ "der", "pkcs8", - "zeroize", + "spki", ] [[package]] name = "pkcs8" -version = "0.8.0" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cabda3fb821068a9a4fab19a683eac3af12edf0f34b94a8be53c4972b8149d0" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" dependencies = [ "der", "spki", - "zeroize", ] [[package]] @@ -2287,27 +2392,15 @@ dependencies = [ "universal-hash", ] -[[package]] -name = "pow_sha256" -version = "0.3.1" -source = "git+https://github.com/mcaptcha/pow_sha256?tag=0.3.1#3b4e28706a8946987ba02f98e1f816d9fa156dad" -dependencies = [ - "bincode", - "derive_builder", - "num", - "serde 1.0.147", - "sha2", -] - [[package]] name = "pow_sha256" version = "0.3.1" source = "git+https://github.com/mcaptcha/pow_sha256#148f1cb70d19114d1340661a77b2b679e95715f6" dependencies = [ "bincode", - "derive_builder", + "derive_builder 0.11.1", "num", - "serde 1.0.147", + "serde", "sha2", ] @@ -2342,7 +2435,7 @@ dependencies = [ "proc-macro-error-attr", "proc-macro2", "quote", - "syn", + "syn 1.0.94", "version_check", ] @@ -2357,19 +2450,13 @@ dependencies = [ "version_check", ] -[[package]] -name = "proc-macro-hack" -version = "0.5.20+deprecated" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" - [[package]] name = "proc-macro2" -version = "1.0.36" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ - "unicode-xid", + "unicode-ident", ] [[package]] @@ -2380,9 +2467,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.19" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f53dc8cf16a769a6f677e09e7ff2cd4be1ea0f48754aac39520536962011de0d" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -2400,7 +2487,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51de85fb3fb6524929c8a2eb85e6b6d363de4e8c48f9e2c2eac4944abc181c93" dependencies = [ "log", - "parking_lot 0.12.1", + "parking_lot", "scheduled-thread-pool", ] @@ -2465,7 +2552,7 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -2474,18 +2561,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" dependencies = [ - "bitflags", -] - -[[package]] -name = "redox_users" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" -dependencies = [ - "getrandom", - "redox_syscall 0.2.16", - "thiserror", + "bitflags 1.3.2", ] [[package]] @@ -2514,28 +2590,41 @@ dependencies = [ "cc", "libc", "once_cell", - "spin", + "spin 0.5.2", "untrusted", "web-sys", "winapi", ] [[package]] -name = "rsa" -version = "0.6.1" +name = "ron" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cf22754c49613d2b3b119f0e5d46e34a2c628a937e3024b8762de4e7d8c710b" +checksum = "88073939a61e5b7680558e6be56b419e208420c2adb92be54921fa6b72283f1a" +dependencies = [ + "base64 0.13.1", + "bitflags 1.3.2", + "serde", +] + +[[package]] +name = "rsa" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ab43bb47d23c1a631b4b680199a45255dce26fa9ab2fa902581f624ff13e6a8" dependencies = [ "byteorder", + "const-oid", "digest", "num-bigint-dig", "num-integer", "num-iter", - "num-traits 0.2.15", + "num-traits", "pkcs1", "pkcs8", "rand_core", - "smallvec", + "signature", + "spki", "subtle", "zeroize", ] @@ -2572,7 +2661,7 @@ dependencies = [ "proc-macro2", "quote", "rust-embed-utils", - "syn", + "syn 1.0.94", "walkdir", ] @@ -2588,9 +2677,13 @@ dependencies = [ [[package]] name = "rust-ini" -version = "0.13.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" +checksum = "f6d5f2436026b4f6e79dc829837d467cc7e9a55ee40e750d716713540715a2df" +dependencies = [ + "cfg-if", + "ordered-multimap", +] [[package]] name = "rustc-demangle" @@ -2598,22 +2691,13 @@ version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver 0.9.0", -] - [[package]] name = "rustc_version" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.17", + "semver", ] [[package]] @@ -2622,7 +2706,7 @@ version = "0.37.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62f25693a73057a1b4cb56179dd3c7ea21a7c6c5ee7d85781f5749b46f34b79c" dependencies = [ - "bitflags", + "bitflags 1.3.2", "errno", "io-lifetimes", "libc", @@ -2632,15 +2716,32 @@ dependencies = [ [[package]] name = "rustls" -version = "0.19.1" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" +checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" dependencies = [ - "base64 0.13.1", - "log", "ring", + "rustls-webpki", "sct", - "webpki", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" +dependencies = [ + "base64 0.21.2", +] + +[[package]] +name = "rustls-webpki" +version = "0.101.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe" +dependencies = [ + "ring", + "untrusted", ] [[package]] @@ -2651,9 +2752,9 @@ checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" [[package]] name = "sailfish" -version = "0.4.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "948a7edfc2f03d7c58a097dda25ed29440a72e8528894a6e182fe9171195fed1" +checksum = "82a03fcade08eb837d7ba0d8f775f1fe6cddb00d413de0c655ab2b93e821a0eb" dependencies = [ "itoap", "ryu", @@ -2663,25 +2764,25 @@ dependencies = [ [[package]] name = "sailfish-compiler" -version = "0.4.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f0a01133d6ce146020e6416ac6a823f813f1cbb30ff77548b4fa20749524947" +checksum = "0cf1deecb07747a1f7ab55745edcc406875db007602b037af5fcf59f40dd2005" dependencies = [ "filetime", "home", "memchr", "proc-macro2", "quote", - "serde 1.0.147", - "syn", - "toml", + "serde", + "syn 2.0.38", + "toml 0.7.8", ] [[package]] name = "sailfish-macros" -version = "0.4.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86326c1f1dce0b316e0a47071f683b185417dc64e1a704380b5c706b09e871b1" +checksum = "c3e5946289d6daa26cde6ffb06678d7a8ba276ec6a7a55d36f64b35e7f644d22" dependencies = [ "proc-macro2", "sailfish-compiler", @@ -2711,7 +2812,7 @@ version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3cbc66816425a074528352f5789333ecff06ca41b36b0b0efdfbb29edc391a19" dependencies = [ - "parking_lot 0.12.1", + "parking_lot", ] [[package]] @@ -2722,9 +2823,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "sct" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" dependencies = [ "ring", "untrusted", @@ -2736,7 +2837,7 @@ version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "core-foundation-sys", "libc", @@ -2753,33 +2854,12 @@ dependencies = [ "libc", ] -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] - [[package]] name = "semver" version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - -[[package]] -name = "serde" -version = "0.8.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dad3f759919b92c3068c696c15c3d17238234498bbdcc80f2c469606f948ac8" - [[package]] name = "serde" version = "1.0.147" @@ -2789,18 +2869,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde-hjson" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a3a4e0ea8a88553209f6cc6cfe8724ecad22e1acf372793c27d995290fe74f8" -dependencies = [ - "lazy_static", - "num-traits 0.1.43", - "regex", - "serde 0.8.23", -] - [[package]] name = "serde_derive" version = "1.0.147" @@ -2809,7 +2877,7 @@ checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.94", ] [[package]] @@ -2820,7 +2888,16 @@ checksum = "46266871c240a00b8f503b877622fe33430b3c7d963bdc0f2adc511e54a1eae3" dependencies = [ "itoa", "ryu", - "serde 1.0.147", + "serde", +] + +[[package]] +name = "serde_spanned" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" +dependencies = [ + "serde", ] [[package]] @@ -2832,18 +2909,7 @@ dependencies = [ "form_urlencoded", "itoa", "ryu", - "serde 1.0.147", -] - -[[package]] -name = "sha-1" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", + "serde", ] [[package]] @@ -2892,6 +2958,16 @@ dependencies = [ "libc", ] +[[package]] +name = "signature" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" +dependencies = [ + "digest", + "rand_core", +] + [[package]] name = "siphasher" version = "0.3.10" @@ -2930,10 +3006,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] -name = "spki" -version = "0.5.4" +name = "spin" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d01ac02a6ccf3e07db148d2be087da624fea0221a16152ed01f0496a6b0a27" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" dependencies = [ "base64ct", "der", @@ -2941,179 +3026,216 @@ dependencies = [ [[package]] name = "sqlformat" -version = "0.1.8" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4b7922be017ee70900be125523f38bdd644f4f06a1b16e8fa5a8ee8c34bffd4" +checksum = "6b7b278788e7be4d0d29c0f39497a0eef3fba6bbc8e70d8bf7fde46edeaa9e85" dependencies = [ "itertools", - "nom 7.1.3", + "nom", "unicode_categories", ] [[package]] name = "sqlx" -version = "0.5.13" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "551873805652ba0d912fec5bbb0f8b4cdd96baf8e2ebf5970e5671092966019b" +checksum = "0e50c216e3624ec8e7ecd14c6a6a6370aad6ee5d8cfc3ab30b5162eeeef2ed33" dependencies = [ "sqlx-core", "sqlx-macros", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", ] [[package]] name = "sqlx-core" -version = "0.5.13" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e48c61941ccf5ddcada342cd59e3e5173b007c509e1e8e990dafc830294d9dc5" +checksum = "8d6753e460c998bbd4cd8c6f0ed9a64346fcca0723d6e75e52fdc351c5d2169d" dependencies = [ - "ahash 0.7.6", + "ahash 0.8.3", "atoi", - "base64 0.13.1", - "bitflags", "byteorder", "bytes", "crc", "crossbeam-queue", - "digest", - "dirs", + "dotenvy", "either", "event-listener", "futures-channel", "futures-core", "futures-intrusive", + "futures-io", "futures-util", - "generic-array", "hashlink", "hex", - "hkdf", - "hmac", - "indexmap", - "itoa", - "libc", + "indexmap 2.0.2", "log", - "md-5", "memchr", - "num-bigint 0.3.3", "once_cell", "paste", "percent-encoding", - "rand", - "rsa", "rustls", - "serde 1.0.147", + "rustls-pemfile", + "serde", "serde_json", - "sha-1", "sha2", "smallvec", "sqlformat", - "sqlx-rt", - "stringprep", "thiserror", - "time 0.2.27", + "time", + "tokio", "tokio-stream", + "tracing", "url", - "webpki", "webpki-roots", - "whoami", ] [[package]] name = "sqlx-macros" -version = "0.5.13" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc0fba2b0cae21fc00fe6046f8baa4c7fcb49e379f0f592b04696607f69ed2e1" +checksum = "9a793bb3ba331ec8359c1853bd39eed32cdd7baaf22c35ccf5c92a7e8d1189ec" dependencies = [ - "dotenv", + "proc-macro2", + "quote", + "sqlx-core", + "sqlx-macros-core", + "syn 1.0.94", +] + +[[package]] +name = "sqlx-macros-core" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a4ee1e104e00dedb6aa5ffdd1343107b0a4702e862a84320ee7cc74782d96fc" +dependencies = [ + "dotenvy", "either", "heck", "hex", "once_cell", "proc-macro2", "quote", - "serde 1.0.147", + "serde", "serde_json", "sha2", "sqlx-core", - "sqlx-rt", - "syn", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", + "syn 1.0.94", + "tempfile", + "tokio", "url", ] [[package]] -name = "sqlx-rt" -version = "0.5.13" +name = "sqlx-mysql" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4db708cd3e459078f85f39f96a00960bd841f66ee2a669e90bf36907f5a79aae" +checksum = "864b869fdf56263f4c95c45483191ea0af340f9f3e3e7b4d57a61c7c87a970db" dependencies = [ - "actix-rt", + "atoi", + "base64 0.21.2", + "bitflags 2.4.1", + "byteorder", + "bytes", + "crc", + "digest", + "dotenvy", + "either", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "generic-array", + "hex", + "hkdf", + "hmac", + "itoa", + "log", + "md-5", + "memchr", "once_cell", - "tokio", - "tokio-rustls", + "percent-encoding", + "rand", + "rsa", + "serde", + "sha1 0.10.5", + "sha2", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror", + "time", + "tracing", + "whoami", ] [[package]] -name = "standback" -version = "0.2.17" +name = "sqlx-postgres" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e113fb6f3de07a243d434a56ec6f186dfd51cb08448239fe7bcae73f87ff28ff" +checksum = "eb7ae0e6a97fb3ba33b23ac2671a5ce6e3cabe003f451abd5a56e7951d975624" dependencies = [ - "version_check", -] - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "stdweb" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" -dependencies = [ - "discard", - "rustc_version 0.2.3", - "stdweb-derive", - "stdweb-internal-macros", - "stdweb-internal-runtime", - "wasm-bindgen", -] - -[[package]] -name = "stdweb-derive" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" -dependencies = [ - "proc-macro2", - "quote", - "serde 1.0.147", - "serde_derive", - "syn", -] - -[[package]] -name = "stdweb-internal-macros" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" -dependencies = [ - "base-x", - "proc-macro2", - "quote", - "serde 1.0.147", - "serde_derive", + "atoi", + "base64 0.21.2", + "bitflags 2.4.1", + "byteorder", + "crc", + "dotenvy", + "etcetera", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "hex", + "hkdf", + "hmac", + "home", + "itoa", + "log", + "md-5", + "memchr", + "once_cell", + "rand", + "serde", "serde_json", - "sha1 0.6.1", - "syn", + "sha1 0.10.5", + "sha2", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror", + "time", + "tracing", + "whoami", ] [[package]] -name = "stdweb-internal-runtime" -version = "0.1.5" +name = "sqlx-sqlite" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" +checksum = "d59dc83cf45d89c555a577694534fcd1b55c545a816c816ce51f20bbe56a4f3f" +dependencies = [ + "atoi", + "flume", + "futures-channel", + "futures-core", + "futures-executor", + "futures-intrusive", + "futures-util", + "libsqlite3-sys", + "log", + "percent-encoding", + "serde", + "sqlx-core", + "time", + "tracing", + "url", +] [[package]] name = "string_cache" @@ -3123,10 +3245,10 @@ checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" dependencies = [ "new_debug_unreachable", "once_cell", - "parking_lot 0.12.1", + "parking_lot", "phf_shared", "precomputed-hash", - "serde 1.0.147", + "serde", ] [[package]] @@ -3174,6 +3296,17 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "syn" +version = "2.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "tempfile" version = "3.6.0" @@ -3225,22 +3358,7 @@ checksum = "5420d42e90af0c38c3290abcca25b9b3bdf379fc9f55c528f53a269d9c9a267e" dependencies = [ "proc-macro2", "quote", - "syn", -] - -[[package]] -name = "time" -version = "0.2.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4752a97f8eebd6854ff91f1c1824cd6160626ac4bd44287f7f4ea2035a02a242" -dependencies = [ - "const_fn", - "libc", - "standback", - "stdweb", - "time-macros 0.1.1", - "version_check", - "winapi", + "syn 1.0.94", ] [[package]] @@ -3250,9 +3368,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd" dependencies = [ "itoa", - "serde 1.0.147", + "serde", "time-core", - "time-macros 0.2.9", + "time-macros", ] [[package]] @@ -3261,16 +3379,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" -[[package]] -name = "time-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1" -dependencies = [ - "proc-macro-hack", - "time-macros-impl", -] - [[package]] name = "time-macros" version = "0.2.9" @@ -3280,19 +3388,6 @@ dependencies = [ "time-core", ] -[[package]] -name = "time-macros-impl" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd3c141a1b43194f3f56a1411225df8646c55781d5f26db825b3d98507eb482f" -dependencies = [ - "proc-macro-hack", - "proc-macro2", - "quote", - "standback", - "syn", -] - [[package]] name = "tinyvec" version = "1.6.0" @@ -3319,8 +3414,7 @@ dependencies = [ "bytes", "libc", "mio", - "num_cpus", - "parking_lot 0.12.1", + "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2", @@ -3337,17 +3431,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-rustls" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" -dependencies = [ - "rustls", - "tokio", - "webpki", -] - [[package]] name = "tokio-stream" version = "0.1.14" @@ -3379,7 +3462,41 @@ version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" dependencies = [ - "serde 1.0.147", + "serde", +] + +[[package]] +name = "toml" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.19.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap 2.0.2", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", ] [[package]] @@ -3391,9 +3508,21 @@ dependencies = [ "cfg-if", "log", "pin-project-lite", + "tracing-attributes", "tracing-core", ] +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + [[package]] name = "tracing-core" version = "0.1.31" @@ -3409,6 +3538,12 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +[[package]] +name = "ucd-trie" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" + [[package]] name = "unicase" version = "2.6.0" @@ -3424,6 +3559,12 @@ version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + [[package]] name = "unicode-normalization" version = "0.1.22" @@ -3476,7 +3617,7 @@ dependencies = [ "form_urlencoded", "idna 0.4.0", "percent-encoding", - "serde 1.0.147", + "serde", ] [[package]] @@ -3498,7 +3639,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d023da39d1fde5a8a3fe1f3e01ca9632ada0a63e9797de55a879d6e2236277be" dependencies = [ "getrandom", - "serde 1.0.147", + "serde", ] [[package]] @@ -3510,7 +3651,7 @@ dependencies = [ "idna 0.2.3", "lazy_static", "regex", - "serde 1.0.147", + "serde", "serde_derive", "serde_json", "url", @@ -3529,7 +3670,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn", + "syn 1.0.94", "validator_types", ] @@ -3540,7 +3681,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2ddf34293296847abfc1493b15c6e2f5d3cd19f57ad7d22673bf4c6278da329" dependencies = [ "proc-macro2", - "syn", + "syn 1.0.94", ] [[package]] @@ -3592,7 +3733,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn", + "syn 1.0.94", "wasm-bindgen-shared", ] @@ -3614,7 +3755,7 @@ checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.94", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3635,23 +3776,13 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "webpki" -version = "0.21.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "webpki-roots" -version = "0.21.1" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aabe153544e473b775453675851ecc86863d2a81d786d741f6b76778f2a48940" +checksum = "b291546d5d9d1eab74f069c77749f2cb8504a12caa20f0f2de93ddbf6f411888" dependencies = [ - "webpki", + "rustls-webpki", ] [[package]] @@ -3659,10 +3790,6 @@ name = "whoami" version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22fc3756b8a9133049b26c7f61ab35416c130e8c09b660f5b3958b446f52cc50" -dependencies = [ - "wasm-bindgen", - "web-sys", -] [[package]] name = "winapi" @@ -3818,6 +3945,15 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +[[package]] +name = "winnow" +version = "0.5.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3b801d0e0a6726477cc207f60162da452f3a95adb368399bef20a946e06f65c" +dependencies = [ + "memchr", +] + [[package]] name = "yaml-rust" version = "0.4.5" diff --git a/Cargo.toml b/Cargo.toml index 25058093..1fe2c08f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,10 +38,10 @@ cache-buster = { git = "https://github.com/realaravinth/cache-buster" } futures = "0.3.15" tokio = { version = "1.14", features = ["sync"]} -sqlx = { version = "0.5.13", features = [ "runtime-actix-rustls", "postgres", "time", "offline", "mysql"] } +sqlx = { version = "0.7", features = [ "runtime-tokio-rustls", "postgres", "time", "mysql"] } argon2-creds = { branch = "master", git = "https://github.com/realaravinth/argon2-creds"} #argon2-creds = { version="*", path = "../../argon2-creds/" } -config = "0.11" +config = "0.13" validator = { version = "0.15", features = ["derive"]} derive_builder = "0.11" @@ -65,7 +65,7 @@ libmcaptcha = { version = "0.2.3", git = "https://github.com/mCaptcha/libmcaptch rand = "0.8" -sailfish = "0.4.0" +sailfish = "0.7.0" mime = "0.3.16" @@ -102,10 +102,10 @@ features = ["actix_identity_backend"] [build-dependencies] serde_json = "1" -sqlx = { version = "0.5.13", features = [ "runtime-actix-rustls", "postgres", "time", "offline", "mysql" ] } +sqlx = { version = "0.7", features = [ "runtime-tokio-rustls", "postgres", "time", "mysql" ] } [dev-dependencies] -pow_sha256 = { version = "0.3.1", git = "https://github.com/mcaptcha/pow_sha256", tag="0.3.1" } +mcaptcha_pow_sha256 = "0.4" awc = "3.0.0" diff --git a/Makefile b/Makefile index 79902191..ec966c18 100644 --- a/Makefile +++ b/Makefile @@ -34,8 +34,7 @@ endef define run_dev_migrations ## run database migrations cd db/db-sqlx-maria/ && \ - DATABASE_URL=${MARIA_DATABASE_URL} sqlx migrate run - cd db/db-sqlx-postgres/ && \ + DATABASE_URL=${MARIA_DATABASE_URL} sqlx migrate run cd db/db-sqlx-postgres/ && \ DATABASE_URL=${POSTGRES_DATABASE_URL} sqlx migrate run endef @@ -67,11 +66,9 @@ define test_db_sqlx_maria endef define test_core - cargo test --no-fail-fast + cargo test --no-fail-fast --jobs=4 endef - - default: frontend ## Build app in debug mode $(call cache_bust) cargo build diff --git a/build.rs b/build.rs index 6da61a7b..be1d3bdc 100644 --- a/build.rs +++ b/build.rs @@ -16,6 +16,7 @@ fn main() { let git_hash = String::from_utf8(output.stdout).unwrap(); println!("cargo:rustc-env=GIT_HASH={}", git_hash); - let now = OffsetDateTime::now_utc().format("%y-%m-%d"); + let now = OffsetDateTime::now_utc(); + let now = format!("{}{}{}", now.year(), now.month(), now.date()); println!("cargo:rustc-env=COMPILED_DATE={}", &now); } diff --git a/config/default.toml b/config/default.toml index 55c77906..fb06e174 100644 --- a/config/default.toml +++ b/config/default.toml @@ -42,17 +42,11 @@ duration = 30 # cooldown period in seconds # This section deals with the database location and how to access it # Please note that at the moment, we have support for only postgresqa. # Example, if you are Batman, your config would be: -# hostname = "batcave.org" -# port = "5432" -# username = "batman" -# password = "somereallycomplicatedBatmanpassword" -hostname = "localhost" -port = "5432" -username = "postgres" -password = "password" -name = "postgres" +# url = "postgres://batman:password@batcave.org:5432/batcave" +# database_type = "postgres" +# pool = 4 +url = "postgres://example.org" # hack for tests to run successfully pool = 4 -database_type="postgres" # "postgres", "maria" [redis] # This section deals with the database location and how to access it diff --git a/db/db-migrations/Cargo.toml b/db/db-migrations/Cargo.toml index f21b6879..952a1a4e 100644 --- a/db/db-migrations/Cargo.toml +++ b/db/db-migrations/Cargo.toml @@ -10,4 +10,4 @@ authors = ["realaravinth "] [dependencies] actix-rt = "2" -sqlx = { version = "0.5.13", features = [ "runtime-actix-rustls", "postgres", "time", "offline", "mysql" ] } +sqlx = { version = "0.7", features = [ "runtime-tokio-rustls", "postgres", "time", "mysql" ] } diff --git a/db/db-sqlx-maria/.sqlx/query-1367dceb151a766a901b5dd771d0b75d0bc61d2fef17a94a90c8ffa0065e2c44.json b/db/db-sqlx-maria/.sqlx/query-1367dceb151a766a901b5dd771d0b75d0bc61d2fef17a94a90c8ffa0065e2c44.json new file mode 100644 index 00000000..5b3e4055 --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-1367dceb151a766a901b5dd771d0b75d0bc61d2fef17a94a90c8ffa0065e2c44.json @@ -0,0 +1,25 @@ +{ + "db_name": "MySQL", + "query": "SELECT time FROM mcaptcha_pow_confirmed_stats \n WHERE \n config_id = (\n SELECT config_id FROM mcaptcha_config \n WHERE \n captcha_key = ?\n AND\n user_id = (\n SELECT \n ID FROM mcaptcha_users WHERE name = ?))\n ORDER BY time DESC", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "time", + "type_info": { + "type": "Timestamp", + "flags": "NOT_NULL | UNSIGNED | BINARY | TIMESTAMP", + "char_set": 63, + "max_size": 19 + } + } + ], + "parameters": { + "Right": 2 + }, + "nullable": [ + false + ] + }, + "hash": "1367dceb151a766a901b5dd771d0b75d0bc61d2fef17a94a90c8ffa0065e2c44" +} diff --git a/db/db-sqlx-maria/.sqlx/query-14dc89b2988b221fd24e4f319b1d48f5e6c65c760c30d11c9c29087f09cee23a.json b/db/db-sqlx-maria/.sqlx/query-14dc89b2988b221fd24e4f319b1d48f5e6c65c760c30d11c9c29087f09cee23a.json new file mode 100644 index 00000000..081a092d --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-14dc89b2988b221fd24e4f319b1d48f5e6c65c760c30d11c9c29087f09cee23a.json @@ -0,0 +1,25 @@ +{ + "db_name": "MySQL", + "query": "SELECT\n captcha_key\n FROM\n mcaptcha_config\n WHERE\n config_id = (\n SELECT\n config_id\n FROM\n mcaptcha_psuedo_campaign_id\n WHERE\n psuedo_id = ?\n );", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "captcha_key", + "type_info": { + "type": "VarString", + "flags": "NOT_NULL | UNIQUE_KEY | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 400 + } + } + ], + "parameters": { + "Right": 1 + }, + "nullable": [ + false + ] + }, + "hash": "14dc89b2988b221fd24e4f319b1d48f5e6c65c760c30d11c9c29087f09cee23a" +} diff --git a/db/db-sqlx-maria/.sqlx/query-22e697114c3ed5b0156cdceab11a398f1ef3a804f482e1cd948bc615ef95fc92.json b/db/db-sqlx-maria/.sqlx/query-22e697114c3ed5b0156cdceab11a398f1ef3a804f482e1cd948bc615ef95fc92.json new file mode 100644 index 00000000..9e861664 --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-22e697114c3ed5b0156cdceab11a398f1ef3a804f482e1cd948bc615ef95fc92.json @@ -0,0 +1,12 @@ +{ + "db_name": "MySQL", + "query": "INSERT INTO mcaptcha_sitekey_user_provided_avg_traffic (\n config_id,\n avg_traffic,\n peak_sustainable_traffic,\n broke_my_site_traffic\n ) VALUES ( \n (SELECT config_id FROM mcaptcha_config where captcha_key= (?)\n AND user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?)\n ), ?, ?, ?)", + "describe": { + "columns": [], + "parameters": { + "Right": 5 + }, + "nullable": [] + }, + "hash": "22e697114c3ed5b0156cdceab11a398f1ef3a804f482e1cd948bc615ef95fc92" +} diff --git a/db/db-sqlx-maria/.sqlx/query-34b29417f9ff3f4d5987df0ce81023b1985eb84e560602b36182f55de6cd9d83.json b/db/db-sqlx-maria/.sqlx/query-34b29417f9ff3f4d5987df0ce81023b1985eb84e560602b36182f55de6cd9d83.json new file mode 100644 index 00000000..ade0e6ce --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-34b29417f9ff3f4d5987df0ce81023b1985eb84e560602b36182f55de6cd9d83.json @@ -0,0 +1,12 @@ +{ + "db_name": "MySQL", + "query": "INSERT INTO mcaptcha_pow_confirmed_stats \n (config_id, time) VALUES ((SELECT config_id FROM mcaptcha_config where captcha_key= ?), ?)", + "describe": { + "columns": [], + "parameters": { + "Right": 2 + }, + "nullable": [] + }, + "hash": "34b29417f9ff3f4d5987df0ce81023b1985eb84e560602b36182f55de6cd9d83" +} diff --git a/db/db-sqlx-maria/.sqlx/query-3812693a9ae4402d900bcbf680981e6194073bd1937af11a77daa3776fb4c873.json b/db/db-sqlx-maria/.sqlx/query-3812693a9ae4402d900bcbf680981e6194073bd1937af11a77daa3776fb4c873.json new file mode 100644 index 00000000..fa80564d --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-3812693a9ae4402d900bcbf680981e6194073bd1937af11a77daa3776fb4c873.json @@ -0,0 +1,58 @@ +{ + "db_name": "MySQL", + "query": "SELECT captcha_key, name, config_id, duration FROM mcaptcha_config WHERE\n user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?) ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "captcha_key", + "type_info": { + "type": "VarString", + "flags": "NOT_NULL | UNIQUE_KEY | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 400 + } + }, + { + "ordinal": 1, + "name": "name", + "type_info": { + "type": "VarString", + "flags": "NOT_NULL | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 400 + } + }, + { + "ordinal": 2, + "name": "config_id", + "type_info": { + "type": "Long", + "flags": "NOT_NULL | PRIMARY_KEY | AUTO_INCREMENT", + "char_set": 63, + "max_size": 11 + } + }, + { + "ordinal": 3, + "name": "duration", + "type_info": { + "type": "Long", + "flags": "NOT_NULL", + "char_set": 63, + "max_size": 11 + } + } + ], + "parameters": { + "Right": 1 + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "3812693a9ae4402d900bcbf680981e6194073bd1937af11a77daa3776fb4c873" +} diff --git a/db/db-sqlx-maria/.sqlx/query-3a8381eb0f0542a492d9dd51368e769e2b313e0576a1873e5c7630011e463daf.json b/db/db-sqlx-maria/.sqlx/query-3a8381eb0f0542a492d9dd51368e769e2b313e0576a1873e5c7630011e463daf.json new file mode 100644 index 00000000..cfa8c9d1 --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-3a8381eb0f0542a492d9dd51368e769e2b313e0576a1873e5c7630011e463daf.json @@ -0,0 +1,12 @@ +{ + "db_name": "MySQL", + "query": "UPDATE mcaptcha_config SET name = ?, duration = ?\n WHERE user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?)\n AND captcha_key = ?", + "describe": { + "columns": [], + "parameters": { + "Right": 4 + }, + "nullable": [] + }, + "hash": "3a8381eb0f0542a492d9dd51368e769e2b313e0576a1873e5c7630011e463daf" +} diff --git a/db/db-sqlx-maria/.sqlx/query-413ea53cea8b8f114fc009bad527b054a68a94477dfcc50d860d45bbd864d4f1.json b/db/db-sqlx-maria/.sqlx/query-413ea53cea8b8f114fc009bad527b054a68a94477dfcc50d860d45bbd864d4f1.json new file mode 100644 index 00000000..2fdc6bb0 --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-413ea53cea8b8f114fc009bad527b054a68a94477dfcc50d860d45bbd864d4f1.json @@ -0,0 +1,25 @@ +{ + "db_name": "MySQL", + "query": "SELECT email FROM mcaptcha_users WHERE name = ?", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "email", + "type_info": { + "type": "VarString", + "flags": "UNIQUE_KEY", + "char_set": 224, + "max_size": 400 + } + } + ], + "parameters": { + "Right": 1 + }, + "nullable": [ + true + ] + }, + "hash": "413ea53cea8b8f114fc009bad527b054a68a94477dfcc50d860d45bbd864d4f1" +} diff --git a/db/db-sqlx-maria/.sqlx/query-42d967d6e080efd3cff8d4df13ea4d2ff38f3093da5c97000349dfc23c4d4eb3.json b/db/db-sqlx-maria/.sqlx/query-42d967d6e080efd3cff8d4df13ea4d2ff38f3093da5c97000349dfc23c4d4eb3.json new file mode 100644 index 00000000..697aaa1e --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-42d967d6e080efd3cff8d4df13ea4d2ff38f3093da5c97000349dfc23c4d4eb3.json @@ -0,0 +1,69 @@ +{ + "db_name": "MySQL", + "query": "-- SPDX-FileCopyrightText: 2023 Aravinth Manivannan \n--\n-- SPDX-License-Identifier: AGPL-3.0-or-later\n\n-- gets all unread notifications a user has\nSELECT \n mcaptcha_notifications.id,\n mcaptcha_notifications.heading,\n mcaptcha_notifications.message,\n mcaptcha_notifications.received,\n mcaptcha_users.name\nFROM\n mcaptcha_notifications \nINNER JOIN \n mcaptcha_users \nON \n mcaptcha_notifications.tx = mcaptcha_users.id\nWHERE \n mcaptcha_notifications.rx = (\n SELECT \n id \n FROM \n mcaptcha_users\n WHERE\n name = ?\n )\nAND \n mcaptcha_notifications.read_notification IS NULL;\n", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": { + "type": "Long", + "flags": "NOT_NULL | PRIMARY_KEY | AUTO_INCREMENT", + "char_set": 63, + "max_size": 11 + } + }, + { + "ordinal": 1, + "name": "heading", + "type_info": { + "type": "VarString", + "flags": "NOT_NULL | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 400 + } + }, + { + "ordinal": 2, + "name": "message", + "type_info": { + "type": "VarString", + "flags": "NOT_NULL | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 1000 + } + }, + { + "ordinal": 3, + "name": "received", + "type_info": { + "type": "Timestamp", + "flags": "NOT_NULL | UNSIGNED | BINARY | TIMESTAMP", + "char_set": 63, + "max_size": 19 + } + }, + { + "ordinal": 4, + "name": "name", + "type_info": { + "type": "VarString", + "flags": "NOT_NULL | UNIQUE_KEY | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 400 + } + } + ], + "parameters": { + "Right": 1 + }, + "nullable": [ + false, + false, + false, + false, + false + ] + }, + "hash": "42d967d6e080efd3cff8d4df13ea4d2ff38f3093da5c97000349dfc23c4d4eb3" +} diff --git a/db/db-sqlx-maria/.sqlx/query-598a8202942771eff460faa6f09bd3fb1fc910d5fab7edb07c49dadbbaeb1cb8.json b/db/db-sqlx-maria/.sqlx/query-598a8202942771eff460faa6f09bd3fb1fc910d5fab7edb07c49dadbbaeb1cb8.json new file mode 100644 index 00000000..dac28855 --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-598a8202942771eff460faa6f09bd3fb1fc910d5fab7edb07c49dadbbaeb1cb8.json @@ -0,0 +1,12 @@ +{ + "db_name": "MySQL", + "query": "INSERT INTO mcaptcha_pow_fetched_stats \n (config_id, time) VALUES ((SELECT config_id FROM mcaptcha_config where captcha_key= ?), ?)", + "describe": { + "columns": [], + "parameters": { + "Right": 2 + }, + "nullable": [] + }, + "hash": "598a8202942771eff460faa6f09bd3fb1fc910d5fab7edb07c49dadbbaeb1cb8" +} diff --git a/db/db-sqlx-maria/.sqlx/query-5ad1ef722a961183228d851813b9f50284520bf8cc8118c765b72c108daaf6fb.json b/db/db-sqlx-maria/.sqlx/query-5ad1ef722a961183228d851813b9f50284520bf8cc8118c765b72c108daaf6fb.json new file mode 100644 index 00000000..c02c6cdf --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-5ad1ef722a961183228d851813b9f50284520bf8cc8118c765b72c108daaf6fb.json @@ -0,0 +1,25 @@ +{ + "db_name": "MySQL", + "query": "SELECT psuedo_id FROM\n mcaptcha_psuedo_campaign_id\n WHERE\n config_id = (SELECT config_id FROM mcaptcha_config WHERE captcha_key = (?));\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "psuedo_id", + "type_info": { + "type": "VarString", + "flags": "NOT_NULL | UNIQUE_KEY | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 400 + } + } + ], + "parameters": { + "Right": 1 + }, + "nullable": [ + false + ] + }, + "hash": "5ad1ef722a961183228d851813b9f50284520bf8cc8118c765b72c108daaf6fb" +} diff --git a/db/db-sqlx-maria/.sqlx/query-5d5a106981345e9f62bc2239c00cdc683d3aaaa820d63da300dc51e3f6f363d3.json b/db/db-sqlx-maria/.sqlx/query-5d5a106981345e9f62bc2239c00cdc683d3aaaa820d63da300dc51e3f6f363d3.json new file mode 100644 index 00000000..7e81e485 --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-5d5a106981345e9f62bc2239c00cdc683d3aaaa820d63da300dc51e3f6f363d3.json @@ -0,0 +1,12 @@ +{ + "db_name": "MySQL", + "query": "INSERT INTO mcaptcha_users \n (name , password, secret) VALUES (?, ?, ?)", + "describe": { + "columns": [], + "parameters": { + "Right": 3 + }, + "nullable": [] + }, + "hash": "5d5a106981345e9f62bc2239c00cdc683d3aaaa820d63da300dc51e3f6f363d3" +} diff --git a/db/db-sqlx-maria/.sqlx/query-6094468b7fa20043b0da90e366b7f1fa29a8c748e163b6712725440b25ae9361.json b/db/db-sqlx-maria/.sqlx/query-6094468b7fa20043b0da90e366b7f1fa29a8c748e163b6712725440b25ae9361.json new file mode 100644 index 00000000..8f7bb03d --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-6094468b7fa20043b0da90e366b7f1fa29a8c748e163b6712725440b25ae9361.json @@ -0,0 +1,12 @@ +{ + "db_name": "MySQL", + "query": "\n DELETE FROM\n mcaptcha_pow_analytics\n WHERE\n config_id = (\n SELECT config_id FROM mcaptcha_config WHERE captcha_key = ?\n ) ", + "describe": { + "columns": [], + "parameters": { + "Right": 1 + }, + "nullable": [] + }, + "hash": "6094468b7fa20043b0da90e366b7f1fa29a8c748e163b6712725440b25ae9361" +} diff --git a/db/db-sqlx-maria/.sqlx/query-66ec7df10484f8e0206f3c97afc9136021589556c38dbbed341d6574487f79f2.json b/db/db-sqlx-maria/.sqlx/query-66ec7df10484f8e0206f3c97afc9136021589556c38dbbed341d6574487f79f2.json new file mode 100644 index 00000000..ef3a8465 --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-66ec7df10484f8e0206f3c97afc9136021589556c38dbbed341d6574487f79f2.json @@ -0,0 +1,25 @@ +{ + "db_name": "MySQL", + "query": "SELECT config_id FROM mcaptcha_config\n WHERE\n captcha_key = ? \n AND user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?)", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "config_id", + "type_info": { + "type": "Long", + "flags": "NOT_NULL | PRIMARY_KEY | AUTO_INCREMENT", + "char_set": 63, + "max_size": 11 + } + } + ], + "parameters": { + "Right": 2 + }, + "nullable": [ + false + ] + }, + "hash": "66ec7df10484f8e0206f3c97afc9136021589556c38dbbed341d6574487f79f2" +} diff --git a/db/db-sqlx-maria/.sqlx/query-676a9f1761c3b63cf16d7d4dd6261507cc7707feb32d458f4b946ed9caa53721.json b/db/db-sqlx-maria/.sqlx/query-676a9f1761c3b63cf16d7d4dd6261507cc7707feb32d458f4b946ed9caa53721.json new file mode 100644 index 00000000..b14a9476 --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-676a9f1761c3b63cf16d7d4dd6261507cc7707feb32d458f4b946ed9caa53721.json @@ -0,0 +1,12 @@ +{ + "db_name": "MySQL", + "query": "UPDATE mcaptcha_users set name = ?\n WHERE name = ?", + "describe": { + "columns": [], + "parameters": { + "Right": 2 + }, + "nullable": [] + }, + "hash": "676a9f1761c3b63cf16d7d4dd6261507cc7707feb32d458f4b946ed9caa53721" +} diff --git a/db/db-sqlx-maria/.sqlx/query-6d1b6e5e58ca2ba285cab7b050bbdc43de1f3e46cf7d420bc95c124a1c7c9d1f.json b/db/db-sqlx-maria/.sqlx/query-6d1b6e5e58ca2ba285cab7b050bbdc43de1f3e46cf7d420bc95c124a1c7c9d1f.json new file mode 100644 index 00000000..655ec872 --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-6d1b6e5e58ca2ba285cab7b050bbdc43de1f3e46cf7d420bc95c124a1c7c9d1f.json @@ -0,0 +1,12 @@ +{ + "db_name": "MySQL", + "query": "DELETE FROM mcaptcha_users WHERE name = (?)", + "describe": { + "columns": [], + "parameters": { + "Right": 1 + }, + "nullable": [] + }, + "hash": "6d1b6e5e58ca2ba285cab7b050bbdc43de1f3e46cf7d420bc95c124a1c7c9d1f" +} diff --git a/db/db-sqlx-maria/.sqlx/query-6d43e6ceb54a0ff8a803bd96dd9134b15da01d48776ac0cf3d66a2997dadce5e.json b/db/db-sqlx-maria/.sqlx/query-6d43e6ceb54a0ff8a803bd96dd9134b15da01d48776ac0cf3d66a2997dadce5e.json new file mode 100644 index 00000000..eb8c1426 --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-6d43e6ceb54a0ff8a803bd96dd9134b15da01d48776ac0cf3d66a2997dadce5e.json @@ -0,0 +1,36 @@ +{ + "db_name": "MySQL", + "query": "SELECT difficulty_factor, visitor_threshold FROM mcaptcha_levels WHERE\n config_id = (\n SELECT config_id FROM mcaptcha_config where captcha_key= (?)\n ) ORDER BY difficulty_factor ASC;", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "difficulty_factor", + "type_info": { + "type": "Long", + "flags": "NOT_NULL | NO_DEFAULT_VALUE", + "char_set": 63, + "max_size": 11 + } + }, + { + "ordinal": 1, + "name": "visitor_threshold", + "type_info": { + "type": "Long", + "flags": "NOT_NULL | NO_DEFAULT_VALUE", + "char_set": 63, + "max_size": 11 + } + } + ], + "parameters": { + "Right": 1 + }, + "nullable": [ + false, + false + ] + }, + "hash": "6d43e6ceb54a0ff8a803bd96dd9134b15da01d48776ac0cf3d66a2997dadce5e" +} diff --git a/db/db-sqlx-maria/.sqlx/query-74d68a86f852d3d85957e94ed04e8acd8e6144744f7b13e383ebcb2bcf3360ae.json b/db/db-sqlx-maria/.sqlx/query-74d68a86f852d3d85957e94ed04e8acd8e6144744f7b13e383ebcb2bcf3360ae.json new file mode 100644 index 00000000..03d7d79f --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-74d68a86f852d3d85957e94ed04e8acd8e6144744f7b13e383ebcb2bcf3360ae.json @@ -0,0 +1,12 @@ +{ + "db_name": "MySQL", + "query": "INSERT INTO mcaptcha_levels (\n difficulty_factor, \n visitor_threshold,\n config_id) VALUES (\n ?, ?, (\n SELECT config_id FROM mcaptcha_config WHERE\n captcha_key = (?) AND user_id = (\n SELECT ID FROM mcaptcha_users WHERE name = ?\n )));", + "describe": { + "columns": [], + "parameters": { + "Right": 4 + }, + "nullable": [] + }, + "hash": "74d68a86f852d3d85957e94ed04e8acd8e6144744f7b13e383ebcb2bcf3360ae" +} diff --git a/db/db-sqlx-maria/.sqlx/query-7838ade4a48068e25c6f117ee8e38f088b867b1ab08a7dd0269b76891266ace6.json b/db/db-sqlx-maria/.sqlx/query-7838ade4a48068e25c6f117ee8e38f088b867b1ab08a7dd0269b76891266ace6.json new file mode 100644 index 00000000..24d03f3f --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-7838ade4a48068e25c6f117ee8e38f088b867b1ab08a7dd0269b76891266ace6.json @@ -0,0 +1,12 @@ +{ + "db_name": "MySQL", + "query": "UPDATE mcaptcha_users set secret = ?\n WHERE name = ?", + "describe": { + "columns": [], + "parameters": { + "Right": 2 + }, + "nullable": [] + }, + "hash": "7838ade4a48068e25c6f117ee8e38f088b867b1ab08a7dd0269b76891266ace6" +} diff --git a/db/db-sqlx-maria/.sqlx/query-7894dda54cd65559fe3b81bab7df8cc848e21ed5c7f5e88951bf1c98c78ed820.json b/db/db-sqlx-maria/.sqlx/query-7894dda54cd65559fe3b81bab7df8cc848e21ed5c7f5e88951bf1c98c78ed820.json new file mode 100644 index 00000000..d2e09b3b --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-7894dda54cd65559fe3b81bab7df8cc848e21ed5c7f5e88951bf1c98c78ed820.json @@ -0,0 +1,12 @@ +{ + "db_name": "MySQL", + "query": "DELETE FROM mcaptcha_levels \n WHERE config_id = (\n SELECT config_id FROM mcaptcha_config where captcha_key= (?) \n AND user_id = (\n SELECT ID from mcaptcha_users WHERE name = ?\n )\n )", + "describe": { + "columns": [], + "parameters": { + "Right": 2 + }, + "nullable": [] + }, + "hash": "7894dda54cd65559fe3b81bab7df8cc848e21ed5c7f5e88951bf1c98c78ed820" +} diff --git a/db/db-sqlx-maria/.sqlx/query-89386c46668a2653a54687e65958af5cf7a8da268339a1f5a379ede47b3c6d2a.json b/db/db-sqlx-maria/.sqlx/query-89386c46668a2653a54687e65958af5cf7a8da268339a1f5a379ede47b3c6d2a.json new file mode 100644 index 00000000..c0af4a0b --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-89386c46668a2653a54687e65958af5cf7a8da268339a1f5a379ede47b3c6d2a.json @@ -0,0 +1,12 @@ +{ + "db_name": "MySQL", + "query": "INSERT INTO mcaptcha_notifications (\n heading, message, tx, rx, received)\n VALUES (\n ?, ?,\n (SELECT ID FROM mcaptcha_users WHERE name = ?),\n (SELECT ID FROM mcaptcha_users WHERE name = ?),\n ?\n );", + "describe": { + "columns": [], + "parameters": { + "Right": 5 + }, + "nullable": [] + }, + "hash": "89386c46668a2653a54687e65958af5cf7a8da268339a1f5a379ede47b3c6d2a" +} diff --git a/db/db-sqlx-maria/.sqlx/query-8acbf84d4801e86221d8f6324ae50488a0986182d66b20ad414bce4e2ac18eca.json b/db/db-sqlx-maria/.sqlx/query-8acbf84d4801e86221d8f6324ae50488a0986182d66b20ad414bce4e2ac18eca.json new file mode 100644 index 00000000..bf554ffb --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-8acbf84d4801e86221d8f6324ae50488a0986182d66b20ad414bce4e2ac18eca.json @@ -0,0 +1,25 @@ +{ + "db_name": "MySQL", + "query": "SELECT duration FROM mcaptcha_config \n where captcha_key= ?", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "duration", + "type_info": { + "type": "Long", + "flags": "NOT_NULL", + "char_set": 63, + "max_size": 11 + } + } + ], + "parameters": { + "Right": 1 + }, + "nullable": [ + false + ] + }, + "hash": "8acbf84d4801e86221d8f6324ae50488a0986182d66b20ad414bce4e2ac18eca" +} diff --git a/db/db-sqlx-maria/.sqlx/query-8e6026abf7c0e8ab90ee8eb7ada9f66962ab6999d3127944b058d6f96346e72f.json b/db/db-sqlx-maria/.sqlx/query-8e6026abf7c0e8ab90ee8eb7ada9f66962ab6999d3127944b058d6f96346e72f.json new file mode 100644 index 00000000..0107c301 --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-8e6026abf7c0e8ab90ee8eb7ada9f66962ab6999d3127944b058d6f96346e72f.json @@ -0,0 +1,12 @@ +{ + "db_name": "MySQL", + "query": "UPDATE mcaptcha_config SET captcha_key = ? \n WHERE captcha_key = ? AND user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?)", + "describe": { + "columns": [], + "parameters": { + "Right": 3 + }, + "nullable": [] + }, + "hash": "8e6026abf7c0e8ab90ee8eb7ada9f66962ab6999d3127944b058d6f96346e72f" +} diff --git a/db/db-sqlx-maria/.sqlx/query-8ec8bbde0c02a99f74d12e6778f123a973283e6d56b6861b30f559768617848a.json b/db/db-sqlx-maria/.sqlx/query-8ec8bbde0c02a99f74d12e6778f123a973283e6d56b6861b30f559768617848a.json new file mode 100644 index 00000000..6a1ca2ff --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-8ec8bbde0c02a99f74d12e6778f123a973283e6d56b6861b30f559768617848a.json @@ -0,0 +1,12 @@ +{ + "db_name": "MySQL", + "query": "insert into mcaptcha_users \n (name , password, email, secret) values (?, ?, ?, ?)", + "describe": { + "columns": [], + "parameters": { + "Right": 4 + }, + "nullable": [] + }, + "hash": "8ec8bbde0c02a99f74d12e6778f123a973283e6d56b6861b30f559768617848a" +} diff --git a/db/db-sqlx-maria/.sqlx/query-9c435148ed5655e79dd1e73e3566ce23b7c6d38edcedbb988c95813c5da893ed.json b/db/db-sqlx-maria/.sqlx/query-9c435148ed5655e79dd1e73e3566ce23b7c6d38edcedbb988c95813c5da893ed.json new file mode 100644 index 00000000..dca3e39f --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-9c435148ed5655e79dd1e73e3566ce23b7c6d38edcedbb988c95813c5da893ed.json @@ -0,0 +1,58 @@ +{ + "db_name": "MySQL", + "query": "SELECT `config_id`, `duration`, `name`, `captcha_key` from mcaptcha_config WHERE\n `captcha_key` = ? AND\n user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?) ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "config_id", + "type_info": { + "type": "Long", + "flags": "NOT_NULL | PRIMARY_KEY | AUTO_INCREMENT", + "char_set": 63, + "max_size": 11 + } + }, + { + "ordinal": 1, + "name": "duration", + "type_info": { + "type": "Long", + "flags": "NOT_NULL", + "char_set": 63, + "max_size": 11 + } + }, + { + "ordinal": 2, + "name": "name", + "type_info": { + "type": "VarString", + "flags": "NOT_NULL | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 400 + } + }, + { + "ordinal": 3, + "name": "captcha_key", + "type_info": { + "type": "VarString", + "flags": "NOT_NULL | UNIQUE_KEY | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 400 + } + } + ], + "parameters": { + "Right": 2 + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "9c435148ed5655e79dd1e73e3566ce23b7c6d38edcedbb988c95813c5da893ed" +} diff --git a/db/db-sqlx-maria/.sqlx/query-9cb416de904872d66af90baa0024f382ce6f8344464c607fe6e6c2572816dfc2.json b/db/db-sqlx-maria/.sqlx/query-9cb416de904872d66af90baa0024f382ce6f8344464c607fe6e6c2572816dfc2.json new file mode 100644 index 00000000..393838c6 --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-9cb416de904872d66af90baa0024f382ce6f8344464c607fe6e6c2572816dfc2.json @@ -0,0 +1,12 @@ +{ + "db_name": "MySQL", + "query": "UPDATE mcaptcha_users set email = ?\n WHERE name = ?", + "describe": { + "columns": [], + "parameters": { + "Right": 2 + }, + "nullable": [] + }, + "hash": "9cb416de904872d66af90baa0024f382ce6f8344464c607fe6e6c2572816dfc2" +} diff --git a/db/db-sqlx-maria/.sqlx/query-9e45969a0f79eab8caba41b0d91e5e3b85a1a68a49136f89fc90793c38f00041.json b/db/db-sqlx-maria/.sqlx/query-9e45969a0f79eab8caba41b0d91e5e3b85a1a68a49136f89fc90793c38f00041.json new file mode 100644 index 00000000..1d619425 --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-9e45969a0f79eab8caba41b0d91e5e3b85a1a68a49136f89fc90793c38f00041.json @@ -0,0 +1,12 @@ +{ + "db_name": "MySQL", + "query": "\n INSERT INTO\n mcaptcha_psuedo_campaign_id (config_id, psuedo_id)\n VALUES (\n (SELECT config_id FROM mcaptcha_config WHERE captcha_key = (?)),\n ?\n );", + "describe": { + "columns": [], + "parameters": { + "Right": 2 + }, + "nullable": [] + }, + "hash": "9e45969a0f79eab8caba41b0d91e5e3b85a1a68a49136f89fc90793c38f00041" +} diff --git a/db/db-sqlx-maria/.sqlx/query-9f10afb0f242f11c58389803c5e85e244cc59102b8929a21e3fcaa852d57a52c.json b/db/db-sqlx-maria/.sqlx/query-9f10afb0f242f11c58389803c5e85e244cc59102b8929a21e3fcaa852d57a52c.json new file mode 100644 index 00000000..e51905c7 --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-9f10afb0f242f11c58389803c5e85e244cc59102b8929a21e3fcaa852d57a52c.json @@ -0,0 +1,58 @@ +{ + "db_name": "MySQL", + "query": "SELECT\n id, time, difficulty_factor, worker_type\n FROM\n mcaptcha_pow_analytics\n WHERE\n config_id = (\n SELECT config_id FROM mcaptcha_config WHERE captcha_key = ?\n ) \n ORDER BY ID\n LIMIT ? OFFSET ?", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": { + "type": "Long", + "flags": "NOT_NULL | PRIMARY_KEY | AUTO_INCREMENT", + "char_set": 63, + "max_size": 11 + } + }, + { + "ordinal": 1, + "name": "time", + "type_info": { + "type": "Long", + "flags": "NOT_NULL | NO_DEFAULT_VALUE", + "char_set": 63, + "max_size": 11 + } + }, + { + "ordinal": 2, + "name": "difficulty_factor", + "type_info": { + "type": "Long", + "flags": "NOT_NULL | NO_DEFAULT_VALUE", + "char_set": 63, + "max_size": 11 + } + }, + { + "ordinal": 3, + "name": "worker_type", + "type_info": { + "type": "VarString", + "flags": "NOT_NULL | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 400 + } + } + ], + "parameters": { + "Right": 3 + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "9f10afb0f242f11c58389803c5e85e244cc59102b8929a21e3fcaa852d57a52c" +} diff --git a/db/db-sqlx-maria/.sqlx/query-a89c066db044cddfdebee6a0fd0d80a5a26dcb7ecc00a9899f5634b72ea0a952.json b/db/db-sqlx-maria/.sqlx/query-a89c066db044cddfdebee6a0fd0d80a5a26dcb7ecc00a9899f5634b72ea0a952.json new file mode 100644 index 00000000..f5f765da --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-a89c066db044cddfdebee6a0fd0d80a5a26dcb7ecc00a9899f5634b72ea0a952.json @@ -0,0 +1,25 @@ +{ + "db_name": "MySQL", + "query": "SELECT config_id from mcaptcha_config WHERE captcha_key = ?", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "config_id", + "type_info": { + "type": "Long", + "flags": "NOT_NULL | PRIMARY_KEY | AUTO_INCREMENT", + "char_set": 63, + "max_size": 11 + } + } + ], + "parameters": { + "Right": 1 + }, + "nullable": [ + false + ] + }, + "hash": "a89c066db044cddfdebee6a0fd0d80a5a26dcb7ecc00a9899f5634b72ea0a952" +} diff --git a/db/db-sqlx-maria/.sqlx/query-b9258c2494d95701d19703cf5cd05a222057a0ccad943192138b1a4a94bf823b.json b/db/db-sqlx-maria/.sqlx/query-b9258c2494d95701d19703cf5cd05a222057a0ccad943192138b1a4a94bf823b.json new file mode 100644 index 00000000..62a84422 --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-b9258c2494d95701d19703cf5cd05a222057a0ccad943192138b1a4a94bf823b.json @@ -0,0 +1,25 @@ +{ + "db_name": "MySQL", + "query": "SELECT secret FROM mcaptcha_users WHERE ID = (\n SELECT user_id FROM mcaptcha_config WHERE captcha_key = ?\n )", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "secret", + "type_info": { + "type": "VarString", + "flags": "NOT_NULL | UNIQUE_KEY | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 200 + } + } + ], + "parameters": { + "Right": 1 + }, + "nullable": [ + false + ] + }, + "hash": "b9258c2494d95701d19703cf5cd05a222057a0ccad943192138b1a4a94bf823b" +} diff --git a/db/db-sqlx-maria/.sqlx/query-b95e5a60a202cb646d5e76df8c7395e4bf881a6dd14e28e6f2e8b93e0536b331.json b/db/db-sqlx-maria/.sqlx/query-b95e5a60a202cb646d5e76df8c7395e4bf881a6dd14e28e6f2e8b93e0536b331.json new file mode 100644 index 00000000..8d918880 --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-b95e5a60a202cb646d5e76df8c7395e4bf881a6dd14e28e6f2e8b93e0536b331.json @@ -0,0 +1,12 @@ +{ + "db_name": "MySQL", + "query": "DELETE FROM mcaptcha_config where captcha_key= (?)\n AND\n user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?)", + "describe": { + "columns": [], + "parameters": { + "Right": 2 + }, + "nullable": [] + }, + "hash": "b95e5a60a202cb646d5e76df8c7395e4bf881a6dd14e28e6f2e8b93e0536b331" +} diff --git a/db/db-sqlx-maria/.sqlx/query-caa1638ee510ef62b86817e5d2baeaca8dfa432c23d7630c0e70737211a4680b.json b/db/db-sqlx-maria/.sqlx/query-caa1638ee510ef62b86817e5d2baeaca8dfa432c23d7630c0e70737211a4680b.json new file mode 100644 index 00000000..ac3347b7 --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-caa1638ee510ef62b86817e5d2baeaca8dfa432c23d7630c0e70737211a4680b.json @@ -0,0 +1,25 @@ +{ + "db_name": "MySQL", + "query": "SELECT name from mcaptcha_users WHERE email = ?", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "name", + "type_info": { + "type": "VarString", + "flags": "NOT_NULL | UNIQUE_KEY | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 400 + } + } + ], + "parameters": { + "Right": 1 + }, + "nullable": [ + false + ] + }, + "hash": "caa1638ee510ef62b86817e5d2baeaca8dfa432c23d7630c0e70737211a4680b" +} diff --git a/db/db-sqlx-maria/.sqlx/query-cad5b403470f26c565e74a1dca19b7dee066141dec0f708070067e34d5bf72cc.json b/db/db-sqlx-maria/.sqlx/query-cad5b403470f26c565e74a1dca19b7dee066141dec0f708070067e34d5bf72cc.json new file mode 100644 index 00000000..dffc0d92 --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-cad5b403470f26c565e74a1dca19b7dee066141dec0f708070067e34d5bf72cc.json @@ -0,0 +1,12 @@ +{ + "db_name": "MySQL", + "query": "UPDATE mcaptcha_users set password = ?\n WHERE name = ?", + "describe": { + "columns": [], + "parameters": { + "Right": 2 + }, + "nullable": [] + }, + "hash": "cad5b403470f26c565e74a1dca19b7dee066141dec0f708070067e34d5bf72cc" +} diff --git a/db/db-sqlx-maria/.sqlx/query-d05b84966f4e70c53789221f961bf3637f404f3ba45e880115e97ed1ba5a2809.json b/db/db-sqlx-maria/.sqlx/query-d05b84966f4e70c53789221f961bf3637f404f3ba45e880115e97ed1ba5a2809.json new file mode 100644 index 00000000..441e9e21 --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-d05b84966f4e70c53789221f961bf3637f404f3ba45e880115e97ed1ba5a2809.json @@ -0,0 +1,12 @@ +{ + "db_name": "MySQL", + "query": "INSERT INTO mcaptcha_config\n (`captcha_key`, `user_id`, `duration`, `name`)\n VALUES (?, (SELECT ID FROM mcaptcha_users WHERE name = ?), ?, ?)", + "describe": { + "columns": [], + "parameters": { + "Right": 4 + }, + "nullable": [] + }, + "hash": "d05b84966f4e70c53789221f961bf3637f404f3ba45e880115e97ed1ba5a2809" +} diff --git a/db/db-sqlx-maria/.sqlx/query-d4b92e8099cd29cfdb99aadeeada739bb6858667fc65f528ec484e98a9da21bc.json b/db/db-sqlx-maria/.sqlx/query-d4b92e8099cd29cfdb99aadeeada739bb6858667fc65f528ec484e98a9da21bc.json new file mode 100644 index 00000000..50784b9a --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-d4b92e8099cd29cfdb99aadeeada739bb6858667fc65f528ec484e98a9da21bc.json @@ -0,0 +1,25 @@ +{ + "db_name": "MySQL", + "query": "SELECT time FROM mcaptcha_pow_solved_stats \n WHERE config_id = (\n SELECT config_id FROM mcaptcha_config \n WHERE \n captcha_key = ?\n AND\n user_id = (\n SELECT \n ID FROM mcaptcha_users WHERE name = ?)) \n ORDER BY time DESC", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "time", + "type_info": { + "type": "Timestamp", + "flags": "NOT_NULL | UNSIGNED | BINARY | TIMESTAMP", + "char_set": 63, + "max_size": 19 + } + } + ], + "parameters": { + "Right": 2 + }, + "nullable": [ + false + ] + }, + "hash": "d4b92e8099cd29cfdb99aadeeada739bb6858667fc65f528ec484e98a9da21bc" +} diff --git a/db/db-sqlx-maria/.sqlx/query-daac5e937aeac2f106eb89154b431fa8bd1bd7baa95e51704fdcdf50bd970a1d.json b/db/db-sqlx-maria/.sqlx/query-daac5e937aeac2f106eb89154b431fa8bd1bd7baa95e51704fdcdf50bd970a1d.json new file mode 100644 index 00000000..dcbbd651 --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-daac5e937aeac2f106eb89154b431fa8bd1bd7baa95e51704fdcdf50bd970a1d.json @@ -0,0 +1,25 @@ +{ + "db_name": "MySQL", + "query": "SELECT time FROM mcaptcha_pow_fetched_stats\n WHERE \n config_id = (\n SELECT \n config_id FROM mcaptcha_config \n WHERE \n captcha_key = ?\n AND\n user_id = (\n SELECT \n ID FROM mcaptcha_users WHERE name = ?))\n ORDER BY time DESC", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "time", + "type_info": { + "type": "Timestamp", + "flags": "NOT_NULL | UNSIGNED | BINARY | TIMESTAMP", + "char_set": 63, + "max_size": 19 + } + } + ], + "parameters": { + "Right": 2 + }, + "nullable": [ + false + ] + }, + "hash": "daac5e937aeac2f106eb89154b431fa8bd1bd7baa95e51704fdcdf50bd970a1d" +} diff --git a/db/db-sqlx-maria/.sqlx/query-dd5ff10b88fa6f374e105b6bed9e34e0870ac8dd7ce36dfb09d13a1b7005b2eb.json b/db/db-sqlx-maria/.sqlx/query-dd5ff10b88fa6f374e105b6bed9e34e0870ac8dd7ce36dfb09d13a1b7005b2eb.json new file mode 100644 index 00000000..121209df --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-dd5ff10b88fa6f374e105b6bed9e34e0870ac8dd7ce36dfb09d13a1b7005b2eb.json @@ -0,0 +1,36 @@ +{ + "db_name": "MySQL", + "query": "SELECT name, password FROM mcaptcha_users WHERE name = ?", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "name", + "type_info": { + "type": "VarString", + "flags": "NOT_NULL | UNIQUE_KEY | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 400 + } + }, + { + "ordinal": 1, + "name": "password", + "type_info": { + "type": "Blob", + "flags": "NOT_NULL | BLOB | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 262140 + } + } + ], + "parameters": { + "Right": 1 + }, + "nullable": [ + false, + false + ] + }, + "hash": "dd5ff10b88fa6f374e105b6bed9e34e0870ac8dd7ce36dfb09d13a1b7005b2eb" +} diff --git a/db/db-sqlx-maria/.sqlx/query-dd9b4dec39405ff19af21faabb6a7c3bb3207e7e785fe15357146b88c6c27f01.json b/db/db-sqlx-maria/.sqlx/query-dd9b4dec39405ff19af21faabb6a7c3bb3207e7e785fe15357146b88c6c27f01.json new file mode 100644 index 00000000..dfd28f92 --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-dd9b4dec39405ff19af21faabb6a7c3bb3207e7e785fe15357146b88c6c27f01.json @@ -0,0 +1,25 @@ +{ + "db_name": "MySQL", + "query": "SELECT secret FROM mcaptcha_users WHERE name = ?", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "secret", + "type_info": { + "type": "VarString", + "flags": "NOT_NULL | UNIQUE_KEY | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 200 + } + } + ], + "parameters": { + "Right": 1 + }, + "nullable": [ + false + ] + }, + "hash": "dd9b4dec39405ff19af21faabb6a7c3bb3207e7e785fe15357146b88c6c27f01" +} diff --git a/db/db-sqlx-maria/.sqlx/query-df6de3b96afcfb7f364f98954995e506b19e80e7f88204405d970c360ad5e1a0.json b/db/db-sqlx-maria/.sqlx/query-df6de3b96afcfb7f364f98954995e506b19e80e7f88204405d970c360ad5e1a0.json new file mode 100644 index 00000000..eda79139 --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-df6de3b96afcfb7f364f98954995e506b19e80e7f88204405d970c360ad5e1a0.json @@ -0,0 +1,36 @@ +{ + "db_name": "MySQL", + "query": "SELECT difficulty_factor, visitor_threshold FROM mcaptcha_levels WHERE\n config_id = (\n SELECT config_id FROM mcaptcha_config where captcha_key= (?)\n AND user_id = (SELECT ID from mcaptcha_users WHERE name = ?)\n )\n ORDER BY difficulty_factor ASC;", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "difficulty_factor", + "type_info": { + "type": "Long", + "flags": "NOT_NULL | NO_DEFAULT_VALUE", + "char_set": 63, + "max_size": 11 + } + }, + { + "ordinal": 1, + "name": "visitor_threshold", + "type_info": { + "type": "Long", + "flags": "NOT_NULL | NO_DEFAULT_VALUE", + "char_set": 63, + "max_size": 11 + } + } + ], + "parameters": { + "Right": 2 + }, + "nullable": [ + false, + false + ] + }, + "hash": "df6de3b96afcfb7f364f98954995e506b19e80e7f88204405d970c360ad5e1a0" +} diff --git a/db/db-sqlx-maria/.sqlx/query-e2b0b85f2afac1cbca43ce684641bf75ef070e44ce3d00404fc6151d2f4d7bcf.json b/db/db-sqlx-maria/.sqlx/query-e2b0b85f2afac1cbca43ce684641bf75ef070e44ce3d00404fc6151d2f4d7bcf.json new file mode 100644 index 00000000..9fe6d052 --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-e2b0b85f2afac1cbca43ce684641bf75ef070e44ce3d00404fc6151d2f4d7bcf.json @@ -0,0 +1,12 @@ +{ + "db_name": "MySQL", + "query": "INSERT INTO mcaptcha_pow_solved_stats \n (config_id, time) VALUES ((SELECT config_id FROM mcaptcha_config where captcha_key= ?), ?)", + "describe": { + "columns": [], + "parameters": { + "Right": 2 + }, + "nullable": [] + }, + "hash": "e2b0b85f2afac1cbca43ce684641bf75ef070e44ce3d00404fc6151d2f4d7bcf" +} diff --git a/db/db-sqlx-maria/.sqlx/query-e4d9bf156a368dcee1433dd5ced9f1991aa15f84e0ade916433aada40f68f0aa.json b/db/db-sqlx-maria/.sqlx/query-e4d9bf156a368dcee1433dd5ced9f1991aa15f84e0ade916433aada40f68f0aa.json new file mode 100644 index 00000000..b88a380d --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-e4d9bf156a368dcee1433dd5ced9f1991aa15f84e0ade916433aada40f68f0aa.json @@ -0,0 +1,12 @@ +{ + "db_name": "MySQL", + "query": "\n DELETE FROM\n mcaptcha_psuedo_campaign_id\n WHERE config_id = (\n SELECT config_id FROM mcaptcha_config WHERE captcha_key = ?\n );", + "describe": { + "columns": [], + "parameters": { + "Right": 1 + }, + "nullable": [] + }, + "hash": "e4d9bf156a368dcee1433dd5ced9f1991aa15f84e0ade916433aada40f68f0aa" +} diff --git a/db/db-sqlx-maria/.sqlx/query-e6569a6064d0e07abea4c0bd4686cdfdaac64f0109ac40efaed06a744a2eaf5e.json b/db/db-sqlx-maria/.sqlx/query-e6569a6064d0e07abea4c0bd4686cdfdaac64f0109ac40efaed06a744a2eaf5e.json new file mode 100644 index 00000000..d6518345 --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-e6569a6064d0e07abea4c0bd4686cdfdaac64f0109ac40efaed06a744a2eaf5e.json @@ -0,0 +1,25 @@ +{ + "db_name": "MySQL", + "query": "SELECT name from mcaptcha_users WHERE name = ?", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "name", + "type_info": { + "type": "VarString", + "flags": "NOT_NULL | UNIQUE_KEY | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 400 + } + } + ], + "parameters": { + "Right": 1 + }, + "nullable": [ + false + ] + }, + "hash": "e6569a6064d0e07abea4c0bd4686cdfdaac64f0109ac40efaed06a744a2eaf5e" +} diff --git a/db/db-sqlx-maria/.sqlx/query-e91116ebce127833488130cf1060e0817e5677f39588632452b8d621688c405a.json b/db/db-sqlx-maria/.sqlx/query-e91116ebce127833488130cf1060e0817e5677f39588632452b8d621688c405a.json new file mode 100644 index 00000000..32f009da --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-e91116ebce127833488130cf1060e0817e5677f39588632452b8d621688c405a.json @@ -0,0 +1,47 @@ +{ + "db_name": "MySQL", + "query": "SELECT \n avg_traffic, \n peak_sustainable_traffic, \n broke_my_site_traffic \n FROM \n mcaptcha_sitekey_user_provided_avg_traffic \n WHERE \n config_id = (\n SELECT \n config_id \n FROM \n mcaptcha_config \n WHERE \n captcha_key = ? \n AND user_id = (\n SELECT \n id \n FROM \n mcaptcha_users \n WHERE \n NAME = ?\n )\n )\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "avg_traffic", + "type_info": { + "type": "Long", + "flags": "NOT_NULL | NO_DEFAULT_VALUE", + "char_set": 63, + "max_size": 11 + } + }, + { + "ordinal": 1, + "name": "peak_sustainable_traffic", + "type_info": { + "type": "Long", + "flags": "NOT_NULL | NO_DEFAULT_VALUE", + "char_set": 63, + "max_size": 11 + } + }, + { + "ordinal": 2, + "name": "broke_my_site_traffic", + "type_info": { + "type": "Long", + "flags": "", + "char_set": 63, + "max_size": 11 + } + } + ], + "parameters": { + "Right": 2 + }, + "nullable": [ + false, + false, + true + ] + }, + "hash": "e91116ebce127833488130cf1060e0817e5677f39588632452b8d621688c405a" +} diff --git a/db/db-sqlx-maria/.sqlx/query-ed943cbf7e16536d81010255ce2f5beb207b2b9d44cb859fa9f2233405b80ae0.json b/db/db-sqlx-maria/.sqlx/query-ed943cbf7e16536d81010255ce2f5beb207b2b9d44cb859fa9f2233405b80ae0.json new file mode 100644 index 00000000..2d136905 --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-ed943cbf7e16536d81010255ce2f5beb207b2b9d44cb859fa9f2233405b80ae0.json @@ -0,0 +1,36 @@ +{ + "db_name": "MySQL", + "query": "SELECT name, password FROM mcaptcha_users WHERE email = ?", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "name", + "type_info": { + "type": "VarString", + "flags": "NOT_NULL | UNIQUE_KEY | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 400 + } + }, + { + "ordinal": 1, + "name": "password", + "type_info": { + "type": "Blob", + "flags": "NOT_NULL | BLOB | NO_DEFAULT_VALUE", + "char_set": 224, + "max_size": 262140 + } + } + ], + "parameters": { + "Right": 1 + }, + "nullable": [ + false, + false + ] + }, + "hash": "ed943cbf7e16536d81010255ce2f5beb207b2b9d44cb859fa9f2233405b80ae0" +} diff --git a/db/db-sqlx-maria/.sqlx/query-f987c4568ab28271d87af47f473b18cf41130a483333e81d5f50199758cbb98b.json b/db/db-sqlx-maria/.sqlx/query-f987c4568ab28271d87af47f473b18cf41130a483333e81d5f50199758cbb98b.json new file mode 100644 index 00000000..9f124cf8 --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-f987c4568ab28271d87af47f473b18cf41130a483333e81d5f50199758cbb98b.json @@ -0,0 +1,12 @@ +{ + "db_name": "MySQL", + "query": "INSERT INTO mcaptcha_pow_analytics \n (config_id, time, difficulty_factor, worker_type)\n VALUES ((SELECT config_id FROM mcaptcha_config where captcha_key= ?), ?, ?, ?)", + "describe": { + "columns": [], + "parameters": { + "Right": 4 + }, + "nullable": [] + }, + "hash": "f987c4568ab28271d87af47f473b18cf41130a483333e81d5f50199758cbb98b" +} diff --git a/db/db-sqlx-maria/.sqlx/query-f9f2ed1b2f47828d5d976d2e470e106d54b8a2357f9d525ef0cdb1f7965aa61c.json b/db/db-sqlx-maria/.sqlx/query-f9f2ed1b2f47828d5d976d2e470e106d54b8a2357f9d525ef0cdb1f7965aa61c.json new file mode 100644 index 00000000..2916120b --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-f9f2ed1b2f47828d5d976d2e470e106d54b8a2357f9d525ef0cdb1f7965aa61c.json @@ -0,0 +1,12 @@ +{ + "db_name": "MySQL", + "query": "-- SPDX-FileCopyrightText: 2023 Aravinth Manivannan \n--\n-- SPDX-License-Identifier: AGPL-3.0-or-later\n\n-- mark a notification as read\nUPDATE mcaptcha_notifications\n SET read_notification = TRUE\nWHERE \n mcaptcha_notifications.id = ?\nAND\n mcaptcha_notifications.rx = (\n SELECT\n id\n FROM\n mcaptcha_users\n WHERE\n name = ?\n );\n", + "describe": { + "columns": [], + "parameters": { + "Right": 2 + }, + "nullable": [] + }, + "hash": "f9f2ed1b2f47828d5d976d2e470e106d54b8a2357f9d525ef0cdb1f7965aa61c" +} diff --git a/db/db-sqlx-maria/.sqlx/query-fc717ff0827ccfaa1cc61a71cc7f71c348ebb03d35895c54b011c03121ad2385.json b/db/db-sqlx-maria/.sqlx/query-fc717ff0827ccfaa1cc61a71cc7f71c348ebb03d35895c54b011c03121ad2385.json new file mode 100644 index 00000000..17145d61 --- /dev/null +++ b/db/db-sqlx-maria/.sqlx/query-fc717ff0827ccfaa1cc61a71cc7f71c348ebb03d35895c54b011c03121ad2385.json @@ -0,0 +1,12 @@ +{ + "db_name": "MySQL", + "query": "DELETE FROM mcaptcha_sitekey_user_provided_avg_traffic\n WHERE config_id = (\n SELECT config_id \n FROM \n mcaptcha_config \n WHERE\n captcha_key = ?\n AND \n user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?)\n );", + "describe": { + "columns": [], + "parameters": { + "Right": 2 + }, + "nullable": [] + }, + "hash": "fc717ff0827ccfaa1cc61a71cc7f71c348ebb03d35895c54b011c03121ad2385" +} diff --git a/db/db-sqlx-maria/Cargo.toml b/db/db-sqlx-maria/Cargo.toml index ab1aa8a7..b5e8e59a 100644 --- a/db/db-sqlx-maria/Cargo.toml +++ b/db/db-sqlx-maria/Cargo.toml @@ -12,11 +12,11 @@ authors = ["realaravinth "] async-trait = "0.1.51" db-core = {path = "../db-core"} futures = "0.3.15" -sqlx = { version = "0.5.13", features = [ "runtime-actix-rustls", "mysql", "time", "offline" ] } +sqlx = { version = "0.7", features = [ "runtime-tokio-rustls", "mysql", "time"] } uuid = { version = "1.4.0", features = ["v4", "serde"] } [dev-dependencies] actix-rt = "2" -sqlx = { version = "0.5.13", features = [ "runtime-actix-rustls", "mysql", "time", "offline" ] } +sqlx = { version = "0.7", features = [ "runtime-tokio-rustls", "mysql", "time" ] } db-core = {path = "../db-core", features = ["test"]} url = { version = "2.2.2", features = ["serde"] } diff --git a/db/db-sqlx-maria/src/lib.rs b/db/db-sqlx-maria/src/lib.rs index f3b0f7a8..94c359a3 100644 --- a/db/db-sqlx-maria/src/lib.rs +++ b/db/db-sqlx-maria/src/lib.rs @@ -49,7 +49,6 @@ pub mod dev { pub mod prelude { pub use super::*; - pub use db_core::prelude::*; } #[async_trait] @@ -61,7 +60,7 @@ impl Connect for ConnectionOptions { let mut connect_options = sqlx::mysql::MySqlConnectOptions::from_str(&fresh.url).unwrap(); if fresh.disable_logging { - connect_options.disable_statement_logging(); + connect_options = connect_options.disable_statement_logging(); } fresh .pool_options diff --git a/db/db-sqlx-postgres/.sqlx/query-017576128f1c63aee062799a33f872457fe19f5d6429d0af312dc00c244b31cb.json b/db/db-sqlx-postgres/.sqlx/query-017576128f1c63aee062799a33f872457fe19f5d6429d0af312dc00c244b31cb.json new file mode 100644 index 00000000..050aa6f9 --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-017576128f1c63aee062799a33f872457fe19f5d6429d0af312dc00c244b31cb.json @@ -0,0 +1,42 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id, time, difficulty_factor, worker_type FROM mcaptcha_pow_analytics\n WHERE \n config_id = (\n SELECT \n config_id FROM mcaptcha_config \n WHERE \n key = $1\n )\n ORDER BY ID\n OFFSET $2 LIMIT $3\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Int4" + }, + { + "ordinal": 1, + "name": "time", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "difficulty_factor", + "type_info": "Int4" + }, + { + "ordinal": 3, + "name": "worker_type", + "type_info": "Varchar" + } + ], + "parameters": { + "Left": [ + "Text", + "Int8", + "Int8" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "017576128f1c63aee062799a33f872457fe19f5d6429d0af312dc00c244b31cb" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-02deb524bb12632af9b7883975f75fdc30d6775d836aff647add1dffd1a4bc00.json b/db/db-sqlx-postgres/.sqlx/query-02deb524bb12632af9b7883975f75fdc30d6775d836aff647add1dffd1a4bc00.json new file mode 100644 index 00000000..6f56b076 --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-02deb524bb12632af9b7883975f75fdc30d6775d836aff647add1dffd1a4bc00.json @@ -0,0 +1,41 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT config_id, duration, name, key from mcaptcha_config WHERE\n key = $1 AND\n user_id = (SELECT ID FROM mcaptcha_users WHERE name = $2) ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "config_id", + "type_info": "Int4" + }, + { + "ordinal": 1, + "name": "duration", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "name", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "key", + "type_info": "Varchar" + } + ], + "parameters": { + "Left": [ + "Text", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "02deb524bb12632af9b7883975f75fdc30d6775d836aff647add1dffd1a4bc00" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-044e2036a518de2ccac9318ccba07f7ce10e4a1c1d51d0128ea5e8cb94358ac5.json b/db/db-sqlx-postgres/.sqlx/query-044e2036a518de2ccac9318ccba07f7ce10e4a1c1d51d0128ea5e8cb94358ac5.json new file mode 100644 index 00000000..68524f15 --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-044e2036a518de2ccac9318ccba07f7ce10e4a1c1d51d0128ea5e8cb94358ac5.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO mcaptcha_pow_confirmed_stats \n (config_id, time) VALUES ((SELECT config_id FROM mcaptcha_config WHERE key = $1), $2)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Text", + "Timestamptz" + ] + }, + "nullable": [] + }, + "hash": "044e2036a518de2ccac9318ccba07f7ce10e4a1c1d51d0128ea5e8cb94358ac5" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-0840af95cc17c8ea6fc994e53696d4dec39ef9b4b6dd6c58c21cc44ccbb4bd09.json b/db/db-sqlx-postgres/.sqlx/query-0840af95cc17c8ea6fc994e53696d4dec39ef9b4b6dd6c58c21cc44ccbb4bd09.json new file mode 100644 index 00000000..ab2bb228 --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-0840af95cc17c8ea6fc994e53696d4dec39ef9b4b6dd6c58c21cc44ccbb4bd09.json @@ -0,0 +1,18 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO mcaptcha_sitekey_user_provided_avg_traffic (\n config_id,\n avg_traffic,\n peak_sustainable_traffic,\n broke_my_site_traffic\n ) VALUES ( \n (SELECT config_id FROM mcaptcha_config WHERE key = ($1)\n AND user_id = (SELECT ID FROM mcaptcha_users WHERE name = $2)\n ), $3, $4, $5)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Text", + "Text", + "Int4", + "Int4", + "Int4" + ] + }, + "nullable": [] + }, + "hash": "0840af95cc17c8ea6fc994e53696d4dec39ef9b4b6dd6c58c21cc44ccbb4bd09" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-0e7a1a38019c5e88ebd096fc5f6031aaa7f337fe735aa44c4e31bd6e51163749.json b/db/db-sqlx-postgres/.sqlx/query-0e7a1a38019c5e88ebd096fc5f6031aaa7f337fe735aa44c4e31bd6e51163749.json new file mode 100644 index 00000000..36994fc2 --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-0e7a1a38019c5e88ebd096fc5f6031aaa7f337fe735aa44c4e31bd6e51163749.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM mcaptcha_sitekey_user_provided_avg_traffic\n WHERE config_id = (\n SELECT config_id \n FROM \n mcaptcha_config \n WHERE\n key = ($1) \n AND \n user_id = (SELECT ID FROM mcaptcha_users WHERE name = $2)\n );", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Text", + "Text" + ] + }, + "nullable": [] + }, + "hash": "0e7a1a38019c5e88ebd096fc5f6031aaa7f337fe735aa44c4e31bd6e51163749" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-16864df9cf9a69c299d9ab68bac559c48f4fc433541a10f7c1b60717df2b820e.json b/db/db-sqlx-postgres/.sqlx/query-16864df9cf9a69c299d9ab68bac559c48f4fc433541a10f7c1b60717df2b820e.json new file mode 100644 index 00000000..f4299db6 --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-16864df9cf9a69c299d9ab68bac559c48f4fc433541a10f7c1b60717df2b820e.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT key, name, config_id, duration FROM mcaptcha_config WHERE\n user_id = (SELECT ID FROM mcaptcha_users WHERE name = $1) ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "key", + "type_info": "Varchar" + }, + { + "ordinal": 1, + "name": "name", + "type_info": "Varchar" + }, + { + "ordinal": 2, + "name": "config_id", + "type_info": "Int4" + }, + { + "ordinal": 3, + "name": "duration", + "type_info": "Int4" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "16864df9cf9a69c299d9ab68bac559c48f4fc433541a10f7c1b60717df2b820e" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-1e9fe69b23e4bfa7bb369455753100307e334e8dbaf02ff37cda08992fe95910.json b/db/db-sqlx-postgres/.sqlx/query-1e9fe69b23e4bfa7bb369455753100307e334e8dbaf02ff37cda08992fe95910.json new file mode 100644 index 00000000..5a567f56 --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-1e9fe69b23e4bfa7bb369455753100307e334e8dbaf02ff37cda08992fe95910.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE mcaptcha_users set name = $1\n WHERE name = $2", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Varchar", + "Text" + ] + }, + "nullable": [] + }, + "hash": "1e9fe69b23e4bfa7bb369455753100307e334e8dbaf02ff37cda08992fe95910" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-213ac909efb60f7f5e095fe2d3d1ec4f98fde7d84de011272c788aaf825b6ae2.json b/db/db-sqlx-postgres/.sqlx/query-213ac909efb60f7f5e095fe2d3d1ec4f98fde7d84de011272c788aaf825b6ae2.json new file mode 100644 index 00000000..15f92119 --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-213ac909efb60f7f5e095fe2d3d1ec4f98fde7d84de011272c788aaf825b6ae2.json @@ -0,0 +1,46 @@ +{ + "db_name": "PostgreSQL", + "query": "-- SPDX-FileCopyrightText: 2023 Aravinth Manivannan \n--\n-- SPDX-License-Identifier: AGPL-3.0-or-later\n\n-- gets all unread notifications a user has\nSELECT \n mcaptcha_notifications.id,\n mcaptcha_notifications.heading,\n mcaptcha_notifications.message,\n mcaptcha_notifications.received,\n mcaptcha_users.name\nFROM\n mcaptcha_notifications \nINNER JOIN \n mcaptcha_users \nON \n mcaptcha_notifications.tx = mcaptcha_users.id\nWHERE \n mcaptcha_notifications.rx = (\n SELECT \n id \n FROM \n mcaptcha_users\n WHERE\n name = $1\n )\nAND \n mcaptcha_notifications.read IS NULL;\n", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Int4" + }, + { + "ordinal": 1, + "name": "heading", + "type_info": "Varchar" + }, + { + "ordinal": 2, + "name": "message", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "received", + "type_info": "Timestamptz" + }, + { + "ordinal": 4, + "name": "name", + "type_info": "Varchar" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false, + false + ] + }, + "hash": "213ac909efb60f7f5e095fe2d3d1ec4f98fde7d84de011272c788aaf825b6ae2" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-21cdf28d8962389d22c8ddefdad82780f5316737e3d833623512aa12a54a026a.json b/db/db-sqlx-postgres/.sqlx/query-21cdf28d8962389d22c8ddefdad82780f5316737e3d833623512aa12a54a026a.json new file mode 100644 index 00000000..a3ec27bc --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-21cdf28d8962389d22c8ddefdad82780f5316737e3d833623512aa12a54a026a.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT\n key\n FROM\n mcaptcha_config\n WHERE\n config_id = (\n SELECT\n config_id\n FROM\n mcaptcha_psuedo_campaign_id\n WHERE\n psuedo_id = $1\n );", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "key", + "type_info": "Varchar" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false + ] + }, + "hash": "21cdf28d8962389d22c8ddefdad82780f5316737e3d833623512aa12a54a026a" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-307245aaf5b0d692448b80358d6916aa50c507b35e724d66c9b16a16b60e1b38.json b/db/db-sqlx-postgres/.sqlx/query-307245aaf5b0d692448b80358d6916aa50c507b35e724d66c9b16a16b60e1b38.json new file mode 100644 index 00000000..ce4c13f6 --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-307245aaf5b0d692448b80358d6916aa50c507b35e724d66c9b16a16b60e1b38.json @@ -0,0 +1,17 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO mcaptcha_config\n (key, user_id, duration, name)\n VALUES ($1, (SELECT ID FROM mcaptcha_users WHERE name = $2), $3, $4)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Varchar", + "Text", + "Int4", + "Varchar" + ] + }, + "nullable": [] + }, + "hash": "307245aaf5b0d692448b80358d6916aa50c507b35e724d66c9b16a16b60e1b38" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-30ba202b601dd07f41798775c7c59fde7deeae759ec959df46734a66ffd78df7.json b/db/db-sqlx-postgres/.sqlx/query-30ba202b601dd07f41798775c7c59fde7deeae759ec959df46734a66ffd78df7.json new file mode 100644 index 00000000..876a834d --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-30ba202b601dd07f41798775c7c59fde7deeae759ec959df46734a66ffd78df7.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT email FROM mcaptcha_users WHERE name = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "email", + "type_info": "Varchar" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + true + ] + }, + "hash": "30ba202b601dd07f41798775c7c59fde7deeae759ec959df46734a66ffd78df7" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-30d8945806b4c68b6da800395f61c1e480839093bfcda9c693bf1972a65c7d79.json b/db/db-sqlx-postgres/.sqlx/query-30d8945806b4c68b6da800395f61c1e480839093bfcda9c693bf1972a65c7d79.json new file mode 100644 index 00000000..ff652cfc --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-30d8945806b4c68b6da800395f61c1e480839093bfcda9c693bf1972a65c7d79.json @@ -0,0 +1,14 @@ +{ + "db_name": "PostgreSQL", + "query": "\n DELETE FROM\n mcaptcha_psuedo_campaign_id\n WHERE config_id = (\n SELECT config_id FROM mcaptcha_config WHERE key = ($1)\n );", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [] + }, + "hash": "30d8945806b4c68b6da800395f61c1e480839093bfcda9c693bf1972a65c7d79" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-3b1c8128fc48b16d8e8ea6957dd4fbc0eb19ae64748fd7824e9f5e1901dd1726.json b/db/db-sqlx-postgres/.sqlx/query-3b1c8128fc48b16d8e8ea6957dd4fbc0eb19ae64748fd7824e9f5e1901dd1726.json new file mode 100644 index 00000000..fe3ff288 --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-3b1c8128fc48b16d8e8ea6957dd4fbc0eb19ae64748fd7824e9f5e1901dd1726.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE mcaptcha_users set secret = $1\n WHERE name = $2", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Varchar", + "Text" + ] + }, + "nullable": [] + }, + "hash": "3b1c8128fc48b16d8e8ea6957dd4fbc0eb19ae64748fd7824e9f5e1901dd1726" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-3eb1c43ffd2378c4dd59975568c3a180b72d13008f294a91f3e76b785dba295b.json b/db/db-sqlx-postgres/.sqlx/query-3eb1c43ffd2378c4dd59975568c3a180b72d13008f294a91f3e76b785dba295b.json new file mode 100644 index 00000000..391360eb --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-3eb1c43ffd2378c4dd59975568c3a180b72d13008f294a91f3e76b785dba295b.json @@ -0,0 +1,23 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT EXISTS (\n SELECT 1 from mcaptcha_config WHERE key = $1 \n AND user_id = (SELECT ID FROM mcaptcha_users WHERE name = $2)\n )", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "exists", + "type_info": "Bool" + } + ], + "parameters": { + "Left": [ + "Text", + "Text" + ] + }, + "nullable": [ + null + ] + }, + "hash": "3eb1c43ffd2378c4dd59975568c3a180b72d13008f294a91f3e76b785dba295b" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-4303f5c6ef98e0de9d8d3c2d781d3ffaa3dee5f7d27db831d327b26f03ba9d68.json b/db/db-sqlx-postgres/.sqlx/query-4303f5c6ef98e0de9d8d3c2d781d3ffaa3dee5f7d27db831d327b26f03ba9d68.json new file mode 100644 index 00000000..ac538f32 --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-4303f5c6ef98e0de9d8d3c2d781d3ffaa3dee5f7d27db831d327b26f03ba9d68.json @@ -0,0 +1,23 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT time FROM mcaptcha_pow_confirmed_stats \n WHERE \n config_id = (\n SELECT config_id FROM mcaptcha_config \n WHERE \n key = $1\n AND\n user_id = (\n SELECT \n ID FROM mcaptcha_users WHERE name = $2))\n ORDER BY time DESC", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "time", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Text", + "Text" + ] + }, + "nullable": [ + false + ] + }, + "hash": "4303f5c6ef98e0de9d8d3c2d781d3ffaa3dee5f7d27db831d327b26f03ba9d68" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-45d9e9fb6344fe3a18c2529d50c935d3837bfe25c96595beb6970d6067720578.json b/db/db-sqlx-postgres/.sqlx/query-45d9e9fb6344fe3a18c2529d50c935d3837bfe25c96595beb6970d6067720578.json new file mode 100644 index 00000000..0f20e3ad --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-45d9e9fb6344fe3a18c2529d50c935d3837bfe25c96595beb6970d6067720578.json @@ -0,0 +1,17 @@ +{ + "db_name": "PostgreSQL", + "query": "insert into mcaptcha_users \n (name , password, email, secret) values ($1, $2, $3, $4)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Varchar", + "Text", + "Varchar", + "Varchar" + ] + }, + "nullable": [] + }, + "hash": "45d9e9fb6344fe3a18c2529d50c935d3837bfe25c96595beb6970d6067720578" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-47fa50aecfb1499b0a18fa9299643017a1a8d69d4e9980032e0d8f745465d14f.json b/db/db-sqlx-postgres/.sqlx/query-47fa50aecfb1499b0a18fa9299643017a1a8d69d4e9980032e0d8f745465d14f.json new file mode 100644 index 00000000..a0a241ce --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-47fa50aecfb1499b0a18fa9299643017a1a8d69d4e9980032e0d8f745465d14f.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT EXISTS (SELECT 1 from mcaptcha_users WHERE email = $1)", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "exists", + "type_info": "Bool" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + null + ] + }, + "hash": "47fa50aecfb1499b0a18fa9299643017a1a8d69d4e9980032e0d8f745465d14f" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-494d2aed281e1408aeda3606b0814db75aea2878783a2e2f11a4feb6fc48e938.json b/db/db-sqlx-postgres/.sqlx/query-494d2aed281e1408aeda3606b0814db75aea2878783a2e2f11a4feb6fc48e938.json new file mode 100644 index 00000000..c98893a7 --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-494d2aed281e1408aeda3606b0814db75aea2878783a2e2f11a4feb6fc48e938.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT secret FROM mcaptcha_users WHERE ID = (\n SELECT user_id FROM mcaptcha_config WHERE key = $1\n )", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "secret", + "type_info": "Varchar" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false + ] + }, + "hash": "494d2aed281e1408aeda3606b0814db75aea2878783a2e2f11a4feb6fc48e938" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-4a5dfbc5aeb2bab290a09640cc25223d484fbc7549e5bc54f33bab8616725031.json b/db/db-sqlx-postgres/.sqlx/query-4a5dfbc5aeb2bab290a09640cc25223d484fbc7549e5bc54f33bab8616725031.json new file mode 100644 index 00000000..3ddd34e6 --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-4a5dfbc5aeb2bab290a09640cc25223d484fbc7549e5bc54f33bab8616725031.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT EXISTS (SELECT 1 from mcaptcha_config WHERE key = $1)", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "exists", + "type_info": "Bool" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + null + ] + }, + "hash": "4a5dfbc5aeb2bab290a09640cc25223d484fbc7549e5bc54f33bab8616725031" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-507bea10c7f8417c5b1430211d0137299cd561333bf47f7b4887d0ef801d1ea4.json b/db/db-sqlx-postgres/.sqlx/query-507bea10c7f8417c5b1430211d0137299cd561333bf47f7b4887d0ef801d1ea4.json new file mode 100644 index 00000000..97cf3ee2 --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-507bea10c7f8417c5b1430211d0137299cd561333bf47f7b4887d0ef801d1ea4.json @@ -0,0 +1,16 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE mcaptcha_config SET key = $1 \n WHERE key = $2 AND user_id = (SELECT ID FROM mcaptcha_users WHERE name = $3)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Varchar", + "Text", + "Text" + ] + }, + "nullable": [] + }, + "hash": "507bea10c7f8417c5b1430211d0137299cd561333bf47f7b4887d0ef801d1ea4" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-570c22f19fe0b97d78086038c8ef82509dce0bae704d80f9f031c1c47e6a6572.json b/db/db-sqlx-postgres/.sqlx/query-570c22f19fe0b97d78086038c8ef82509dce0bae704d80f9f031c1c47e6a6572.json new file mode 100644 index 00000000..a5533c87 --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-570c22f19fe0b97d78086038c8ef82509dce0bae704d80f9f031c1c47e6a6572.json @@ -0,0 +1,17 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE mcaptcha_config SET name = $1, duration = $2\n WHERE user_id = (SELECT ID FROM mcaptcha_users WHERE name = $3)\n AND key = $4", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Varchar", + "Int4", + "Text", + "Text" + ] + }, + "nullable": [] + }, + "hash": "570c22f19fe0b97d78086038c8ef82509dce0bae704d80f9f031c1c47e6a6572" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-717771c42737feb3f4ca13f2ab11361073ea17b55562a103f660149bf049c5c6.json b/db/db-sqlx-postgres/.sqlx/query-717771c42737feb3f4ca13f2ab11361073ea17b55562a103f660149bf049c5c6.json new file mode 100644 index 00000000..31e38215 --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-717771c42737feb3f4ca13f2ab11361073ea17b55562a103f660149bf049c5c6.json @@ -0,0 +1,29 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT difficulty_factor, visitor_threshold FROM mcaptcha_levels WHERE\n config_id = (\n SELECT config_id FROM mcaptcha_config WHERE key = ($1)\n AND user_id = (SELECT ID from mcaptcha_users WHERE name = $2)\n )\n ORDER BY difficulty_factor ASC;", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "difficulty_factor", + "type_info": "Int4" + }, + { + "ordinal": 1, + "name": "visitor_threshold", + "type_info": "Int4" + } + ], + "parameters": { + "Left": [ + "Text", + "Text" + ] + }, + "nullable": [ + false, + false + ] + }, + "hash": "717771c42737feb3f4ca13f2ab11361073ea17b55562a103f660149bf049c5c6" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-726a794f7599b78ab749d9f887f5c28db38f072b41f691bde35d23ba0dd72409.json b/db/db-sqlx-postgres/.sqlx/query-726a794f7599b78ab749d9f887f5c28db38f072b41f691bde35d23ba0dd72409.json new file mode 100644 index 00000000..2b299324 --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-726a794f7599b78ab749d9f887f5c28db38f072b41f691bde35d23ba0dd72409.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO mcaptcha_pow_fetched_stats \n (config_id, time) VALUES ((SELECT config_id FROM mcaptcha_config WHERE key = $1), $2)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Text", + "Timestamptz" + ] + }, + "nullable": [] + }, + "hash": "726a794f7599b78ab749d9f887f5c28db38f072b41f691bde35d23ba0dd72409" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-7c96ae73dd73c1b0e073e3ac78f87f4cba23fdb2cdbed9ba9b0d55f33655582e.json b/db/db-sqlx-postgres/.sqlx/query-7c96ae73dd73c1b0e073e3ac78f87f4cba23fdb2cdbed9ba9b0d55f33655582e.json new file mode 100644 index 00000000..ec64cfbf --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-7c96ae73dd73c1b0e073e3ac78f87f4cba23fdb2cdbed9ba9b0d55f33655582e.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM mcaptcha_levels \n WHERE config_id = (\n SELECT config_id FROM mcaptcha_config where key = ($1) \n AND user_id = (\n SELECT ID from mcaptcha_users WHERE name = $2\n )\n )", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Text", + "Text" + ] + }, + "nullable": [] + }, + "hash": "7c96ae73dd73c1b0e073e3ac78f87f4cba23fdb2cdbed9ba9b0d55f33655582e" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-81c779ed4bb59f8b94dea730cbda31f7733ef16d509a3ed607388b5ddef74638.json b/db/db-sqlx-postgres/.sqlx/query-81c779ed4bb59f8b94dea730cbda31f7733ef16d509a3ed607388b5ddef74638.json new file mode 100644 index 00000000..57ed4ac9 --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-81c779ed4bb59f8b94dea730cbda31f7733ef16d509a3ed607388b5ddef74638.json @@ -0,0 +1,16 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO mcaptcha_users \n (name , password, secret) VALUES ($1, $2, $3)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Varchar", + "Text", + "Varchar" + ] + }, + "nullable": [] + }, + "hash": "81c779ed4bb59f8b94dea730cbda31f7733ef16d509a3ed607388b5ddef74638" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-839dfdfc3543b12128cb2b44bf356cd81f3da380963e5684ec3624a0ea4f9547.json b/db/db-sqlx-postgres/.sqlx/query-839dfdfc3543b12128cb2b44bf356cd81f3da380963e5684ec3624a0ea4f9547.json new file mode 100644 index 00000000..26108301 --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-839dfdfc3543b12128cb2b44bf356cd81f3da380963e5684ec3624a0ea4f9547.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT psuedo_id FROM\n mcaptcha_psuedo_campaign_id\n WHERE\n config_id = (SELECT config_id FROM mcaptcha_config WHERE key = ($1));\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "psuedo_id", + "type_info": "Varchar" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false + ] + }, + "hash": "839dfdfc3543b12128cb2b44bf356cd81f3da380963e5684ec3624a0ea4f9547" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-84484cb6892db29121816bc5bff5702b9e857e20aa14e79d080d78ae7593153b.json b/db/db-sqlx-postgres/.sqlx/query-84484cb6892db29121816bc5bff5702b9e857e20aa14e79d080d78ae7593153b.json new file mode 100644 index 00000000..19912a95 --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-84484cb6892db29121816bc5bff5702b9e857e20aa14e79d080d78ae7593153b.json @@ -0,0 +1,23 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT time FROM mcaptcha_pow_solved_stats \n WHERE config_id = (\n SELECT config_id FROM mcaptcha_config \n WHERE \n key = $1\n AND\n user_id = (\n SELECT \n ID FROM mcaptcha_users WHERE name = $2)) \n ORDER BY time DESC", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "time", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Text", + "Text" + ] + }, + "nullable": [ + false + ] + }, + "hash": "84484cb6892db29121816bc5bff5702b9e857e20aa14e79d080d78ae7593153b" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-9753721856a47438c5e72f28fd9d149db10c48e677b4613bf3f1e8487908aac8.json b/db/db-sqlx-postgres/.sqlx/query-9753721856a47438c5e72f28fd9d149db10c48e677b4613bf3f1e8487908aac8.json new file mode 100644 index 00000000..f2f38114 --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-9753721856a47438c5e72f28fd9d149db10c48e677b4613bf3f1e8487908aac8.json @@ -0,0 +1,28 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT difficulty_factor, visitor_threshold FROM mcaptcha_levels WHERE\n config_id = (\n SELECT config_id FROM mcaptcha_config WHERE key = ($1)\n ) ORDER BY difficulty_factor ASC;", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "difficulty_factor", + "type_info": "Int4" + }, + { + "ordinal": 1, + "name": "visitor_threshold", + "type_info": "Int4" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false, + false + ] + }, + "hash": "9753721856a47438c5e72f28fd9d149db10c48e677b4613bf3f1e8487908aac8" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-ad196ab3ef9dc32f6de2313577ccd6c26eae9ab19df5f71ce182651983efb99a.json b/db/db-sqlx-postgres/.sqlx/query-ad196ab3ef9dc32f6de2313577ccd6c26eae9ab19df5f71ce182651983efb99a.json new file mode 100644 index 00000000..d6f8b18d --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-ad196ab3ef9dc32f6de2313577ccd6c26eae9ab19df5f71ce182651983efb99a.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT duration FROM mcaptcha_config \n WHERE key = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "duration", + "type_info": "Int4" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false + ] + }, + "hash": "ad196ab3ef9dc32f6de2313577ccd6c26eae9ab19df5f71ce182651983efb99a" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-ad23588ee4bcbb13e208460ce21e2fa9f1373893934b530b339fea10360b34a8.json b/db/db-sqlx-postgres/.sqlx/query-ad23588ee4bcbb13e208460ce21e2fa9f1373893934b530b339fea10360b34a8.json new file mode 100644 index 00000000..82676020 --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-ad23588ee4bcbb13e208460ce21e2fa9f1373893934b530b339fea10360b34a8.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT EXISTS (SELECT 1 from mcaptcha_users WHERE name = $1)", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "exists", + "type_info": "Bool" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + null + ] + }, + "hash": "ad23588ee4bcbb13e208460ce21e2fa9f1373893934b530b339fea10360b34a8" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-af47990880a92c63d1cf5192203899c72621479dc6bb47859fb4498264b78033.json b/db/db-sqlx-postgres/.sqlx/query-af47990880a92c63d1cf5192203899c72621479dc6bb47859fb4498264b78033.json new file mode 100644 index 00000000..b46ae4f7 --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-af47990880a92c63d1cf5192203899c72621479dc6bb47859fb4498264b78033.json @@ -0,0 +1,17 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO mcaptcha_pow_analytics \n (config_id, time, difficulty_factor, worker_type)\n VALUES ((SELECT config_id FROM mcaptcha_config WHERE key = $1), $2, $3, $4)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Text", + "Int4", + "Int4", + "Varchar" + ] + }, + "nullable": [] + }, + "hash": "af47990880a92c63d1cf5192203899c72621479dc6bb47859fb4498264b78033" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-b465e974155aeaaa128896d4261505a32845dbe52dac07908c1d16810bfde4dc.json b/db/db-sqlx-postgres/.sqlx/query-b465e974155aeaaa128896d4261505a32845dbe52dac07908c1d16810bfde4dc.json new file mode 100644 index 00000000..fc656a6a --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-b465e974155aeaaa128896d4261505a32845dbe52dac07908c1d16810bfde4dc.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "-- SPDX-FileCopyrightText: 2023 Aravinth Manivannan \n--\n-- SPDX-License-Identifier: AGPL-3.0-or-later\n\n-- mark a notification as read\nUPDATE mcaptcha_notifications\n SET read = TRUE\nWHERE \n mcaptcha_notifications.id = $1\nAND\n mcaptcha_notifications.rx = (\n SELECT\n id\n FROM\n mcaptcha_users\n WHERE\n name = $2\n );\n", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int4", + "Text" + ] + }, + "nullable": [] + }, + "hash": "b465e974155aeaaa128896d4261505a32845dbe52dac07908c1d16810bfde4dc" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-b67da576ff30a1bc8b1c0a79eff07f0622bd9ea035d3de15b91f5e1e8a5fda9b.json b/db/db-sqlx-postgres/.sqlx/query-b67da576ff30a1bc8b1c0a79eff07f0622bd9ea035d3de15b91f5e1e8a5fda9b.json new file mode 100644 index 00000000..8a49c095 --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-b67da576ff30a1bc8b1c0a79eff07f0622bd9ea035d3de15b91f5e1e8a5fda9b.json @@ -0,0 +1,14 @@ +{ + "db_name": "PostgreSQL", + "query": "\n DELETE FROM\n mcaptcha_pow_analytics\n WHERE\n config_id = (\n SELECT config_id FROM mcaptcha_config WHERE key = $1\n )\n ", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [] + }, + "hash": "b67da576ff30a1bc8b1c0a79eff07f0622bd9ea035d3de15b91f5e1e8a5fda9b" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-b97d810814fbeb2df19f47bcfa381bc6fb7ac6832d040b377cf4fca2ca896cfb.json b/db/db-sqlx-postgres/.sqlx/query-b97d810814fbeb2df19f47bcfa381bc6fb7ac6832d040b377cf4fca2ca896cfb.json new file mode 100644 index 00000000..a89812c1 --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-b97d810814fbeb2df19f47bcfa381bc6fb7ac6832d040b377cf4fca2ca896cfb.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE mcaptcha_users set email = $1\n WHERE name = $2", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Varchar", + "Text" + ] + }, + "nullable": [] + }, + "hash": "b97d810814fbeb2df19f47bcfa381bc6fb7ac6832d040b377cf4fca2ca896cfb" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-bb6443e1df704294abbbdb563f1bf46660d0f3462c0c35c10a533446fc7c53e8.json b/db/db-sqlx-postgres/.sqlx/query-bb6443e1df704294abbbdb563f1bf46660d0f3462c0c35c10a533446fc7c53e8.json new file mode 100644 index 00000000..a0812b72 --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-bb6443e1df704294abbbdb563f1bf46660d0f3462c0c35c10a533446fc7c53e8.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM mcaptcha_config WHERE key = ($1)\n AND\n user_id = (SELECT ID FROM mcaptcha_users WHERE name = $2)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Text", + "Text" + ] + }, + "nullable": [] + }, + "hash": "bb6443e1df704294abbbdb563f1bf46660d0f3462c0c35c10a533446fc7c53e8" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-bdf2e2781bfa2e9c81c18ef8df7230809d3b20274685a35b1c544804f2a58241.json b/db/db-sqlx-postgres/.sqlx/query-bdf2e2781bfa2e9c81c18ef8df7230809d3b20274685a35b1c544804f2a58241.json new file mode 100644 index 00000000..8af267af --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-bdf2e2781bfa2e9c81c18ef8df7230809d3b20274685a35b1c544804f2a58241.json @@ -0,0 +1,28 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT name, password FROM mcaptcha_users WHERE email = ($1)", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "name", + "type_info": "Varchar" + }, + { + "ordinal": 1, + "name": "password", + "type_info": "Text" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false, + false + ] + }, + "hash": "bdf2e2781bfa2e9c81c18ef8df7230809d3b20274685a35b1c544804f2a58241" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-c1bb8e02d1f9dc28322309d055de3c40ed4e1a1b9453a7e5a93a70e5186d762d.json b/db/db-sqlx-postgres/.sqlx/query-c1bb8e02d1f9dc28322309d055de3c40ed4e1a1b9453a7e5a93a70e5186d762d.json new file mode 100644 index 00000000..7359697a --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-c1bb8e02d1f9dc28322309d055de3c40ed4e1a1b9453a7e5a93a70e5186d762d.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "\n INSERT INTO\n mcaptcha_psuedo_campaign_id (config_id, psuedo_id)\n VALUES (\n (SELECT config_id FROM mcaptcha_config WHERE key = ($1)),\n $2\n );", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Text", + "Varchar" + ] + }, + "nullable": [] + }, + "hash": "c1bb8e02d1f9dc28322309d055de3c40ed4e1a1b9453a7e5a93a70e5186d762d" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-c2e167e56242de7e0a835e25004b15ca8340545fa0ca7ac8f3293157d2d03d98.json b/db/db-sqlx-postgres/.sqlx/query-c2e167e56242de7e0a835e25004b15ca8340545fa0ca7ac8f3293157d2d03d98.json new file mode 100644 index 00000000..69079452 --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-c2e167e56242de7e0a835e25004b15ca8340545fa0ca7ac8f3293157d2d03d98.json @@ -0,0 +1,35 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT \n avg_traffic, \n peak_sustainable_traffic, \n broke_my_site_traffic \n FROM \n mcaptcha_sitekey_user_provided_avg_traffic \n WHERE \n config_id = (\n SELECT \n config_id \n FROM \n mcaptcha_config \n WHERE \n KEY = $1 \n AND user_id = (\n SELECT \n id \n FROM \n mcaptcha_users \n WHERE \n NAME = $2\n )\n )\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "avg_traffic", + "type_info": "Int4" + }, + { + "ordinal": 1, + "name": "peak_sustainable_traffic", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "broke_my_site_traffic", + "type_info": "Int4" + } + ], + "parameters": { + "Left": [ + "Text", + "Text" + ] + }, + "nullable": [ + false, + false, + true + ] + }, + "hash": "c2e167e56242de7e0a835e25004b15ca8340545fa0ca7ac8f3293157d2d03d98" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-c399efd5db1284dcb470c40f9b076851f77498c75a63a3b151d4a111bd3e2957.json b/db/db-sqlx-postgres/.sqlx/query-c399efd5db1284dcb470c40f9b076851f77498c75a63a3b151d4a111bd3e2957.json new file mode 100644 index 00000000..adc57cba --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-c399efd5db1284dcb470c40f9b076851f77498c75a63a3b151d4a111bd3e2957.json @@ -0,0 +1,23 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT time FROM mcaptcha_pow_fetched_stats\n WHERE \n config_id = (\n SELECT \n config_id FROM mcaptcha_config \n WHERE \n key = $1\n AND\n user_id = (\n SELECT \n ID FROM mcaptcha_users WHERE name = $2))\n ORDER BY time DESC", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "time", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Text", + "Text" + ] + }, + "nullable": [ + false + ] + }, + "hash": "c399efd5db1284dcb470c40f9b076851f77498c75a63a3b151d4a111bd3e2957" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-ca9d5241f1234d1825f7ead391ebe9099fca776e7101ac6e1761881606def5fa.json b/db/db-sqlx-postgres/.sqlx/query-ca9d5241f1234d1825f7ead391ebe9099fca776e7101ac6e1761881606def5fa.json new file mode 100644 index 00000000..7a35eccf --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-ca9d5241f1234d1825f7ead391ebe9099fca776e7101ac6e1761881606def5fa.json @@ -0,0 +1,14 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM mcaptcha_users WHERE name = ($1)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [] + }, + "hash": "ca9d5241f1234d1825f7ead391ebe9099fca776e7101ac6e1761881606def5fa" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-d7dd6cd6a7626e79c62377b2d59115067c5851ec044911ff8833779a08bbb8f7.json b/db/db-sqlx-postgres/.sqlx/query-d7dd6cd6a7626e79c62377b2d59115067c5851ec044911ff8833779a08bbb8f7.json new file mode 100644 index 00000000..ab4d62bb --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-d7dd6cd6a7626e79c62377b2d59115067c5851ec044911ff8833779a08bbb8f7.json @@ -0,0 +1,18 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO mcaptcha_notifications (\n heading, message, tx, rx, received)\n VALUES (\n $1, $2,\n (SELECT ID FROM mcaptcha_users WHERE name = $3),\n (SELECT ID FROM mcaptcha_users WHERE name = $4),\n $5\n );", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Varchar", + "Varchar", + "Text", + "Text", + "Timestamptz" + ] + }, + "nullable": [] + }, + "hash": "d7dd6cd6a7626e79c62377b2d59115067c5851ec044911ff8833779a08bbb8f7" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-dbe4307651d94bc6db4f1d8b2c6d076fde6280983d59593216d7765cbbdd669c.json b/db/db-sqlx-postgres/.sqlx/query-dbe4307651d94bc6db4f1d8b2c6d076fde6280983d59593216d7765cbbdd669c.json new file mode 100644 index 00000000..d88db237 --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-dbe4307651d94bc6db4f1d8b2c6d076fde6280983d59593216d7765cbbdd669c.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO mcaptcha_pow_solved_stats \n (config_id, time) VALUES ((SELECT config_id FROM mcaptcha_config WHERE key = $1), $2)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Text", + "Timestamptz" + ] + }, + "nullable": [] + }, + "hash": "dbe4307651d94bc6db4f1d8b2c6d076fde6280983d59593216d7765cbbdd669c" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-e4c710d33b709aee262fa0704372ac216d98851447ef4fbe221740b7ae4ea422.json b/db/db-sqlx-postgres/.sqlx/query-e4c710d33b709aee262fa0704372ac216d98851447ef4fbe221740b7ae4ea422.json new file mode 100644 index 00000000..9c8247ca --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-e4c710d33b709aee262fa0704372ac216d98851447ef4fbe221740b7ae4ea422.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT secret FROM mcaptcha_users WHERE name = ($1)", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "secret", + "type_info": "Varchar" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false + ] + }, + "hash": "e4c710d33b709aee262fa0704372ac216d98851447ef4fbe221740b7ae4ea422" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-e9ed973dfd2bfef36d5a4724aef4993328e1d8d3ca397fe6d5408a780efc775a.json b/db/db-sqlx-postgres/.sqlx/query-e9ed973dfd2bfef36d5a4724aef4993328e1d8d3ca397fe6d5408a780efc775a.json new file mode 100644 index 00000000..0889a5a7 --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-e9ed973dfd2bfef36d5a4724aef4993328e1d8d3ca397fe6d5408a780efc775a.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE mcaptcha_users set password = $1\n WHERE name = $2", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Text", + "Text" + ] + }, + "nullable": [] + }, + "hash": "e9ed973dfd2bfef36d5a4724aef4993328e1d8d3ca397fe6d5408a780efc775a" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-f330cb94c53d33495df94aacec7e4e91d8a920742b89a63d1c59a8ea8937c5c8.json b/db/db-sqlx-postgres/.sqlx/query-f330cb94c53d33495df94aacec7e4e91d8a920742b89a63d1c59a8ea8937c5c8.json new file mode 100644 index 00000000..d45fe92a --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-f330cb94c53d33495df94aacec7e4e91d8a920742b89a63d1c59a8ea8937c5c8.json @@ -0,0 +1,17 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO mcaptcha_levels (\n difficulty_factor, \n visitor_threshold,\n config_id) VALUES (\n $1, $2, (\n SELECT config_id FROM mcaptcha_config WHERE\n key = ($3) AND user_id = (\n SELECT ID FROM mcaptcha_users WHERE name = $4\n )));", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int4", + "Int4", + "Text", + "Text" + ] + }, + "nullable": [] + }, + "hash": "f330cb94c53d33495df94aacec7e4e91d8a920742b89a63d1c59a8ea8937c5c8" +} diff --git a/db/db-sqlx-postgres/.sqlx/query-f3dee60b85be2ae861b6695286e387529dabf3d11202fb2eeb7e75a7bb3bd0a4.json b/db/db-sqlx-postgres/.sqlx/query-f3dee60b85be2ae861b6695286e387529dabf3d11202fb2eeb7e75a7bb3bd0a4.json new file mode 100644 index 00000000..e6c73bf1 --- /dev/null +++ b/db/db-sqlx-postgres/.sqlx/query-f3dee60b85be2ae861b6695286e387529dabf3d11202fb2eeb7e75a7bb3bd0a4.json @@ -0,0 +1,28 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT name, password FROM mcaptcha_users WHERE name = ($1)", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "name", + "type_info": "Varchar" + }, + { + "ordinal": 1, + "name": "password", + "type_info": "Text" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false, + false + ] + }, + "hash": "f3dee60b85be2ae861b6695286e387529dabf3d11202fb2eeb7e75a7bb3bd0a4" +} diff --git a/db/db-sqlx-postgres/Cargo.toml b/db/db-sqlx-postgres/Cargo.toml index 27461e7d..aeaf5dd4 100644 --- a/db/db-sqlx-postgres/Cargo.toml +++ b/db/db-sqlx-postgres/Cargo.toml @@ -12,11 +12,11 @@ authors = ["realaravinth "] async-trait = "0.1.51" db-core = {path = "../db-core"} futures = "0.3.15" -sqlx = { version = "0.5.13", features = [ "runtime-actix-rustls", "postgres", "time", "offline" ] } +sqlx = { version = "0.7", features = [ "runtime-tokio-rustls", "postgres", "time" ] } uuid = { version = "1.4.0", features = ["v4", "serde"] } [dev-dependencies] actix-rt = "2" -sqlx = { version = "0.5.13", features = [ "runtime-actix-rustls", "postgres", "time", "offline" ] } +sqlx = { version = "0.7", features = [ "runtime-tokio-rustls", "postgres", "time"] } db-core = {path = "../db-core", features = ["test"]} url = { version = "2.2.2", features = ["serde"] } diff --git a/db/db-sqlx-postgres/src/lib.rs b/db/db-sqlx-postgres/src/lib.rs index dd6d0c9d..d06dfeeb 100644 --- a/db/db-sqlx-postgres/src/lib.rs +++ b/db/db-sqlx-postgres/src/lib.rs @@ -49,7 +49,6 @@ pub mod dev { pub mod prelude { pub use super::*; - pub use db_core::prelude::*; } #[async_trait] @@ -61,7 +60,7 @@ impl Connect for ConnectionOptions { let mut connect_options = sqlx::postgres::PgConnectOptions::from_str(&fresh.url).unwrap(); if fresh.disable_logging { - connect_options.disable_statement_logging(); + connect_options = connect_options.disable_statement_logging(); } fresh .pool_options diff --git a/docs/CONFIGURATION.md b/docs/CONFIGURATION.md index cc31adbf..d964a484 100644 --- a/docs/CONFIGURATION.md +++ b/docs/CONFIGURATION.md @@ -21,54 +21,52 @@ you will be overriding the values set in the configuration files. | Name | Value | | ----------------------------- | ----------------------------------------------------------------------------------------------------------------- | -| `MCAPTCHA_CONFIG` | Path to configuration file | -| `MCAPTCHA_COMMERCIAL` | Does this instance offer commercial plans? Please consider donating if it does :D | -| `MCAPTCHA_SOURCE_CODE` | Link to the source code of this instance | -| `MCAPTCHA_ALLOW_REGISTRATION` | Is registration allowed on this instance? | -| `MCAPTCHA_ALLOW_DEMO` | Allow demo access to the server? If registration(previous option) is disabled then demo users will not be allowed | +| `MCAPTCHA_debug` | Enable debug logging | +| `MCAPTCHA_config` | Path to configuration file | +| `MCAPTCHA_commercial` | Does this instance offer commercial plans? Please consider donating if it does :D | +| `MCAPTCHA_source_code` | Link to the source code of this instance | +| `MCAPTCHA_allow_registration` | Is registration allowed on this instance? | +| `MCAPTCHA_allow_demo` | Allow demo access to the server? If registration(previous option) is disabled then demo users will not be allowed | -#### Database +### Database -| Name | Value | -| ------------------------------------ | -------------------------------------------------------------- | -| `MCAPTCHA_DATEBASE_PASSWORD` | database user password | -| `MCAPTCHA_DATEBASE_NAME` | database name | -| `MCAPTCHA_DATEBASE_PORT` | port on which the DBMS is running | -| `MCAPTCHA_DATEBASE_HOSTNAME` | hostname of the DBMS | -| `MCAPTCHA_DATEBASE_USERNAME` | database username | -| `MCAPTCHA_DATEBASE_POOL` | database connection pool size | -| `MCAPTCHA_DATEBASE_DATABASE_TYPE` | database tpye: "postgres" or "maria" | +| Name | Value | +| ------------------------------------- | -------------------------------------------------------------- | +| `MCAPTCHA_database_DATEBASE_POOL` | database connection pool size | | `DATABASE_URL` (overrides above vars) | database URL in `postgres://user:pass@host:port/dbname` format | -#### Redis +### Redis | Name | Value | | --------------------- | -------------------------- | -| `MCAPTCHA_REDIS_URL` | Redis URL | -| `MCAPTCHA_REDIS_POOL` | Redis connection pool size | +| `MCAPTCHA_redis_URL` | Redis URL | +| `MCAPTCHA_redis_POOL` | Redis connection pool size | -#### Server +### Server -| Name | Value | -| ---------------------------------------- | ---------------------------------------------------------------------------------- | -| `MCAPTCHA_SERVER_PORT` | The port on which you want mCaptcha to listen to | -| `PORT`(overrides `MCAPTCHA_SERVER_PORT`) | The port on which you want mCaptcha to listen to | -| `MCAPTCHA_SERVER_IP` | The IP address on which you want mCaptcha to listen to | -| `MCAPTCHA_SERVER_DOMAIN` | Domain under which mCaptcha will be\* | -| `MCAPTCHA_SERVER_COOKIE_SECRET` | Cookie secret, must be long and random | -| `MCAPTCHA_SERVER_PROXY_HAS_TLS` | Is mCaptcha behind a proxy? If yes, mCaptcha can send additional headers like HSTS | +| Name | Value | +| ------------------------------- | ---------------------------------------------------------------------------------- | +| `PORT` | The port on which you want mCaptcha to listen to | +| `MCAPTCHA_server_IP` | The IP address on which you want mCaptcha to listen to | +| `MCAPTCHA_server_DOMAIN` | Domain under which mCaptcha will be\* | +| `MCAPTCHA_server_COOKIE_SECRET` | Cookie secret, must be long and random | +| `MCAPTCHA_server_PROXY_HAS_TLS` | Is mCaptcha behind a proxy? If yes, mCaptcha can send additional headers like HSTS | \* Authentication doesn't work without `MCAPTCHA_DOMAIN` set to the correct domain ### Captcha -| Name | Value | -| ---------------------------------------------------- | --------------------------------------------------------------------------------------------------- | -| `MCAPTCHA_CAPTCHA_SALT` | Salt has to be long and random | -| `MCAPTCHA_CAPTCHA_GC` | Garbage collection duration in seconds, requires tuning but 30 is a good starting point | -| `MCAPTCHA_CAPTCHA_AVG_TRAFFIC_DIFFICULTY`% | Difficulty factor to use in CAPTCHA configuration estimation for average traffic metric | -| `MCAPTCHA_CAPTCHA_PEAK_TRAFFIC_DIFFICULTY`% | Difficulty factor to use in CAPTCHA configuration estimation for peak traffic metric | -| `MCAPTCHA_CAPTCHA_BROKE_MY_SITE_TRAFFIC_DIFFICULTY`% | Difficulty factor to use in CAPTCHA configuration estimation for traffic that took the website down | +| Name | Value | +| ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | --- | +| `MCAPTCHA_captcha_SALT` | Salt has to be long and random | +| `MCAPTCHA_captcha_GC` | Garbage collection duration in seconds, requires tuning but 30 is a good starting point | +| `MCAPTCHA_captcha_RUNNERS` | [Performance] Number of runners to use for PoW validation. Defaults to number of CPUs available | +| `MCAPTCHA_captcha_QUEUE_LENGTH` | [Performance] PoW Validation queue length, controls how many pending validation jobs can be held in queue | +| `MCAPTCHA_captcha_ENABLE_STATS` | Record for CAPTCHA events like configuration fetch, solves and authentication of validation token. Useful for commercial deployments. | | +| `MCAPTCHA_captcha_DEFAULT_DIFFICULTY_STRATEGY_avg_traffic_difficulty`% | Default difficulty factor to use in easy mode CAPTCHA configuration estimation for average traffic metric | +| `MCAPTCHA_captcha_DEFAULT_DIFFICULTY_STRATEGY_peak_sustainable_traffic_difficulty`% | Default difficulty factor to use in easy mode CAPTCHA configuration estimation for peak traffic metric | +| `MCAPTCHA_captcha_DEFAULT_DIFFICULTY_STRATEGY_broke_my_site_traffic_difficulty`% | Default difficulty factor to use in easy mode CAPTCHA configuration estimation for traffic that took the website down | +| `MCAPTCHA_captcha_DEFAULT_DIFFICULTY_STRATEGY_duration`% | Default duration to use in CAPTCHA configuration in easy mode | \% See commits [`54b14291ec140e`](https://github.com/mCaptcha/mCaptcha/commit/54b14291ec140ea4cbbf73462d3d6fc2d39f2d2c) @@ -80,9 +78,8 @@ for more info. | Name | Value | | ------------------------ | ----------------------------------------------- | -| `MCAPTCHA_SMTP_FROM` | email address from which the email will be sent | -| `MCAPTCHA_SMTP_REPLY_TO` | email address to which reply can be sent | -| `MCAPTCHA_URL` | SMTP server URL | -| `MCAPTCHA_SMTP_PORT` | SMTP server port | -| `MCAPTCHA_SMTP_USERNAME` | SMTP username | -| `MCAPTCHA_SMTP_PASSWORD` | SMTP password | +| `MCAPTCHA_smtp_FROM` | email address from which the email will be sent | +| `MCAPTCHA_smtp_URL` | SMTP server URL | +| `MCAPTCHA_smtp_PORT` | SMTP server port | +| `MCAPTCHA_smtp_USERNAME` | SMTP username | +| `MCAPTCHA_smtp_PASSWORD` | SMTP password | diff --git a/sqlx-data.json b/sqlx-data.json deleted file mode 100644 index 3b4cb791..00000000 --- a/sqlx-data.json +++ /dev/null @@ -1,761 +0,0 @@ -{ - "db": "PostgreSQL", - "02deb524bb12632af9b7883975f75fdc30d6775d836aff647add1dffd1a4bc00": { - "describe": { - "columns": [ - { - "name": "config_id", - "ordinal": 0, - "type_info": "Int4" - }, - { - "name": "duration", - "ordinal": 1, - "type_info": "Int4" - }, - { - "name": "name", - "ordinal": 2, - "type_info": "Varchar" - }, - { - "name": "key", - "ordinal": 3, - "type_info": "Varchar" - } - ], - "nullable": [ - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "Text", - "Text" - ] - } - }, - "query": "SELECT config_id, duration, name, key from mcaptcha_config WHERE\n key = $1 AND\n user_id = (SELECT ID FROM mcaptcha_users WHERE name = $2) " - }, - "044e2036a518de2ccac9318ccba07f7ce10e4a1c1d51d0128ea5e8cb94358ac5": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text", - "Timestamptz" - ] - } - }, - "query": "INSERT INTO mcaptcha_pow_confirmed_stats \n (config_id, time) VALUES ((SELECT config_id FROM mcaptcha_config WHERE key = $1), $2)" - }, - "0840af95cc17c8ea6fc994e53696d4dec39ef9b4b6dd6c58c21cc44ccbb4bd09": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text", - "Text", - "Int4", - "Int4", - "Int4" - ] - } - }, - "query": "INSERT INTO mcaptcha_sitekey_user_provided_avg_traffic (\n config_id,\n avg_traffic,\n peak_sustainable_traffic,\n broke_my_site_traffic\n ) VALUES ( \n (SELECT config_id FROM mcaptcha_config WHERE key = ($1)\n AND user_id = (SELECT ID FROM mcaptcha_users WHERE name = $2)\n ), $3, $4, $5)" - }, - "0e7a1a38019c5e88ebd096fc5f6031aaa7f337fe735aa44c4e31bd6e51163749": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text", - "Text" - ] - } - }, - "query": "DELETE FROM mcaptcha_sitekey_user_provided_avg_traffic\n WHERE config_id = (\n SELECT config_id \n FROM \n mcaptcha_config \n WHERE\n key = ($1) \n AND \n user_id = (SELECT ID FROM mcaptcha_users WHERE name = $2)\n );" - }, - "16864df9cf9a69c299d9ab68bac559c48f4fc433541a10f7c1b60717df2b820e": { - "describe": { - "columns": [ - { - "name": "key", - "ordinal": 0, - "type_info": "Varchar" - }, - { - "name": "name", - "ordinal": 1, - "type_info": "Varchar" - }, - { - "name": "config_id", - "ordinal": 2, - "type_info": "Int4" - }, - { - "name": "duration", - "ordinal": 3, - "type_info": "Int4" - } - ], - "nullable": [ - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "SELECT key, name, config_id, duration FROM mcaptcha_config WHERE\n user_id = (SELECT ID FROM mcaptcha_users WHERE name = $1) " - }, - "1e9fe69b23e4bfa7bb369455753100307e334e8dbaf02ff37cda08992fe95910": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Text" - ] - } - }, - "query": "UPDATE mcaptcha_users set name = $1\n WHERE name = $2" - }, - "2b319a202bb983d5f28979d1e371f399125da1122fbda36a5a55b75b9c743451": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int4", - "Text" - ] - } - }, - "query": "-- mark a notification as read\nUPDATE mcaptcha_notifications\n SET read = TRUE\nWHERE \n mcaptcha_notifications.id = $1\nAND\n mcaptcha_notifications.rx = (\n SELECT\n id\n FROM\n mcaptcha_users\n WHERE\n name = $2\n );\n" - }, - "307245aaf5b0d692448b80358d6916aa50c507b35e724d66c9b16a16b60e1b38": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Text", - "Int4", - "Varchar" - ] - } - }, - "query": "INSERT INTO mcaptcha_config\n (key, user_id, duration, name)\n VALUES ($1, (SELECT ID FROM mcaptcha_users WHERE name = $2), $3, $4)" - }, - "30ba202b601dd07f41798775c7c59fde7deeae759ec959df46734a66ffd78df7": { - "describe": { - "columns": [ - { - "name": "email", - "ordinal": 0, - "type_info": "Varchar" - } - ], - "nullable": [ - true - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "SELECT email FROM mcaptcha_users WHERE name = $1" - }, - "3b1c8128fc48b16d8e8ea6957dd4fbc0eb19ae64748fd7824e9f5e1901dd1726": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Text" - ] - } - }, - "query": "UPDATE mcaptcha_users set secret = $1\n WHERE name = $2" - }, - "3eb1c43ffd2378c4dd59975568c3a180b72d13008f294a91f3e76b785dba295b": { - "describe": { - "columns": [ - { - "name": "exists", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Text", - "Text" - ] - } - }, - "query": "SELECT EXISTS (\n SELECT 1 from mcaptcha_config WHERE key = $1 \n AND user_id = (SELECT ID FROM mcaptcha_users WHERE name = $2)\n )" - }, - "4303f5c6ef98e0de9d8d3c2d781d3ffaa3dee5f7d27db831d327b26f03ba9d68": { - "describe": { - "columns": [ - { - "name": "time", - "ordinal": 0, - "type_info": "Timestamptz" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Text", - "Text" - ] - } - }, - "query": "SELECT time FROM mcaptcha_pow_confirmed_stats \n WHERE \n config_id = (\n SELECT config_id FROM mcaptcha_config \n WHERE \n key = $1\n AND\n user_id = (\n SELECT \n ID FROM mcaptcha_users WHERE name = $2))\n ORDER BY time DESC" - }, - "45d9e9fb6344fe3a18c2529d50c935d3837bfe25c96595beb6970d6067720578": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Text", - "Varchar", - "Varchar" - ] - } - }, - "query": "insert into mcaptcha_users \n (name , password, email, secret) values ($1, $2, $3, $4)" - }, - "47fa50aecfb1499b0a18fa9299643017a1a8d69d4e9980032e0d8f745465d14f": { - "describe": { - "columns": [ - { - "name": "exists", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "SELECT EXISTS (SELECT 1 from mcaptcha_users WHERE email = $1)" - }, - "494d2aed281e1408aeda3606b0814db75aea2878783a2e2f11a4feb6fc48e938": { - "describe": { - "columns": [ - { - "name": "secret", - "ordinal": 0, - "type_info": "Varchar" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "SELECT secret FROM mcaptcha_users WHERE ID = (\n SELECT user_id FROM mcaptcha_config WHERE key = $1\n )" - }, - "4a5dfbc5aeb2bab290a09640cc25223d484fbc7549e5bc54f33bab8616725031": { - "describe": { - "columns": [ - { - "name": "exists", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "SELECT EXISTS (SELECT 1 from mcaptcha_config WHERE key = $1)" - }, - "507bea10c7f8417c5b1430211d0137299cd561333bf47f7b4887d0ef801d1ea4": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Text", - "Text" - ] - } - }, - "query": "UPDATE mcaptcha_config SET key = $1 \n WHERE key = $2 AND user_id = (SELECT ID FROM mcaptcha_users WHERE name = $3)" - }, - "570c22f19fe0b97d78086038c8ef82509dce0bae704d80f9f031c1c47e6a6572": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int4", - "Text", - "Text" - ] - } - }, - "query": "UPDATE mcaptcha_config SET name = $1, duration = $2\n WHERE user_id = (SELECT ID FROM mcaptcha_users WHERE name = $3)\n AND key = $4" - }, - "717771c42737feb3f4ca13f2ab11361073ea17b55562a103f660149bf049c5c6": { - "describe": { - "columns": [ - { - "name": "difficulty_factor", - "ordinal": 0, - "type_info": "Int4" - }, - { - "name": "visitor_threshold", - "ordinal": 1, - "type_info": "Int4" - } - ], - "nullable": [ - false, - false - ], - "parameters": { - "Left": [ - "Text", - "Text" - ] - } - }, - "query": "SELECT difficulty_factor, visitor_threshold FROM mcaptcha_levels WHERE\n config_id = (\n SELECT config_id FROM mcaptcha_config WHERE key = ($1)\n AND user_id = (SELECT ID from mcaptcha_users WHERE name = $2)\n )\n ORDER BY difficulty_factor ASC;" - }, - "726a794f7599b78ab749d9f887f5c28db38f072b41f691bde35d23ba0dd72409": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text", - "Timestamptz" - ] - } - }, - "query": "INSERT INTO mcaptcha_pow_fetched_stats \n (config_id, time) VALUES ((SELECT config_id FROM mcaptcha_config WHERE key = $1), $2)" - }, - "7c96ae73dd73c1b0e073e3ac78f87f4cba23fdb2cdbed9ba9b0d55f33655582e": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text", - "Text" - ] - } - }, - "query": "DELETE FROM mcaptcha_levels \n WHERE config_id = (\n SELECT config_id FROM mcaptcha_config where key = ($1) \n AND user_id = (\n SELECT ID from mcaptcha_users WHERE name = $2\n )\n )" - }, - "81c779ed4bb59f8b94dea730cbda31f7733ef16d509a3ed607388b5ddef74638": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Text", - "Varchar" - ] - } - }, - "query": "INSERT INTO mcaptcha_users \n (name , password, secret) VALUES ($1, $2, $3)" - }, - "84484cb6892db29121816bc5bff5702b9e857e20aa14e79d080d78ae7593153b": { - "describe": { - "columns": [ - { - "name": "time", - "ordinal": 0, - "type_info": "Timestamptz" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Text", - "Text" - ] - } - }, - "query": "SELECT time FROM mcaptcha_pow_solved_stats \n WHERE config_id = (\n SELECT config_id FROM mcaptcha_config \n WHERE \n key = $1\n AND\n user_id = (\n SELECT \n ID FROM mcaptcha_users WHERE name = $2)) \n ORDER BY time DESC" - }, - "9753721856a47438c5e72f28fd9d149db10c48e677b4613bf3f1e8487908aac8": { - "describe": { - "columns": [ - { - "name": "difficulty_factor", - "ordinal": 0, - "type_info": "Int4" - }, - { - "name": "visitor_threshold", - "ordinal": 1, - "type_info": "Int4" - } - ], - "nullable": [ - false, - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "SELECT difficulty_factor, visitor_threshold FROM mcaptcha_levels WHERE\n config_id = (\n SELECT config_id FROM mcaptcha_config WHERE key = ($1)\n ) ORDER BY difficulty_factor ASC;" - }, - "ad196ab3ef9dc32f6de2313577ccd6c26eae9ab19df5f71ce182651983efb99a": { - "describe": { - "columns": [ - { - "name": "duration", - "ordinal": 0, - "type_info": "Int4" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "SELECT duration FROM mcaptcha_config \n WHERE key = $1" - }, - "ad23588ee4bcbb13e208460ce21e2fa9f1373893934b530b339fea10360b34a8": { - "describe": { - "columns": [ - { - "name": "exists", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "SELECT EXISTS (SELECT 1 from mcaptcha_users WHERE name = $1)" - }, - "b97d810814fbeb2df19f47bcfa381bc6fb7ac6832d040b377cf4fca2ca896cfb": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Text" - ] - } - }, - "query": "UPDATE mcaptcha_users set email = $1\n WHERE name = $2" - }, - "bb6443e1df704294abbbdb563f1bf46660d0f3462c0c35c10a533446fc7c53e8": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text", - "Text" - ] - } - }, - "query": "DELETE FROM mcaptcha_config WHERE key = ($1)\n AND\n user_id = (SELECT ID FROM mcaptcha_users WHERE name = $2)" - }, - "bdf2e2781bfa2e9c81c18ef8df7230809d3b20274685a35b1c544804f2a58241": { - "describe": { - "columns": [ - { - "name": "name", - "ordinal": 0, - "type_info": "Varchar" - }, - { - "name": "password", - "ordinal": 1, - "type_info": "Text" - } - ], - "nullable": [ - false, - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "SELECT name, password FROM mcaptcha_users WHERE email = ($1)" - }, - "c2e167e56242de7e0a835e25004b15ca8340545fa0ca7ac8f3293157d2d03d98": { - "describe": { - "columns": [ - { - "name": "avg_traffic", - "ordinal": 0, - "type_info": "Int4" - }, - { - "name": "peak_sustainable_traffic", - "ordinal": 1, - "type_info": "Int4" - }, - { - "name": "broke_my_site_traffic", - "ordinal": 2, - "type_info": "Int4" - } - ], - "nullable": [ - false, - false, - true - ], - "parameters": { - "Left": [ - "Text", - "Text" - ] - } - }, - "query": "SELECT \n avg_traffic, \n peak_sustainable_traffic, \n broke_my_site_traffic \n FROM \n mcaptcha_sitekey_user_provided_avg_traffic \n WHERE \n config_id = (\n SELECT \n config_id \n FROM \n mcaptcha_config \n WHERE \n KEY = $1 \n AND user_id = (\n SELECT \n id \n FROM \n mcaptcha_users \n WHERE \n NAME = $2\n )\n )\n " - }, - "c399efd5db1284dcb470c40f9b076851f77498c75a63a3b151d4a111bd3e2957": { - "describe": { - "columns": [ - { - "name": "time", - "ordinal": 0, - "type_info": "Timestamptz" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Text", - "Text" - ] - } - }, - "query": "SELECT time FROM mcaptcha_pow_fetched_stats\n WHERE \n config_id = (\n SELECT \n config_id FROM mcaptcha_config \n WHERE \n key = $1\n AND\n user_id = (\n SELECT \n ID FROM mcaptcha_users WHERE name = $2))\n ORDER BY time DESC" - }, - "ca9d5241f1234d1825f7ead391ebe9099fca776e7101ac6e1761881606def5fa": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "DELETE FROM mcaptcha_users WHERE name = ($1)" - }, - "d7dd6cd6a7626e79c62377b2d59115067c5851ec044911ff8833779a08bbb8f7": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Varchar", - "Text", - "Text", - "Timestamptz" - ] - } - }, - "query": "INSERT INTO mcaptcha_notifications (\n heading, message, tx, rx, received)\n VALUES (\n $1, $2,\n (SELECT ID FROM mcaptcha_users WHERE name = $3),\n (SELECT ID FROM mcaptcha_users WHERE name = $4),\n $5\n );" - }, - "dbe4307651d94bc6db4f1d8b2c6d076fde6280983d59593216d7765cbbdd669c": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text", - "Timestamptz" - ] - } - }, - "query": "INSERT INTO mcaptcha_pow_solved_stats \n (config_id, time) VALUES ((SELECT config_id FROM mcaptcha_config WHERE key = $1), $2)" - }, - "dcf0d4f9d803dcb1d6f775899f79595f9c78d46633e0ec822303284430df7a3d": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int4" - }, - { - "name": "heading", - "ordinal": 1, - "type_info": "Varchar" - }, - { - "name": "message", - "ordinal": 2, - "type_info": "Varchar" - }, - { - "name": "received", - "ordinal": 3, - "type_info": "Timestamptz" - }, - { - "name": "name", - "ordinal": 4, - "type_info": "Varchar" - } - ], - "nullable": [ - true, - true, - true, - true, - true - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "-- gets all unread notifications a user has\nSELECT \n mcaptcha_notifications.id,\n mcaptcha_notifications.heading,\n mcaptcha_notifications.message,\n mcaptcha_notifications.received,\n mcaptcha_users.name\nFROM\n mcaptcha_notifications \nINNER JOIN \n mcaptcha_users \nON \n mcaptcha_notifications.tx = mcaptcha_users.id\nWHERE \n mcaptcha_notifications.rx = (\n SELECT \n id \n FROM \n mcaptcha_users\n WHERE\n name = $1\n )\nAND \n mcaptcha_notifications.read IS NULL;\n" - }, - "e4c710d33b709aee262fa0704372ac216d98851447ef4fbe221740b7ae4ea422": { - "describe": { - "columns": [ - { - "name": "secret", - "ordinal": 0, - "type_info": "Varchar" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "SELECT secret FROM mcaptcha_users WHERE name = ($1)" - }, - "e9ed973dfd2bfef36d5a4724aef4993328e1d8d3ca397fe6d5408a780efc775a": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text", - "Text" - ] - } - }, - "query": "UPDATE mcaptcha_users set password = $1\n WHERE name = $2" - }, - "f330cb94c53d33495df94aacec7e4e91d8a920742b89a63d1c59a8ea8937c5c8": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int4", - "Int4", - "Text", - "Text" - ] - } - }, - "query": "INSERT INTO mcaptcha_levels (\n difficulty_factor, \n visitor_threshold,\n config_id) VALUES (\n $1, $2, (\n SELECT config_id FROM mcaptcha_config WHERE\n key = ($3) AND user_id = (\n SELECT ID FROM mcaptcha_users WHERE name = $4\n )));" - }, - "f3dee60b85be2ae861b6695286e387529dabf3d11202fb2eeb7e75a7bb3bd0a4": { - "describe": { - "columns": [ - { - "name": "name", - "ordinal": 0, - "type_info": "Varchar" - }, - { - "name": "password", - "ordinal": 1, - "type_info": "Text" - } - ], - "nullable": [ - false, - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "SELECT name, password FROM mcaptcha_users WHERE name = ($1)" - } -} \ No newline at end of file diff --git a/src/api/v1/pow/verify_pow.rs b/src/api/v1/pow/verify_pow.rs index 78751cd9..0b2b7eb7 100644 --- a/src/api/v1/pow/verify_pow.rs +++ b/src/api/v1/pow/verify_pow.rs @@ -67,11 +67,11 @@ pub async fn verify_pow( let time = payload.time; let (res, difficulty_factor) = data.captcha.verify_pow(payload.into(), ip).await?; data.stats.record_solve(&data, &key).await?; - if time.is_some() && worker_type.is_some() { + if let (Some(time), Some(worker_type)) = (time, worker_type) { let analytics = db_core::CreatePerformanceAnalytics { difficulty_factor, - time: time.unwrap(), - worker_type: worker_type.unwrap(), + time, + worker_type, }; data.db.analysis_save(&key, &analytics).await?; } @@ -141,7 +141,7 @@ pub mod tests { assert_eq!(get_config_resp.status(), StatusCode::OK); let config: PoWConfig = test::read_body_json(get_config_resp).await; - let pow = pow_sha256::ConfigBuilder::default() + let pow = mcaptcha_pow_sha256::ConfigBuilder::default() .salt(config.salt) .build() .unwrap(); @@ -204,7 +204,7 @@ pub mod tests { assert_eq!(get_config_resp.status(), StatusCode::OK); let config: PoWConfig = test::read_body_json(get_config_resp).await; - let pow = pow_sha256::ConfigBuilder::default() + let pow = mcaptcha_pow_sha256::ConfigBuilder::default() .salt(config.salt) .build() .unwrap(); diff --git a/src/api/v1/pow/verify_token.rs b/src/api/v1/pow/verify_token.rs index 4a8910f3..ea143baf 100644 --- a/src/api/v1/pow/verify_token.rs +++ b/src/api/v1/pow/verify_token.rs @@ -123,7 +123,7 @@ pub mod tests { assert_eq!(get_config_resp.status(), StatusCode::OK); let config: PoWConfig = test::read_body_json(get_config_resp).await; - let pow = pow_sha256::ConfigBuilder::default() + let pow = mcaptcha_pow_sha256::ConfigBuilder::default() .salt(config.salt) .build() .unwrap(); diff --git a/src/date.rs b/src/date.rs index e73c8e7a..ce6ef55c 100644 --- a/src/date.rs +++ b/src/date.rs @@ -33,7 +33,7 @@ impl Date { let difference = now - timestamp; if difference >= 3 * WEEK { - date.format("%d-%m-%y") + format!("{}{}{}", date.year(), date.month(), date.date()) } else if (DAY..(3 * WEEK)).contains(&difference) { format!("{} days ago", date.hour()) } else if (HOUR..DAY).contains(&difference) { @@ -52,12 +52,12 @@ impl Date { /// print date pub fn date(&self) -> String { - self.time.format("%F %r %z") + format!("{}{}{}", self.time.year(), self.time.month(), self.time.date()) } pub fn new(unix: i64) -> Self { Self { - time: OffsetDateTime::from_unix_timestamp(unix), + time: OffsetDateTime::from_unix_timestamp(unix).unwrap(), } } } @@ -77,28 +77,28 @@ mod tests { // seconds test assert!(n.print_date().contains("seconds ago")); - n.time = OffsetDateTime::from_unix_timestamp(timestamp - 5); + n.time = OffsetDateTime::from_unix_timestamp(timestamp - 5).unwrap(); assert!(n.print_date().contains("seconds ago")); // minutes test - n.time = OffsetDateTime::from_unix_timestamp(timestamp - MINUTE * 2); + n.time = OffsetDateTime::from_unix_timestamp(timestamp - MINUTE * 2).unwrap(); assert!(n.print_date().contains("minutes ago")); - n.time = OffsetDateTime::from_unix_timestamp(timestamp - MINUTE * 56); + n.time = OffsetDateTime::from_unix_timestamp(timestamp - MINUTE * 56).unwrap(); assert!(n.print_date().contains("minutes ago")); // hours test - n.time = OffsetDateTime::from_unix_timestamp(timestamp - HOUR); + n.time = OffsetDateTime::from_unix_timestamp(timestamp - HOUR).unwrap(); assert!(n.print_date().contains("hours ago")); - n.time = OffsetDateTime::from_unix_timestamp(timestamp - HOUR * 23); + n.time = OffsetDateTime::from_unix_timestamp(timestamp - HOUR * 23).unwrap(); assert!(n.print_date().contains("hours ago")); // days test - n.time = OffsetDateTime::from_unix_timestamp(timestamp - 2 * WEEK); + n.time = OffsetDateTime::from_unix_timestamp(timestamp - 2 * WEEK).unwrap(); assert!(n.print_date().contains("days ago")); // date test - n.time = OffsetDateTime::from_unix_timestamp(timestamp - 6 * WEEK); - let date = n.time.format("%d-%m-%y"); + n.time = OffsetDateTime::from_unix_timestamp(timestamp - 6 * WEEK).unwrap(); + let date = format!("{}{}{}", n.time.year(), n.time.month(), n.time.date()); assert!(n.print_date().contains(&date)) } } diff --git a/src/main.rs b/src/main.rs index 17f39298..5c9f833b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,4 @@ +#![allow(warnings)] // Copyright (C) 2022 Aravinth Manivannan // SPDX-FileCopyrightText: 2023 Aravinth Manivannan // diff --git a/src/pages/auth/login.rs b/src/pages/auth/login.rs index e7eb184f..118ee3e2 100644 --- a/src/pages/auth/login.rs +++ b/src/pages/auth/login.rs @@ -22,7 +22,7 @@ impl Default for IndexPage { } lazy_static! { - static ref INDEX: String = IndexPage::default().render_once().unwrap(); + static ref INDEX: String = IndexPage.render_once().unwrap(); } #[get(path = "PAGES.auth.login")] diff --git a/src/pages/auth/register.rs b/src/pages/auth/register.rs index a4fe407b..ebca1696 100644 --- a/src/pages/auth/register.rs +++ b/src/pages/auth/register.rs @@ -20,7 +20,7 @@ impl Default for IndexPage { } lazy_static! { - static ref INDEX: String = IndexPage::default().render_once().unwrap(); + static ref INDEX: String = IndexPage.render_once().unwrap(); } #[my_codegen::get(path = "crate::PAGES.auth.join")] diff --git a/src/pages/mod.rs b/src/pages/mod.rs index 0fd9580d..a57887c0 100644 --- a/src/pages/mod.rs +++ b/src/pages/mod.rs @@ -63,8 +63,7 @@ mod tests { let edit_sitekey_url = PAGES.panel.sitekey.get_edit_advance(&token_key.key); let delete_sitekey_url = PAGES.panel.sitekey.get_delete(&token_key.key); - let urls = vec![ - PAGES.home, + let urls = [PAGES.home, PAGES.panel.sitekey.add_advance, PAGES.panel.sitekey.add_easy, PAGES.panel.sitekey.list, @@ -73,8 +72,7 @@ mod tests { PAGES.panel.settings.delete_account, PAGES.panel.settings.update_secret, &delete_sitekey_url, - &edit_sitekey_url, - ]; + &edit_sitekey_url]; for url in urls.iter() { let resp = @@ -100,7 +98,7 @@ mod tests { #[actix_rt::test] async fn public_pages_tempaltes_work() { let app = test::init_service(App::new().configure(services)).await; - let urls = vec![PAGES.auth.login, PAGES.auth.join, PAGES.sitemap]; + let urls = [PAGES.auth.login, PAGES.auth.join, PAGES.sitemap]; for url in urls.iter() { let resp = diff --git a/src/pages/panel/notifications.rs b/src/pages/panel/notifications.rs index dff4dd28..0c118dc3 100644 --- a/src/pages/panel/notifications.rs +++ b/src/pages/panel/notifications.rs @@ -38,7 +38,7 @@ impl From for Notification { Notification { name: n.name.unwrap(), heading: n.heading.unwrap(), - received: OffsetDateTime::from_unix_timestamp(n.received.unwrap()), + received: OffsetDateTime::from_unix_timestamp(n.received.unwrap()).unwrap(), id: n.id.unwrap(), message: n.message.unwrap(), } @@ -91,28 +91,28 @@ mod tests { // seconds test assert!(n.print_date().contains("seconds ago")); - n.received = OffsetDateTime::from_unix_timestamp(timestamp - 5); + n.received = OffsetDateTime::from_unix_timestamp(timestamp - 5).unwrap(); assert!(n.print_date().contains("seconds ago")); // minutes test - n.received = OffsetDateTime::from_unix_timestamp(timestamp - MINUTE * 2); + n.received = OffsetDateTime::from_unix_timestamp(timestamp - MINUTE * 2).unwrap(); assert!(n.print_date().contains("minutes ago")); - n.received = OffsetDateTime::from_unix_timestamp(timestamp - MINUTE * 56); + n.received = OffsetDateTime::from_unix_timestamp(timestamp - MINUTE * 56).unwrap(); assert!(n.print_date().contains("minutes ago")); // hours test - n.received = OffsetDateTime::from_unix_timestamp(timestamp - HOUR); + n.received = OffsetDateTime::from_unix_timestamp(timestamp - HOUR).unwrap(); assert!(n.print_date().contains("hours ago")); - n.received = OffsetDateTime::from_unix_timestamp(timestamp - HOUR * 23); + n.received = OffsetDateTime::from_unix_timestamp(timestamp - HOUR * 23).unwrap(); assert!(n.print_date().contains("hours ago")); // days test - n.received = OffsetDateTime::from_unix_timestamp(timestamp - 2 * WEEK); + n.received = OffsetDateTime::from_unix_timestamp(timestamp - 2 * WEEK).unwrap(); assert!(n.print_date().contains("days ago")); // date test - n.received = OffsetDateTime::from_unix_timestamp(timestamp - 6 * WEEK); - let date = n.received.format("%d-%m-%y"); + n.received = OffsetDateTime::from_unix_timestamp(timestamp - 6 * WEEK).unwrap(); + let date = format!("{}{}{}", n.received.year(), n.received.month(), n.received.date()); assert!(n.print_date().contains(&date)) } } diff --git a/src/pages/panel/sitekey/edit.rs b/src/pages/panel/sitekey/edit.rs index 50509243..4dd6adc4 100644 --- a/src/pages/panel/sitekey/edit.rs +++ b/src/pages/panel/sitekey/edit.rs @@ -108,7 +108,7 @@ pub async fn easy( let pattern = TrafficPatternRequest { peak_sustainable_traffic: c.peak_sustainable_traffic, avg_traffic: c.avg_traffic, - broke_my_site_traffic: c.broke_my_site_traffic.map(|n| n), + broke_my_site_traffic: c.broke_my_site_traffic, description: config.description, publish_benchmarks, }; diff --git a/src/settings.rs b/src/settings.rs index e64b8a67..a6b4e500 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -6,23 +6,25 @@ use std::path::Path; use std::{env, fs}; -use config::{Config, ConfigError, Environment, File}; +use config::builder::DefaultState; +use config::{Config, ConfigBuilder, ConfigError, File}; use derive_more::Display; use serde::{Deserialize, Serialize}; use url::Url; -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, Eq, PartialEq)] pub struct Server { pub port: u32, pub domain: String, pub cookie_secret: String, pub ip: String, + // TODO: remove pub url_prefix: Option, pub proxy_has_tls: bool, } -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, Eq, PartialEq)] pub struct Captcha { pub salt: String, pub gc: u64, @@ -32,7 +34,7 @@ pub struct Captcha { pub default_difficulty_strategy: DefaultDifficultyStrategy, } -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, Eq, PartialEq)] pub struct DefaultDifficultyStrategy { pub avg_traffic_difficulty: u32, pub broke_my_site_traffic_difficulty: u32, @@ -40,7 +42,7 @@ pub struct DefaultDifficultyStrategy { pub duration: u32, } -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, Eq, PartialEq)] pub struct Smtp { pub from: String, pub reply: String, @@ -57,33 +59,7 @@ impl Server { } } -//#[derive(Debug, Clone, Deserialize)] -//struct DatabaseBuilder { -// pub port: u32, -// pub hostname: String, -// pub username: String, -// pub password: String, -// pub name: String, -//} - -//impl DatabaseBuilder { -// #[cfg(not(tarpaulin_include))] -// fn extract_database_url(url: &Url) -> Self { -// debug!("Database name: {}", url.path()); -// let mut path = url.path().split('/'); -// path.next(); -// let name = path.next().expect("no database name").to_string(); -// DatabaseBuilder { -// port: url.port().expect("Enter database port").into(), -// hostname: url.host().expect("Enter database host").to_string(), -// username: url.username().into(), -// password: url.password().expect("Enter database password").into(), -// name, -// } -// } -//} - -#[derive(Deserialize, Serialize, Display, PartialEq, Clone, Debug)] +#[derive(Deserialize, Serialize, Display, Eq, PartialEq, Clone, Debug)] #[serde(rename_all = "lowercase")] pub enum DBType { #[display(fmt = "postgres")] @@ -102,51 +78,112 @@ impl DBType { } } -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, Eq, PartialEq)] pub struct Database { pub url: String, pub pool: u32, pub database_type: DBType, } -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, Eq, PartialEq)] pub struct Redis { pub url: String, pub pool: u32, } -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, Eq, PartialEq)] pub struct Settings { pub debug: bool, pub commercial: bool, + pub source_code: String, + pub allow_registration: bool, + pub allow_demo: bool, pub database: Database, pub redis: Option, pub server: Server, pub captcha: Captcha, - pub source_code: String, pub smtp: Option, - pub allow_registration: bool, - pub allow_demo: bool, } +const ENV_VAR_CONFIG: [(&str, &str); 29] = [ + /* top-level */ + ("debug", "MCAPTCHA_debug"), + ("commercial", "MCAPTCHA_commercial"), + ("source_code", "MCAPTCHA_source_code"), + ("allow_registration", "MCAPTCHA_allow_registration"), + ("allow_demo", "MCAPTCHA_allow_demo"), + + /* database */ + ("database.url", "DATABASE_URL"), + ("database.pool", "MCAPTCHA_database_POOL"), + + /* redis */ + ("redis.url", "MCPATCHA_redis_URL"), + ("redis.pool", "MCPATCHA_redis_POOL"), + + /* server */ + ("server.port", "PORT"), + ("server.domain", "MCAPTCHA_server_DOMAIN"), + ("server.cookie_secret", "MCAPTCHA__server_COOKIE_SECRET"), + ("server.ip", "MCAPTCHA__server_IP"), + ("server.proxy_has_tls", "MCAPTCHA__server_PROXY_HAS_TLS"), + + + /* captcha */ + ("captcha.salt", "MCAPTCHA_captcha_SALT"), + ("captcha.gc", "MCAPTCHA_captcha_GC"), + ("captcha.runners", "MCAPTCHA_captcha_RUNNERS"), + ("captcha.queue_length", "MCAPTCHA_captcha_QUEUE_LENGTH"), + ("captcha.enable_stats", "MCAPTCHA_captcha_ENABLE_STATS"), + ("captcha.default_difficulty_strategy.avg_traffic_difficulty", "MCAPTCHA_captcha_DEFAULT_DIFFICULTY_STRATEGY_avg_traffic_difficulty"), + ("captcha.default_difficulty_strategy.broke_my_site_traffic_difficulty", "MCAPTCHA_captcha_DEFAULT_DIFFICULTY_STRATEGY_broke_my_site_traffic_difficulty"), + ("captcha.default_difficulty_strategy.peak_sustainable_traffic_difficulty", + "MCAPTCHA_captcha_DEFAULT_DIFFICULTY_STRATEGY_peak_sustainable_traffic_difficulty"), + ( "captcha.default_difficulty_strategy.duration", + "MCAPTCHA_captcha_DEFAULT_DIFFICULTY_STRATEGY_duration" + ), + + + /* SMTP */ + ("smtp.from", "MCPATCHA_smtp_FROM"), + ("smtp.reply", "MCPATCHA_smtp_REPLY"), + ("smtp.url", "MCPATCHA_smtp_URL"), + ("smtp.username", "MCPATCHA_smtp_USERNAME"), + ("smtp.password", "MCPATCHA_smtp_PASSWORD"), + ("smtp.port", "MCPATCHA_smtp_PORT"), + + + +]; + #[cfg(not(tarpaulin_include))] impl Settings { pub fn new() -> Result { - let mut s = Config::new(); + let mut s = Config::builder(); const CURRENT_DIR: &str = "./config/default.toml"; const ETC: &str = "/etc/mcaptcha/config.toml"; - s.set("capatcha.enable_stats", true.to_string()) + s = s + .set_default("capatcha.enable_stats", true.to_string()) .expect("unable to set capatcha.enable_stats default config"); + // Will be overridden after config is parsed and loaded into Settings by + // Settings::set_database_type. + // This parameter is not ergonomic for users, but it is required and can be programatically + // inferred. But we need a default value for config lib to parse successfully, since it is + // DBType and not Option + s = s + .set_default("database.database_type", DBType::Postgres.to_string()) + .expect("unable to set database.database_type default config"); + if let Ok(path) = env::var("MCAPTCHA_CONFIG") { let absolute_path = Path::new(&path).canonicalize().unwrap(); log::info!( "Loading config file from {}", absolute_path.to_str().unwrap() ); - s.merge(File::with_name(absolute_path.to_str().unwrap()))?; + s = s.add_source(File::with_name(absolute_path.to_str().unwrap())); } else if Path::new(CURRENT_DIR).exists() { let absolute_path = fs::canonicalize(CURRENT_DIR).unwrap(); log::info!( @@ -154,102 +191,216 @@ impl Settings { absolute_path.to_str().unwrap() ); // merging default config from file - s.merge(File::with_name(absolute_path.to_str().unwrap()))?; + s = s.add_source(File::with_name(absolute_path.to_str().unwrap())); } else if Path::new(ETC).exists() { log::info!("{}", format!("Loading config file from {}", ETC)); - s.merge(File::with_name(ETC))?; + s = s.add_source(File::with_name(ETC)); } else { log::warn!("Configuration file not found"); } - s.merge(Environment::with_prefix("MCAPTCHA").separator("_"))?; + s = Self::env_override(s); - check_url(&s); + let mut settings = s.build()?.try_deserialize::()?; + settings.check_url(); - if let Ok(val) = env::var("PORT") { - s.set("server.port", val).unwrap(); - log::info!("Overriding [server].port with environment variable"); - } + settings.set_database_type(); - match env::var("DATABASE_URL") { - Ok(val) => { - let url = Url::parse(&val).expect("couldn't parse Database URL"); - s.set("database.url", url.to_string()).unwrap(); - let database_type = DBType::from_url(&url).unwrap(); - s.set("database.database_type", database_type.to_string()) - .unwrap(); - log::info!("Overriding [database].url and [database].database_type with environment variable"); - } - Err(_e) => { - set_database_url(&mut s); + Ok(settings) + } + + fn env_override(mut s: ConfigBuilder) -> ConfigBuilder { + for (parameter, env_var_name) in ENV_VAR_CONFIG.iter() { + if let Ok(val) = env::var(env_var_name) { + log::debug!( + "Overriding [{parameter}] with environment variable {env_var_name}" + ); + s = s.set_override(parameter, val).unwrap(); } } - // setting default values - #[cfg(test)] - s.set("database.pool", 2.to_string()) - .expect("Couldn't set database pool count"); + s + } - match s.try_into() { - Ok(val) => Ok(val), - Err(e) => Err(ConfigError::Message(format!("\n\nError: {}. If it says missing fields, then please refer to https://github.com/mCaptcha/mcaptcha#configuration to learn more about how mcaptcha reads configuration\n\n", e))), - } + fn set_database_type(&mut self) { + let url = Url::parse(&self.database.url) + .expect("couldn't parse Database URL and detect database type"); + self.database.database_type = DBType::from_url(&url).unwrap(); + } + + fn check_url(&self) { + Url::parse(&self.source_code) + .expect("Please enter a URL for source_code in settings"); } } -#[cfg(not(tarpaulin_include))] -fn check_url(s: &Config) { - let url = s - .get::("source_code") - .expect("Couldn't access source_code"); +#[cfg(test)] +mod tests { - Url::parse(&url).expect("Please enter a URL for source_code in settings"); + use super::*; + + #[test] + fn env_override_works() { + use crate::tests::get_settings; + let init_settings = get_settings(); + // so that it can be tested outside the macro (helper) too + let mut new_settings; + + macro_rules! helper { + + + + + ($env:expr, $val:expr, $val_typed:expr, $($param:ident).+) => { + println!("Setting env var {} to {} for test", $env, $val); + env::set_var($env, $val); + new_settings = get_settings(); + assert_eq!(new_settings.$($param).+, $val_typed); + assert_ne!(new_settings.$($param).+, init_settings.$($param).+); + env::remove_var($env); + }; + + + ($env:expr, $val:expr, $($param:ident).+) => { + helper!($env, $val.to_string(), $val, $($param).+); + }; + } + + /* top level */ + helper!("MCAPTCHA_debug", false, debug); + helper!("MCAPTCHA_commercial", true, commercial); + helper!("MCAPTCHA_allow_registration", false, allow_registration); + helper!("MCAPTCHA_allow_demo", false, allow_demo); + + /* database_type */ + + helper!( + "DATABASE_URL", + "postgres://postgres:password@localhost:5432/postgres", + database.url + ); + assert_eq!(new_settings.database.database_type, DBType::Postgres); + helper!( + "DATABASE_URL", + "mysql://maria:password@localhost/maria", + database.url + ); + assert_eq!(new_settings.database.database_type, DBType::Maria); + helper!("MCAPTCHA_database_POOL", 1000, database.pool); + + /* redis */ + + /* redis.url */ + let env = "MCPATCHA_redis_URL"; + let val = "redis://redis.example.org"; + println!("Setting env var {} to {} for test", env, val); + env::set_var(env, val); + new_settings = get_settings(); + assert_eq!(new_settings.redis.as_ref().unwrap().url, val); + assert_ne!( + new_settings.redis.as_ref().unwrap().url, + init_settings.redis.as_ref().unwrap().url + ); + env::remove_var(env); + + /* redis.pool */ + let env = "MCPATCHA_redis_POOL"; + let val = 999; + println!("Setting env var {} to {} for test", env, val); + env::set_var(env, val.to_string()); + new_settings = get_settings(); + assert_eq!(new_settings.redis.as_ref().unwrap().pool, val); + assert_ne!( + new_settings.redis.as_ref().unwrap().pool, + init_settings.redis.as_ref().unwrap().pool + ); + env::remove_var(env); + + helper!("PORT", 0, server.port); + helper!("MCAPTCHA_server_DOMAIN", "example.org", server.domain); + helper!( + "MCAPTCHA__server_COOKIE_SECRET", + "dafasdfsdf", + server.cookie_secret + ); + helper!("MCAPTCHA__server_IP", "9.9.9.9", server.ip); + helper!("MCAPTCHA__server_PROXY_HAS_TLS", true, server.proxy_has_tls); + + /* captcha */ + + helper!("MCAPTCHA_captcha_SALT", "foobarasdfasdf", captcha.salt); + helper!("MCAPTCHA_captcha_GC", 500, captcha.gc); + helper!( + "MCAPTCHA_captcha_RUNNERS", + "500", + Some(500), + captcha.runners + ); + + helper!("MCAPTCHA_captcha_QUEUE_LENGTH", 500, captcha.queue_length); + helper!("MCAPTCHA_captcha_ENABLE_STATS", false, captcha.enable_stats); + helper!( + "MCAPTCHA_captcha_DEFAULT_DIFFICULTY_STRATEGY_avg_traffic_difficulty", + 999, + captcha.default_difficulty_strategy.avg_traffic_difficulty + ); + helper!("MCAPTCHA_captcha_DEFAULT_DIFFICULTY_STRATEGY_peak_sustainable_traffic_difficulty", 999 , captcha.default_difficulty_strategy.peak_sustainable_traffic_difficulty); + helper!("MCAPTCHA_captcha_DEFAULT_DIFFICULTY_STRATEGY_broke_my_site_traffic_difficulty", 999 , captcha.default_difficulty_strategy.broke_my_site_traffic_difficulty); + helper!( + "MCAPTCHA_captcha_DEFAULT_DIFFICULTY_STRATEGY_duration", + 999, + captcha.default_difficulty_strategy.duration + ); + + /* SMTP */ + + let vals = [ + "MCPATCHA_smtp_FROM", + "MCPATCHA_smtp_REPLY", + "MCPATCHA_smtp_URL", + "MCPATCHA_smtp_USERNAME", + "MCPATCHA_smtp_PASSWORD", + "MCPATCHA_smtp_PORT", + ]; + for env in vals.iter() { + println!("Setting env var {} to {} for test", env, env); + env::set_var(env, env); + } + + let port = 9999; + env::set_var("MCPATCHA_smtp_PORT", port.to_string()); + + new_settings = get_settings(); + let smtp_new = new_settings.smtp.as_ref().unwrap(); + let smtp_old = init_settings.smtp.as_ref().unwrap(); + assert_eq!(smtp_new.from, "MCPATCHA_smtp_FROM"); + assert_eq!(smtp_new.reply, "MCPATCHA_smtp_REPLY"); + assert_eq!(smtp_new.username, "MCPATCHA_smtp_USERNAME"); + assert_eq!(smtp_new.password, "MCPATCHA_smtp_PASSWORD"); + assert_eq!(smtp_new.port, port); + assert_ne!(smtp_new, smtp_old); + + for env in vals.iter() { + env::remove_var(env); + } + } + + // #[test] + // fn url_prefix_test() { + // let mut settings = Settings::new().unwrap(); + // assert!(settings.server.url_prefix.is_none()); + // settings.server.url_prefix = Some("test".into()); + // settings.server.check_url_prefix(); + // settings.server.url_prefix = Some(" ".into()); + // settings.server.check_url_prefix(); + // assert!(settings.server.url_prefix.is_none()); + // } + // + // #[test] + // fn smtp_config_works() { + // let settings = Settings::new().unwrap(); + // assert!(settings.smtp.is_some()); + // assert_eq!(settings.smtp.as_ref().unwrap().password, "password"); + // assert_eq!(settings.smtp.as_ref().unwrap().username, "admin"); + // } } - -#[cfg(not(tarpaulin_include))] -fn set_database_url(s: &mut Config) { - s.set( - "database.url", - format!( - r"postgres://{}:{}@{}:{}/{}", - s.get::("database.username") - .expect("Couldn't access database username"), - urlencoding::encode( - s.get::("database.password") - .expect("Couldn't access database password") - .as_str() - ), - s.get::("database.hostname") - .expect("Couldn't access database hostname"), - s.get::("database.port") - .expect("Couldn't access database port"), - s.get::("database.name") - .expect("Couldn't access database name") - ), - ) - .expect("Couldn't set database url"); -} - -//#[cfg(test)] -//mod tests { -// use super::*; -// -// #[test] -// fn url_prefix_test() { -// let mut settings = Settings::new().unwrap(); -// assert!(settings.server.url_prefix.is_none()); -// settings.server.url_prefix = Some("test".into()); -// settings.server.check_url_prefix(); -// settings.server.url_prefix = Some(" ".into()); -// settings.server.check_url_prefix(); -// assert!(settings.server.url_prefix.is_none()); -// } -// -// #[test] -// fn smtp_config_works() { -// let settings = Settings::new().unwrap(); -// assert!(settings.smtp.is_some()); -// assert_eq!(settings.smtp.as_ref().unwrap().password, "password"); -// assert_eq!(settings.smtp.as_ref().unwrap().username, "admin"); -// } -//} diff --git a/src/tests/mod.rs b/src/tests/mod.rs index 89986675..40e95974 100644 --- a/src/tests/mod.rs +++ b/src/tests/mod.rs @@ -40,7 +40,8 @@ pub mod pg { settings.captcha.runners = Some(1); settings.database.url = url.clone(); settings.database.database_type = DBType::Postgres; - + settings.database.pool = 2; + Data::new(&settings).await } } @@ -59,7 +60,8 @@ pub mod maria { settings.captcha.runners = Some(1); settings.database.url = url.clone(); settings.database.database_type = DBType::Maria; - + settings.database.pool = 2; + Data::new(&settings).await } } @@ -116,7 +118,7 @@ macro_rules! get_app { .wrap(actix_middleware::NormalizePath::new( actix_middleware::TrailingSlash::Trim, )) - .configure(crate::routes::services) + .configure($crate::routes::services) //.data(std::sync::Arc::new(crate::data::Data::new().await)) .app_data(actix_web::web::Data::new($data.clone())), )