diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 41643bd..a76fd86 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: needs: cancel-previous-runs runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: profile: minimal @@ -56,7 +56,7 @@ jobs: needs: cancel-previous-runs runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: toolchain: ${{ env.RUST_VERSION }} @@ -70,7 +70,7 @@ jobs: needs: cancel-previous-runs runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: toolchain: ${{ env.RUST_VERSION }} @@ -85,7 +85,7 @@ jobs: needs: cancel-previous-runs runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: profile: minimal @@ -101,7 +101,7 @@ jobs: needs: cancel-previous-runs runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: profile: minimal @@ -124,16 +124,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v4 - - - name: Installing Bun - uses: oven-sh/setup-bun@v1 - - - name: Building Frontend - run: | - cd frontend - bun install - bun run build + uses: actions/checkout@v2 - name: Docker meta id: meta diff --git a/.gitignore b/.gitignore index 74dee6d..d8f63cd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,29 +1,2 @@ .DS_Store -target -node_modules -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -pnpm-debug.log* -lerna-debug.log* - -node_modules -dist -dist-ssr -*.local - -# Editor directories and files -.vscode/* -!.vscode/extensions.json -.idea -.DS_Store -*.suo -*.ntvs* -*.njsproj -*.sln -*.sw? - -static/js +/target diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 3a789a3..0000000 --- a/.prettierrc +++ /dev/null @@ -1,12 +0,0 @@ -{ - "singleQuote": false, - "printWidth": 80, - "overrides": [ - { - "files": ["**/*.html"], - "options": { - "printWidth": 120 - } - } - ] -} diff --git a/Cargo.lock b/Cargo.lock index 3f14e86..72b0988 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12,186 +12,6 @@ dependencies = [ "regex", ] -[[package]] -name = "actix-codec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f7b0a21988c1bf877cf4759ef5ddaac04c1c9fe808c9142ecb78ba97d97a28a" -dependencies = [ - "bitflags 2.4.1", - "bytes", - "futures-core", - "futures-sink", - "memchr", - "pin-project-lite", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "actix-http" -version = "3.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d223b13fd481fc0d1f83bb12659ae774d9e3601814c68a0bc539731698cca743" -dependencies = [ - "actix-codec", - "actix-rt", - "actix-service", - "actix-utils", - "ahash 0.8.11", - "base64 0.21.5", - "bitflags 2.4.1", - "brotli", - "bytes", - "bytestring", - "derive_more", - "encoding_rs", - "flate2", - "futures-core", - "h2 0.3.24", - "http 0.2.11", - "httparse", - "httpdate", - "itoa", - "language-tags", - "local-channel", - "mime", - "percent-encoding", - "pin-project-lite", - "rand", - "sha1", - "smallvec", - "tokio", - "tokio-util", - "tracing", - "zstd", -] - -[[package]] -name = "actix-macros" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" -dependencies = [ - "quote", - "syn 2.0.55", -] - -[[package]] -name = "actix-router" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d22475596539443685426b6bdadb926ad0ecaefdfc5fb05e5e3441f15463c511" -dependencies = [ - "bytestring", - "http 0.2.11", - "regex", - "serde", - "tracing", -] - -[[package]] -name = "actix-rt" -version = "2.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28f32d40287d3f402ae0028a9d54bef51af15c8769492826a69d28f81893151d" -dependencies = [ - "actix-macros", - "futures-core", - "tokio", -] - -[[package]] -name = "actix-server" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3eb13e7eef0423ea6eab0e59f6c72e7cb46d33691ad56a726b3cd07ddec2c2d4" -dependencies = [ - "actix-rt", - "actix-service", - "actix-utils", - "futures-core", - "futures-util", - "mio", - "socket2 0.5.5", - "tokio", - "tracing", -] - -[[package]] -name = "actix-service" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b894941f818cfdc7ccc4b9e60fa7e53b5042a2e8567270f9147d5591893373a" -dependencies = [ - "futures-core", - "paste", - "pin-project-lite", -] - -[[package]] -name = "actix-utils" -version = "3.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88a1dcdff1466e3c2488e1cb5c36a71822750ad43839937f85d2f4d9f8b705d8" -dependencies = [ - "local-waker", - "pin-project-lite", -] - -[[package]] -name = "actix-web" -version = "4.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a6556ddebb638c2358714d853257ed226ece6023ef9364f23f0c70737ea984" -dependencies = [ - "actix-codec", - "actix-http", - "actix-macros", - "actix-router", - "actix-rt", - "actix-server", - "actix-service", - "actix-utils", - "actix-web-codegen", - "ahash 0.8.11", - "bytes", - "bytestring", - "cfg-if", - "cookie 0.16.2", - "derive_more", - "encoding_rs", - "futures-core", - "futures-util", - "itoa", - "language-tags", - "log", - "mime", - "once_cell", - "pin-project-lite", - "regex", - "serde", - "serde_json", - "serde_urlencoded", - "smallvec", - "socket2 0.5.5", - "time", - "url", -] - -[[package]] -name = "actix-web-codegen" -version = "4.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1f50ebbb30eca122b188319a4398b3f7bb4a8cdf50ecfb73bfc6a3c3ce54f5" -dependencies = [ - "actix-router", - "proc-macro2", - "quote", - "syn 2.0.55", -] - [[package]] name = "addr2line" version = "0.21.0" @@ -220,23 +40,11 @@ dependencies = [ [[package]] name = "ahash" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" -dependencies = [ - "getrandom", - "once_cell", - "version_check", -] - -[[package]] -name = "ahash" -version = "0.8.11" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" dependencies = [ "cfg-if", - "getrandom", "once_cell", "version_check", "zerocopy", @@ -260,21 +68,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "alloc-no-stdlib" -version = "2.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" - -[[package]] -name = "alloc-stdlib" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" -dependencies = [ - "alloc-no-stdlib", -] - [[package]] name = "allocator-api2" version = "0.2.16" @@ -331,7 +124,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" dependencies = [ - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -341,7 +134,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" dependencies = [ "anstyle", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -371,7 +164,7 @@ dependencies = [ "bytes", "fnv", "futures-util", - "http 0.2.11", + "http", "indexmap 1.9.3", "mime", "multer", @@ -448,18 +241,18 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.55", + "syn 2.0.39", ] [[package]] name = "async-trait" -version = "0.1.79" +version = "0.1.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507401cad91ec6a857ed5513a2073c82a9b9048762b885bb98655b306964681" +checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.55", + "syn 2.0.39", ] [[package]] @@ -484,15 +277,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acee9fd5073ab6b045a275b3e709c163dd36c90685219cb21804a147b58dba43" dependencies = [ "async-trait", - "axum-core 0.2.9", + "axum-core", "bitflags 1.3.2", "bytes", "futures-util", - "http 0.2.11", - "http-body 0.4.5", - "hyper 0.14.27", + "http", + "http-body", + "hyper", "itoa", - "matchit 0.5.0", + "matchit", "memchr", "mime", "percent-encoding", @@ -508,40 +301,6 @@ dependencies = [ "tower-service", ] -[[package]] -name = "axum" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1236b4b292f6c4d6dc34604bb5120d85c3fe1d1aa596bd5cc52ca054d13e7b9e" -dependencies = [ - "async-trait", - "axum-core 0.4.3", - "bytes", - "futures-util", - "http 1.1.0", - "http-body 1.0.0", - "http-body-util", - "hyper 1.2.0", - "hyper-util", - "itoa", - "matchit 0.7.3", - "memchr", - "mime", - "percent-encoding", - "pin-project-lite", - "rustversion", - "serde", - "serde_json", - "serde_path_to_error", - "serde_urlencoded", - "sync_wrapper", - "tokio", - "tower", - "tower-layer", - "tower-service", - "tracing", -] - [[package]] name = "axum-core" version = "0.2.9" @@ -551,32 +310,11 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http 0.2.11", - "http-body 0.4.5", - "mime", - "tower-layer", - "tower-service", -] - -[[package]] -name = "axum-core" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3" -dependencies = [ - "async-trait", - "bytes", - "futures-util", - "http 1.1.0", - "http-body 1.0.0", - "http-body-util", + "http", + "http-body", "mime", - "pin-project-lite", - "rustversion", - "sync_wrapper", "tower-layer", "tower-service", - "tracing", ] [[package]] @@ -613,21 +351,6 @@ version = "0.21.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" -[[package]] -name = "base64" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51" - -[[package]] -name = "base64-simd" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "781dd20c3aff0bd194fe7d2a977dd92f21c173891f3a03b677359e5fa457e5d5" -dependencies = [ - "simd-abstraction", -] - [[package]] name = "base64ct" version = "1.6.0" @@ -676,27 +399,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "brotli" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "516074a47ef4bce09577a3b379392300159ce5b1ba2e501ff1c819950066100f" -dependencies = [ - "alloc-no-stdlib", - "alloc-stdlib", - "brotli-decompressor", -] - -[[package]] -name = "brotli-decompressor" -version = "2.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e2e4afe60d7dd600fdd3de8d0f08c2b7ec039712e3b6137ff98b7004e82de4f" -dependencies = [ - "alloc-no-stdlib", - "alloc-stdlib", -] - [[package]] name = "bs58" version = "0.5.0" @@ -713,28 +415,6 @@ version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" -[[package]] -name = "bytecheck" -version = "0.6.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23cdc57ce23ac53c931e88a43d06d070a6fd142f2617be5855eb75efc9beb1c2" -dependencies = [ - "bytecheck_derive", - "ptr_meta", - "simdutf8", -] - -[[package]] -name = "bytecheck_derive" -version = "0.6.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3db406d29fbcd95542e92559bed4d8ad92636d1ca8b3b72ede10b4bcc010e659" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "byteorder" version = "1.5.0" @@ -750,22 +430,12 @@ dependencies = [ "serde", ] -[[package]] -name = "bytestring" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d80203ea6b29df88012294f62733de21cfeab47f17b41af3a38bc30a03ee72" -dependencies = [ - "bytes", -] - [[package]] name = "cc" version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ - "jobserver", "libc", ] @@ -785,9 +455,8 @@ dependencies = [ "iana-time-zone", "js-sys", "num-traits", - "serde", "wasm-bindgen", - "windows-targets", + "windows-targets 0.48.5", ] [[package]] @@ -831,7 +500,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.55", + "syn 2.0.39", ] [[package]] @@ -840,25 +509,6 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" -[[package]] -name = "clerk-rs" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29fa155891dd4b888fb23359e5c7471af6faf951d035e2fdb8f81eb03eb48cac" -dependencies = [ - "actix-rt", - "actix-web", - "futures-util", - "jsonwebtoken", - "regex", - "reqwest", - "serde", - "serde_derive", - "serde_json", - "serde_with 2.3.3", - "url", -] - [[package]] name = "cobs" version = "0.2.3" @@ -937,30 +587,22 @@ dependencies = [ ] [[package]] -name = "const-oid" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" - -[[package]] -name = "const-str" -version = "0.3.2" +name = "console" +version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21077772762a1002bb421c3af42ac1725fa56066bfc53d9a55bb79905df2aaf3" +checksum = "c926e00cc70edefdc64d3a5ff31cc65bb97a3460097762bd23afb4d8145fccf8" dependencies = [ - "const-str-proc-macro", + "encode_unicode", + "lazy_static", + "libc", + "windows-sys 0.45.0", ] [[package]] -name = "const-str-proc-macro" -version = "0.3.2" +name = "const-oid" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e1e0fdd2e5d3041e530e1b21158aeeef8b5d0e306bc5c1e3d6cf0930d10e25a" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] +checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" [[package]] name = "convert_case" @@ -980,35 +622,13 @@ dependencies = [ ] [[package]] -name = "cookie" -version = "0.17.0" +name = "cookie_store" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7efb37c3e1ccb1ff97164ad95ac1606e8ccd35b3fa0a7d99a304c7f4a428cc24" +checksum = "d606d0fba62e13cf04db20536c05cb7f13673c161cb47a47a82b9b9e7d3f1daa" dependencies = [ - "percent-encoding", - "time", - "version_check", -] - -[[package]] -name = "cookie" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cd91cf61412820176e137621345ee43b3f4423e589e7ae4e50d601d93e35ef8" -dependencies = [ - "percent-encoding", - "time", - "version_check", -] - -[[package]] -name = "cookie_store" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "387461abbc748185c3a6e1673d826918b450b87ff22639429c694619a83b6cf6" -dependencies = [ - "cookie 0.17.0", - "idna 0.3.0", + "cookie", + "idna 0.2.3", "log", "publicsuffix", "serde", @@ -1052,15 +672,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crc32fast" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" -dependencies = [ - "cfg-if", -] - [[package]] name = "critical-section" version = "1.1.2" @@ -1128,38 +739,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "cssparser" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9be934d936a0fbed5bcdc01042b770de1398bf79d0e192f49fa7faea0e99281e" -dependencies = [ - "cssparser-macros", - "dtoa-short", - "itoa", - "phf 0.11.2", - "smallvec", -] - -[[package]] -name = "cssparser-color" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "556c099a61d85989d7af52b692e35a8d68a57e7df8c6d07563dc0778b3960c9f" -dependencies = [ - "cssparser", -] - -[[package]] -name = "cssparser-macros" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" -dependencies = [ - "quote", - "syn 2.0.55", -] - [[package]] name = "ct-logs" version = "0.8.0" @@ -1202,7 +781,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.55", + "syn 2.0.39", ] [[package]] @@ -1265,16 +844,6 @@ dependencies = [ "darling_macro 0.14.4", ] -[[package]] -name = "darling" -version = "0.20.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" -dependencies = [ - "darling_core 0.20.8", - "darling_macro 0.20.8", -] - [[package]] name = "darling_core" version = "0.13.4" @@ -1303,20 +872,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "darling_core" -version = "0.20.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn 2.0.55", -] - [[package]] name = "darling_macro" version = "0.13.4" @@ -1339,45 +894,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "darling_macro" -version = "0.20.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" -dependencies = [ - "darling_core 0.20.8", - "quote", - "syn 2.0.55", -] - -[[package]] -name = "dashmap" -version = "5.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" -dependencies = [ - "cfg-if", - "hashbrown 0.14.3", - "lock_api", - "once_cell", - "parking_lot_core", -] - -[[package]] -name = "data-encoding" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" - -[[package]] -name = "data-url" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a30bfce702bcfa94e906ef82421f2c0e61c076ad76030c16ee5d2e9a32fe193" -dependencies = [ - "matches", -] - [[package]] name = "der" version = "0.7.8" @@ -1395,7 +911,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" dependencies = [ "powerfmt", - "serde", ] [[package]] @@ -1440,15 +955,6 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" -[[package]] -name = "dtoa-short" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbaceec3c6e4211c79e7b1800fb9680527106beb2f9c51904a3210c03a448c74" -dependencies = [ - "dtoa", -] - [[package]] name = "ecdsa" version = "0.16.9" @@ -1515,6 +1021,12 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" +[[package]] +name = "encode_unicode" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" + [[package]] name = "encoding_rs" version = "0.8.33" @@ -1541,7 +1053,7 @@ checksum = "eecf8589574ce9b895052fa12d69af7a233f99e6107f5cb8dd1044f2a17bfdcb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.55", + "syn 2.0.39", ] [[package]] @@ -1557,7 +1069,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f258a7194e7f7c2a7837a8913aeab7fd8c383457034fa20ce4dd3dcb813e8eb8" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -1595,7 +1107,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9146112ee3ce031aa5aebe3e049e10b1d353b9c7630cc6be488c2c62cc5d9c42" dependencies = [ "futures", - "hyper 0.14.27", + "hyper", "hyper-rustls 0.22.1", "hyper-timeout", "log", @@ -1634,37 +1146,12 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "flate2" -version = "1.0.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" -dependencies = [ - "crc32fast", - "miniz_oxide", -] - [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "form_urlencoded" version = "1.2.1" @@ -1687,7 +1174,7 @@ dependencies = [ "regex", "serde", "serde_json", - "syn 2.0.55", + "syn 2.0.39", "thiserror", ] @@ -1712,7 +1199,7 @@ dependencies = [ "anyhow", "async-graphql", "async-trait", - "axum 0.5.17", + "axum", "clap", "derive_more", "enum-iterator", @@ -1730,7 +1217,7 @@ dependencies = [ "fuel-core-types", "futures", "hex", - "hyper 0.14.27", + "hyper", "itertools 0.10.5", "postcard", "rand", @@ -1761,7 +1248,7 @@ dependencies = [ "postcard", "serde", "serde_json", - "serde_with 1.14.0", + "serde_with", "tracing", ] @@ -1850,7 +1337,7 @@ version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "10d853a839036a1906e8082192268034ace79e5d04dbd935abeaee745c5f5a39" dependencies = [ - "axum 0.5.17", + "axum", "once_cell", "pin-project-lite", "prometheus-client 0.18.1", @@ -1987,7 +1474,7 @@ checksum = "ff58cf4d01a4fb9440c63a8764154dfd3b07c74e4b3639cce8eea77d67e63a7a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.55", + "syn 2.0.39", "synstructure", ] @@ -1996,29 +1483,29 @@ name = "fuel-faucet" version = "0.0.0" dependencies = [ "anyhow", - "axum 0.7.4", - "clerk-rs", + "axum", "fuel-core", "fuel-core-client", "fuel-core-txpool", + "fuel-crypto", "fuel-tx", "fuel-types", "fuels-accounts", "fuels-core", "futures", "handlebars", + "insta", "lazy_static", + "memoize", "minify-html", "rand", "reqwest", "secrecy", "serde", "serde_json", - "time", "tokio", "tower", - "tower-http 0.5.2", - "tower-sessions", + "tower-http 0.2.5", "tracing", "tracing-subscriber", ] @@ -2147,7 +1634,7 @@ dependencies = [ "quote", "regex", "serde_json", - "syn 2.0.55", + "syn 2.0.39", ] [[package]] @@ -2189,7 +1676,7 @@ dependencies = [ "proc-macro2", "quote", "rand", - "syn 2.0.55", + "syn 2.0.39", ] [[package]] @@ -2254,7 +1741,7 @@ checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.55", + "syn 2.0.39", ] [[package]] @@ -2287,15 +1774,6 @@ dependencies = [ "slab", ] -[[package]] -name = "fxhash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" -dependencies = [ - "byteorder", -] - [[package]] name = "generic-array" version = "0.14.7" @@ -2347,35 +1825,16 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.24" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" +checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" dependencies = [ "bytes", "fnv", "futures-core", "futures-sink", "futures-util", - "http 0.2.11", - "indexmap 2.1.0", - "slab", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "h2" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31d030e59af851932b72ceebadf4a2b5986dba4c3b99dd2493f8273a0f151943" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http 1.1.0", + "http", "indexmap 2.1.0", "slab", "tokio", @@ -2411,9 +1870,6 @@ name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -dependencies = [ - "ahash 0.7.8", -] [[package]] name = "hashbrown" @@ -2421,8 +1877,7 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ - "ahash 0.8.11", - "bumpalo", + "ahash", ] [[package]] @@ -2431,7 +1886,7 @@ version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" dependencies = [ - "ahash 0.8.11", + "ahash", "allocator-api2", "serde", ] @@ -2491,17 +1946,6 @@ dependencies = [ "itoa", ] -[[package]] -name = "http" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - [[package]] name = "http-body" version = "0.4.5" @@ -2509,30 +1953,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ "bytes", - "http 0.2.11", - "pin-project-lite", -] - -[[package]] -name = "http-body" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" -dependencies = [ - "bytes", - "http 1.1.0", -] - -[[package]] -name = "http-body-util" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cb79eb393015dadd30fc252023adb0b2400a0caee0fa2a077e6e21a551e840" -dependencies = [ - "bytes", - "futures-util", - "http 1.1.0", - "http-body 1.0.0", + "http", "pin-project-lite", ] @@ -2542,12 +1963,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "add0ab9360ddbd88cfeb3bd9574a1d85cfdfa14db10b3e21d3700dbc4328758f" -[[package]] -name = "http-range-header" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ce4ef31cda248bbdb6e6820603b82dfcd9e833db65a43e997a0ccec777d11fe" - [[package]] name = "httparse" version = "1.8.0" @@ -2570,9 +1985,9 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2 0.3.24", - "http 0.2.11", - "http-body 0.4.5", + "h2", + "http", + "http-body", "httparse", "httpdate", "itoa", @@ -2584,26 +1999,6 @@ dependencies = [ "want", ] -[[package]] -name = "hyper" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "186548d73ac615b32a73aafe38fb4f56c0d340e110e5a200bcadbaf2e199263a" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "h2 0.4.2", - "http 1.1.0", - "http-body 1.0.0", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "smallvec", - "tokio", -] - [[package]] name = "hyper-rustls" version = "0.22.1" @@ -2612,7 +2007,7 @@ checksum = "5f9f7a97316d44c0af9b0301e65010573a853a9fc97046d7331d7f6bc0fd5a64" dependencies = [ "ct-logs", "futures-util", - "hyper 0.14.27", + "hyper", "log", "rustls 0.19.1", "rustls-native-certs 0.5.0", @@ -2628,8 +2023,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", - "http 0.2.11", - "hyper 0.14.27", + "http", + "hyper", "log", "rustls 0.21.9", "rustls-native-certs 0.6.3", @@ -2644,41 +2039,12 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ - "hyper 0.14.27", + "hyper", "pin-project-lite", "tokio", "tokio-io-timeout", ] -[[package]] -name = "hyper-tls" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" -dependencies = [ - "bytes", - "hyper 0.14.27", - "native-tls", - "tokio", - "tokio-native-tls", -] - -[[package]] -name = "hyper-util" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" -dependencies = [ - "bytes", - "futures-util", - "http 1.1.0", - "http-body 1.0.0", - "hyper 1.2.0", - "pin-project-lite", - "socket2 0.5.5", - "tokio", -] - [[package]] name = "iana-time-zone" version = "0.1.58" @@ -2708,6 +2074,17 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" +[[package]] +name = "idna" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "idna" version = "0.3.0" @@ -2758,6 +2135,19 @@ dependencies = [ "generic-array", ] +[[package]] +name = "insta" +version = "1.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d64600be34b2fcfc267740a243fa7744441bb4947a619ac4e5bb6507f35fbfc" +dependencies = [ + "console", + "lazy_static", + "linked-hash-map", + "similar", + "yaml-rust", +] + [[package]] name = "ipnet" version = "2.9.0" @@ -2788,15 +2178,6 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" -[[package]] -name = "jobserver" -version = "0.1.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6" -dependencies = [ - "libc", -] - [[package]] name = "js-sys" version = "0.3.65" @@ -2806,20 +2187,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "jsonwebtoken" -version = "8.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" -dependencies = [ - "base64 0.21.5", - "pem", - "ring 0.16.20", - "serde", - "serde_json", - "simple_asn1", -] - [[package]] name = "k256" version = "0.13.2" @@ -2843,12 +2210,6 @@ dependencies = [ "cpufeatures", ] -[[package]] -name = "language-tags" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388" - [[package]] name = "lazy_static" version = "1.4.0" @@ -2868,29 +2229,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] -name = "lightningcss" -version = "1.0.0-alpha.54" +name = "linked-hash-map" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07d306844e5af1753490c420c0d6ae3d814b00725092d106332762827ca8f0fe" -dependencies = [ - "ahash 0.8.11", - "bitflags 2.4.1", - "const-str", - "cssparser", - "cssparser-color", - "dashmap", - "data-encoding", - "getrandom", - "itertools 0.10.5", - "lazy_static", - "parcel_selectors", - "parcel_sourcemap", - "paste", - "pathdiff", - "rayon", - "serde", - "smallvec", -] +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "linux-raw-sys" @@ -2898,23 +2240,6 @@ version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" -[[package]] -name = "local-channel" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6cbc85e69b8df4b8bb8b89ec634e7189099cea8927a276b7384ce5488e53ec8" -dependencies = [ - "futures-core", - "futures-sink", - "local-waker", -] - -[[package]] -name = "local-waker" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d873d7c67ce09b42110d801813efbc9364414e356be9935700d368351657487" - [[package]] name = "lock_api" version = "0.4.11" @@ -2923,7 +2248,6 @@ checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg", "scopeguard", - "serde", ] [[package]] @@ -2953,12 +2277,6 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73cbba799671b762df5a175adf59ce145165747bb891505c43d09aefbbf38beb" -[[package]] -name = "matchit" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" - [[package]] name = "memchr" version = "2.6.4" @@ -2975,60 +2293,42 @@ dependencies = [ ] [[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - -[[package]] -name = "mime_guess" -version = "2.0.4" +name = "memoize" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" +checksum = "c25d125e4063f313300d87c8f658e5b3d69257095df9a4221c12ba50b0421bff" dependencies = [ - "mime", - "unicase", + "lazy_static", + "memoize-inner", ] [[package]] -name = "minify-html" -version = "0.15.0" +name = "memoize-inner" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd4517942a8e7425c990b14977f86a63e4996eed7b15cfcca1540126ac5ff25" +checksum = "b8b7d5160e6ffcc59d4c571c38238ec5b7065bc91a5a24f511988dabcddda723" dependencies = [ - "aho-corasick 0.7.20", "lazy_static", - "lightningcss", - "memchr", - "minify-html-common", - "minify-js", - "once_cell", - "rustc-hash", + "proc-macro2", + "quote", + "syn 1.0.109", ] [[package]] -name = "minify-html-common" -version = "0.0.2" +name = "mime" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "697a6b40dffdc5de10c0cbd709dc2bc2039cea9dab8aaa636eb9a49d6b411780" -dependencies = [ - "aho-corasick 0.7.20", - "itertools 0.12.0", - "lazy_static", - "memchr", - "rustc-hash", - "serde", - "serde_json", -] +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] -name = "minify-js" -version = "0.5.6" +name = "minify-html" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22d6c512a82abddbbc13b70609cb2beff01be2c7afff534d6e5e1c85e438fc8b" +checksum = "f617f8bf5ea04b94647e6d1a918807695e970f90fd2e8523fc86785ed52da5e6" dependencies = [ + "aho-corasick 0.7.20", "lazy_static", - "parse-js", + "memchr", ] [[package]] @@ -3047,9 +2347,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" dependencies = [ "libc", - "log", "wasi", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -3061,7 +2360,7 @@ dependencies = [ "bytes", "encoding_rs", "futures-util", - "http 0.2.11", + "http", "httparse", "log", "memchr", @@ -3070,24 +2369,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "native-tls" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" -dependencies = [ - "lazy_static", - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -3098,32 +2379,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "num-bigint" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-conv" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" - -[[package]] -name = "num-integer" -version = "0.1.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" -dependencies = [ - "num-traits", -] - [[package]] name = "num-traits" version = "0.2.17" @@ -3154,35 +2409,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - -[[package]] -name = "openssl" -version = "0.10.64" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" -dependencies = [ - "bitflags 2.4.1", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.55", -] +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "openssl-probe" @@ -3190,24 +2419,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" -[[package]] -name = "openssl-sys" -version = "0.9.101" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dda2b0f344e78efc2facf7d195d098df0dd72151b26ab98da807afc26c198dff" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "outref" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f222829ae9293e33a9f5e9f440c6760a3d450a64affe1846486b140db81c1f4" - [[package]] name = "overload" version = "0.1.1" @@ -3226,36 +2437,6 @@ dependencies = [ "sha2", ] -[[package]] -name = "parcel_selectors" -version = "0.26.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d74befe2d076330d9a58bf9ca2da424568724ab278adf15fb5718253133887" -dependencies = [ - "bitflags 2.4.1", - "cssparser", - "fxhash", - "log", - "phf 0.10.1", - "phf_codegen", - "precomputed-hash", - "smallvec", -] - -[[package]] -name = "parcel_sourcemap" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "485b74d7218068b2b7c0e3ff12fbc61ae11d57cb5d8224f525bd304c6be05bbb" -dependencies = [ - "base64-simd", - "data-url", - "rkyv", - "serde", - "serde_json", - "vlq", -] - [[package]] name = "parking_lot" version = "0.12.1" @@ -3276,20 +2457,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets", -] - -[[package]] -name = "parse-js" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ec3b11d443640ec35165ee8f6f0559f1c6f41878d70330fe9187012b5935f02" -dependencies = [ - "aho-corasick 0.7.20", - "bumpalo", - "hashbrown 0.13.2", - "lazy_static", - "memchr", + "windows-targets 0.48.5", ] [[package]] @@ -3298,12 +2466,6 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" -[[package]] -name = "pathdiff" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" - [[package]] name = "pbkdf2" version = "0.11.0" @@ -3323,15 +2485,6 @@ dependencies = [ "hmac", ] -[[package]] -name = "pem" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" -dependencies = [ - "base64 0.13.1", -] - [[package]] name = "percent-encoding" version = "2.3.1" @@ -3369,7 +2522,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.55", + "syn 2.0.39", ] [[package]] @@ -3383,86 +2536,6 @@ dependencies = [ "sha2", ] -[[package]] -name = "phf" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" -dependencies = [ - "phf_shared 0.10.0", -] - -[[package]] -name = "phf" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" -dependencies = [ - "phf_macros", - "phf_shared 0.11.2", -] - -[[package]] -name = "phf_codegen" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd" -dependencies = [ - "phf_generator 0.10.0", - "phf_shared 0.10.0", -] - -[[package]] -name = "phf_generator" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" -dependencies = [ - "phf_shared 0.10.0", - "rand", -] - -[[package]] -name = "phf_generator" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" -dependencies = [ - "phf_shared 0.11.2", - "rand", -] - -[[package]] -name = "phf_macros" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" -dependencies = [ - "phf_generator 0.11.2", - "phf_shared 0.11.2", - "proc-macro2", - "quote", - "syn 2.0.55", -] - -[[package]] -name = "phf_shared" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" -dependencies = [ - "siphasher", -] - -[[package]] -name = "phf_shared" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" -dependencies = [ - "siphasher", -] - [[package]] name = "pin-project" version = "1.1.3" @@ -3480,7 +2553,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.55", + "syn 2.0.39", ] [[package]] @@ -3505,12 +2578,6 @@ dependencies = [ "spki", ] -[[package]] -name = "pkg-config" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" - [[package]] name = "platforms" version = "3.2.0" @@ -3539,13 +2606,7 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" name = "ppv-lite86" version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" - -[[package]] -name = "precomputed-hash" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "primeorder" @@ -3578,9 +2639,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.79" +version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" +checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" dependencies = [ "unicode-ident", ] @@ -3617,7 +2678,7 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.55", + "syn 2.0.39", ] [[package]] @@ -3637,26 +2698,6 @@ version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33cb294fe86a74cbcf50d4445b37da762029549ebeea341421c7c70370f86cac" -[[package]] -name = "ptr_meta" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" -dependencies = [ - "ptr_meta_derive", -] - -[[package]] -name = "ptr_meta_derive" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "publicsuffix" version = "2.2.3" @@ -3669,9 +2710,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.35" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -3785,40 +2826,28 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" -[[package]] -name = "rend" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71fe3824f5629716b1589be05dacd749f6aa084c87e00e016714a8cdfccc997c" -dependencies = [ - "bytecheck", -] - [[package]] name = "reqwest" -version = "0.11.24" +version = "0.11.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6920094eb85afde5e4a138be3f2de8bbdf28000f0029e72c45025a56b042251" +checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" dependencies = [ "base64 0.21.5", "bytes", - "cookie 0.17.0", + "cookie", "cookie_store", "encoding_rs", "futures-core", "futures-util", - "h2 0.3.24", - "http 0.2.11", - "http-body 0.4.5", - "hyper 0.14.27", + "h2", + "http", + "http-body", + "hyper", "hyper-rustls 0.24.2", - "hyper-tls", "ipnet", "js-sys", "log", "mime", - "mime_guess", - "native-tls", "once_cell", "percent-encoding", "pin-project-lite", @@ -3827,10 +2856,8 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sync_wrapper", "system-configuration", "tokio", - "tokio-native-tls", "tokio-rustls 0.24.1", "tower-service", "url", @@ -3877,7 +2904,7 @@ dependencies = [ "libc", "spin 0.9.8", "untrusted 0.9.0", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -3889,47 +2916,12 @@ dependencies = [ "digest", ] -[[package]] -name = "rkyv" -version = "0.7.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cba464629b3394fc4dbc6f940ff8f5b4ff5c7aef40f29166fd4ad12acbc99c0" -dependencies = [ - "bitvec", - "bytecheck", - "bytes", - "hashbrown 0.12.3", - "ptr_meta", - "rend", - "rkyv_derive", - "seahash", - "tinyvec", - "uuid 1.6.1", -] - -[[package]] -name = "rkyv_derive" -version = "0.7.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7dddfff8de25e6f62b9d64e6e432bf1c6736c57d20323e15ee10435fbda7c65" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "rustc-demangle" version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - [[package]] name = "rustc_version" version = "0.4.0" @@ -3949,7 +2941,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -4047,7 +3039,7 @@ version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" dependencies = [ - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -4114,12 +3106,6 @@ dependencies = [ "untrusted 0.9.0", ] -[[package]] -name = "seahash" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" - [[package]] name = "sec1" version = "0.7.3" @@ -4208,7 +3194,7 @@ checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.55", + "syn 2.0.39", ] [[package]] @@ -4222,16 +3208,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_path_to_error" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4beec8bce849d58d06238cb50db2e1c417cfeafa4c63f692b15c82b7c80f8335" -dependencies = [ - "itoa", - "serde", -] - [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -4251,23 +3227,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "678b5a069e50bf00ecd22d0cd8ddf7c236f68581b03db652061ed5eb13a312ff" dependencies = [ "serde", - "serde_with_macros 1.5.2", -] - -[[package]] -name = "serde_with" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07ff71d2c147a7b57362cead5e22f772cd52f6ab31cfcd9edcd7f6aeb2a0afbe" -dependencies = [ - "base64 0.13.1", - "chrono", - "hex", - "indexmap 1.9.3", - "serde", - "serde_json", - "serde_with_macros 2.3.3", - "time", + "serde_with_macros", ] [[package]] @@ -4282,29 +3242,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "serde_with_macros" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" -dependencies = [ - "darling 0.20.8", - "proc-macro2", - "quote", - "syn 2.0.55", -] - -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - [[package]] name = "sha2" version = "0.10.8" @@ -4355,37 +3292,10 @@ dependencies = [ ] [[package]] -name = "simd-abstraction" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cadb29c57caadc51ff8346233b5cec1d240b68ce55cf1afc764818791876987" -dependencies = [ - "outref", -] - -[[package]] -name = "simdutf8" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" - -[[package]] -name = "simple_asn1" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085" -dependencies = [ - "num-bigint", - "num-traits", - "thiserror", - "time", -] - -[[package]] -name = "siphasher" -version = "0.3.11" +name = "similar" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" +checksum = "2aeaf503862c419d66959f5d7ca015337d864e9c49485d771b732e2a20453597" [[package]] name = "slab" @@ -4398,9 +3308,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.1" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" [[package]] name = "socket2" @@ -4419,7 +3329,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -4506,9 +3416,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.55" +version = "2.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "002a1b3dbf967edfafc32655d0f377ab0bb7b994aa1d32c8cc7e9b8bf3ebb8f0" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" dependencies = [ "proc-macro2", "quote", @@ -4529,7 +3439,7 @@ checksum = "285ba80e733fac80aa4270fbcdf83772a79b80aa35c97075320abfee4a915b06" dependencies = [ "proc-macro2", "quote", - "syn 2.0.55", + "syn 2.0.39", "unicode-xid", ] @@ -4579,7 +3489,7 @@ dependencies = [ "fastrand", "redox_syscall", "rustix", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -4599,14 +3509,14 @@ checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.55", + "syn 2.0.39", ] [[package]] name = "thread_local" -version = "1.1.8" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" dependencies = [ "cfg-if", "once_cell", @@ -4614,13 +3524,12 @@ dependencies = [ [[package]] name = "time" -version = "0.3.34" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" +checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" dependencies = [ "deranged", "itoa", - "num-conv", "powerfmt", "serde", "time-core", @@ -4635,11 +3544,10 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.17" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" +checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" dependencies = [ - "num-conv", "time-core", ] @@ -4674,7 +3582,7 @@ dependencies = [ "signal-hook-registry", "socket2 0.5.5", "tokio-macros", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -4695,17 +3603,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.55", -] - -[[package]] -name = "tokio-native-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" -dependencies = [ - "native-tls", - "tokio", + "syn 2.0.39", ] [[package]] @@ -4799,39 +3697,20 @@ dependencies = [ "tracing", ] -[[package]] -name = "tower-cookies" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fd0118512cf0b3768f7fcccf0bef1ae41d68f2b45edc1e77432b36c97c56c6d" -dependencies = [ - "async-trait", - "axum-core 0.4.3", - "cookie 0.18.0", - "futures-util", - "http 1.1.0", - "parking_lot", - "pin-project-lite", - "tower-layer", - "tower-service", -] - [[package]] name = "tower-http" -version = "0.3.5" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f873044bf02dd1e8239e9c1293ea39dad76dc594ec16185d0a1bf31d8dc8d858" +checksum = "aba3f3efabf7fb41fae8534fc20a817013dd1c12cb45441efb6c82e6556b4cd8" dependencies = [ "bitflags 1.3.2", "bytes", "futures-core", "futures-util", - "http 0.2.11", - "http-body 0.4.5", - "http-range-header 0.3.1", + "http", + "http-body", + "http-range-header", "pin-project-lite", - "tokio", - "tower", "tower-layer", "tower-service", "tracing", @@ -4839,24 +3718,20 @@ dependencies = [ [[package]] name = "tower-http" -version = "0.5.2" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5" +checksum = "f873044bf02dd1e8239e9c1293ea39dad76dc594ec16185d0a1bf31d8dc8d858" dependencies = [ - "bitflags 2.4.1", + "bitflags 1.3.2", "bytes", + "futures-core", "futures-util", - "http 1.1.0", - "http-body 1.0.0", - "http-body-util", - "http-range-header 0.4.0", - "httpdate", - "mime", - "mime_guess", - "percent-encoding", + "http", + "http-body", + "http-range-header", "pin-project-lite", "tokio", - "tokio-util", + "tower", "tower-layer", "tower-service", "tracing", @@ -4874,57 +3749,6 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" -[[package]] -name = "tower-sessions" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "989b4d77286a7fb96b094b9e62c4524cebe7bb720769b41588ebaac5d9a787ca" -dependencies = [ - "async-trait", - "http 1.1.0", - "time", - "tokio", - "tower-cookies", - "tower-layer", - "tower-service", - "tower-sessions-core", - "tower-sessions-memory-store", - "tracing", -] - -[[package]] -name = "tower-sessions-core" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0a9049748900860b01f92d3decf5fec71b9d75008f07732956288b003a2282f" -dependencies = [ - "async-trait", - "axum-core 0.4.3", - "base64 0.22.0", - "futures", - "http 1.1.0", - "parking_lot", - "rand", - "serde", - "serde_json", - "thiserror", - "time", - "tokio", - "tracing", -] - -[[package]] -name = "tower-sessions-memory-store" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36baf499920bb861ec9fa929a1f879cec0759af987c6360bd65226bc484ab846" -dependencies = [ - "async-trait", - "time", - "tokio", - "tower-sessions-core", -] - [[package]] name = "tracing" version = "0.1.40" @@ -4945,7 +3769,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.55", + "syn 2.0.39", ] [[package]] @@ -5042,15 +3866,6 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "unicase" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" -dependencies = [ - "version_check", -] - [[package]] name = "unicode-bidi" version = "0.3.13" @@ -5141,24 +3956,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "vlq" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65dd7eed29412da847b0f78bcec0ac98588165988a8cfe41d4ea1d429f8ccfff" - [[package]] name = "void" version = "1.0.2" @@ -5201,7 +4004,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.55", + "syn 2.0.39", "wasm-bindgen-shared", ] @@ -5235,7 +4038,7 @@ checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" dependencies = [ "proc-macro2", "quote", - "syn 2.0.55", + "syn 2.0.39", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5300,7 +4103,16 @@ version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" dependencies = [ - "windows-targets", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", ] [[package]] @@ -5309,7 +4121,22 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", ] [[package]] @@ -5318,51 +4145,93 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + [[package]] name = "windows_i686_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + [[package]] name = "windows_i686_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" @@ -5385,7 +4254,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ "cfg-if", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -5397,24 +4266,33 @@ dependencies = [ "tap", ] +[[package]] +name = "yaml-rust" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" +dependencies = [ + "linked-hash-map", +] + [[package]] name = "zerocopy" -version = "0.7.32" +version = "0.7.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +checksum = "e97e415490559a91254a2979b4829267a57d2fcd741a98eee8b722fb57289aa0" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.32" +version = "0.7.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +checksum = "dd7e48ccf166952882ca8bd778a43502c64f33bf94c12ebe2a7f08e5a0f6689f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.55", + "syn 2.0.39", ] [[package]] @@ -5434,33 +4312,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.55", -] - -[[package]] -name = "zstd" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bffb3309596d527cfcba7dfc6ed6052f1d39dfbd7c867aa2e865e4a449c10110" -dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "7.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43747c7422e2924c11144d5229878b98180ef8b06cca4ab5af37afc8a8d8ea3e" -dependencies = [ - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "2.0.9+zstd.1.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656" -dependencies = [ - "cc", - "pkg-config", + "syn 2.0.39", ] diff --git a/Cargo.toml b/Cargo.toml index 234efc1..6d90457 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,49 +11,34 @@ description = "A token faucet for onboarding fuel users" [dependencies] anyhow = "1.0" -axum = "0.7.4" -clerk-rs = "0.2.3" +axum = "0.5" fuel-core-client = "0.22.0" fuel-tx = "0.43.0" fuel-types = "0.43.0" fuels-accounts = "0.54.0" fuels-core = "0.54.0" -handlebars = "4.5" +handlebars = "4.2" lazy_static = "1.4" +memoize = "0.3.1" +reqwest = { version = "0.11", features = ["json", "rustls-tls-webpki-roots"], default-features = false } secrecy = "0.8" serde = { version = "1.0", features = ["derive"] } serde_json = { version = "1.0" } -time = "0.3.34" tokio = { version = "1.0", features = ["full"] } -tower = { version = "0.4", features = [ - "buffer", - "limit", - "load-shed", - "util", - "timeout", -] } -tower-http = { version = "0.5.2", features = [ - "fs", - "cors", - "trace", - "set-header", -] } -tower-sessions = "0.11.0" +tower = { version = "0.4", features = ["buffer", "limit", "load-shed", "util", "timeout"] } +tower-http = { version = "0.2.5", features = ["cors", "trace", "set-header"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] } [dev-dependencies] fuel-core = { version = "0.22.0", default-features = false } fuel-core-txpool = "0.22.0" +fuel-crypto = "0.43.0" fuel-types = { version = "0.43.0", features = ["random"] } futures = "0.3" +insta = "1.14" rand = "0.8" -reqwest = { version = "0.11.24", features = [ - "json", - "cookies", - "rustls-tls-webpki-roots", -], default-features = false } tokio = { version = "1.0", features = ["test-util"] } [build-dependencies] -minify-html = "0.15" +minify-html = "0.8" diff --git a/README.md b/README.md index bfa2d90..734503e 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,26 @@ -# Faucet App - +Faucet App +=== [![build](https://github.com/FuelLabs/faucet/actions/workflows/ci.yml/badge.svg)](https://github.com/FuelLabs/faucet/actions/workflows/ci.yml) [![discord](https://img.shields.io/badge/chat%20on-discord-orange?&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/xfpK4Pe) -A simple faucet app for dispensing tokens on a fuel network. +A simple faucet app for dispensing tokens on a fuel network. It uses Google captcha for spam resistance +without requiring any social media based identification. ## Configuration - The faucet makes use of environment variables for configuration. -| Environment Variable | Description | -| -------------------- | ----------------------------------------------------------------------------------------------- | -| RUST_LOG | EnvFilter configuration for adjusting logging granularity. | -| HUMAN_LOGGING | If false, logs will be output as machine readable JSON. | -| CLERK_PUB_KEY | The public key used for enabling clerk authentication. | -| CLERK_SECRET_KEY | The secret key used for enabling clerk authentication. | -| WALLET_SECRET_KEY | A hex formatted string of the wallet private key that owns some tokens. | -| FUEL_NODE_URL | The GraphQL endpoint for connecting to fuel-core. | +| Environment Variable | Description | +|----------------------|-------------------------------------------------------------------------| +| RUST_LOG | EnvFilter configuration for adjusting logging granularity. | +| HUMAN_LOGGING | If false, logs will be output as machine readable JSON. | +| CAPTCHA_SECRET | The secret key used for enabling Google captcha authentication. | +| CAPTCHA_KEY | The website key used for enabling Google captcha authentication. | +| WALLET_SECRET_KEY | A hex formatted string of the wallet private key that owns some tokens. | +| FUEL_NODE_URL | The GraphQL endpoint for connecting to fuel-core. | | PUBLIC_FUEL_NODE_URL | The public GraphQL endpoint for connecting to fuel-core. Ex.: https://node.fuel.network/graphql | -| SERVICE_PORT | The port the service will listen for http connections on. | -| DISPENSE_AMOUNT | Dispense amount on each faucet | -| MIN_GAS_PRICE | The minimum gas price to use in each transfer | +| SERVICE_PORT | The port the service will listen for http connections on. | +| DISPENSE_AMOUNT | Dispense amount on each faucet | +| MIN_GAS_PRICE | The minimum gas price to use in each transfer | ## Build and Run @@ -29,20 +29,3 @@ To run locally, assuming environment variables have already been set: ```sh cargo run ``` - -## Building Frontend - -To build the frontend code, you can run the following commands: - -```sh -cd frontend -bun install -bun run build -``` - -If you don't have `bun` installed, here is the command to install it: -```sh -curl -fsSL https://bun.sh/install | bash -``` - -For development you can run `bun run build:watch`. \ No newline at end of file diff --git a/build.rs b/build.rs index b7d4d11..9a6568f 100644 --- a/build.rs +++ b/build.rs @@ -1,15 +1,12 @@ use minify_html::Cfg; use std::{env, fs, path::Path}; -fn build(page: &str, raw: &[u8]) { +fn main() { let out_dir = env::var("OUT_DIR").unwrap(); - let html_dest_path = Path::new(&out_dir).join(page); - let minified = minify_html::minify(raw, &Cfg::spec_compliant()); - fs::write(html_dest_path, minified).expect("failed to save minified index page"); + let dest_path = Path::new(&out_dir).join("index.html"); + let page = include_bytes!("./static/index.html"); + let minified = minify_html::minify(page, &Cfg::spec_compliant()); + fs::write(dest_path, minified).expect("failed to save minified index page"); println!("cargo:rerun-if-changed=static"); } - -fn main() { - build("index.html", include_bytes!("./static/index.html")); -} diff --git a/deployment/Dockerfile b/deployment/Dockerfile index 1244efb..dd1b36a 100644 --- a/deployment/Dockerfile +++ b/deployment/Dockerfile @@ -1,23 +1,3 @@ -# Stage 0: Setup Bun and build frontend -FROM ubuntu:22.04 as frontend -RUN apt-get update && \ - apt-get install -y curl unzip && \ - curl -fsSL https://bun.sh/install | bash && \ - ln -s /root/.bun/bin/bun /usr/local/bin/bun && \ - apt-get remove -y curl unzip && \ - apt-get autoremove -y && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* - -WORKDIR /frontend -COPY ./frontend . - -# Install dependencies and run build script -RUN bun install && \ - bun run build - -COPY ./static ./static - # Stage 1: Build FROM lukemathwalker/cargo-chef:latest-rust-1.74 as chef WORKDIR /build/ @@ -59,7 +39,6 @@ WORKDIR /root/ COPY --from=builder /build/target/release/fuel-faucet . COPY --from=builder /build/target/release/fuel-faucet.d . -COPY --from=frontend /frontend/static/js ./static/js EXPOSE 3000 diff --git a/deployment/charts/templates/fuel-faucet-deploy.yaml b/deployment/charts/templates/fuel-faucet-deploy.yaml index 73f639b..fbc41b3 100644 --- a/deployment/charts/templates/fuel-faucet-deploy.yaml +++ b/deployment/charts/templates/fuel-faucet-deploy.yaml @@ -62,18 +62,18 @@ spec: value: "{{ .Values.app.target_port }}" - name: WALLET_SECRET_KEY value: "{{ .Values.app.wallet_secret_key }}" + {{- if .Values.app.captcha_key }} + - name: CAPTCHA_KEY + value: "{{ .Values.app.captcha_key }}" + {{- end }} + {{- if .Values.app.captcha_secret }} + - name: CAPTCHA_SECRET + value: "{{ .Values.app.captcha_secret }}" + {{- end }} - name: FUEL_NODE_URL value: "{{ .Values.app.node_url }}" - name: PUBLIC_FUEL_NODE_URL value: "{{ .Values.app.public_node_url }}" - {{- if .Values.app.clerk_pub_key }} - - name: CLERK_PUB_KEY - value: "{{ .Values.app.clerk_pub_key }}" - {{- end }} - {{- if .Values.app.clerk_secret_key }} - - name: CLERK_SECRET_KEY - value: "{{ .Values.app.clerk_secret_key }}" - {{- end }} {{- if .Values.app.max_dispenses_per_minute }} - name: MAX_DISPENSES_PER_MINUTE value: "{{ .Values.app.max_dispenses_per_minute }}" diff --git a/deployment/charts/values.yaml b/deployment/charts/values.yaml index 2da3af1..77fa8c4 100644 --- a/deployment/charts/values.yaml +++ b/deployment/charts/values.yaml @@ -8,8 +8,8 @@ app: target_port: 3000 human_logging: "${fuel_faucet_human_logging}" wallet_secret_key: "${fuel_faucet_wallet_secret_key}" - clerk_pub_key: "${fuel_faucet_clerk_pub_key}" - clerk_secret_key: "${fuel_faucet_clerk_secret_key}" + captcha_secret: "${fuel_faucet_captcha_secret}" + captcha_key: "${fuel_faucet_captcha_key}" node_url: "${fuel_faucet_node_url}" public_node_url: "${fuel_faucet_public_node_url}" max_dispenses_per_minute: "${fuel_faucet_max_dispenses_per_minute}" diff --git a/deployment/scripts/.env b/deployment/scripts/.env index 97e7c64..e6552ca 100644 --- a/deployment/scripts/.env +++ b/deployment/scripts/.env @@ -7,13 +7,13 @@ fuel_faucet_image_repository="ghcr.io/fuellabs/faucet" fuel_faucet_image_tag="latest" fuel_faucet_human_logging="false" fuel_faucet_wallet_secret_key="random" +fuel_faucet_captcha_key="6Ld3cEwfAAAAAMd4QTs7aO85LyKGdgj0bFsdBfre" +fuel_faucet_captcha_secret="fuelrocks" fuel_faucet_node_url="node.example.com" fuel_faucet_public_node_url="https://node.example.com/graphql" fuel_faucet_max_dispenses_per_minute=20 fuel_faucet_min_gas_price=0 fuel_faucet_dispense_amount=10000 -fuel_faucet_clerk_pub_key="6Ld3cEwfAAAAAMd4QTs7aO85LyKGdgj0bFsdBfre" -fuel_faucet_clerk_secret_key="fuelrocks" # Ingress envs letsencrypt_email="helloworld@gmail.com" @@ -21,5 +21,5 @@ fuel_faucet_ingress_dns="faucet.example.com" fuel_faucet_dns_secret="faucet-example-com" fuel_faucet_ingress_http_port="80" -# EKS +# EKS TF_VAR_eks_cluster_name="test-cluster" diff --git a/frontend/bun.lockb b/frontend/bun.lockb deleted file mode 100755 index 064e8b1..0000000 Binary files a/frontend/bun.lockb and /dev/null differ diff --git a/frontend/package.json b/frontend/package.json deleted file mode 100644 index 6402eac..0000000 --- a/frontend/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "my-app", - "private": true, - "version": "0.0.0", - "type": "module", - "scripts": { - "build": "bun build ./src/index.tsx --outdir ../static --minify --target browser --entry-naming [dir]/js/[name].[hash].[ext]", - "build:watch": "bun run build --watch" - }, - "dependencies": { - "@clerk/clerk-js": "^4.70.5", - "@preact/signals": "^1.2.2", - "canvas-confetti": "^1.9.2", - "confetti": "^2.0.3", - "mitt": "^3.0.1", - "preact": "^10.19.6" - }, - "devDependencies": { - "typescript": "^5.2.2" - } -} diff --git a/frontend/src/app.tsx b/frontend/src/app.tsx deleted file mode 100644 index ecb5d0e..0000000 --- a/frontend/src/app.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { Component } from "preact"; - -import { FaucetForm } from "./components/faucet-form"; -import { FuelLogo } from "./components/fuel-logo"; - -export class App extends Component<{ providerUrl: string }> { - render() { - const { providerUrl } = this.props; - return ( -
-
- - -
-
- Node url: {providerUrl} -
-
- ); - } -} diff --git a/frontend/src/components/faucet-form.tsx b/frontend/src/components/faucet-form.tsx deleted file mode 100644 index 3a4646d..0000000 --- a/frontend/src/components/faucet-form.tsx +++ /dev/null @@ -1,137 +0,0 @@ -import { useClaim } from "../hooks/use-claim"; - -function AlertError({ error }: { error: string }) { - if (!error) return null; - return ( - - ); -} - -function AlertSuccess() { - return ( - - ); -} - -function Submit({ - children, - disabled, - onClick, - isHidden, -}: { - children: any; - disabled: boolean; - onClick: any; - isHidden: boolean; -}) { - if (isHidden) return null; - return ( - - ); -} - -export function FaucetForm({ providerUrl }: { providerUrl: string }) { - const { - address, - error, - method, - isSignedIn, - isDisabled, - isLoading, - isDone, - onSubmit, - onInput, - setMethod, - submitAuthText, - } = useClaim(providerUrl); - - const onSubmitAuth = setMethod("auth"); - - function getForm() { - if (isDone) return null; - return ( -
- - -
- ); - } - - return ( -
-
- - {getForm()} -

- This is a Test Ether faucet running on the{" "} - Test Fuel network. This faucet sends fake Ether assets to - the provided wallet address. -

- - {isLoading && ( -
-
-
- )} -
- - {isLoading ? "Loading..." : "Send me test ETH"} - - - {submitAuthText()} - -
- - {isDone && } -
- ); -} - -const styles = { - formWrapper: "border p-4 mb-4 flex flex-col rounded-lg", - label: "mb-2 text-md text-gray-500", - input: - "border border-gray-300 text-gray-900 text-sm rounded focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5", - alertError: - "flex flex-col items-center py-2 px-4 border border-red-300 mt-6 gap-1 text-sm rounded-lg bg-red-50 text-red-800", - alertSuccess: - "flex flex-col items-center p-4 border border-green-300 mt-6 gap-1 text-sm rounded-lg bg-green-50", - submitButton: - "text-black bg-[#02F58C] hover:bg-[#02E281] font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2 disabled:bg-gray-300 disabled:text-gray-800 disabled:cursor-not-allowed", -}; diff --git a/frontend/src/components/fuel-logo.tsx b/frontend/src/components/fuel-logo.tsx deleted file mode 100644 index 6bbb5a3..0000000 --- a/frontend/src/components/fuel-logo.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { Component } from "preact"; - -export class FuelLogo extends Component { - render() { - return ( -
- - - - - - - - - - -
- ); - } -} diff --git a/frontend/src/hooks/use-claim.tsx b/frontend/src/hooks/use-claim.tsx deleted file mode 100644 index c70db28..0000000 --- a/frontend/src/hooks/use-claim.tsx +++ /dev/null @@ -1,151 +0,0 @@ -import Clerk from "@clerk/clerk-js"; -import { useComputed, useSignal } from "@preact/signals"; -import confetti from "canvas-confetti"; -import { useEffect } from "preact/hooks"; - -import * as api from "../lib/api"; -import { Claim } from "../lib/claim"; - -const query = new URLSearchParams(document.location.search); -const queryAddress = query.get("address") ?? ""; -const claim = new Claim(); -const clerk = new Clerk(window.__CLERK_PUB_KEY__, { - domain: "https://quick-crawdad-10.clerk.accounts.dev", -}); - -export function useClaim(providerUrl: string) { - const address = useSignal(queryAddress); - const error = useSignal(null); - const state = useSignal("loading"); - const method = useSignal<"auth" | null>(null); - const isDone = state.value?.includes("done"); - const isSignedIn = useSignal(false); - const isLoading = useComputed(() => state.value === "loading"); - const isDisabled = useComputed( - () => !address.value?.length || state.value === "loading" || isDone, - ); - - async function fetchSession() { - state.value = "loading"; - await clerk.load(); - const { value, sessions } = await api.getClerkSession(clerk); - if (value) { - await api.validateClerkSession({ value }); - isSignedIn.value = true; - method.value = "auth"; - state.value = "idle"; - return; - } - await api.removeSession(); - state.value = "idle"; - return sessions; - } - - async function submitUsingAuth() { - state.value = "loading"; - error.value = null; - - await clerk.load(); - const { value } = await api.getClerkSession(clerk); - if (value) { - await api.validateClerkSession({ value }); - await claim.withAuth(); - return; - } - - const body = document.querySelector("#root"); - const overlay = document.createElement("div"); - overlay.id = "overlay"; - body?.appendChild(overlay); - clerk.mountSignIn(overlay, { - routing: "virtual", - redirectUrl: `/?address=${address.value}`, - }); - } - - async function onSubmit(e: any) { - e.preventDefault(); - - if (method.value === "auth") { - await submitUsingAuth(); - return; - } - } - - function setMethod(value: "auth" | null) { - return () => { - method.value = value; - }; - } - - function onInput(e: any) { - address.value = e.target.value; - } - - function submitAuthText() { - if (isLoading.value) return "Loading"; - return "Login with to request faucet ETH"; - } - - useEffect(() => { - claim.setProviderUrl(providerUrl); - claim.setAddress(address.value); - - const subs = [ - claim.onError((err) => { - error.value = err.message; - state.value = "error"; - }), - claim.onDone(() => { - state.value = "done"; - error.value = null; - confetti({ - particleCount: 100, - spread: 70, - origin: { y: 0.6 }, - }); - }), - ]; - - return () => { - subs.forEach((sub) => sub()); - }; - }, [providerUrl, address.value]); - - useEffect(() => { - fetchSession().then(() => { - if (clerk.user) { - const userBtn = document.querySelector("#clerk-user"); - clerk.mountUserButton(userBtn as any); - return; - } - - clerk.addListener(async (resources) => { - if (!resources.session) { - const res = await fetch("/api/session/remove", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - }); - await res.json(); - } - }); - }); - }, []); - - return { - address: address.value, - error: error.value, - state: state.value, - method: method.value, - isSignedIn: isSignedIn.value, - isDisabled: isDisabled.value, - isLoading: isLoading.value, - isDone, - onSubmit, - onInput, - setMethod, - submitAuthText, - }; -} diff --git a/frontend/src/index.tsx b/frontend/src/index.tsx deleted file mode 100644 index 20a008f..0000000 --- a/frontend/src/index.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import { render } from "preact"; -import { App } from "./app.tsx"; - -render( - , - document.getElementById("root")!, -); diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts deleted file mode 100644 index d5458e7..0000000 --- a/frontend/src/lib/api.ts +++ /dev/null @@ -1,71 +0,0 @@ -import Clerk from "@clerk/clerk-js"; - -type DispenseMethod = "auth"; -export type DispenseInput = { - salt?: string; - nonce?: string; - address?: string | null; -}; - -type DispenseResponse = { - status: string; - tokens: number; - error?: string; -}; - -export async function dispense(payload: DispenseInput, method: DispenseMethod) { - const response = await fetch(`/api/dispense?method=${method}`, { - method: "POST", - headers: { - Accept: "application/json", - "Content-Type": "application/json", - }, - body: JSON.stringify(payload), - }); - return response.json() as Promise; -} - -type RemoveSessionResponse = { - status: string; - error?: string; -}; - -export async function removeSession() { - const response = await fetch("/api/session/remove", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({}), - }); - return response.json() as Promise; -} - -type ValidateSessionInput = { - value: string; -}; -type ValidateSessionResponse = { - user: any; - session: any; - error?: string; -}; - -export async function validateClerkSession(input: ValidateSessionInput) { - const response = await fetch("/api/session/validate", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ value: input.value }), - }); - return response.json() as Promise; -} - -export async function getClerkSession(clerk: Clerk | null) { - const sessions = await clerk?.user?.getSessions(); - if (sessions?.length) { - const value = sessions?.[0].id; - return { value, sessions }; - } - return { value: null, sessions: [] }; -} diff --git a/frontend/src/lib/claim.ts b/frontend/src/lib/claim.ts deleted file mode 100644 index 6f5e429..0000000 --- a/frontend/src/lib/claim.ts +++ /dev/null @@ -1,51 +0,0 @@ -import mitt from "mitt"; -import * as api from "../lib/api"; - -const emitter = mitt(); - -export class Claim { - address: string | null; - providerUrl: string | null; - - constructor() { - this.address = null; - this.providerUrl = null; - } - - setAddress(address: string | null) { - this.address = address; - } - - setProviderUrl(url: string) { - this.providerUrl = url; - } - - async withAuth() { - const payload = { - address: this.address, - }; - - try { - const data = await api.dispense(payload, "auth"); - if (data.error) { - emitter.emit("error", data.error); - throw new Error(data.error); - } - emitter.emit("done", data); - return data; - } catch (error) { - console.log(error); - emitter.emit("error", error); - } - } - - onDone(cb: () => void) { - emitter.on("done", cb); - return () => emitter.off("done", cb); - } - - onError(cb: (err: any) => void) { - emitter.on("error", cb); - return () => emitter.off("error", cb); - } -} diff --git a/frontend/src/types.d.ts b/frontend/src/types.d.ts deleted file mode 100644 index 98b4e08..0000000 --- a/frontend/src/types.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/// -declare module "canvas-confetti"; - -interface Window { - __PROVIDER_URL__: string; - __CLERK_PUB_KEY__: string; -} diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json deleted file mode 100644 index 7c5f351..0000000 --- a/frontend/tsconfig.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2020", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ES2020", "DOM", "DOM.Iterable"], - "skipLibCheck": true, - "paths": { - "react": ["./node_modules/preact/compat"], - "react-dom": ["./node_modules/preact/compat"] - }, - - /* Bundler mode */ - "moduleResolution": "bundler", - "allowImportingTsExtensions": true, - "resolveJsonModule": true, - "isolatedModules": true, - "noEmit": true, - "jsx": "react-jsx", - "jsxImportSource": "preact", - - /* Linting */ - "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noFallthroughCasesInSwitch": true - }, - "include": ["./src"] -} diff --git a/src/auth.rs b/src/auth.rs deleted file mode 100644 index c79a402..0000000 --- a/src/auth.rs +++ /dev/null @@ -1,31 +0,0 @@ -use axum::async_trait; - -pub mod clerk; - -#[derive(Debug)] -pub struct AuthError { - pub message: String, -} - -impl AuthError { - pub fn new(message: impl Into) -> Self { - AuthError { - message: message.into(), - } - } -} - -impl std::fmt::Display for AuthError { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", self.message) - } -} - -impl std::error::Error for AuthError {} - -type UserId = String; - -#[async_trait] -pub trait AuthHandler: Send + Sync { - async fn get_user_session(&self, session_id: &str) -> Result; -} diff --git a/src/auth/clerk.rs b/src/auth/clerk.rs deleted file mode 100644 index af496a4..0000000 --- a/src/auth/clerk.rs +++ /dev/null @@ -1,43 +0,0 @@ -use crate::config::Config; -use axum::async_trait; -use clerk_rs::{apis::sessions_api, clerk::Clerk, models, ClerkConfiguration}; -use secrecy::ExposeSecret; - -use super::{AuthError, AuthHandler}; - -pub struct ClerkHandler { - pub client: Clerk, - pub dispense_limit_interval: u64, -} - -impl ClerkHandler { - pub fn new(config: &Config) -> Self { - let clerk_secret_key = config - .clerk_secret_key - .clone() - .expect("Clerk secret key is required"); - let clerk_key = Some(clerk_secret_key.expose_secret().clone()); - let clerk_config = ClerkConfiguration::new(None, None, clerk_key, None); - let client = Clerk::new(clerk_config); - ClerkHandler { - client, - dispense_limit_interval: config.dispense_limit_interval, - } - } - - async fn get_session(&self, session_id: &str) -> Result { - let session = sessions_api::Session::get_session(&self.client, session_id) - .await - .map_err(|_| AuthError::new("Failed to retrieve session".to_string()))?; - - Ok(session) - } -} - -#[async_trait] -impl AuthHandler for ClerkHandler { - async fn get_user_session(&self, session_id: &str) -> Result { - let session = self.get_session(session_id).await?; - Ok(session.user_id) - } -} diff --git a/src/config.rs b/src/config.rs index 142c60b..3051515 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,5 +1,5 @@ use crate::constants::{ - CLERK_PUB_KEY, CLERK_SECRET_KEY, DEFAULT_DISPENSE_INTERVAL, DEFAULT_FAUCET_DISPENSE_AMOUNT, + CAPTCHA_KEY, CAPTCHA_SECRET, DEFAULT_DISPENSE_INTERVAL, DEFAULT_FAUCET_DISPENSE_AMOUNT, DEFAULT_NODE_URL, DEFAULT_PORT, DISPENSE_AMOUNT, DISPENSE_INTERVAL, FAUCET_ASSET_ID, FUEL_NODE_URL, HUMAN_LOGGING, LOG_FILTER, MIN_GAS_PRICE, PUBLIC_FUEL_NODE_URL, SERVICE_PORT, TIMEOUT_SECONDS, WALLET_SECRET_KEY, @@ -13,8 +13,8 @@ pub struct Config { pub log_filter: String, pub human_logging: bool, pub service_port: u16, - pub clerk_pub_key: Option, - pub clerk_secret_key: Option>, + pub captcha_key: Option, + pub captcha_secret: Option>, pub node_url: String, pub public_node_url: String, pub wallet_secret_key: Option>, @@ -33,9 +33,9 @@ impl Default for Config { service_port: env::var_os(SERVICE_PORT) .map(|s| s.into_string().unwrap().parse().unwrap()) .unwrap_or(DEFAULT_PORT), - clerk_pub_key: env::var_os(CLERK_PUB_KEY).map(|s| s.into_string().unwrap()), - clerk_secret_key: env::var_os(CLERK_SECRET_KEY) + captcha_secret: env::var_os(CAPTCHA_SECRET) .map(|s| Secret::new(s.into_string().unwrap())), + captcha_key: env::var_os(CAPTCHA_KEY).map(|s| s.into_string().unwrap()), node_url: env::var(FUEL_NODE_URL).unwrap_or_else(|_| DEFAULT_NODE_URL.to_string()), public_node_url: env::var(PUBLIC_FUEL_NODE_URL) .unwrap_or_else(|_| DEFAULT_NODE_URL.to_string()), diff --git a/src/constants.rs b/src/constants.rs index f3e6dec..2228508 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -2,9 +2,9 @@ use fuels_core::types::AssetId; pub const LOG_FILTER: &str = "RUST_LOG"; pub const HUMAN_LOGGING: &str = "HUMAN_LOGGING"; +pub const CAPTCHA_KEY: &str = "CAPTCHA_KEY"; +pub const CAPTCHA_SECRET: &str = "CAPTCHA_SECRET"; pub const WALLET_SECRET_KEY: &str = "WALLET_SECRET_KEY"; -pub const CLERK_PUB_KEY: &str = "CLERK_PUB_KEY"; -pub const CLERK_SECRET_KEY: &str = "CLERK_SECRET_KEY"; pub const PUBLIC_FUEL_NODE_URL: &str = "PUBLIC_FUEL_NODE_URL"; pub const WALLET_SECRET_DEV_KEY: &str = "99ad179d4f892ff3124ccd817408ff8a4452d9c16bb1b4968b8a59797e13cd7a"; @@ -17,6 +17,7 @@ pub const DEFAULT_FAUCET_DISPENSE_AMOUNT: u64 = 10_000_000; pub const FAUCET_ASSET_ID: AssetId = AssetId::new([0; 32]); pub const SERVICE_PORT: &str = "PORT"; pub const DEFAULT_PORT: u16 = 3000; + pub const MIN_GAS_PRICE: &str = "MIN_GAS_PRICE"; pub const TIMEOUT_SECONDS: &str = "TIMEOUT_SECONDS"; diff --git a/src/dispense_tracker.rs b/src/dispense_tracker.rs index e700c78..4ec62d2 100644 --- a/src/dispense_tracker.rs +++ b/src/dispense_tracker.rs @@ -2,7 +2,7 @@ use std::collections::BTreeMap; use std::collections::{HashMap, HashSet}; use std::time::{SystemTime, UNIX_EPOCH}; -type UserId = String; +use fuel_types::Address; pub trait Clock: std::fmt::Debug + Send + Sync { fn now(&self) -> u64; @@ -23,9 +23,9 @@ impl Clock for StdTime { #[derive(Debug)] pub struct DispenseTracker { - tracked: HashMap, - queue: BTreeMap>, - in_progress: HashSet, + tracked: HashMap, + queue: BTreeMap>, + in_progress: HashSet
, clock: Box, } @@ -50,20 +50,20 @@ impl DispenseTracker { } } - pub fn track(&mut self, user_id: UserId) { - self.in_progress.remove(&user_id); + pub fn track(&mut self, address: Address) { + self.in_progress.remove(&address); let timestamp = self.clock.now(); - self.tracked.insert(user_id.clone(), timestamp); - self.queue.entry(timestamp).or_default().push(user_id); + self.tracked.insert(address, timestamp); + self.queue.entry(timestamp).or_default().push(address); } - pub fn mark_in_progress(&mut self, user_id: String) { - self.in_progress.insert(user_id); + pub fn mark_in_progress(&mut self, address: Address) { + self.in_progress.insert(address); } - pub fn remove_in_progress(&mut self, user_id: &String) { - self.in_progress.remove(user_id); + pub fn remove_in_progress(&mut self, address: &Address) { + self.in_progress.remove(address); } pub fn evict_expired_entries(&mut self, eviction_duration: u64) { @@ -71,10 +71,10 @@ impl DispenseTracker { while let Some(oldest_entry) = self.queue.first_entry() { if now - oldest_entry.key() > eviction_duration { - let (_, user_ids) = oldest_entry.remove_entry(); + let (_, addresses) = oldest_entry.remove_entry(); - for user_id in user_ids { - self.tracked.remove(&user_id); + for address in addresses { + self.tracked.remove(&address); } } else { break; @@ -82,11 +82,11 @@ impl DispenseTracker { } } - pub fn has_tracked(&self, user_id: &UserId) -> bool { - self.tracked.get(user_id).is_some() + pub fn has_tracked(&self, address: &Address) -> bool { + self.tracked.get(address).is_some() } - pub fn is_in_progress(&self, user_id: &UserId) -> bool { - self.in_progress.contains(user_id) + pub fn is_in_progress(&self, address: &Address) -> bool { + self.in_progress.contains(address) } } diff --git a/src/lib.rs b/src/lib.rs index 42a60b7..3599a1a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,18 +1,16 @@ -#![deny(warnings)] - use crate::{ config::Config, constants::{MAX_CONCURRENT_REQUESTS, WALLET_SECRET_DEV_KEY}, dispense_tracker::DispenseTracker, + routes::health, }; -use auth::AuthHandler; +use anyhow::anyhow; use axum::{ error_handling::HandleErrorLayer, - extract::Extension, http::{header::CACHE_CONTROL, HeaderValue, StatusCode}, response::IntoResponse, routing::{get, post}, - BoxError, Json, Router, + BoxError, Extension, Json, Router, }; use fuel_core_client::client::FuelClient; use fuel_tx::UtxoId; @@ -23,10 +21,10 @@ use fuels_core::types::transaction_builders::NetworkInfo; use secrecy::{ExposeSecret, Secret}; use serde_json::json; use std::{ - net::SocketAddr, + net::{SocketAddr, TcpListener}, sync::{Arc, Mutex}, + time::Duration, }; -use time::ext::NumericalDuration; use tokio::task::JoinHandle; use tower::ServiceBuilder; use tower_http::{ @@ -34,18 +32,18 @@ use tower_http::{ set_header::SetResponseHeaderLayer, trace::TraceLayer, }; -use tower_sessions::{Expiry, MemoryStore, SessionManagerLayer}; use tracing::info; -pub mod auth; pub mod config; pub mod models; mod constants; mod dispense_tracker; +mod recaptcha; mod routes; pub use dispense_tracker::{Clock, StdTime}; +pub use routes::THE_BIGGEST_AMOUNT; #[derive(Debug)] pub struct NetworkConfig { @@ -94,12 +92,10 @@ pub type SharedWallet = Arc; pub type SharedConfig = Arc; pub type SharedNetworkConfig = Arc; pub type SharedDispenseTracker = Arc>; -pub type SharedAuthHandler = Arc>; pub async fn start_server( service_config: Config, clock: impl Clock + 'static, - auth_handler: impl AuthHandler + 'static, ) -> (SocketAddr, JoinHandle>) { info!("{:#?}", &service_config); @@ -129,7 +125,6 @@ pub async fn start_server( .wallet_secret_key .clone() .unwrap_or_else(|| Secret::new(WALLET_SECRET_DEV_KEY.to_string())); - let wallet = WalletUnlocked::new_from_private_key( secret .expose_secret() @@ -151,23 +146,20 @@ pub async fn start_server( info!("Faucet Account: {:#x}", Address::from(wallet.address())); info!("Faucet Balance: {}", balance); - let session_store = MemoryStore::default(); - let session_layer = SessionManagerLayer::new(session_store) - .with_secure(false) - .with_expiry(Expiry::OnInactivity(NumericalDuration::days(7))); - - let web_layer = ServiceBuilder::new() - .layer(SetResponseHeaderLayer::<_>::overriding( - CACHE_CONTROL, - HeaderValue::from_static("public, max-age=3600, immutable"), - )) - .layer(session_layer.clone()) - .into_inner(); - - let api_routes = Router::new() + // setup routes + let app = Router::new() + .route( + "/", + get(routes::main).layer(SetResponseHeaderLayer::<_>::overriding( + CACHE_CONTROL, + HeaderValue::from_static("public, max-age=3600, immutable"), + )), + ) + .route("/health", get(health)) + .route("/dispense", get(routes::dispense_info)) .route( "/dispense", - post(routes::dispense::tokens_handler).route_layer( + post(routes::dispense_tokens).route_layer( // Apply rate limiting specifically on the dispense endpoint, and // only allow a single instance at a time to avoid race conditions ServiceBuilder::new() @@ -177,28 +169,13 @@ pub async fn start_server( .into_inner(), ), ) - .route("/session/validate", post(routes::session_validate::handler)) - .route("/session/remove", post(routes::session_remove::handler)); - - // setup routes - let app = Router::new() - .nest("/api", api_routes) - .layer(session_layer) - .nest("/static", routes::static_files::handler("static")) - .route("/favicon.ico", get(routes::favicon::handler)) - .route( - "/", - get(routes::main::handler).route_layer(web_layer.clone()), - ) - .route("/dispense", get(routes::dispense::info_handler)) - .route("/health", get(routes::health::handler)) .layer( ServiceBuilder::new() // Handle errors from middleware .layer(HandleErrorLayer::new(handle_error)) .load_shed() .concurrency_limit(MAX_CONCURRENT_REQUESTS) - .timeout(std::time::Duration::from_secs(60)) + .timeout(Duration::from_secs(60)) .layer(TraceLayer::new_for_http()) .layer(Extension(Arc::new(wallet))) .layer(Extension(Arc::new(client))) @@ -208,9 +185,6 @@ pub async fn start_server( .layer(Extension(Arc::new(service_config.clone()))) .layer(Extension(Arc::new(network_config))) .layer(Extension(Arc::new(Mutex::new(DispenseTracker::new(clock))))) - .layer(Extension(Arc::new( - Box::new(auth_handler) as Box - ))) .layer( CorsLayer::new() .allow_origin(Any) @@ -220,19 +194,21 @@ pub async fn start_server( .into_inner(), ); + // run the server let addr = SocketAddr::from(([0, 0, 0, 0], service_config.service_port)); - let listener = tokio::net::TcpListener::bind(addr).await.unwrap(); + let listener = TcpListener::bind(addr).unwrap(); let bound_addr = listener.local_addr().unwrap(); - let task = tokio::spawn(async move { - axum::serve(listener, app.into_make_service()) - .await - .unwrap(); - Ok(()) - }); - - // run the server info!("listening on {}", bound_addr); - (bound_addr, task) + ( + bound_addr, + tokio::spawn(async move { + axum::Server::from_tcp(listener) + .unwrap() + .serve(app.into_make_service()) + .await + .map_err(|e| anyhow!(e)) + }), + ) } async fn handle_error(error: BoxError) -> impl IntoResponse { diff --git a/src/main.rs b/src/main.rs index c177070..8549ea1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,4 @@ -#![deny(warnings)] - -use fuel_faucet::{auth::clerk::ClerkHandler, config::Config, start_server, StdTime}; +use fuel_faucet::{config::Config, start_server, StdTime}; use tracing_subscriber::EnvFilter; #[tokio::main] @@ -8,9 +6,7 @@ async fn main() { let config = Config::default(); init_logger(&config); let clock = StdTime {}; - let auth_handler = ClerkHandler::new(&config); - - let (_, task) = start_server(config, clock, auth_handler).await; + let (_, task) = start_server(config, clock).await; let _ = task.await.unwrap(); } diff --git a/src/models.rs b/src/models.rs index c04076f..79c1ffb 100644 --- a/src/models.rs +++ b/src/models.rs @@ -1,6 +1,6 @@ use std::fmt::{self, Display, Formatter}; -use axum::http::StatusCode; +use reqwest::StatusCode; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Debug)] @@ -11,7 +11,8 @@ pub struct DispenseInfoResponse { #[derive(Deserialize, Debug)] pub struct DispenseInput { - pub address: Option, + pub address: String, + pub captcha: String, } #[derive(Serialize, Debug)] diff --git a/src/recaptcha.rs b/src/recaptcha.rs new file mode 100644 index 0000000..0447c9e --- /dev/null +++ b/src/recaptcha.rs @@ -0,0 +1,39 @@ +use anyhow::anyhow; +use reqwest::Url; +use serde::Deserialize; +use std::collections::HashSet; +use std::net::IpAddr; + +#[derive(Debug, Deserialize)] +pub struct RecaptchaResponse { + pub success: bool, + #[serde(rename = "error-codes")] + pub error_codes: Option>, +} + +pub async fn verify( + key: &str, + response: &str, + user_ip: Option<&IpAddr>, +) -> Result<(), anyhow::Error> { + let user_ip = user_ip.map(ToString::to_string); + + let mut url = Url::parse("https://www.google.com/recaptcha/api/siteverify").unwrap(); + + // TODO: find a more secure means to pass the secret (i.e. headers) + url.query_pairs_mut() + .extend_pairs(&[("secret", key), ("response", response)]); + + if let Some(user_ip) = user_ip { + url.query_pairs_mut().append_pair("remoteip", &user_ip); + } + + let response = reqwest::get(url).await?; + let recaptcha_response = response.json::().await?; + + match (recaptcha_response.success, recaptcha_response.error_codes) { + (true, _) => Ok(()), + (false, Some(errors)) => Err(anyhow!(format!("{errors:?}"))), + (false, _) => Err(anyhow!(format!("unknown error"))), + } +} diff --git a/src/routes/dispense.rs b/src/routes.rs similarity index 69% rename from src/routes/dispense.rs rename to src/routes.rs index 15a3c75..221f091 100644 --- a/src/routes/dispense.rs +++ b/src/routes.rs @@ -1,35 +1,101 @@ use crate::{ - models::*, CoinOutput, SharedConfig, SharedDispenseTracker, SharedFaucetState, + models::*, recaptcha, CoinOutput, SharedConfig, SharedDispenseTracker, SharedFaucetState, SharedNetworkConfig, SharedWallet, }; use axum::{ - extract::Extension, - http::StatusCode, - response::{IntoResponse, Response}, - Json, + response::{Html, IntoResponse, Response}, + Extension, Json, }; + use fuel_core_client::client::FuelClient; use fuel_tx::UtxoId; -use fuel_types::{AssetId, Bytes32}; +use fuel_types::{Address, AssetId, Bytes32}; use fuels_accounts::{wallet::WalletUnlocked, Account, Signer, ViewOnlyAccount}; +use fuels_core::types::transaction::{Transaction, TxPolicies}; +use fuels_core::types::transaction_builders::BuildableTransaction; use fuels_core::types::{ bech32::Bech32Address, - transaction::{Transaction, TxPolicies}, - transaction_builders::BuildableTransaction, - Address, -}; -use fuels_core::types::{ coin::{Coin, CoinStatus}, coin_type::CoinType, }; use fuels_core::types::{input::Input, transaction_builders::ScriptTransactionBuilder}; -use serde::Deserialize; +use handlebars::Handlebars; +use reqwest::StatusCode; +use secrecy::ExposeSecret; use serde_json::json; +use std::sync::Arc; use std::time::Duration; -use std::{str::FromStr, sync::Arc}; -use tower_sessions::Session; +use std::{ + collections::BTreeMap, + str::FromStr, + time::{SystemTime, UNIX_EPOCH}, +}; use tracing::{error, info}; +// The amount to fetch the biggest input of the faucet. +pub const THE_BIGGEST_AMOUNT: u64 = u32::MAX as u64; + +lazy_static::lazy_static! { + static ref START_TIME: u64 = SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis() as u64; +} + +#[memoize::memoize] +pub fn render_page(public_node_url: String, captcha_key: Option) -> String { + let template = include_str!(concat!(env!("OUT_DIR"), "/index.html")); + // sub in values + let mut handlebars = Handlebars::new(); + handlebars + .register_template_string("index", template) + .unwrap(); + let mut data = BTreeMap::new(); + data.insert("page_title", "Fuel Faucet"); + data.insert("public_node_url", public_node_url.as_str()); + // if captcha is enabled, add captcha key + if let Some(captcha_key) = &captcha_key { + data.insert("captcha_key", captcha_key.as_str()); + } + // render page + handlebars.render("index", &data).unwrap() +} + +pub async fn main(Extension(config): Extension) -> Html { + let public_node_url = config.public_node_url.clone(); + let captcha_key = config.captcha_key.clone(); + Html(render_page(public_node_url, captcha_key)) +} + +#[tracing::instrument(skip_all)] +pub async fn health(Extension(wallet): Extension) -> Response { + // ping client for health + let client = wallet + .provider() + .expect("client provider") + .healthy() + .await + .unwrap_or(false); + + let time = SystemTime::now() + .duration_since(UNIX_EPOCH) + .unwrap() + .as_millis() as u64; + + let status = if client { + StatusCode::OK + } else { + StatusCode::INTERNAL_SERVER_ERROR + }; + + ( + status, + Json(json!({ + "up": true, + "uptime": time - *START_TIME, + "fuel-core" : client, + })), + ) + .into_response() +} + impl IntoResponse for DispenseResponse { fn into_response(self) -> Response { (StatusCode::CREATED, Json(self)).into_response() @@ -56,20 +122,27 @@ impl IntoResponse for DispenseInfoResponse { fn check_and_mark_dispense_limit( dispense_tracker: &SharedDispenseTracker, - user_id: String, + address: Address, interval: u64, ) -> Result<(), DispenseError> { let mut tracker = dispense_tracker.lock().unwrap(); tracker.evict_expired_entries(interval); - if tracker.has_tracked(&user_id) { + if tracker.has_tracked(&address) { return Err(error( "Account has already received assets today".to_string(), StatusCode::TOO_MANY_REQUESTS, )); } - tracker.mark_in_progress(user_id); + if tracker.is_in_progress(&address) { + return Err(error( + "Account is already in the process of receiving assets".to_string(), + StatusCode::TOO_MANY_REQUESTS, + )); + } + + tracker.mark_in_progress(address); Ok(()) } @@ -136,60 +209,20 @@ async fn submit_tx_with_timeout( Ok(()) } -#[derive(Deserialize, Debug)] -pub struct Method { - pub method: Option, -} - -#[allow(clippy::too_many_arguments)] #[tracing::instrument(skip_all)] -pub async fn tokens_handler( - Extension(wallet): Extension, - Extension(state): Extension, - Extension(config): Extension, - Extension(client): Extension>, - Extension(network_config): Extension, - Extension(dispense_tracker): Extension, - Extension(session): Extension, +pub async fn dispense_tokens( Json(input): Json, -) -> Result { - dispense_auth( - Extension(wallet), - Extension(state), - Extension(config), - Extension(client), - Extension(network_config), - Extension(dispense_tracker), - Extension(session), - Json(input), - ) - .await -} - -fn get_input(value: Option, prop: &str) -> Result { - let value = - value.ok_or_else(|| error(format!("{} is required", prop), StatusCode::BAD_REQUEST))?; - Ok(value) -} - -#[allow(clippy::too_many_arguments)] -#[tracing::instrument(skip_all)] -async fn dispense_auth( Extension(wallet): Extension, Extension(state): Extension, Extension(config): Extension, Extension(client): Extension>, Extension(network_config): Extension, Extension(dispense_tracker): Extension, - Extension(session): Extension, - Json(input): Json, ) -> Result { - let input_address = get_input(input.address.clone(), "address")?; - // parse deposit address - let address = if let Ok(address) = Address::from_str(input_address.as_str()) { + let address = if let Ok(address) = Address::from_str(input.address.as_str()) { Ok(address) - } else if let Ok(address) = Bech32Address::from_str(input_address.as_str()) { + } else if let Ok(address) = Bech32Address::from_str(input.address.as_str()) { Ok(address.into()) } else { return Err(error( @@ -198,27 +231,20 @@ async fn dispense_auth( )); }?; - let user_id: String = session - .get("user_id") - .await - .map_err(|_| { - error( - "Loading the session failed".to_string(), - StatusCode::INTERNAL_SERVER_ERROR, - ) - })? - .ok_or_else(|| { - error( - "Session is missing user_id".to_string(), - StatusCode::UNAUTHORIZED, - ) - })?; + // verify captcha + if let Some(s) = config.captcha_secret.clone() { + recaptcha::verify(s.expose_secret(), input.captcha.as_str(), None) + .await + .map_err(|e| { + tracing::error!("{}", e); + DispenseError { + error: "captcha failed".to_string(), + status: StatusCode::UNAUTHORIZED, + } + })?; + } - check_and_mark_dispense_limit( - &dispense_tracker, - user_id.clone(), - config.dispense_limit_interval, - )?; + check_and_mark_dispense_limit(&dispense_tracker, address, config.dispense_limit_interval)?; struct CleanUpper(Fn) where @@ -238,7 +264,7 @@ async fn dispense_auth( dispense_tracker .lock() .unwrap() - .remove_in_progress(&user_id); + .remove_in_progress(&address); }); let provider = wallet.provider().expect("client provider"); @@ -342,7 +368,8 @@ async fn dispense_auth( config.dispense_amount, &address ); - dispense_tracker.lock().unwrap().track(user_id.clone()); + let mut tracker = dispense_tracker.lock().unwrap(); + tracker.track(address); Ok(DispenseResponse { status: "Success".to_string(), @@ -352,7 +379,7 @@ async fn dispense_auth( } #[tracing::instrument(skip_all)] -pub async fn info_handler( +pub async fn dispense_info( Extension(config): Extension, ) -> Result { Ok(DispenseInfoResponse { diff --git a/src/routes/favicon.rs b/src/routes/favicon.rs deleted file mode 100644 index 72dc0b9..0000000 --- a/src/routes/favicon.rs +++ /dev/null @@ -1,5 +0,0 @@ -use axum::response::{IntoResponse, Redirect}; - -pub async fn handler() -> impl IntoResponse { - Redirect::permanent("/static/img/favicon.svg").into_response() -} diff --git a/src/routes/health.rs b/src/routes/health.rs deleted file mode 100644 index fc2e93d..0000000 --- a/src/routes/health.rs +++ /dev/null @@ -1,41 +0,0 @@ -use std::time::{SystemTime, UNIX_EPOCH}; - -use axum::{http::StatusCode, response::IntoResponse, Extension, Json}; -use serde_json::json; - -use crate::SharedWallet; - -lazy_static::lazy_static! { - static ref START_TIME: u64 = SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis() as u64; -} - -#[tracing::instrument(skip(wallet))] -pub async fn handler(Extension(wallet): Extension) -> impl IntoResponse { - // ping client for health - let client = wallet - .provider() - .expect("client provider") - .healthy() - .await - .unwrap_or(false); - - let time = SystemTime::now() - .duration_since(UNIX_EPOCH) - .unwrap() - .as_millis() as u64; - - let status = if client { - StatusCode::OK - } else { - StatusCode::INTERNAL_SERVER_ERROR - }; - - ( - status, - Json(json!({ - "up": true, - "uptime": time - *START_TIME, - "fuel-core" : client, - })), - ) -} diff --git a/src/routes/main.rs b/src/routes/main.rs deleted file mode 100644 index 254c520..0000000 --- a/src/routes/main.rs +++ /dev/null @@ -1,56 +0,0 @@ -use crate::SharedConfig; -use axum::{ - extract::Extension, - response::{Html, IntoResponse}, -}; -use handlebars::Handlebars; -use std::{ - collections::BTreeMap, - env, - error::Error, - path::PathBuf, - time::{SystemTime, UNIX_EPOCH}, -}; - -lazy_static::lazy_static! { - static ref START_TIME: u64 = SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis() as u64; -} - -fn get_js_file() -> Result> { - let project_root = env::var("CARGO_MANIFEST_DIR").expect("Failed to get project root"); - let js_dir = PathBuf::from(project_root).join("static/js"); - let entries = std::fs::read_dir(js_dir)? - .map(|res| res.map(|e| e.path())) - .collect::, std::io::Error>>()?; - - let first = entries - .iter() - .find(|entry| entry.to_str().unwrap().contains("index")) - .unwrap(); - - let js_file = first.as_path().file_name().unwrap(); - Ok(js_file.to_str().unwrap().to_string()) -} - -fn render_main(public_node_url: String, clerk_pub_key: String) -> String { - let js_file = get_js_file().unwrap(); - let template = include_str!(concat!(env!("OUT_DIR"), "/index.html")); - // sub in values - let mut handlebars = Handlebars::new(); - handlebars - .register_template_string("index", template) - .unwrap(); - let mut data = BTreeMap::new(); - data.insert("page_title", "Fuel Faucet"); - data.insert("public_node_url", public_node_url.as_str()); - data.insert("clerk_public_key", clerk_pub_key.as_str()); - data.insert("js_file", js_file.as_str()); - // render page - handlebars.render("index", &data).unwrap() -} - -pub async fn handler(Extension(config): Extension) -> impl IntoResponse { - let public_node_url = config.public_node_url.clone(); - let clerk_pub_key = config.clerk_pub_key.clone().unwrap_or("".to_string()); - Html(render_main(public_node_url, clerk_pub_key)).into_response() -} diff --git a/src/routes/mod.rs b/src/routes/mod.rs deleted file mode 100644 index 23f93b2..0000000 --- a/src/routes/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -pub mod dispense; -pub mod favicon; -pub mod health; -pub mod main; -pub mod session_remove; -pub mod session_validate; -pub mod static_files; diff --git a/src/routes/session_remove.rs b/src/routes/session_remove.rs deleted file mode 100644 index 3e77a96..0000000 --- a/src/routes/session_remove.rs +++ /dev/null @@ -1,8 +0,0 @@ -use axum::{http::StatusCode, response::IntoResponse, Json}; -use serde_json::json; -use tower_sessions::Session; - -pub async fn handler(session_manager: Session) -> impl IntoResponse { - session_manager.remove_value("user_id").await.unwrap(); - (StatusCode::OK, Json(json!({ "status": "OK" }))) -} diff --git a/src/routes/session_validate.rs b/src/routes/session_validate.rs deleted file mode 100644 index 2061d79..0000000 --- a/src/routes/session_validate.rs +++ /dev/null @@ -1,35 +0,0 @@ -use crate::SharedAuthHandler; -use axum::{http::StatusCode, response::IntoResponse, Extension, Json}; -use serde::Deserialize; -use serde_json::json; -use tower_sessions::Session; - -#[derive(Deserialize)] -pub struct SessionData { - value: String, -} - -pub async fn handler( - Extension(auth_handler): Extension, - session: Session, - Json(data): Json, -) -> impl IntoResponse { - let data = auth_handler.get_user_session(data.value.as_str()).await; - let user_id = match data { - Ok(user_id) => user_id, - Err(_) => { - return ( - StatusCode::UNAUTHORIZED, - Json(json!({"error": "Unauthorized"})), - ) - } - }; - - let response = Json(json!({ - "user": user_id, - })); - - session.insert("user_id", user_id).await.unwrap(); - - (StatusCode::OK, response) -} diff --git a/src/routes/static_files.rs b/src/routes/static_files.rs deleted file mode 100644 index 2b1d21d..0000000 --- a/src/routes/static_files.rs +++ /dev/null @@ -1,49 +0,0 @@ -use axum::{ - body::Body, - http::Request, - middleware::{from_fn, Next}, - response::Response, - Router, -}; -use std::path::Path; -use tower_http::services::ServeDir; - -async fn content_type_middleware(req: Request, next: Next) -> Response { - let uri = req.uri().to_owned(); - let path = uri.path(); - let splited = path.split('.').collect::>(); - if let Some(extension) = splited.last() { - let mut response = next.run(req).await; - let extension = extension.to_owned().to_lowercase(); - let content_type = match extension.as_str() { - "html" => "text/html", - "css" => "text/css", - "js" => "text/javascript", - "ps" => "application/postscript", - "svg" => "image/svg+xml", - _ => "application/octet-stream", - }; - - if let Ok(content_type) = content_type.parse() { - response.headers_mut().insert("Content-Type", content_type); - } - - response - } else { - let mut response = next.run(req).await; - - if let Ok(content_type) = "application/octet-stream".parse() { - response.headers_mut().insert("Content-Type", content_type); - } - - response - } -} - -pub fn handler>(path: P) -> Router { - let serve_dir = ServeDir::new(path); - - Router::new() - .fallback_service(serve_dir) - .layer(from_fn(content_type_middleware)) -} diff --git a/static/favicon.svg b/static/favicon.svg deleted file mode 100644 index 3d37edb..0000000 --- a/static/favicon.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/static/index.css b/static/index.css deleted file mode 100644 index 9a729bd..0000000 --- a/static/index.css +++ /dev/null @@ -1,77 +0,0 @@ -body, -#root { - display: flex; - justify-content: center; - align-items: center; - flex-direction: column; -} - -.background { - background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' width='32' height='32' fill='none' stroke='%230f172a' stroke-opacity='0.04'%3E%3Cpath d='M0 .5H31.5V32' /%3E%3C/svg%3E%0A"); - -webkit-mask-image: linear-gradient( - 180deg, - rgba(255, 255, 255, 1), - rgba(255, 255, 255, 1), - rgba(255, 255, 255, 0.3) - ); - mask-image: linear-gradient( - 180deg, - rgba(255, 255, 255, 1), - rgba(255, 255, 255, 1), - rgba(255, 255, 255, 0.3) - ); -} - -.cl-userButton-root { - position: absolute; - top: 20px; - right: 20px; -} - -.inter-font { - font-family: "Inter", sans-serif; - font-optical-sizing: auto; - font-weight: ; - font-style: normal; - font-variation-settings: "slnt" 0; -} - -.loader { - width: 24px; - height: 24px; - border: 3px solid #eee; - border-bottom-color: #02f58c; - border-radius: 50%; - display: inline-block; - box-sizing: border-box; - animation: rotation 1s linear infinite; -} - -@keyframes rotation { - 0% { - transform: rotate(0deg); - } - 100% { - transform: rotate(360deg); - } -} - -#overlay { - position: fixed; - inset: 0 0 0 0; - width: 100vw; - height: 100vh; - background: rgba(0, 0, 0, 0.2); - z-index: 1000; - display: flex; - justify-content: center; - align-items: center; -} - -.container { - width: 100vw; - height: 100vh; - display: flex; - justify-content: center; - align-items: center; -} diff --git a/static/index.html b/static/index.html index 184270a..5e7f087 100644 --- a/static/index.html +++ b/static/index.html @@ -1,23 +1,341 @@ - + - - - - - {{ page_title }} - - - - - - - -
-
- - - - + + + + {{ page_title }} + + + + + + + +
+
+ +
+
+ + +
+

+ This is a Test Ether faucet running on the + Test Fuel network. This faucet sends fake Ether + assets to the provided wallet address. +

+
+ {{#if captcha_key}} +
+
+
+ {{/if}} + +
+
+ +
+ +
+ +
+
+
+ +
+
+

Test Ether sent to the wallet

+ See on Fuel Explorer +
+
+
Node url: {{ public_node_url }}
+ + + + \ No newline at end of file diff --git a/tests/dispense.rs b/tests/dispense.rs index e967901..ba1809d 100644 --- a/tests/dispense.rs +++ b/tests/dispense.rs @@ -1,15 +1,11 @@ -use axum::async_trait; use fuel_core::chain_config::{ChainConfig, CoinConfig, StateConfig}; use fuel_core::service::config::Trigger; use fuel_core::service::{Config as NodeConfig, FuelService}; use fuel_core_client::client::pagination::{PageDirection, PaginationRequest}; -use fuel_faucet::auth::{AuthError, AuthHandler}; use fuel_faucet::config::Config; - use fuel_faucet::models::DispenseInfoResponse; -use fuel_faucet::{start_server, Clock}; - +use fuel_faucet::{start_server, Clock, THE_BIGGEST_AMOUNT}; use fuel_tx::{ConsensusParameters, FeeParameters}; use fuel_types::{Address, AssetId}; use fuels_accounts::fuel_crypto::SecretKey; @@ -21,15 +17,11 @@ use rand::rngs::StdRng; use rand::{Rng, SeedableRng}; use secrecy::Secret; use serde_json::json; -use std::collections::HashSet; use std::net::SocketAddr; use std::sync::{Arc, Mutex}; use std::time::Duration; use std::usize; -// The amount to fetch the biggest input of the faucet. -const THE_BIGGEST_AMOUNT: u64 = u32::MAX as u64; - #[derive(Debug, Clone)] struct MockClock { timer: Arc>, @@ -53,45 +45,12 @@ impl MockClock { } } -#[derive(Debug, Clone)] -struct MockAuthHandler { - user_ids: Arc>>, -} - -impl MockAuthHandler { - pub fn new() -> Self { - Self { - user_ids: Default::default(), - } - } - - pub fn register_user(&self, user_id: String) { - self.user_ids.lock().as_deref_mut().unwrap().insert(user_id); - } - - pub fn is_registered(&self, user_id: &str) -> bool { - self.user_ids.lock().as_deref().unwrap().contains(user_id) - } -} - -#[async_trait] -impl AuthHandler for MockAuthHandler { - async fn get_user_session(&self, user_id: &str) -> Result { - if self.is_registered(user_id) { - Ok(user_id.to_string()) - } else { - Err(AuthError::new("User needs to be registered")) - } - } -} - struct TestContext { #[allow(dead_code)] fuel_node: FuelService, faucet_config: Config, provider: Provider, addr: SocketAddr, - auth_handler: MockAuthHandler, clock: MockClock, } impl TestContext { @@ -175,65 +134,18 @@ impl TestContext { }; let clock = MockClock::new(); - let auth_handler = MockAuthHandler::new(); - let (addr, _) = - start_server(faucet_config.clone(), clock.clone(), auth_handler.clone()).await; + let (addr, _) = start_server(faucet_config.clone(), clock.clone()).await; Self { fuel_node, faucet_config, provider, addr, - auth_handler, clock, } } } -struct DispenseRequest { - client: reqwest::Client, - recipient_address: String, - addr: SocketAddr, -} -impl DispenseRequest { - fn for_recipient(recipient_address: String, context: &TestContext) -> Self { - context - .auth_handler - .register_user(recipient_address.clone()); - - let client = reqwest::ClientBuilder::new() - .cookie_store(true) - .build() - .unwrap(); - - Self { - client, - recipient_address, - addr: context.addr, - } - } - - async fn send(&self) -> reqwest::Result { - let addr = self.addr; - self.client - .post(format!("http://{addr}/api/session/validate")) - .json(&json!({ - "value": self.recipient_address, - })) - .send() - .await - .unwrap(); - - self.client - .post(format!("http://{addr}/api/dispense")) - .json(&json!({ - "address": self.recipient_address, - })) - .send() - .await - } -} - #[tokio::test] async fn can_start_server() { let context = TestContext::new(StdRng::seed_from_u64(42)).await; @@ -262,7 +174,7 @@ async fn dispense_sends_coins_to_valid_address_hex_address() { let mut rng = StdRng::seed_from_u64(42); let recipient_address: Address = rng.gen(); - dispense_sends_coins_to_valid_address( + _dispense_sends_coins_to_valid_address( rng, recipient_address.into(), format!("{:#x}", &recipient_address), @@ -275,7 +187,7 @@ async fn dispense_sends_coins_to_valid_address_non_hex() { let mut rng = StdRng::seed_from_u64(42); let recipient_address: Address = rng.gen(); - dispense_sends_coins_to_valid_address( + _dispense_sends_coins_to_valid_address( rng, recipient_address.into(), format!("{}", &recipient_address), @@ -283,18 +195,21 @@ async fn dispense_sends_coins_to_valid_address_non_hex() { .await } -async fn dispense_sends_coins_to_valid_address( +async fn _dispense_sends_coins_to_valid_address( rng: StdRng, recipient_address: Bech32Address, recipient_address_str: String, ) { let context = TestContext::new(rng).await; + let addr = context.addr; + let client = reqwest::Client::new(); - context - .auth_handler - .register_user(recipient_address_str.clone()); - - DispenseRequest::for_recipient(recipient_address_str, &context) + client + .post(format!("http://{addr}/dispense")) + .json(&json!({ + "captcha": "", + "address": recipient_address_str, + })) .send() .await .unwrap(); @@ -326,12 +241,19 @@ async fn many_concurrent_requests() { const COUNT: usize = 30; let recipient_addresses_str = generate_recipient_addresses(COUNT, &mut rng); let context = TestContext::new(rng).await; + let addr = context.addr; let mut queries = vec![]; for recipient in recipient_addresses_str { - queries.push(async { - context.auth_handler.register_user(recipient.clone()); - DispenseRequest::for_recipient(recipient, &context) + let recipient = recipient.clone(); + queries.push(async move { + let client = reqwest::Client::new(); + client + .post(format!("http://{addr}/dispense")) + .json(&json!({ + "captcha": "", + "address": recipient, + })) .send() .await }); @@ -364,14 +286,17 @@ async fn dispense_once_per_day() { let recipient_address: Address = rng.gen(); let recipient_address_str = format!("{}", &recipient_address); let context = TestContext::new(rng).await; + let addr = context.addr; let dispense_interval = 24 * 60 * 60; let time_increment = dispense_interval / 6; - context - .auth_handler - .register_user(recipient_address_str.clone()); - let response = DispenseRequest::for_recipient(recipient_address_str.clone(), &context) + let response = reqwest::Client::new() + .post(format!("http://{addr}/dispense")) + .json(&json!({ + "captcha": "", + "address": recipient_address_str.clone(), + })) .send() .await .expect("First dispensing request should be successful"); @@ -381,7 +306,12 @@ async fn dispense_once_per_day() { for _ in 0..5 { context.clock.advance(time_increment); - let response = DispenseRequest::for_recipient(recipient_address_str.clone(), &context) + let response = reqwest::Client::new() + .post(format!("http://{addr}/dispense")) + .json(&json!({ + "captcha": "", + "address": recipient_address_str.clone(), + })) .send() .await .expect("Subsequent dispensing requests should be successfully sent"); @@ -390,7 +320,12 @@ async fn dispense_once_per_day() { } context.clock.advance(time_increment + 1); - let response = DispenseRequest::for_recipient(recipient_address_str.clone(), &context) + let response = reqwest::Client::new() + .post(format!("http://{addr}/dispense")) + .json(&json!({ + "captcha": "", + "address": recipient_address_str.clone(), + })) .send() .await .expect("Dispensing requests after the interval should be successful");