mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-11 18:15:39 +00:00
Compare commits
13 Commits
feat-maria
...
fix-ip-que
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b3d00c89a6 | ||
|
|
8c9587ad65 | ||
|
|
21825582e5 | ||
|
|
f8e6bdf229 | ||
|
|
8c576d2b07 | ||
|
|
c377cf431e | ||
|
|
ce1b3b0856 | ||
|
|
cd6cecfe4a | ||
|
|
a66d75c3c3 | ||
|
|
3d9056e968 | ||
|
|
bb42841a66 | ||
|
|
961bb6c5f4 | ||
|
|
f56bc6d9e4 |
234
Cargo.lock
generated
234
Cargo.lock
generated
@@ -57,9 +57,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "actix-cors"
|
||||
version = "0.6.1"
|
||||
version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "414360eed71ba2d5435b185ba43ecbe281dfab5df3898286d6b7be8074372c92"
|
||||
checksum = "02a0adcaabb68f1dfe8880cb3c5f049261c68f5d69ce06b6f3a930f31710838e"
|
||||
dependencies = [
|
||||
"actix-utils",
|
||||
"actix-web",
|
||||
@@ -94,7 +94,7 @@ dependencies = [
|
||||
"http",
|
||||
"httparse",
|
||||
"httpdate",
|
||||
"itoa 1.0.2",
|
||||
"itoa 1.0.3",
|
||||
"language-tags",
|
||||
"local-channel",
|
||||
"mime",
|
||||
@@ -117,9 +117,9 @@ dependencies = [
|
||||
"actix-utils",
|
||||
"actix-web",
|
||||
"futures-util",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.142",
|
||||
"serde_json",
|
||||
"time 0.3.11",
|
||||
"time 0.3.12",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -143,7 +143,7 @@ dependencies = [
|
||||
"http",
|
||||
"log",
|
||||
"regex",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.142",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -237,19 +237,19 @@ dependencies = [
|
||||
"encoding_rs",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"itoa 1.0.2",
|
||||
"itoa 1.0.3",
|
||||
"language-tags",
|
||||
"log",
|
||||
"mime",
|
||||
"once_cell",
|
||||
"pin-project-lite",
|
||||
"regex",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.142",
|
||||
"serde_json",
|
||||
"serde_urlencoded",
|
||||
"smallvec",
|
||||
"socket2",
|
||||
"time 0.3.11",
|
||||
"time 0.3.12",
|
||||
"url",
|
||||
]
|
||||
|
||||
@@ -469,13 +469,13 @@ dependencies = [
|
||||
"futures-util",
|
||||
"h2",
|
||||
"http",
|
||||
"itoa 1.0.2",
|
||||
"itoa 1.0.3",
|
||||
"log",
|
||||
"mime",
|
||||
"percent-encoding",
|
||||
"pin-project-lite",
|
||||
"rand",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.142",
|
||||
"serde_json",
|
||||
"serde_urlencoded",
|
||||
"tokio",
|
||||
@@ -505,7 +505,7 @@ version = "1.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
|
||||
dependencies = [
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.142",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -578,9 +578,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.2.0"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0b3de4a0c5e67e16066a0715723abd91edc2f9001d09c46e1dca929351e130e"
|
||||
checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db"
|
||||
|
||||
[[package]]
|
||||
name = "bytestring"
|
||||
@@ -600,7 +600,7 @@ dependencies = [
|
||||
"derive_builder 0.11.1",
|
||||
"mime",
|
||||
"mime_guess",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.142",
|
||||
"serde_json",
|
||||
"sha2 0.10.2",
|
||||
"walkdir",
|
||||
@@ -653,7 +653,7 @@ dependencies = [
|
||||
"lazy_static",
|
||||
"nom 5.1.2",
|
||||
"rust-ini",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.142",
|
||||
"serde-hjson",
|
||||
"serde_json",
|
||||
"toml",
|
||||
@@ -698,7 +698,7 @@ dependencies = [
|
||||
"rand",
|
||||
"sha2 0.10.2",
|
||||
"subtle",
|
||||
"time 0.3.11",
|
||||
"time 0.3.12",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
@@ -759,9 +759,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-channel"
|
||||
version = "0.5.5"
|
||||
version = "0.5.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c02a4d71819009c192cf4872265391563fd6a84c81ff2c0f2a7026ca4c1d85c"
|
||||
checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"crossbeam-utils",
|
||||
@@ -769,9 +769,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-queue"
|
||||
version = "0.3.5"
|
||||
version = "0.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f25d8400f4a7a5778f0e4e52384a48cbd9b5c495d110786187fc750075277a2"
|
||||
checksum = "1cd42583b04998a5363558e5f9291ee5a5ff6b49944332103f251e7479a82aa7"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"crossbeam-utils",
|
||||
@@ -779,9 +779,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.10"
|
||||
version = "0.8.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d82ee10ce34d7bc12c2122495e7593a9c41347ecdd64185af4ecf72cb1a7f83"
|
||||
checksum = "51887d4adc7b564537b15adcfb307936f8075dfcd5f00dde9a9f1d29383682bc"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
@@ -863,7 +863,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"libmcaptcha",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.142",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
"url",
|
||||
@@ -1043,7 +1043,7 @@ version = "1.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be"
|
||||
dependencies = [
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.142",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1086,15 +1086,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "event-listener"
|
||||
version = "2.5.2"
|
||||
version = "2.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "77f3309417938f28bf8228fcff79a4a37103981e3e186d2ccd19c74b38f4eb71"
|
||||
checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
|
||||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "1.7.0"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf"
|
||||
checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499"
|
||||
dependencies = [
|
||||
"instant",
|
||||
]
|
||||
@@ -1270,9 +1270,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.14.5"
|
||||
version = "0.14.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803"
|
||||
checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9"
|
||||
dependencies = [
|
||||
"typenum",
|
||||
"version_check",
|
||||
@@ -1426,7 +1426,7 @@ checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"fnv",
|
||||
"itoa 1.0.2",
|
||||
"itoa 1.0.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1509,9 +1509,9 @@ checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.2"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d"
|
||||
checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754"
|
||||
|
||||
[[package]]
|
||||
name = "itoap"
|
||||
@@ -1530,9 +1530,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.58"
|
||||
version = "0.3.59"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27"
|
||||
checksum = "258451ab10b34f8af53416d1fdab72c22e805f0c92a1136d59470ec0b11138b2"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
@@ -1593,30 +1593,32 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.126"
|
||||
version = "0.2.127"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
|
||||
checksum = "505e71a4706fa491e9b1b55f51b95d4037d0821ee40131190475f692b35b009b"
|
||||
|
||||
[[package]]
|
||||
name = "libm"
|
||||
version = "0.2.2"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "33a33a362ce288760ec6a508b94caaec573ae7d3bbbd91b87aa0bad4456839db"
|
||||
checksum = "da83a57f3f5ba3680950aa3cbc806fc297bc0b289d42e8942ed528ace71b8145"
|
||||
|
||||
[[package]]
|
||||
name = "libmcaptcha"
|
||||
version = "0.1.4"
|
||||
source = "git+https://github.com/mCaptcha/libmcaptcha?branch=master#374dcc936ad5d030517be73a4d939cbe245fd9ac"
|
||||
version = "0.2.2"
|
||||
source = "git+https://github.com/mCaptcha/libmcaptcha?tag=0.2.2#62841b383e3406113fb1ff1db67ee6aeafd8aaf4"
|
||||
dependencies = [
|
||||
"actix",
|
||||
"crossbeam-channel",
|
||||
"derive_builder 0.10.2",
|
||||
"derive_more",
|
||||
"log",
|
||||
"pow_sha256",
|
||||
"num_cpus",
|
||||
"pow_sha256 0.3.1 (git+https://github.com/mcaptcha/pow_sha256)",
|
||||
"pretty_env_logger",
|
||||
"rand",
|
||||
"redis",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.142",
|
||||
"serde_json",
|
||||
"tokio",
|
||||
]
|
||||
@@ -1732,13 +1734,14 @@ dependencies = [
|
||||
"log",
|
||||
"mime",
|
||||
"mime_guess",
|
||||
"num_cpus",
|
||||
"openssl",
|
||||
"pow_sha256",
|
||||
"pow_sha256 0.3.1 (git+https://github.com/mcaptcha/pow_sha256?tag=0.3.1)",
|
||||
"pretty_env_logger",
|
||||
"rand",
|
||||
"rust-embed",
|
||||
"sailfish",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.142",
|
||||
"serde_json",
|
||||
"sqlx",
|
||||
"tokio",
|
||||
@@ -1884,7 +1887,7 @@ dependencies = [
|
||||
"autocfg",
|
||||
"num-integer",
|
||||
"num-traits 0.2.15",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.142",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1911,7 +1914,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ae39348c8bc5fbd7f40c727a9925f03517afd2ab27d46702108b6a7e5414c19"
|
||||
dependencies = [
|
||||
"num-traits 0.2.15",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.142",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1944,7 +1947,7 @@ dependencies = [
|
||||
"autocfg",
|
||||
"num-integer",
|
||||
"num-traits 0.2.15",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.142",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2102,9 +2105,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "paste"
|
||||
version = "1.0.7"
|
||||
version = "1.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c520e05135d6e763148b6426a837e239041653ba7becd2e538c076c738025fc"
|
||||
checksum = "9423e2b32f7a043629287a536f21951e8c6a82482d0acb1eeebfc90bc2225b22"
|
||||
|
||||
[[package]]
|
||||
name = "pem-rfc7468"
|
||||
@@ -2213,13 +2216,25 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pow_sha256"
|
||||
version = "0.2.1"
|
||||
source = "git+https://github.com/mcaptcha/pow_sha256#36c48597b24eb8ea3cdb47f9676f44e1f5c22627"
|
||||
version = "0.3.1"
|
||||
source = "git+https://github.com/mcaptcha/pow_sha256?tag=0.3.1#3b4e28706a8946987ba02f98e1f816d9fa156dad"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"derive_builder 0.11.1",
|
||||
"num",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.142",
|
||||
"sha2 0.10.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pow_sha256"
|
||||
version = "0.3.1"
|
||||
source = "git+https://github.com/mcaptcha/pow_sha256#3b4e28706a8946987ba02f98e1f816d9fa156dad"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"derive_builder 0.11.1",
|
||||
"num",
|
||||
"serde 1.0.142",
|
||||
"sha2 0.10.2",
|
||||
]
|
||||
|
||||
@@ -2359,9 +2374,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.2.13"
|
||||
version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42"
|
||||
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
@@ -2505,7 +2520,7 @@ version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
|
||||
dependencies = [
|
||||
"semver 1.0.12",
|
||||
"semver 1.0.13",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2523,9 +2538,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.10"
|
||||
version = "1.0.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695"
|
||||
checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09"
|
||||
|
||||
[[package]]
|
||||
name = "sailfish"
|
||||
@@ -2550,7 +2565,7 @@ dependencies = [
|
||||
"memchr",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.142",
|
||||
"syn",
|
||||
"toml",
|
||||
]
|
||||
@@ -2634,9 +2649,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.12"
|
||||
version = "1.0.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1"
|
||||
checksum = "93f6841e709003d68bb2deee8c343572bf446003ec20a583e76f7b15cebf3711"
|
||||
|
||||
[[package]]
|
||||
name = "semver-parser"
|
||||
@@ -2652,9 +2667,9 @@ checksum = "9dad3f759919b92c3068c696c15c3d17238234498bbdcc80f2c469606f948ac8"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.140"
|
||||
version = "1.0.142"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fc855a42c7967b7c369eb5860f7164ef1f6f81c20c7cc1141f2a604e18723b03"
|
||||
checksum = "e590c437916fb6b221e1d00df6e3294f3fccd70ca7e92541c475d6ed6ef5fee2"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
@@ -2673,9 +2688,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.140"
|
||||
version = "1.0.142"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f2122636b9fe3b81f1cb25099fcf2d3f542cdb1d45940d56c713158884a05da"
|
||||
checksum = "34b5b8d809babe02f538c2cfec6f2c1ed10804c0e5a6a041a049a4f5588ccc2e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -2684,13 +2699,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.82"
|
||||
version = "1.0.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7"
|
||||
checksum = "38dd04e3c8279e75b31ef29dbdceebfe5ad89f4d0937213c53f7d49d01b3d5a7"
|
||||
dependencies = [
|
||||
"itoa 1.0.2",
|
||||
"itoa 1.0.3",
|
||||
"ryu",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.142",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2700,9 +2715,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
|
||||
dependencies = [
|
||||
"form_urlencoded",
|
||||
"itoa 1.0.2",
|
||||
"itoa 1.0.3",
|
||||
"ryu",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.142",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2871,7 +2886,7 @@ dependencies = [
|
||||
"hkdf",
|
||||
"hmac",
|
||||
"indexmap",
|
||||
"itoa 1.0.2",
|
||||
"itoa 1.0.3",
|
||||
"libc",
|
||||
"log",
|
||||
"md-5",
|
||||
@@ -2883,7 +2898,7 @@ dependencies = [
|
||||
"rand",
|
||||
"rsa",
|
||||
"rustls",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.142",
|
||||
"serde_json",
|
||||
"sha-1",
|
||||
"sha2 0.10.2",
|
||||
@@ -2913,7 +2928,7 @@ dependencies = [
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.142",
|
||||
"serde_json",
|
||||
"sha2 0.10.2",
|
||||
"sqlx-core",
|
||||
@@ -2971,7 +2986,7 @@ checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.142",
|
||||
"serde_derive",
|
||||
"syn",
|
||||
]
|
||||
@@ -2985,7 +3000,7 @@ dependencies = [
|
||||
"base-x",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.142",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"sha1 0.6.1",
|
||||
@@ -3009,7 +3024,7 @@ dependencies = [
|
||||
"parking_lot 0.12.1",
|
||||
"phf_shared",
|
||||
"precomputed-hash",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.142",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3093,18 +3108,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.31"
|
||||
version = "1.0.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a"
|
||||
checksum = "f5f6586b7f764adc0231f4c79be7b920e766bb2f3e51b3661cdb263828f19994"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.31"
|
||||
version = "1.0.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a"
|
||||
checksum = "12bafc5b54507e0149cdf1b145a5d80ab80a90bcd9275df43d4fff68460f6c21"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -3128,11 +3143,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.3.11"
|
||||
version = "0.3.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72c91f41dcb2f096c05f0873d667dceec1087ce5bcf984ec8ffb19acddbb3217"
|
||||
checksum = "74b7cc93fc23ba97fde84f7eea56c55d1ba183f495c6715defdfc7b9cb8c870f"
|
||||
dependencies = [
|
||||
"itoa 1.0.2",
|
||||
"itoa 1.0.3",
|
||||
"js-sys",
|
||||
"libc",
|
||||
"num_threads",
|
||||
"time-macros 0.2.4",
|
||||
@@ -3184,9 +3200,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.20.0"
|
||||
version = "1.20.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57aec3cfa4c296db7255446efb4928a6be304b431a806216105542a67b6ca82e"
|
||||
checksum = "7a8325f63a7d4774dd041e363b2409ed1c5cbbd0f867795e661df066b2b0a581"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"bytes",
|
||||
@@ -3268,14 +3284,14 @@ version = "0.5.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7"
|
||||
dependencies = [
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.142",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing"
|
||||
version = "0.1.35"
|
||||
version = "0.1.36"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160"
|
||||
checksum = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"log",
|
||||
@@ -3285,9 +3301,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tracing-core"
|
||||
version = "0.1.28"
|
||||
version = "0.1.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b7358be39f2f274f322d2aaed611acc57f382e8eb1e5b48cb9ae30933495ce7"
|
||||
checksum = "5aeea4303076558a00714b823f9ad67d58a3bbda1df83d8827d21193156e22f7"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
]
|
||||
@@ -3366,7 +3382,7 @@ dependencies = [
|
||||
"idna",
|
||||
"matches",
|
||||
"percent-encoding",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.142",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3390,7 +3406,7 @@ dependencies = [
|
||||
"idna",
|
||||
"lazy_static",
|
||||
"regex",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.142",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"url",
|
||||
@@ -3454,9 +3470,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.81"
|
||||
version = "0.2.82"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994"
|
||||
checksum = "fc7652e3f6c4706c8d9cd54832c4a4ccb9b5336e2c3bd154d5cccfbf1c1f5f7d"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"wasm-bindgen-macro",
|
||||
@@ -3464,13 +3480,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.81"
|
||||
version = "0.2.82"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a"
|
||||
checksum = "662cd44805586bd52971b9586b1df85cdbbd9112e4ef4d8f41559c334dc6ac3f"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
@@ -3479,9 +3495,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.81"
|
||||
version = "0.2.82"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa"
|
||||
checksum = "b260f13d3012071dfb1512849c033b1925038373aea48ced3012c09df952c602"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
@@ -3489,9 +3505,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.81"
|
||||
version = "0.2.82"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048"
|
||||
checksum = "5be8e654bdd9b79216c2929ab90721aa82faf65c48cdf08bdc4e7f51357b80da"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -3502,15 +3518,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.81"
|
||||
version = "0.2.82"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be"
|
||||
checksum = "6598dd0bd3c7d51095ff6531a5b23e02acdc81804e30d8f07afb77b7215a140a"
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.58"
|
||||
version = "0.3.59"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90"
|
||||
checksum = "ed055ab27f941423197eb86b2035720b1a3ce40504df082cac2ecc6ed73335a1"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
@@ -3630,9 +3646,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zeroize"
|
||||
version = "1.5.6"
|
||||
version = "1.5.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "20b578acffd8516a6c3f2a1bdefc1ec37e547bb4e0fb8b6b01a4cafc886b4442"
|
||||
checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f"
|
||||
|
||||
[[package]]
|
||||
name = "zstd"
|
||||
|
||||
@@ -59,7 +59,7 @@ log = "0.4"
|
||||
lazy_static = "1.4"
|
||||
|
||||
|
||||
libmcaptcha = { branch = "master", git = "https://github.com/mCaptcha/libmcaptcha", features = ["full"] }
|
||||
libmcaptcha = { version = "0.2.2", git = "https://github.com/mCaptcha/libmcaptcha", features = ["full"], tag ="0.2.2" }
|
||||
#libmcaptcha = { path = "../libmcaptcha", features = ["full"]}
|
||||
|
||||
rand = "0.8"
|
||||
@@ -68,6 +68,8 @@ sailfish = "0.4.0"
|
||||
|
||||
mime = "0.3.16"
|
||||
|
||||
num_cpus = "1.13.1"
|
||||
|
||||
lettre = { version = "0.10.0-rc.3", features = [
|
||||
"builder",
|
||||
"tokio1",
|
||||
@@ -101,7 +103,7 @@ serde_json = "1"
|
||||
sqlx = { version = "0.5.13", features = [ "runtime-actix-rustls", "postgres", "time", "offline", "mysql" ] }
|
||||
|
||||
[dev-dependencies]
|
||||
pow_sha256 = { version = "0.2.1", git = "https://github.com/mcaptcha/pow_sha256" }
|
||||
pow_sha256 = { version = "0.3.1", git = "https://github.com/mcaptcha/pow_sha256", tag="0.3.1" }
|
||||
awc = "3.0.0"
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ cookie_secret = "Zae0OOxf^bOJ#zN^&k7VozgW&QAx%n02TQFXpRMG4cCU0xMzgu3dna@tQ9dvc&T
|
||||
# The port at which you want authentication to listen to
|
||||
# takes a number, choose from 1000-10000 if you dont know what you are doing
|
||||
port = 7000
|
||||
#IP address. Enter 0.0.0.0 to listen on all availale addresses
|
||||
#IP address. Enter 0.0.0.0 to listen on all available addresses
|
||||
ip= "0.0.0.0"
|
||||
# enter your hostname, eg: example.com
|
||||
domain = "localhost"
|
||||
@@ -28,6 +28,8 @@ salt = "asdl;kjfhjawehfpa;osdkjasdvjaksndfpoanjdfainsdfaijdsfajlkjdsaf;ajsdfwero
|
||||
# garbage collection period to manage mCaptcha system
|
||||
# leave untouched if you don't know what you are doing
|
||||
gc = 30
|
||||
runners = 4
|
||||
queue_length = 2000
|
||||
enable_stats = true
|
||||
|
||||
[captcha.default_difficulty_strategy]
|
||||
|
||||
@@ -13,7 +13,7 @@ async-trait = "0.1.51"
|
||||
thiserror = "1.0.30"
|
||||
serde = { version = "1", features = ["derive"]}
|
||||
url = { version = "2.2.2", features = ["serde"] }
|
||||
libmcaptcha = { branch = "master", git = "https://github.com/mCaptcha/libmcaptcha", features = ["minimal"], default-features = false }
|
||||
libmcaptcha = { version = "0.2.2", git = "https://github.com/mCaptcha/libmcaptcha", features = ["minimal"], default-features = false, tag = "0.2.2"}
|
||||
|
||||
[features]
|
||||
default = []
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
//!
|
||||
//! ## Organisation
|
||||
//!
|
||||
//! Database functionallity is divided accross various modules:
|
||||
//! Database functionality is divided across various modules:
|
||||
//!
|
||||
//! - [errors](crate::auth): error data structures used in this crate
|
||||
//! - [ops](crate::ops): meta operations like connection pool creation, migrations and getting
|
||||
@@ -242,13 +242,13 @@ pub trait MCDatabase: std::marker::Send + std::marker::Sync + CloneSPDatabase {
|
||||
/// record PoWConfig confirms
|
||||
async fn record_confirm(&self, key: &str) -> DBResult<()>;
|
||||
|
||||
/// featch PoWConfig fetches
|
||||
/// fetch PoWConfig fetches
|
||||
async fn fetch_config_fetched(&self, user: &str, key: &str) -> DBResult<Vec<i64>>;
|
||||
|
||||
/// featch PoWConfig solves
|
||||
/// fetch PoWConfig solves
|
||||
async fn fetch_solve(&self, user: &str, key: &str) -> DBResult<Vec<i64>>;
|
||||
|
||||
/// featch PoWConfig confirms
|
||||
/// fetch PoWConfig confirms
|
||||
async fn fetch_confirm(&self, user: &str, key: &str) -> DBResult<Vec<i64>>;
|
||||
}
|
||||
|
||||
@@ -287,7 +287,7 @@ pub struct AddNotification<'a> {
|
||||
pub from: &'a str,
|
||||
/// heading of the notification
|
||||
pub heading: &'a str,
|
||||
/// mesage of the notification
|
||||
/// message of the notification
|
||||
pub message: &'a str,
|
||||
}
|
||||
|
||||
@@ -298,12 +298,12 @@ pub struct TrafficPattern {
|
||||
pub avg_traffic: u32,
|
||||
/// the peak traffic that the user's website can handle
|
||||
pub peak_sustainable_traffic: u32,
|
||||
/// trafic that bought the user's website down; optional
|
||||
/// traffic that bought the user's website down; optional
|
||||
pub broke_my_site_traffic: Option<u32>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Deserialize, Serialize)]
|
||||
/// data requried to create new captcha
|
||||
/// data required to create new captcha
|
||||
pub struct CreateCaptcha<'a> {
|
||||
/// cool down duration
|
||||
pub duration: i32,
|
||||
|
||||
@@ -30,7 +30,7 @@ pub trait GetConnection {
|
||||
async fn get_conn(&self) -> DBResult<Self::Conn>;
|
||||
}
|
||||
|
||||
/// Create databse connection
|
||||
/// Create database connection
|
||||
#[async_trait]
|
||||
pub trait Connect {
|
||||
/// database specific pool-type
|
||||
|
||||
@@ -33,7 +33,7 @@ pub async fn database_works<'a, T: MCDatabase>(
|
||||
db.delete_user(p.username).await.unwrap();
|
||||
assert!(
|
||||
!db.username_exists(p.username).await.unwrap(),
|
||||
"user is deleted so username shouldn't exsit"
|
||||
"user is deleted so username shouldn't exist"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -89,11 +89,11 @@ pub async fn database_works<'a, T: MCDatabase>(
|
||||
// testing email exists
|
||||
assert!(
|
||||
db.email_exists(p.email.as_ref().unwrap()).await.unwrap(),
|
||||
"user is registered so email should exsit"
|
||||
"user is registered so email should exist"
|
||||
);
|
||||
assert!(
|
||||
db.username_exists(p.username).await.unwrap(),
|
||||
"user is registered so username should exsit"
|
||||
"user is registered so username should exist"
|
||||
);
|
||||
|
||||
// update password test. setting password = username
|
||||
@@ -124,7 +124,7 @@ pub async fn database_works<'a, T: MCDatabase>(
|
||||
db.delete_user(p.email.as_ref().unwrap()).await.unwrap();
|
||||
assert!(
|
||||
!db.username_exists(p.email.as_ref().unwrap()).await.unwrap(),
|
||||
"user is deleted so username shouldn't exsit"
|
||||
"user is deleted so username shouldn't exist"
|
||||
);
|
||||
|
||||
// register with email = None
|
||||
@@ -133,11 +133,11 @@ pub async fn database_works<'a, T: MCDatabase>(
|
||||
db.register(&p2).await.unwrap();
|
||||
assert!(
|
||||
db.username_exists(p2.username).await.unwrap(),
|
||||
"user is registered so username should exsit"
|
||||
"user is registered so username should exist"
|
||||
);
|
||||
assert!(
|
||||
!db.email_exists(p.email.as_ref().unwrap()).await.unwrap(),
|
||||
"user registration with email is deleted; so email shouldn't exsit"
|
||||
"user registration with email is deleted; so email shouldn't exist"
|
||||
);
|
||||
|
||||
// testing get_email = None
|
||||
@@ -155,7 +155,7 @@ pub async fn database_works<'a, T: MCDatabase>(
|
||||
);
|
||||
assert!(
|
||||
db.email_exists(p.email.as_ref().unwrap()).await.unwrap(),
|
||||
"user was with empty email but email is set; so email should exsit"
|
||||
"user was with empty email but email is set; so email should exist"
|
||||
);
|
||||
|
||||
/*
|
||||
|
||||
@@ -35,7 +35,7 @@ pub struct Database {
|
||||
/// Use an existing database pool
|
||||
pub struct Conn(pub MySqlPool);
|
||||
|
||||
/// Connect to databse
|
||||
/// Connect to database
|
||||
pub enum ConnectionOptions {
|
||||
/// fresh connection
|
||||
Fresh(Fresh),
|
||||
@@ -824,7 +824,7 @@ impl MCDatabase for Database {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// featch PoWConfig fetches
|
||||
/// fetch PoWConfig fetches
|
||||
async fn fetch_config_fetched(&self, user: &str, key: &str) -> DBResult<Vec<i64>> {
|
||||
let records = sqlx::query_as!(
|
||||
Date,
|
||||
@@ -850,7 +850,7 @@ impl MCDatabase for Database {
|
||||
Ok(Date::dates_to_unix(records))
|
||||
}
|
||||
|
||||
/// featch PoWConfig solves
|
||||
/// fetch PoWConfig solves
|
||||
async fn fetch_solve(&self, user: &str, key: &str) -> DBResult<Vec<i64>> {
|
||||
let records = sqlx::query_as!(
|
||||
Date,
|
||||
@@ -874,7 +874,7 @@ impl MCDatabase for Database {
|
||||
Ok(Date::dates_to_unix(records))
|
||||
}
|
||||
|
||||
/// featch PoWConfig confirms
|
||||
/// fetch PoWConfig confirms
|
||||
async fn fetch_confirm(&self, user: &str, key: &str) -> DBResult<Vec<i64>> {
|
||||
let records = sqlx::query_as!(
|
||||
Date,
|
||||
|
||||
@@ -35,7 +35,7 @@ pub struct Database {
|
||||
/// Use an existing database pool
|
||||
pub struct Conn(pub PgPool);
|
||||
|
||||
/// Connect to databse
|
||||
/// Connect to database
|
||||
pub enum ConnectionOptions {
|
||||
/// fresh connection
|
||||
Fresh(Fresh),
|
||||
@@ -830,7 +830,7 @@ impl MCDatabase for Database {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// featch PoWConfig fetches
|
||||
/// fetch PoWConfig fetches
|
||||
async fn fetch_config_fetched(&self, user: &str, key: &str) -> DBResult<Vec<i64>> {
|
||||
let records = sqlx::query_as!(
|
||||
Date,
|
||||
@@ -856,7 +856,7 @@ impl MCDatabase for Database {
|
||||
Ok(Date::dates_to_unix(records))
|
||||
}
|
||||
|
||||
/// featch PoWConfig solves
|
||||
/// fetch PoWConfig solves
|
||||
async fn fetch_solve(&self, user: &str, key: &str) -> DBResult<Vec<i64>> {
|
||||
let records = sqlx::query_as!(
|
||||
Date,
|
||||
@@ -880,7 +880,7 @@ impl MCDatabase for Database {
|
||||
Ok(Date::dates_to_unix(records))
|
||||
}
|
||||
|
||||
/// featch PoWConfig confirms
|
||||
/// fetch PoWConfig confirms
|
||||
async fn fetch_confirm(&self, user: &str, key: &str) -> DBResult<Vec<i64>> {
|
||||
let records = sqlx::query_as!(
|
||||
Date,
|
||||
|
||||
@@ -7,12 +7,12 @@ services:
|
||||
- 7000:7000
|
||||
environment:
|
||||
DATABASE_URL: postgres://postgres:password@mcaptcha_postgres:5432/postgres # set password at placeholder
|
||||
MCAPTCHA_REDIS_URL: redis://mcaptcha-redis/
|
||||
MCAPTCHA_REDIS_URL: redis://mcaptcha_redis/
|
||||
RUST_LOG: debug
|
||||
PORT: 7000
|
||||
depends_on:
|
||||
- mcaptcha-postgres
|
||||
- mcaptcha-redis
|
||||
- mcaptcha_postgres
|
||||
- mcaptcha_redis
|
||||
|
||||
mcaptcha_postgres:
|
||||
image: postgres:13.2
|
||||
@@ -22,7 +22,7 @@ services:
|
||||
POSTGRES_PASSWORD: password # change password
|
||||
PGDATA: /var/lib/postgresql/data/mcaptcha/
|
||||
|
||||
mcaptcha-redis:
|
||||
mcaptcha_redis:
|
||||
image: mcaptcha/cache:latest
|
||||
|
||||
volumes:
|
||||
|
||||
@@ -107,7 +107,7 @@ I use mariadb also in Docker
|
||||
2. Create create database user:
|
||||
|
||||
```bash
|
||||
docker create
|
||||
docker create \
|
||||
-p 3306:3306 \
|
||||
--name some-mariadb \
|
||||
--env MARIADB_USER=maria \
|
||||
|
||||
@@ -51,7 +51,7 @@ pub async fn uname_email_exists_works(data: ArcData) {
|
||||
let cookies = get_cookie!(signin_resp);
|
||||
let app = get_app!(data).await;
|
||||
|
||||
// chech if get user secret works
|
||||
// check if get user secret works
|
||||
let resp = test::call_service(
|
||||
&app,
|
||||
test::TestRequest::get()
|
||||
@@ -62,7 +62,7 @@ pub async fn uname_email_exists_works(data: ArcData) {
|
||||
.await;
|
||||
assert_eq!(resp.status(), StatusCode::OK);
|
||||
|
||||
// chech if get user secret works
|
||||
// check if get user secret works
|
||||
let resp = test::call_service(
|
||||
&app,
|
||||
test::TestRequest::post()
|
||||
@@ -178,7 +178,7 @@ pub async fn email_udpate_password_validation_del_userworks(data: ArcData) {
|
||||
)
|
||||
.await;
|
||||
|
||||
// wrong password while deleteing account
|
||||
// wrong password while deleting account
|
||||
let mut payload = Password {
|
||||
password: NAME.into(),
|
||||
};
|
||||
|
||||
@@ -86,7 +86,7 @@ pub mod runners {
|
||||
pub password: String,
|
||||
}
|
||||
|
||||
/// returns Ok(()) when everything checks out and the user is authenticated. Erros otherwise
|
||||
/// returns Ok(()) when everything checks out and the user is authenticated. Errors otherwise
|
||||
pub async fn login_runner(payload: Login, data: &AppData) -> ServiceResult<String> {
|
||||
use argon2_creds::Config;
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ pub struct TrafficPatternRequest {
|
||||
pub avg_traffic: u32,
|
||||
/// the peak traffic that the user's website can handle
|
||||
pub peak_sustainable_traffic: u32,
|
||||
/// trafic that bought the user's website down; optional
|
||||
/// traffic that bought the user's website down; optional
|
||||
pub broke_my_site_traffic: Option<u32>,
|
||||
/// Captcha description
|
||||
pub description: String,
|
||||
|
||||
@@ -191,7 +191,7 @@ mod tests {
|
||||
let updated_token: MCaptchaDetails =
|
||||
test::read_body_json(update_token_resp).await;
|
||||
|
||||
// get levels with udpated key
|
||||
// get levels with updated key
|
||||
let get_token_resp = test::call_service(
|
||||
&app,
|
||||
post_request!(&updated_token, ROUTES.captcha.get)
|
||||
@@ -199,7 +199,7 @@ mod tests {
|
||||
.to_request(),
|
||||
)
|
||||
.await;
|
||||
// if updated key doesn't exist in databse, a non 200 result will bereturned
|
||||
// if updated key doesn't exist in database, a non 200 result will bereturned
|
||||
assert_eq!(get_token_resp.status(), StatusCode::OK);
|
||||
|
||||
// get stats
|
||||
@@ -211,7 +211,7 @@ mod tests {
|
||||
.to_request(),
|
||||
)
|
||||
.await;
|
||||
// if updated key doesn't exist in databse, a non 200 result will bereturned
|
||||
// if updated key doesn't exist in database, a non 200 result will bereturned
|
||||
assert_eq!(get_statis_resp.status(), StatusCode::OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ pub mod routes {
|
||||
}
|
||||
}
|
||||
|
||||
/// emmits build details of the bninary
|
||||
/// emits build details of the bninary
|
||||
#[my_codegen::get(path = "crate::V1_API_ROUTES.meta.build_details")]
|
||||
async fn build_details() -> impl Responder {
|
||||
let build = BuildDetails {
|
||||
|
||||
@@ -42,7 +42,7 @@ pub async fn add_notification(
|
||||
id: Identity,
|
||||
) -> ServiceResult<impl Responder> {
|
||||
let sender = id.identity().unwrap();
|
||||
// TODO handle error where payload.to doesnt exist
|
||||
// TODO handle error where payload.to doesn't exist
|
||||
|
||||
let p = AddNotification {
|
||||
from: &sender,
|
||||
@@ -98,7 +98,7 @@ pub mod tests {
|
||||
let msg = AddNotificationRequest {
|
||||
to: NAME2.into(),
|
||||
heading: "Test notification".into(),
|
||||
message: "Testeing notifications with a dummy message".into(),
|
||||
message: "Testing notifications with a dummy message".into(),
|
||||
};
|
||||
|
||||
let send_notification_resp = test::call_service(
|
||||
|
||||
@@ -68,7 +68,7 @@ pub async fn get_notification(
|
||||
id: Identity,
|
||||
) -> ServiceResult<impl Responder> {
|
||||
let receiver = id.identity().unwrap();
|
||||
// TODO handle error where payload.to doesnt exist
|
||||
// TODO handle error where payload.to doesn't exist
|
||||
|
||||
let notifications = data.db.get_all_unread_notifications(&receiver).await?;
|
||||
let notifications = NotificationResp::from_notifications(notifications);
|
||||
|
||||
@@ -38,7 +38,7 @@ pub async fn mark_read(
|
||||
id: Identity,
|
||||
) -> ServiceResult<impl Responder> {
|
||||
let receiver = id.identity().unwrap();
|
||||
// TODO handle error where payload.to doesnt exist
|
||||
// TODO handle error where payload.to doesn't exist
|
||||
|
||||
// TODO get payload from path /api/v1/notifications/{id}/read"
|
||||
data.db
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
//! PoW Verification module
|
||||
|
||||
use actix_web::HttpRequest;
|
||||
use actix_web::{web, HttpResponse, Responder};
|
||||
use libmcaptcha::pow::Work;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -37,11 +38,21 @@ pub struct ValidationToken {
|
||||
/// if verification is successful
|
||||
#[my_codegen::post(path = "V1_API_ROUTES.pow.verify_pow()")]
|
||||
pub async fn verify_pow(
|
||||
req: HttpRequest,
|
||||
payload: web::Json<Work>,
|
||||
data: AppData,
|
||||
) -> ServiceResult<impl Responder> {
|
||||
#[cfg(not(test))]
|
||||
let ip = req.connection_info().peer_addr().unwrap().to_string();
|
||||
// From actix-web docs:
|
||||
// Will only return None when called in unit tests unless TestRequest::peer_addr is used.
|
||||
//
|
||||
// ref: https://docs.rs/actix-web/latest/actix_web/struct.HttpRequest.html#method.peer_addr
|
||||
#[cfg(test)]
|
||||
let ip = "127.0.1.1".into();
|
||||
|
||||
let key = payload.key.clone();
|
||||
let res = data.captcha.verify_pow(payload.into_inner()).await?;
|
||||
let res = data.captcha.verify_pow(payload.into_inner(), ip).await?;
|
||||
data.stats.record_solve(&data, &key).await?;
|
||||
let payload = ValidationToken { token: res };
|
||||
Ok(HttpResponse::Ok().json(payload))
|
||||
@@ -135,7 +146,7 @@ pub mod tests {
|
||||
// .await;
|
||||
// assert_eq!(pow_config_resp.status(), StatusCode::OK);
|
||||
// I'm not checking for errors because changing work.result triggered
|
||||
// InssuficientDifficulty, which is possible becuase libmcaptcha calculates
|
||||
// InssuficientDifficulty, which is possible because libmcaptcha calculates
|
||||
// difficulty with the submitted result. Besides, this endpoint is merely
|
||||
// propagating errors from libmcaptcha and libmcaptcha has tests covering the
|
||||
// pow aspects ¯\_(ツ)_/¯
|
||||
|
||||
@@ -47,7 +47,7 @@ impl From<VerifyCaptchaResultPayload> for VerifyCaptchaResult {
|
||||
|
||||
// API keys are mcaptcha actor names
|
||||
|
||||
/// route hander that validates a PoW solution token
|
||||
/// route handler that validates a PoW solution token
|
||||
#[my_codegen::post(path = "V1_API_ROUTES.pow.validate_captcha_token()")]
|
||||
pub async fn validate_captcha_token(
|
||||
payload: web::Json<VerifyCaptchaResultPayload>,
|
||||
|
||||
22
src/data.rs
22
src/data.rs
@@ -69,7 +69,7 @@ macro_rules! enum_system_wrapper {
|
||||
|
||||
/// Represents mCaptcha cache and master system.
|
||||
/// When Redis is configured, [SystemGroup::Redis] is used and
|
||||
/// in its absense, [SystemGroup::Embedded] is used
|
||||
/// in its absence, [SystemGroup::Embedded] is used
|
||||
pub enum SystemGroup {
|
||||
Embedded(System<HashCache, EmbeddedMaster>),
|
||||
Redis(System<RedisCache, RedisMaster>),
|
||||
@@ -83,7 +83,12 @@ impl SystemGroup {
|
||||
enum_system_wrapper!(get_pow, String, CaptchaResult<Option<PoWConfig>>);
|
||||
|
||||
// utility function to verify [Work]
|
||||
enum_system_wrapper!(verify_pow, Work, CaptchaResult<String>);
|
||||
pub async fn verify_pow(&self, msg: Work, ip: String) -> CaptchaResult<String> {
|
||||
match self {
|
||||
Self::Embedded(val) => val.verify_pow(msg, ip).await,
|
||||
Self::Redis(val) => val.verify_pow(msg, ip).await,
|
||||
}
|
||||
}
|
||||
|
||||
// utility function to validate verification tokens
|
||||
enum_system_wrapper!(
|
||||
@@ -111,7 +116,18 @@ impl SystemGroup {
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
SystemBuilder::default().pow(pow).cache(c).master(m).build()
|
||||
let runners = if let Some(runners) = s.captcha.runners {
|
||||
runners
|
||||
} else {
|
||||
num_cpus::get_physical()
|
||||
};
|
||||
SystemBuilder::default()
|
||||
.pow(pow)
|
||||
.cache(c)
|
||||
.master(m)
|
||||
.runners(runners)
|
||||
.queue_length(s.captcha.queue_length)
|
||||
.build()
|
||||
}
|
||||
|
||||
// read settings, if Redis is configured then produce a Redis mCaptcha cache
|
||||
|
||||
@@ -111,7 +111,7 @@ mod tests {
|
||||
use super::*;
|
||||
use crate::tests::*;
|
||||
|
||||
const DURATION: u64 = 5;
|
||||
const DURATION: u64 = 25;
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn demo_account_works_pg() {
|
||||
|
||||
@@ -71,7 +71,7 @@ const PAGE: &str = "Notifications";
|
||||
)]
|
||||
pub async fn notifications(data: AppData, id: Identity) -> PageResult<impl Responder> {
|
||||
let receiver = id.identity().unwrap();
|
||||
// TODO handle error where payload.to doesnt exist
|
||||
// TODO handle error where payload.to doesn't exist
|
||||
|
||||
// let mut notifications = runner::get_notification(&data, &receiver).await?;
|
||||
let mut notifications = data.db.get_all_unread_notifications(&receiver).await?;
|
||||
|
||||
@@ -37,6 +37,8 @@ pub struct Server {
|
||||
pub struct Captcha {
|
||||
pub salt: String,
|
||||
pub gc: u64,
|
||||
pub runners: Option<usize>,
|
||||
pub queue_length: usize,
|
||||
pub enable_stats: bool,
|
||||
pub default_difficulty_strategy: DefaultDifficultyStrategy,
|
||||
}
|
||||
@@ -78,7 +80,7 @@ impl Server {
|
||||
//impl DatabaseBuilder {
|
||||
// #[cfg(not(tarpaulin_include))]
|
||||
// fn extract_database_url(url: &Url) -> Self {
|
||||
// debug!("Databse name: {}", url.path());
|
||||
// debug!("Database name: {}", url.path());
|
||||
// let mut path = url.path().split('/');
|
||||
// path.next();
|
||||
// let name = path.next().expect("no database name").to_string();
|
||||
@@ -223,7 +225,7 @@ fn set_database_url(s: &mut Config) {
|
||||
.expect("Couldn't access database name")
|
||||
),
|
||||
)
|
||||
.expect("Couldn't set databse url");
|
||||
.expect("Couldn't set database url");
|
||||
}
|
||||
|
||||
//#[cfg(test)]
|
||||
|
||||
@@ -49,6 +49,7 @@ pub mod pg {
|
||||
pub async fn get_data() -> ArcData {
|
||||
let url = env::var("POSTGRES_DATABASE_URL").unwrap();
|
||||
let mut settings = get_settings();
|
||||
settings.captcha.runners = Some(1);
|
||||
settings.database.url = url.clone();
|
||||
settings.database.database_type = DBType::Postgres;
|
||||
let data = Data::new(&settings).await;
|
||||
@@ -67,6 +68,7 @@ pub mod maria {
|
||||
pub async fn get_data() -> ArcData {
|
||||
let url = env::var("MARIA_DATABASE_URL").unwrap();
|
||||
let mut settings = get_settings();
|
||||
settings.captcha.runners = Some(1);
|
||||
settings.database.url = url.clone();
|
||||
settings.database.database_type = DBType::Maria;
|
||||
let data = Data::new(&settings).await;
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
@import '../reset';
|
||||
|
||||
.widget__contaienr {
|
||||
max-width: 300px;
|
||||
max-height: 74px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.widget__noscript-container {
|
||||
@@ -49,13 +49,10 @@
|
||||
}
|
||||
|
||||
.widget__verification-container {
|
||||
display: none;
|
||||
/*display: flex; */
|
||||
align-items: center;
|
||||
display: none;
|
||||
line-height: 30px;
|
||||
flex: 2;
|
||||
margin: auto;
|
||||
font-size: 0.99rem;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.widget__verification-checkbox {
|
||||
@@ -95,15 +92,10 @@
|
||||
}
|
||||
|
||||
.widget__mcaptcha-details {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.widget__mcaptcha-logo-container {
|
||||
flex: 2;
|
||||
padding-top: 3px;
|
||||
margin-left: auto;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.widget__mcaptcha-brand-name {
|
||||
|
||||
Reference in New Issue
Block a user