mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-11 10:05:41 +00:00
Compare commits
44 Commits
fix-siteke
...
wip-publis
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f521fe199 | ||
|
|
8ac1e2b81e | ||
|
|
5db58d477b | ||
|
|
db03cd3b1f | ||
|
|
e5e89bd8a0 | ||
|
|
2dd6f063c5 | ||
|
|
bb81e7fb9b | ||
|
|
b3d00c89a6 | ||
|
|
8c9587ad65 | ||
|
|
21825582e5 | ||
|
|
f8e6bdf229 | ||
|
|
8c576d2b07 | ||
|
|
c377cf431e | ||
|
|
ce1b3b0856 | ||
|
|
cd6cecfe4a | ||
|
|
a66d75c3c3 | ||
|
|
3d9056e968 | ||
|
|
bb42841a66 | ||
|
|
961bb6c5f4 | ||
|
|
f56bc6d9e4 | ||
|
|
a040b39558 | ||
|
|
80214b776c | ||
|
|
6de9129cd0 | ||
|
|
1fded38ee8 | ||
|
|
96119fdc71 | ||
|
|
337a378b08 | ||
|
|
d5b17ac00e | ||
|
|
a50763f520 | ||
|
|
6f5c09185f | ||
|
|
249b6461ee | ||
|
|
912b342e0e | ||
|
|
f9efb062e0 | ||
|
|
b8d3b1449a | ||
|
|
9b5b34a1f8 | ||
|
|
0b2af2f900 | ||
|
|
9371416398 | ||
|
|
9a687f99ee | ||
|
|
b6afe79a81 | ||
|
|
b12c30e956 | ||
|
|
c5dc72a83c | ||
|
|
3c3982bad5 | ||
|
|
c92a35a01f | ||
|
|
8a667ad71f | ||
|
|
72cff2a470 |
@@ -1 +1,2 @@
|
||||
export POSTGRES_DATABASE_URL="postgres://postgres:password@localhost:5432/postgres"
|
||||
export MARIA_DATABASE_URL="mysql://maria:password@localhost:3306/maria"
|
||||
|
||||
37
.github/workflows/coverage.yml
vendored
37
.github/workflows/coverage.yml
vendored
@@ -34,11 +34,39 @@ jobs:
|
||||
--health-retries 5
|
||||
ports:
|
||||
- 5432:5432
|
||||
|
||||
mcaptcha-redis:
|
||||
image: mcaptcha/cache
|
||||
ports:
|
||||
- 6379:6379
|
||||
|
||||
mcaptcha-smtp:
|
||||
image: maildev/maildev
|
||||
env:
|
||||
MAILDEV_WEB_PORT: "1080"
|
||||
MAILDEV_INCOMING_USER: "admin"
|
||||
MAILDEV_INCOMING_PASS: "password"
|
||||
ports:
|
||||
- 1080:1080
|
||||
- 10025:1025
|
||||
|
||||
|
||||
maria:
|
||||
image: mariadb
|
||||
env:
|
||||
MARIADB_USER: "maria"
|
||||
MARIADB_PASSWORD: "password"
|
||||
MARIADB_ROOT_PASSWORD: "password"
|
||||
MARIADB_DATABASE: "maria"
|
||||
options: >-
|
||||
--health-cmd="mysqladmin ping"
|
||||
--health-interval=10s
|
||||
--health-timeout=5s
|
||||
--health-retries=10
|
||||
ports:
|
||||
- 3306:3306
|
||||
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: ⚡ Cache
|
||||
@@ -56,15 +84,14 @@ jobs:
|
||||
- name: load env
|
||||
run: |
|
||||
source .env_sample \
|
||||
&& echo "POSTGRES_DATABASE_URL=$POSTGRES_DATABASE_URL" >> $GITHUB_ENV
|
||||
&& echo "POSTGRES_DATABASE_URL=$POSTGRES_DATABASE_URL" >> $GITHUB_ENV \
|
||||
&& echo "MARIA_DATABASE_URL=$MARIA_DATABASE_URL" >> $GITHUB_ENV
|
||||
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: "16.x"
|
||||
|
||||
- name: start smtp server
|
||||
run: docker run -d -p 1080:1080 -p 10025:1025 maildev/maildev --incoming-user admin --incoming-pass password
|
||||
|
||||
- name: Install ${{ matrix.version }}
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
@@ -82,6 +109,7 @@ jobs:
|
||||
run: make migrate
|
||||
env:
|
||||
POSTGRES_DATABASE_URL: "${{ env.POSTGRES_DATABASE_URL }}"
|
||||
MARIA_DATABASE_URL: "${{ env.MARIA_DATABASE_URL }}"
|
||||
|
||||
- name: build frontend
|
||||
run: make frontend
|
||||
@@ -94,6 +122,7 @@ jobs:
|
||||
args: "-t 1200"
|
||||
env:
|
||||
POSTGRES_DATABASE_URL: "${{ env.POSTGRES_DATABASE_URL }}"
|
||||
MARIA_DATABASE_URL: "${{ env.MARIA_DATABASE_URL }}"
|
||||
# GIT_HASH is dummy value. I guess build.rs is skipped in tarpaulin
|
||||
# execution so this value is required for preventing meta tests from
|
||||
# panicking
|
||||
|
||||
65
.github/workflows/linux.yml
vendored
65
.github/workflows/linux.yml
vendored
@@ -8,7 +8,8 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- db-abstract
|
||||
- "*"
|
||||
- '!gh-pages'
|
||||
|
||||
jobs:
|
||||
build_and_test:
|
||||
@@ -37,10 +38,35 @@ jobs:
|
||||
--health-retries 5
|
||||
ports:
|
||||
- 5432:5432
|
||||
|
||||
mcaptcha-redis:
|
||||
image: mcaptcha/cache
|
||||
ports:
|
||||
- 6379:6379
|
||||
mcaptcha-smtp:
|
||||
image: maildev/maildev
|
||||
env:
|
||||
MAILDEV_WEB_PORT: "1080"
|
||||
MAILDEV_INCOMING_USER: "admin"
|
||||
MAILDEV_INCOMING_PASS: "password"
|
||||
ports:
|
||||
- 1080:1080
|
||||
- 10025:1025
|
||||
|
||||
maria:
|
||||
image: mariadb
|
||||
env:
|
||||
MARIADB_USER: "maria"
|
||||
MARIADB_PASSWORD: "password"
|
||||
MARIADB_ROOT_PASSWORD: "password"
|
||||
MARIADB_DATABASE: "maria"
|
||||
options: >-
|
||||
--health-cmd="mysqladmin ping"
|
||||
--health-interval=10s
|
||||
--health-timeout=5s
|
||||
--health-retries=10
|
||||
ports:
|
||||
- 3306:3306
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@@ -55,18 +81,21 @@ jobs:
|
||||
target
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: configure GPG key
|
||||
if: (github.ref == 'refs/heads/master' || github.event_name == 'push') && github.repository == 'realaravinth/dumbserve'
|
||||
run: echo -n "$RELEASE_BOT_GPG_SIGNING_KEY" | gpg --batch --import --pinentry-mode loopback
|
||||
env:
|
||||
RELEASE_BOT_GPG_SIGNING_KEY: ${{ secrets.RELEASE_BOT_GPG_SIGNING_KEY }}
|
||||
|
||||
- name: load env
|
||||
run: |
|
||||
source .env_sample \
|
||||
&& echo "POSTGRES_DATABASE_URL=$POSTGRES_DATABASE_URL" >> $GITHUB_ENV
|
||||
&& echo "POSTGRES_DATABASE_URL=$POSTGRES_DATABASE_URL" >> $GITHUB_ENV \
|
||||
&& echo "MARIA_DATABASE_URL=$MARIA_DATABASE_URL" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '16.x'
|
||||
|
||||
- name: start smtp server
|
||||
run: docker run -d -p 1080:1080 -p 10025:1025 maildev/maildev --incoming-user admin --incoming-pass password
|
||||
node-version: "16.x"
|
||||
|
||||
- name: Install ${{ matrix.version }}
|
||||
uses: actions-rs/toolchain@v1
|
||||
@@ -79,11 +108,13 @@ jobs:
|
||||
run: make migrate
|
||||
env:
|
||||
POSTGRES_DATABASE_URL: "${{ env.POSTGRES_DATABASE_URL }}"
|
||||
MARIA_DATABASE_URL: "${{ env.MARIA_DATABASE_URL }}"
|
||||
|
||||
- name: build
|
||||
run: make
|
||||
env:
|
||||
POSTGRES_DATABASE_URL: "${{ env.POSTGRES_DATABASE_URL }}"
|
||||
MARIA_DATABASE_URL: "${{ env.MARIA_DATABASE_URL }}"
|
||||
|
||||
# - name: build frontend
|
||||
# run: make frontend
|
||||
@@ -95,12 +126,32 @@ jobs:
|
||||
run: make test
|
||||
env:
|
||||
POSTGRES_DATABASE_URL: "${{ env.POSTGRES_DATABASE_URL }}"
|
||||
|
||||
MARIA_DATABASE_URL: "${{ env.MARIA_DATABASE_URL }}"
|
||||
|
||||
- name: Login to DockerHub
|
||||
if: (github.ref == 'refs/heads/master' || github.event_name == 'push') && github.repository == 'mCaptcha/mCaptcha'
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: mcaptcha
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: publish docker images
|
||||
if: (github.ref == 'refs/heads/master' || github.event_name == 'push') && github.repository == 'mCaptcha/mCaptcha'
|
||||
run: make docker-publish
|
||||
|
||||
- name: publish bins
|
||||
if: (github.ref == 'refs/heads/master' || github.event_name == 'push') && github.repository == 'mCaptcha/mCaptcha'
|
||||
run: ./scripts/publish.sh publish master latest $DUMBSERVE_PASSWORD
|
||||
env:
|
||||
DUMBSERVE_PASSWORD: ${{ secrets.DUMBSERVE_PASSWORD }}
|
||||
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
|
||||
|
||||
- name: generate documentation
|
||||
if: matrix.version == 'stable' && (github.repository == 'mCaptcha/mCaptcha')
|
||||
run: make doc
|
||||
env:
|
||||
POSTGRES_DATABASE_URL: "${{ env.POSTGRES_DATABASE_URL }}"
|
||||
MARIA_DATABASE_URL: "${{ env.MARIA_DATABASE_URL }}"
|
||||
GIT_HASH: 8e77345f1597e40c2e266cb4e6dee74888918a61 # dummy value
|
||||
COMPILED_DATE: "2021-07-21"
|
||||
|
||||
|
||||
32
.github/workflows/tagged-release.yml
vendored
Normal file
32
.github/workflows/tagged-release.yml
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
name: Create binary for release
|
||||
|
||||
# Only on tags that start with a "v"
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- target: x86_64-pc-windows-gnu
|
||||
archive: zip
|
||||
- target: x86_64-unknown-linux-musl
|
||||
archive: tar.gz tar.xz
|
||||
- target: x86_64-apple-darwin
|
||||
archive: zip
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Compile and release
|
||||
uses: rust-build/rust-build.action@v1.3.2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
RUSTTARGET: ${{ matrix.target }}
|
||||
ARCHIVE_TYPES: ${{ matrix.archive }}
|
||||
390
Cargo.lock
generated
390
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.143",
|
||||
"serde_json",
|
||||
"time 0.3.11",
|
||||
"time 0.3.13",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -143,7 +143,7 @@ dependencies = [
|
||||
"http",
|
||||
"log",
|
||||
"regex",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.143",
|
||||
]
|
||||
|
||||
[[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.143",
|
||||
"serde_json",
|
||||
"serde_urlencoded",
|
||||
"smallvec",
|
||||
"socket2",
|
||||
"time 0.3.11",
|
||||
"time 0.3.13",
|
||||
"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.143",
|
||||
"serde_json",
|
||||
"serde_urlencoded",
|
||||
"tokio",
|
||||
@@ -493,13 +493,19 @@ version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
|
||||
|
||||
[[package]]
|
||||
name = "base64ct"
|
||||
version = "1.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3bdca834647821e0b13d9539a8634eb62d3501b6b6c2cec1722786ee6671b851"
|
||||
|
||||
[[package]]
|
||||
name = "bincode"
|
||||
version = "1.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
|
||||
dependencies = [
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.143",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -572,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"
|
||||
@@ -594,7 +600,7 @@ dependencies = [
|
||||
"derive_builder 0.11.1",
|
||||
"mime",
|
||||
"mime_guess",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.143",
|
||||
"serde_json",
|
||||
"sha2 0.10.2",
|
||||
"walkdir",
|
||||
@@ -626,9 +632,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "combine"
|
||||
version = "4.6.4"
|
||||
version = "4.6.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2a604e93b79d1808327a6fca85a6f2d69de66461e7620f5a4cbf5fb4d1d7c948"
|
||||
checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-core",
|
||||
@@ -647,13 +653,19 @@ dependencies = [
|
||||
"lazy_static",
|
||||
"nom 5.1.2",
|
||||
"rust-ini",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.143",
|
||||
"serde-hjson",
|
||||
"serde_json",
|
||||
"toml",
|
||||
"yaml-rust",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "const-oid"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3"
|
||||
|
||||
[[package]]
|
||||
name = "const_fn"
|
||||
version = "0.4.9"
|
||||
@@ -686,7 +698,7 @@ dependencies = [
|
||||
"rand",
|
||||
"sha2 0.10.2",
|
||||
"subtle",
|
||||
"time 0.3.11",
|
||||
"time 0.3.13",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
@@ -747,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",
|
||||
@@ -757,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",
|
||||
@@ -767,14 +779,24 @@ 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",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crypto-bigint"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crypto-common"
|
||||
version = "0.1.6"
|
||||
@@ -841,12 +863,24 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"libmcaptcha",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.143",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "db-sqlx-maria"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"actix-rt",
|
||||
"async-trait",
|
||||
"db-core",
|
||||
"futures",
|
||||
"sqlx",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "db-sqlx-postgres"
|
||||
version = "0.1.0"
|
||||
@@ -859,6 +893,17 @@ dependencies = [
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "der"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c"
|
||||
dependencies = [
|
||||
"const-oid",
|
||||
"crypto-bigint",
|
||||
"pem-rfc7468",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "derive_builder"
|
||||
version = "0.10.2"
|
||||
@@ -998,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.143",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1013,9 +1058,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "email_address"
|
||||
version = "0.2.1"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8684b7c9cb4857dfa1e5b9629ef584ba618c9b93bae60f58cb23f4f271d0468e"
|
||||
checksum = "b1b32a7a2580c4473f10f66b512c34bdd7d33c5e3473227ca833abdb5afe4809"
|
||||
|
||||
[[package]]
|
||||
name = "encoding_rs"
|
||||
@@ -1041,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",
|
||||
]
|
||||
@@ -1225,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",
|
||||
@@ -1381,7 +1426,7 @@ checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"fnv",
|
||||
"itoa 1.0.2",
|
||||
"itoa 1.0.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1464,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"
|
||||
@@ -1485,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",
|
||||
]
|
||||
@@ -1503,6 +1548,9 @@ name = "lazy_static"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
dependencies = [
|
||||
"spin",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lettre"
|
||||
@@ -1545,24 +1593,32 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.126"
|
||||
version = "0.2.129"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
|
||||
checksum = "64de3cc433455c14174d42e554d4027ee631c4d046d43e3ecc6efc4636cdc7a7"
|
||||
|
||||
[[package]]
|
||||
name = "libm"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "292a948cd991e376cf75541fe5b97a1081d713c618b4f1b9500f8844e49eb565"
|
||||
|
||||
[[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?branch=master#4efe8cdfee94766dd85647ad6f1ecc1b486b40a7"
|
||||
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.143",
|
||||
"serde_json",
|
||||
"tokio",
|
||||
]
|
||||
@@ -1667,6 +1723,7 @@ dependencies = [
|
||||
"cache-buster",
|
||||
"config",
|
||||
"db-core",
|
||||
"db-sqlx-maria",
|
||||
"db-sqlx-postgres",
|
||||
"derive_builder 0.11.1",
|
||||
"derive_more",
|
||||
@@ -1677,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.143",
|
||||
"serde_json",
|
||||
"sqlx",
|
||||
"tokio",
|
||||
@@ -1801,7 +1859,7 @@ version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43db66d1170d347f9a065114077f7dccb00c1b9478c89384490a3425279a4606"
|
||||
dependencies = [
|
||||
"num-bigint",
|
||||
"num-bigint 0.4.3",
|
||||
"num-complex",
|
||||
"num-integer",
|
||||
"num-iter",
|
||||
@@ -1809,6 +1867,17 @@ dependencies = [
|
||||
"num-traits 0.2.15",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-bigint"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"num-integer",
|
||||
"num-traits 0.2.15",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-bigint"
|
||||
version = "0.4.3"
|
||||
@@ -1818,7 +1887,24 @@ dependencies = [
|
||||
"autocfg",
|
||||
"num-integer",
|
||||
"num-traits 0.2.15",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.143",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-bigint-dig"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "566d173b2f9406afbc5510a90925d5a2cd80cae4605631f1212303df265de011"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"lazy_static",
|
||||
"libm",
|
||||
"num-integer",
|
||||
"num-iter",
|
||||
"num-traits 0.2.15",
|
||||
"rand",
|
||||
"smallvec",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1828,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.143",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1861,7 +1947,7 @@ dependencies = [
|
||||
"autocfg",
|
||||
"num-integer",
|
||||
"num-traits 0.2.15",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.143",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1880,6 +1966,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"libm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2018,9 +2105,18 @@ 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"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "01de5d978f34aa4b2296576379fcc416034702fd94117c56ffd8a1a767cefb30"
|
||||
dependencies = [
|
||||
"base64ct",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "percent-encoding"
|
||||
@@ -2078,6 +2174,28 @@ version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
||||
|
||||
[[package]]
|
||||
name = "pkcs1"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a78f66c04ccc83dd4486fd46c33896f4e17b24a7a3a6400dedc48ed0ddd72320"
|
||||
dependencies = [
|
||||
"der",
|
||||
"pkcs8",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pkcs8"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7cabda3fb821068a9a4fab19a683eac3af12edf0f34b94a8be53c4972b8149d0"
|
||||
dependencies = [
|
||||
"der",
|
||||
"spki",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.25"
|
||||
@@ -2098,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.143",
|
||||
"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.143",
|
||||
"sha2 0.10.2",
|
||||
]
|
||||
|
||||
@@ -2244,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",
|
||||
]
|
||||
@@ -2303,6 +2433,26 @@ dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rsa"
|
||||
version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4cf22754c49613d2b3b119f0e5d46e34a2c628a937e3024b8762de4e7d8c710b"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"digest 0.10.3",
|
||||
"num-bigint-dig",
|
||||
"num-integer",
|
||||
"num-iter",
|
||||
"num-traits 0.2.15",
|
||||
"pkcs1",
|
||||
"pkcs8",
|
||||
"rand_core",
|
||||
"smallvec",
|
||||
"subtle",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rust-argon2"
|
||||
version = "1.0.0"
|
||||
@@ -2370,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]]
|
||||
@@ -2388,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"
|
||||
@@ -2415,7 +2565,7 @@ dependencies = [
|
||||
"memchr",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.143",
|
||||
"syn",
|
||||
"toml",
|
||||
]
|
||||
@@ -2499,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"
|
||||
@@ -2517,9 +2667,9 @@ checksum = "9dad3f759919b92c3068c696c15c3d17238234498bbdcc80f2c469606f948ac8"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.140"
|
||||
version = "1.0.143"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fc855a42c7967b7c369eb5860f7164ef1f6f81c20c7cc1141f2a604e18723b03"
|
||||
checksum = "53e8e5d5b70924f74ff5c6d64d9a5acd91422117c60f48c4e07855238a254553"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
@@ -2538,9 +2688,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.140"
|
||||
version = "1.0.143"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f2122636b9fe3b81f1cb25099fcf2d3f542cdb1d45940d56c713158884a05da"
|
||||
checksum = "d3d8e8de557aee63c26b85b947f5e59b690d0454c753f3adeb5cd7835ab88391"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -2549,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.143",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2565,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.143",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2677,6 +2827,16 @@ version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
|
||||
|
||||
[[package]]
|
||||
name = "spki"
|
||||
version = "0.5.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44d01ac02a6ccf3e07db148d2be087da624fea0221a16152ed01f0496a6b0a27"
|
||||
dependencies = [
|
||||
"base64ct",
|
||||
"der",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sqlformat"
|
||||
version = "0.1.8"
|
||||
@@ -2712,6 +2872,7 @@ dependencies = [
|
||||
"bytes",
|
||||
"crc",
|
||||
"crossbeam-queue",
|
||||
"digest 0.10.3",
|
||||
"dirs",
|
||||
"either",
|
||||
"event-listener",
|
||||
@@ -2719,22 +2880,25 @@ dependencies = [
|
||||
"futures-core",
|
||||
"futures-intrusive",
|
||||
"futures-util",
|
||||
"generic-array",
|
||||
"hashlink",
|
||||
"hex",
|
||||
"hkdf",
|
||||
"hmac",
|
||||
"indexmap",
|
||||
"itoa 1.0.2",
|
||||
"itoa 1.0.3",
|
||||
"libc",
|
||||
"log",
|
||||
"md-5",
|
||||
"memchr",
|
||||
"num-bigint 0.3.3",
|
||||
"once_cell",
|
||||
"paste",
|
||||
"percent-encoding",
|
||||
"rand",
|
||||
"rsa",
|
||||
"rustls",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.143",
|
||||
"serde_json",
|
||||
"sha-1",
|
||||
"sha2 0.10.2",
|
||||
@@ -2764,7 +2928,7 @@ dependencies = [
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.143",
|
||||
"serde_json",
|
||||
"sha2 0.10.2",
|
||||
"sqlx-core",
|
||||
@@ -2822,7 +2986,7 @@ checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.143",
|
||||
"serde_derive",
|
||||
"syn",
|
||||
]
|
||||
@@ -2836,7 +3000,7 @@ dependencies = [
|
||||
"base-x",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.143",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"sha1 0.6.1",
|
||||
@@ -2860,7 +3024,7 @@ dependencies = [
|
||||
"parking_lot 0.12.1",
|
||||
"phf_shared",
|
||||
"precomputed-hash",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.143",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2944,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",
|
||||
@@ -2979,11 +3143,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.3.11"
|
||||
version = "0.3.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72c91f41dcb2f096c05f0873d667dceec1087ce5bcf984ec8ffb19acddbb3217"
|
||||
checksum = "db76ff9fa4b1458b3c7f077f3ff9887394058460d21e634355b273aaf11eea45"
|
||||
dependencies = [
|
||||
"itoa 1.0.2",
|
||||
"itoa 1.0.3",
|
||||
"libc",
|
||||
"num_threads",
|
||||
"time-macros 0.2.4",
|
||||
@@ -3035,9 +3199,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",
|
||||
@@ -3119,14 +3283,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.143",
|
||||
]
|
||||
|
||||
[[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",
|
||||
@@ -3136,9 +3300,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",
|
||||
]
|
||||
@@ -3217,7 +3381,7 @@ dependencies = [
|
||||
"idna",
|
||||
"matches",
|
||||
"percent-encoding",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.143",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3241,7 +3405,7 @@ dependencies = [
|
||||
"idna",
|
||||
"lazy_static",
|
||||
"regex",
|
||||
"serde 1.0.140",
|
||||
"serde 1.0.143",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"url",
|
||||
@@ -3305,9 +3469,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",
|
||||
@@ -3315,13 +3479,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",
|
||||
@@ -3330,9 +3494,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",
|
||||
@@ -3340,9 +3504,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",
|
||||
@@ -3353,15 +3517,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",
|
||||
@@ -3479,6 +3643,12 @@ dependencies = [
|
||||
"linked-hash-map",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zeroize"
|
||||
version = "1.5.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f"
|
||||
|
||||
[[package]]
|
||||
name = "zstd"
|
||||
version = "0.11.2+zstd.1.5.2"
|
||||
|
||||
14
Cargo.toml
14
Cargo.toml
@@ -16,7 +16,7 @@ build = "build.rs"
|
||||
|
||||
[workspace]
|
||||
exclude = ["db/db-migrations", "utils/cache-bust"]
|
||||
memebers = [".", "db/db-core", "db/db-sqlx-postgres"]
|
||||
memebers = [".", "db/db-core", "db/db-sqlx-postgres", "db/db-sqlx-maria"]
|
||||
|
||||
[[bin]]
|
||||
name = "mcaptcha"
|
||||
@@ -38,7 +38,7 @@ cache-buster = { git = "https://github.com/realaravinth/cache-buster" }
|
||||
futures = "0.3.15"
|
||||
tokio = { version = "1.14", features = ["sync"]}
|
||||
|
||||
sqlx = { version = "0.5.13", features = [ "runtime-actix-rustls", "postgres", "time", "offline" ] }
|
||||
sqlx = { version = "0.5.13", features = [ "runtime-actix-rustls", "postgres", "time", "offline", "mysql"] }
|
||||
argon2-creds = { branch = "master", git = "https://github.com/realaravinth/argon2-creds"}
|
||||
#argon2-creds = { version="*", path = "../../argon2-creds/" }
|
||||
config = "0.11"
|
||||
@@ -59,6 +59,7 @@ log = "0.4"
|
||||
lazy_static = "1.4"
|
||||
|
||||
|
||||
#libmcaptcha = { version = "0.2.2", git = "https://github.com/mCaptcha/libmcaptcha", features = ["full"], tag ="0.2.2" }
|
||||
libmcaptcha = { branch = "master", git = "https://github.com/mCaptcha/libmcaptcha", features = ["full"] }
|
||||
#libmcaptcha = { path = "../libmcaptcha", features = ["full"]}
|
||||
|
||||
@@ -68,6 +69,8 @@ sailfish = "0.4.0"
|
||||
|
||||
mime = "0.3.16"
|
||||
|
||||
num_cpus = "1.13.1"
|
||||
|
||||
lettre = { version = "0.10.0-rc.3", features = [
|
||||
"builder",
|
||||
"tokio1",
|
||||
@@ -84,6 +87,9 @@ path = "./db/db-core"
|
||||
[dependencies.db-sqlx-postgres]
|
||||
path = "./db/db-sqlx-postgres"
|
||||
|
||||
[dependencies.db-sqlx-maria]
|
||||
path = "./db/db-sqlx-maria"
|
||||
|
||||
[dependencies.my-codegen]
|
||||
git = "https://github.com/realaravinth/actix-web"
|
||||
package = "actix-web-codegen"
|
||||
@@ -95,10 +101,10 @@ features = ["actix_identity_backend"]
|
||||
|
||||
[build-dependencies]
|
||||
serde_json = "1"
|
||||
sqlx = { version = "0.5.13", features = [ "runtime-actix-rustls", "postgres", "time", "offline" ] }
|
||||
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"
|
||||
|
||||
|
||||
|
||||
20
Makefile
20
Makefile
@@ -22,6 +22,9 @@ check: ## Check for syntax errors on all workspaces
|
||||
cd db/db-sqlx-postgres &&\
|
||||
DATABASE_URL=${POSTGRES_DATABASE_URL}\
|
||||
cargo check
|
||||
cd db/db-sqlx-maria &&\
|
||||
DATABASE_URL=${MARIA_DATABASE_URL}\
|
||||
cargo check
|
||||
cd db/db-core/ && cargo check
|
||||
|
||||
cache-bust: ## Run cache buster on static assets
|
||||
@@ -84,26 +87,24 @@ lint: ## Lint codebase
|
||||
cd $(OPENAPI)&& yarn test
|
||||
|
||||
migrate: ## Run database migrations
|
||||
cd db/db-migrations/ && \
|
||||
DATABASE_URL=${POSTGRES_DATABASE_URL} cargo run
|
||||
cd db/db-migrations/ && cargo run
|
||||
|
||||
release: frontend ## Build app with release optimizations
|
||||
$(call cache_bust)
|
||||
cargo build --release
|
||||
|
||||
run: frontend ## Run app in debug mode
|
||||
$(call cache_bust)
|
||||
cargo run
|
||||
|
||||
|
||||
sqlx-offline-data: ## prepare sqlx offline data
|
||||
cargo sqlx prepare --database-url=${POSTGRES_DATABASE_URL} -- --bin mcaptcha \
|
||||
--all-features
|
||||
cd db/db-migrations && cargo sqlx prepare \
|
||||
--database-url=${POSTGRES_DATABASE_URL} -- --bin db-migrations \
|
||||
--all-features
|
||||
cd db/db-sqlx-postgres && cargo sqlx prepare \
|
||||
--database-url=${POSTGRES_DATABASE_URL} -- \
|
||||
--all-features
|
||||
cd db/db-sqlx-maria && cargo sqlx prepare \
|
||||
--database-url=${MARIA_DATABASE_URL} -- \
|
||||
--all-features
|
||||
# cd db/db-sqlx-sqlite/ \
|
||||
# && DATABASE_URL=${SQLITE_DATABASE_URL} cargo sqlx prepare
|
||||
|
||||
@@ -116,7 +117,10 @@ test: frontend-test frontend ## Run all available tests
|
||||
cd db/db-sqlx-postgres &&\
|
||||
DATABASE_URL=${POSTGRES_DATABASE_URL}\
|
||||
cargo test --no-fail-fast
|
||||
cargo test --all-features --no-fail-fast
|
||||
cd db/db-sqlx-maria &&\
|
||||
DATABASE_URL=${MARIA_DATABASE_URL}\
|
||||
cargo test --no-fail-fast
|
||||
cargo test --no-fail-fast
|
||||
# ./scripts/tests.sh
|
||||
|
||||
xml-test-coverage: migrate ## Generate code coverage report in XML format
|
||||
|
||||
@@ -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]
|
||||
@@ -50,6 +52,7 @@ username = "postgres"
|
||||
password = "password"
|
||||
name = "postgres"
|
||||
pool = 4
|
||||
database_type="postgres" # "postgres", "maria"
|
||||
|
||||
[redis]
|
||||
# This section deals with the database location and how to access it
|
||||
|
||||
@@ -13,7 +13,8 @@ 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"}
|
||||
libmcaptcha = { branch = "master", git = "https://github.com/mCaptcha/libmcaptcha", features = ["full"] }
|
||||
|
||||
[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
|
||||
|
||||
@@ -28,21 +28,31 @@ pub async fn database_works<'a, T: MCDatabase>(
|
||||
an: &AddNotification<'a>,
|
||||
) {
|
||||
assert!(db.ping().await, "ping test");
|
||||
|
||||
if db.username_exists(p.username).await.unwrap() {
|
||||
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"
|
||||
);
|
||||
}
|
||||
|
||||
assert!(matches!(
|
||||
db.get_secret(&p.username).await,
|
||||
Err(DBError::AccountNotFound)
|
||||
));
|
||||
|
||||
db.register(p).await.unwrap();
|
||||
|
||||
assert!(matches!(db.register(&p).await, Err(DBError::UsernameTaken)));
|
||||
|
||||
// testing get secret
|
||||
let secret = db.get_secret(p.username).await.unwrap();
|
||||
assert_eq!(secret.secret, p.secret, "user secret matches");
|
||||
|
||||
// testing update secret: setting secret = username
|
||||
db.update_secret(p.username, p.username).await.unwrap();
|
||||
|
||||
let secret = db.get_secret(p.username).await.unwrap();
|
||||
assert_eq!(
|
||||
secret.secret, p.username,
|
||||
@@ -79,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
|
||||
@@ -114,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
|
||||
@@ -123,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
|
||||
@@ -145,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"
|
||||
);
|
||||
|
||||
/*
|
||||
|
||||
@@ -10,4 +10,4 @@ authors = ["realaravinth <realaravinth@batsense.net>"]
|
||||
|
||||
[dependencies]
|
||||
actix-rt = "2"
|
||||
sqlx = { version = "0.5.13", features = [ "runtime-actix-rustls", "postgres", "time", "offline" ] }
|
||||
sqlx = { version = "0.5.13", features = [ "runtime-actix-rustls", "postgres", "time", "offline", "mysql" ] }
|
||||
|
||||
@@ -17,12 +17,14 @@
|
||||
use std::env;
|
||||
|
||||
use sqlx::postgres::PgPoolOptions;
|
||||
use sqlx::mysql::MySqlPoolOptions;
|
||||
|
||||
#[cfg(not(tarpaulin_include))]
|
||||
#[actix_rt::main]
|
||||
async fn main() {
|
||||
//TODO featuregate sqlite and postgres
|
||||
postgres_migrate().await;
|
||||
maria_migrate().await;
|
||||
}
|
||||
|
||||
async fn postgres_migrate() {
|
||||
@@ -38,3 +40,17 @@ async fn postgres_migrate() {
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
async fn maria_migrate() {
|
||||
let db_url = env::var("MARIA_DATABASE_URL").expect("set POSTGRES_DATABASE_URL env var");
|
||||
let db = MySqlPoolOptions::new()
|
||||
.max_connections(2)
|
||||
.connect(&db_url)
|
||||
.await
|
||||
.expect("Unable to form database pool");
|
||||
|
||||
sqlx::migrate!("../db-sqlx-maria/migrations/")
|
||||
.run(&db)
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
16
db/db-sqlx-maria/.gitignore
vendored
Normal file
16
db/db-sqlx-maria/.gitignore
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
/target
|
||||
tarpaulin-report.html
|
||||
.env
|
||||
.env
|
||||
cobertura.xml
|
||||
prod/
|
||||
node_modules/
|
||||
/static-assets/bundle
|
||||
static/cache/bundle
|
||||
./templates/**/*.js
|
||||
/static-assets/bundle/*
|
||||
src/cache_buster_data.json
|
||||
coverage
|
||||
dist
|
||||
assets
|
||||
yarn-error.log
|
||||
21
db/db-sqlx-maria/Cargo.toml
Normal file
21
db/db-sqlx-maria/Cargo.toml
Normal file
@@ -0,0 +1,21 @@
|
||||
[package]
|
||||
name = "db-sqlx-maria"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
homepage = "https://mcaptcha.org"
|
||||
repository = "https://github.com/mCaptcha/mCaptcha"
|
||||
documentation = "https://mcaptcha.org/docs/"
|
||||
license = "AGPLv3 or later version"
|
||||
authors = ["realaravinth <realaravinth@batsense.net>"]
|
||||
|
||||
[dependencies]
|
||||
async-trait = "0.1.51"
|
||||
db-core = {path = "../db-core"}
|
||||
futures = "0.3.15"
|
||||
sqlx = { version = "0.5.13", features = [ "runtime-actix-rustls", "mysql", "time", "offline" ] }
|
||||
|
||||
[dev-dependencies]
|
||||
actix-rt = "2"
|
||||
sqlx = { version = "0.5.13", features = [ "runtime-actix-rustls", "mysql", "time", "offline" ] }
|
||||
db-core = {path = "../db-core", features = ["test"]}
|
||||
url = { version = "2.2.2", features = ["serde"] }
|
||||
@@ -0,0 +1,9 @@
|
||||
CREATE TABLE IF NOT EXISTS mcaptcha_users (
|
||||
name VARCHAR(100) NOT NULL UNIQUE,
|
||||
email VARCHAR(100) UNIQUE DEFAULT NULL,
|
||||
email_verified BOOLEAN DEFAULT NULL,
|
||||
secret varchar(50) NOT NULL UNIQUE,
|
||||
password TEXT NOT NULL,
|
||||
ID INT auto_increment,
|
||||
PRIMARY KEY(ID)
|
||||
);
|
||||
@@ -0,0 +1,16 @@
|
||||
-- TODO: changed key -> captcha_key
|
||||
|
||||
CREATE TABLE IF NOT EXISTS mcaptcha_config (
|
||||
config_id INT auto_increment,
|
||||
PRIMARY KEY(config_id),
|
||||
user_id INT NOT NULL,
|
||||
captcha_key varchar(100) NOT NULL UNIQUE,
|
||||
name varchar(100) NOT NULL,
|
||||
duration integer NOT NULL DEFAULT 30,
|
||||
|
||||
CONSTRAINT `fk_mcaptcha_user`
|
||||
FOREIGN KEY (user_id)
|
||||
REFERENCES mcaptcha_users (ID)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
);
|
||||
@@ -0,0 +1,12 @@
|
||||
CREATE TABLE IF NOT EXISTS mcaptcha_levels (
|
||||
config_id INTEGER NOT NULL,
|
||||
difficulty_factor INTEGER NOT NULL,
|
||||
visitor_threshold INTEGER NOT NULL,
|
||||
level_id INT auto_increment,
|
||||
PRIMARY KEY(level_id),
|
||||
CONSTRAINT `fk_mcaptcha_config_id`
|
||||
FOREIGN KEY (config_id)
|
||||
REFERENCES mcaptcha_config (config_id)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
);
|
||||
@@ -0,0 +1,10 @@
|
||||
CREATE TABLE IF NOT EXISTS mcaptcha_pow_fetched_stats (
|
||||
config_id INTEGER NOT NULL,
|
||||
time timestamp NOT NULL DEFAULT now(),
|
||||
CONSTRAINT `fk_mcaptcha_config_id_pow_fetched_stats`
|
||||
FOREIGN KEY (config_id)
|
||||
REFERENCES mcaptcha_config (config_id)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
|
||||
);
|
||||
@@ -0,0 +1,9 @@
|
||||
CREATE TABLE IF NOT EXISTS mcaptcha_pow_solved_stats (
|
||||
config_id INTEGER NOT NULL,
|
||||
time timestamp NOT NULL DEFAULT now(),
|
||||
CONSTRAINT `fk_mcaptcha_config_id_pow_solved_stats`
|
||||
FOREIGN KEY (config_id)
|
||||
REFERENCES mcaptcha_config (config_id)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
);
|
||||
@@ -0,0 +1,10 @@
|
||||
CREATE TABLE IF NOT EXISTS mcaptcha_pow_confirmed_stats (
|
||||
config_id INTEGER NOT NULL,
|
||||
time timestamp NOT NULL DEFAULT now(),
|
||||
CONSTRAINT `fk_mcaptcha_config_id_pow_confirmed_stats`
|
||||
FOREIGN KEY (config_id)
|
||||
REFERENCES mcaptcha_config (config_id)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
|
||||
);
|
||||
@@ -0,0 +1,19 @@
|
||||
-- Add migration script here
|
||||
CREATE TABLE IF NOT EXISTS mcaptcha_notifications (
|
||||
id INT auto_increment,
|
||||
PRIMARY KEY(id),
|
||||
|
||||
tx INT NOT NULL,
|
||||
rx INT NOT NULL,
|
||||
heading varchar(30) NOT NULL,
|
||||
message varchar(250) NOT NULL,
|
||||
-- todo: mv read -> read_notification
|
||||
read_notification BOOLEAN DEFAULT null,
|
||||
received timestamp NOT NULL DEFAULT now(),
|
||||
|
||||
CONSTRAINT `fk_mcaptcha_mcaptcha_user_notifications_tx`
|
||||
FOREIGN KEY (tx)
|
||||
REFERENCES mcaptcha_users (ID)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
);
|
||||
@@ -0,0 +1,13 @@
|
||||
CREATE TABLE IF NOT EXISTS mcaptcha_sitekey_user_provided_avg_traffic (
|
||||
config_id INT NOT NULL,
|
||||
PRIMARY KEY(config_id),
|
||||
avg_traffic INTEGER DEFAULT NULL,
|
||||
peak_sustainable_traffic INTEGER DEFAULT NULL,
|
||||
broke_my_site_traffic INT DEFAULT NULL,
|
||||
|
||||
CONSTRAINT `fk_mcaptcha_sitekey_user_provided_avg_trafic_config_id`
|
||||
FOREIGN KEY (config_id)
|
||||
REFERENCES mcaptcha_config (config_id)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
);
|
||||
@@ -0,0 +1,3 @@
|
||||
ALTER TABLE mcaptcha_sitekey_user_provided_avg_traffic
|
||||
MODIFY avg_traffic INTEGER NOT NULL,
|
||||
MODIFY peak_sustainable_traffic INTEGER NOT NULL;
|
||||
@@ -0,0 +1,2 @@
|
||||
-- Add migration script here
|
||||
ALTER TABLE mcaptcha_notifications MODIFY heading varchar(100) NOT NULL;
|
||||
886
db/db-sqlx-maria/sqlx-data.json
Normal file
886
db/db-sqlx-maria/sqlx-data.json
Normal file
@@ -0,0 +1,886 @@
|
||||
{
|
||||
"db": "MySQL",
|
||||
"1367dceb151a766a901b5dd771d0b75d0bc61d2fef17a94a90c8ffa0065e2c44": {
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "time",
|
||||
"ordinal": 0,
|
||||
"type_info": {
|
||||
"char_set": 63,
|
||||
"flags": {
|
||||
"bits": 1185
|
||||
},
|
||||
"max_size": 19,
|
||||
"type": "Timestamp"
|
||||
}
|
||||
}
|
||||
],
|
||||
"nullable": [
|
||||
false
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
}
|
||||
},
|
||||
"query": "SELECT time FROM mcaptcha_pow_confirmed_stats \n WHERE \n config_id = (\n SELECT config_id FROM mcaptcha_config \n WHERE \n captcha_key = ?\n AND\n user_id = (\n SELECT \n ID FROM mcaptcha_users WHERE name = ?))\n ORDER BY time DESC"
|
||||
},
|
||||
"22e697114c3ed5b0156cdceab11a398f1ef3a804f482e1cd948bc615ef95fc92": {
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"nullable": [],
|
||||
"parameters": {
|
||||
"Right": 5
|
||||
}
|
||||
},
|
||||
"query": "INSERT INTO mcaptcha_sitekey_user_provided_avg_traffic (\n config_id,\n avg_traffic,\n peak_sustainable_traffic,\n broke_my_site_traffic\n ) VALUES ( \n (SELECT config_id FROM mcaptcha_config where captcha_key= (?)\n AND user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?)\n ), ?, ?, ?)"
|
||||
},
|
||||
"34b29417f9ff3f4d5987df0ce81023b1985eb84e560602b36182f55de6cd9d83": {
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"nullable": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
}
|
||||
},
|
||||
"query": "INSERT INTO mcaptcha_pow_confirmed_stats \n (config_id, time) VALUES ((SELECT config_id FROM mcaptcha_config where captcha_key= ?), ?)"
|
||||
},
|
||||
"3812693a9ae4402d900bcbf680981e6194073bd1937af11a77daa3776fb4c873": {
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "captcha_key",
|
||||
"ordinal": 0,
|
||||
"type_info": {
|
||||
"char_set": 224,
|
||||
"flags": {
|
||||
"bits": 4101
|
||||
},
|
||||
"max_size": 400,
|
||||
"type": "VarString"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"ordinal": 1,
|
||||
"type_info": {
|
||||
"char_set": 224,
|
||||
"flags": {
|
||||
"bits": 4097
|
||||
},
|
||||
"max_size": 400,
|
||||
"type": "VarString"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "config_id",
|
||||
"ordinal": 2,
|
||||
"type_info": {
|
||||
"char_set": 63,
|
||||
"flags": {
|
||||
"bits": 515
|
||||
},
|
||||
"max_size": 11,
|
||||
"type": "Long"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "duration",
|
||||
"ordinal": 3,
|
||||
"type_info": {
|
||||
"char_set": 63,
|
||||
"flags": {
|
||||
"bits": 1
|
||||
},
|
||||
"max_size": 11,
|
||||
"type": "Long"
|
||||
}
|
||||
}
|
||||
],
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
}
|
||||
},
|
||||
"query": "SELECT captcha_key, name, config_id, duration FROM mcaptcha_config WHERE\n user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?) "
|
||||
},
|
||||
"3a8381eb0f0542a492d9dd51368e769e2b313e0576a1873e5c7630011e463daf": {
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"nullable": [],
|
||||
"parameters": {
|
||||
"Right": 4
|
||||
}
|
||||
},
|
||||
"query": "UPDATE mcaptcha_config SET name = ?, duration = ?\n WHERE user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?)\n AND captcha_key = ?"
|
||||
},
|
||||
"413ea53cea8b8f114fc009bad527b054a68a94477dfcc50d860d45bbd864d4f1": {
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "email",
|
||||
"ordinal": 0,
|
||||
"type_info": {
|
||||
"char_set": 224,
|
||||
"flags": {
|
||||
"bits": 4
|
||||
},
|
||||
"max_size": 400,
|
||||
"type": "VarString"
|
||||
}
|
||||
}
|
||||
],
|
||||
"nullable": [
|
||||
true
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
}
|
||||
},
|
||||
"query": "SELECT email FROM mcaptcha_users WHERE name = ?"
|
||||
},
|
||||
"598a8202942771eff460faa6f09bd3fb1fc910d5fab7edb07c49dadbbaeb1cb8": {
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"nullable": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
}
|
||||
},
|
||||
"query": "INSERT INTO mcaptcha_pow_fetched_stats \n (config_id, time) VALUES ((SELECT config_id FROM mcaptcha_config where captcha_key= ?), ?)"
|
||||
},
|
||||
"5d5a106981345e9f62bc2239c00cdc683d3aaaa820d63da300dc51e3f6f363d3": {
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"nullable": [],
|
||||
"parameters": {
|
||||
"Right": 3
|
||||
}
|
||||
},
|
||||
"query": "INSERT INTO mcaptcha_users \n (name , password, secret) VALUES (?, ?, ?)"
|
||||
},
|
||||
"66ec7df10484f8e0206f3c97afc9136021589556c38dbbed341d6574487f79f2": {
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "config_id",
|
||||
"ordinal": 0,
|
||||
"type_info": {
|
||||
"char_set": 63,
|
||||
"flags": {
|
||||
"bits": 515
|
||||
},
|
||||
"max_size": 11,
|
||||
"type": "Long"
|
||||
}
|
||||
}
|
||||
],
|
||||
"nullable": [
|
||||
false
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
}
|
||||
},
|
||||
"query": "SELECT config_id FROM mcaptcha_config\n WHERE\n captcha_key = ? \n AND user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?)"
|
||||
},
|
||||
"676a9f1761c3b63cf16d7d4dd6261507cc7707feb32d458f4b946ed9caa53721": {
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"nullable": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
}
|
||||
},
|
||||
"query": "UPDATE mcaptcha_users set name = ?\n WHERE name = ?"
|
||||
},
|
||||
"6d1b6e5e58ca2ba285cab7b050bbdc43de1f3e46cf7d420bc95c124a1c7c9d1f": {
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"nullable": [],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
}
|
||||
},
|
||||
"query": "DELETE FROM mcaptcha_users WHERE name = (?)"
|
||||
},
|
||||
"6d43e6ceb54a0ff8a803bd96dd9134b15da01d48776ac0cf3d66a2997dadce5e": {
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "difficulty_factor",
|
||||
"ordinal": 0,
|
||||
"type_info": {
|
||||
"char_set": 63,
|
||||
"flags": {
|
||||
"bits": 4097
|
||||
},
|
||||
"max_size": 11,
|
||||
"type": "Long"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "visitor_threshold",
|
||||
"ordinal": 1,
|
||||
"type_info": {
|
||||
"char_set": 63,
|
||||
"flags": {
|
||||
"bits": 4097
|
||||
},
|
||||
"max_size": 11,
|
||||
"type": "Long"
|
||||
}
|
||||
}
|
||||
],
|
||||
"nullable": [
|
||||
false,
|
||||
false
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
}
|
||||
},
|
||||
"query": "SELECT difficulty_factor, visitor_threshold FROM mcaptcha_levels WHERE\n config_id = (\n SELECT config_id FROM mcaptcha_config where captcha_key= (?)\n ) ORDER BY difficulty_factor ASC;"
|
||||
},
|
||||
"74d68a86f852d3d85957e94ed04e8acd8e6144744f7b13e383ebcb2bcf3360ae": {
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"nullable": [],
|
||||
"parameters": {
|
||||
"Right": 4
|
||||
}
|
||||
},
|
||||
"query": "INSERT INTO mcaptcha_levels (\n difficulty_factor, \n visitor_threshold,\n config_id) VALUES (\n ?, ?, (\n SELECT config_id FROM mcaptcha_config WHERE\n captcha_key = (?) AND user_id = (\n SELECT ID FROM mcaptcha_users WHERE name = ?\n )));"
|
||||
},
|
||||
"7838ade4a48068e25c6f117ee8e38f088b867b1ab08a7dd0269b76891266ace6": {
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"nullable": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
}
|
||||
},
|
||||
"query": "UPDATE mcaptcha_users set secret = ?\n WHERE name = ?"
|
||||
},
|
||||
"7894dda54cd65559fe3b81bab7df8cc848e21ed5c7f5e88951bf1c98c78ed820": {
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"nullable": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
}
|
||||
},
|
||||
"query": "DELETE FROM mcaptcha_levels \n WHERE config_id = (\n SELECT config_id FROM mcaptcha_config where captcha_key= (?) \n AND user_id = (\n SELECT ID from mcaptcha_users WHERE name = ?\n )\n )"
|
||||
},
|
||||
"89386c46668a2653a54687e65958af5cf7a8da268339a1f5a379ede47b3c6d2a": {
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"nullable": [],
|
||||
"parameters": {
|
||||
"Right": 5
|
||||
}
|
||||
},
|
||||
"query": "INSERT INTO mcaptcha_notifications (\n heading, message, tx, rx, received)\n VALUES (\n ?, ?,\n (SELECT ID FROM mcaptcha_users WHERE name = ?),\n (SELECT ID FROM mcaptcha_users WHERE name = ?),\n ?\n );"
|
||||
},
|
||||
"8acbf84d4801e86221d8f6324ae50488a0986182d66b20ad414bce4e2ac18eca": {
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "duration",
|
||||
"ordinal": 0,
|
||||
"type_info": {
|
||||
"char_set": 63,
|
||||
"flags": {
|
||||
"bits": 1
|
||||
},
|
||||
"max_size": 11,
|
||||
"type": "Long"
|
||||
}
|
||||
}
|
||||
],
|
||||
"nullable": [
|
||||
false
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
}
|
||||
},
|
||||
"query": "SELECT duration FROM mcaptcha_config \n where captcha_key= ?"
|
||||
},
|
||||
"8e6026abf7c0e8ab90ee8eb7ada9f66962ab6999d3127944b058d6f96346e72f": {
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"nullable": [],
|
||||
"parameters": {
|
||||
"Right": 3
|
||||
}
|
||||
},
|
||||
"query": "UPDATE mcaptcha_config SET captcha_key = ? \n WHERE captcha_key = ? AND user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?)"
|
||||
},
|
||||
"8ec8bbde0c02a99f74d12e6778f123a973283e6d56b6861b30f559768617848a": {
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"nullable": [],
|
||||
"parameters": {
|
||||
"Right": 4
|
||||
}
|
||||
},
|
||||
"query": "insert into mcaptcha_users \n (name , password, email, secret) values (?, ?, ?, ?)"
|
||||
},
|
||||
"9c435148ed5655e79dd1e73e3566ce23b7c6d38edcedbb988c95813c5da893ed": {
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "config_id",
|
||||
"ordinal": 0,
|
||||
"type_info": {
|
||||
"char_set": 63,
|
||||
"flags": {
|
||||
"bits": 515
|
||||
},
|
||||
"max_size": 11,
|
||||
"type": "Long"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "duration",
|
||||
"ordinal": 1,
|
||||
"type_info": {
|
||||
"char_set": 63,
|
||||
"flags": {
|
||||
"bits": 1
|
||||
},
|
||||
"max_size": 11,
|
||||
"type": "Long"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"ordinal": 2,
|
||||
"type_info": {
|
||||
"char_set": 224,
|
||||
"flags": {
|
||||
"bits": 4097
|
||||
},
|
||||
"max_size": 400,
|
||||
"type": "VarString"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "captcha_key",
|
||||
"ordinal": 3,
|
||||
"type_info": {
|
||||
"char_set": 224,
|
||||
"flags": {
|
||||
"bits": 4101
|
||||
},
|
||||
"max_size": 400,
|
||||
"type": "VarString"
|
||||
}
|
||||
}
|
||||
],
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
}
|
||||
},
|
||||
"query": "SELECT `config_id`, `duration`, `name`, `captcha_key` from mcaptcha_config WHERE\n `captcha_key` = ? AND\n user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?) "
|
||||
},
|
||||
"9cb416de904872d66af90baa0024f382ce6f8344464c607fe6e6c2572816dfc2": {
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"nullable": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
}
|
||||
},
|
||||
"query": "UPDATE mcaptcha_users set email = ?\n WHERE name = ?"
|
||||
},
|
||||
"a89c066db044cddfdebee6a0fd0d80a5a26dcb7ecc00a9899f5634b72ea0a952": {
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "config_id",
|
||||
"ordinal": 0,
|
||||
"type_info": {
|
||||
"char_set": 63,
|
||||
"flags": {
|
||||
"bits": 515
|
||||
},
|
||||
"max_size": 11,
|
||||
"type": "Long"
|
||||
}
|
||||
}
|
||||
],
|
||||
"nullable": [
|
||||
false
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
}
|
||||
},
|
||||
"query": "SELECT config_id from mcaptcha_config WHERE captcha_key = ?"
|
||||
},
|
||||
"b9258c2494d95701d19703cf5cd05a222057a0ccad943192138b1a4a94bf823b": {
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "secret",
|
||||
"ordinal": 0,
|
||||
"type_info": {
|
||||
"char_set": 224,
|
||||
"flags": {
|
||||
"bits": 4101
|
||||
},
|
||||
"max_size": 200,
|
||||
"type": "VarString"
|
||||
}
|
||||
}
|
||||
],
|
||||
"nullable": [
|
||||
false
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
}
|
||||
},
|
||||
"query": "SELECT secret FROM mcaptcha_users WHERE ID = (\n SELECT user_id FROM mcaptcha_config WHERE captcha_key = ?\n )"
|
||||
},
|
||||
"b95e5a60a202cb646d5e76df8c7395e4bf881a6dd14e28e6f2e8b93e0536b331": {
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"nullable": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
}
|
||||
},
|
||||
"query": "DELETE FROM mcaptcha_config where captcha_key= (?)\n AND\n user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?)"
|
||||
},
|
||||
"b9b0c63380bc0dfdea8aae092dcefceb316fe94667d74f53d53063810cdd2ba8": {
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"ordinal": 0,
|
||||
"type_info": {
|
||||
"char_set": 63,
|
||||
"flags": {
|
||||
"bits": 515
|
||||
},
|
||||
"max_size": 11,
|
||||
"type": "Long"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "heading",
|
||||
"ordinal": 1,
|
||||
"type_info": {
|
||||
"char_set": 224,
|
||||
"flags": {
|
||||
"bits": 4097
|
||||
},
|
||||
"max_size": 400,
|
||||
"type": "VarString"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "message",
|
||||
"ordinal": 2,
|
||||
"type_info": {
|
||||
"char_set": 224,
|
||||
"flags": {
|
||||
"bits": 4097
|
||||
},
|
||||
"max_size": 1000,
|
||||
"type": "VarString"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "received",
|
||||
"ordinal": 3,
|
||||
"type_info": {
|
||||
"char_set": 63,
|
||||
"flags": {
|
||||
"bits": 1185
|
||||
},
|
||||
"max_size": 19,
|
||||
"type": "Timestamp"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"ordinal": 4,
|
||||
"type_info": {
|
||||
"char_set": 224,
|
||||
"flags": {
|
||||
"bits": 4101
|
||||
},
|
||||
"max_size": 400,
|
||||
"type": "VarString"
|
||||
}
|
||||
}
|
||||
],
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
}
|
||||
},
|
||||
"query": "-- gets all unread notifications a user has\nSELECT \n mcaptcha_notifications.id,\n mcaptcha_notifications.heading,\n mcaptcha_notifications.message,\n mcaptcha_notifications.received,\n mcaptcha_users.name\nFROM\n mcaptcha_notifications \nINNER JOIN \n mcaptcha_users \nON \n mcaptcha_notifications.tx = mcaptcha_users.id\nWHERE \n mcaptcha_notifications.rx = (\n SELECT \n id \n FROM \n mcaptcha_users\n WHERE\n name = ?\n )\nAND \n mcaptcha_notifications.read_notification IS NULL;\n"
|
||||
},
|
||||
"caa1638ee510ef62b86817e5d2baeaca8dfa432c23d7630c0e70737211a4680b": {
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "name",
|
||||
"ordinal": 0,
|
||||
"type_info": {
|
||||
"char_set": 224,
|
||||
"flags": {
|
||||
"bits": 4101
|
||||
},
|
||||
"max_size": 400,
|
||||
"type": "VarString"
|
||||
}
|
||||
}
|
||||
],
|
||||
"nullable": [
|
||||
false
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
}
|
||||
},
|
||||
"query": "SELECT name from mcaptcha_users WHERE email = ?"
|
||||
},
|
||||
"cad5b403470f26c565e74a1dca19b7dee066141dec0f708070067e34d5bf72cc": {
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"nullable": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
}
|
||||
},
|
||||
"query": "UPDATE mcaptcha_users set password = ?\n WHERE name = ?"
|
||||
},
|
||||
"cf333541509213f11a9bf7119dcb3289bb77abf1482fc1d47e7f5bb27bdc8d97": {
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"nullable": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
}
|
||||
},
|
||||
"query": "-- mark a notification as read\nUPDATE mcaptcha_notifications\n SET read_notification = TRUE\nWHERE \n mcaptcha_notifications.id = ?\nAND\n mcaptcha_notifications.rx = (\n SELECT\n id\n FROM\n mcaptcha_users\n WHERE\n name = ?\n );\n"
|
||||
},
|
||||
"d05b84966f4e70c53789221f961bf3637f404f3ba45e880115e97ed1ba5a2809": {
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"nullable": [],
|
||||
"parameters": {
|
||||
"Right": 4
|
||||
}
|
||||
},
|
||||
"query": "INSERT INTO mcaptcha_config\n (`captcha_key`, `user_id`, `duration`, `name`)\n VALUES (?, (SELECT ID FROM mcaptcha_users WHERE name = ?), ?, ?)"
|
||||
},
|
||||
"d4b92e8099cd29cfdb99aadeeada739bb6858667fc65f528ec484e98a9da21bc": {
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "time",
|
||||
"ordinal": 0,
|
||||
"type_info": {
|
||||
"char_set": 63,
|
||||
"flags": {
|
||||
"bits": 1185
|
||||
},
|
||||
"max_size": 19,
|
||||
"type": "Timestamp"
|
||||
}
|
||||
}
|
||||
],
|
||||
"nullable": [
|
||||
false
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
}
|
||||
},
|
||||
"query": "SELECT time FROM mcaptcha_pow_solved_stats \n WHERE config_id = (\n SELECT config_id FROM mcaptcha_config \n WHERE \n captcha_key = ?\n AND\n user_id = (\n SELECT \n ID FROM mcaptcha_users WHERE name = ?)) \n ORDER BY time DESC"
|
||||
},
|
||||
"daac5e937aeac2f106eb89154b431fa8bd1bd7baa95e51704fdcdf50bd970a1d": {
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "time",
|
||||
"ordinal": 0,
|
||||
"type_info": {
|
||||
"char_set": 63,
|
||||
"flags": {
|
||||
"bits": 1185
|
||||
},
|
||||
"max_size": 19,
|
||||
"type": "Timestamp"
|
||||
}
|
||||
}
|
||||
],
|
||||
"nullable": [
|
||||
false
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
}
|
||||
},
|
||||
"query": "SELECT time FROM mcaptcha_pow_fetched_stats\n WHERE \n config_id = (\n SELECT \n config_id FROM mcaptcha_config \n WHERE \n captcha_key = ?\n AND\n user_id = (\n SELECT \n ID FROM mcaptcha_users WHERE name = ?))\n ORDER BY time DESC"
|
||||
},
|
||||
"dd5ff10b88fa6f374e105b6bed9e34e0870ac8dd7ce36dfb09d13a1b7005b2eb": {
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "name",
|
||||
"ordinal": 0,
|
||||
"type_info": {
|
||||
"char_set": 224,
|
||||
"flags": {
|
||||
"bits": 4101
|
||||
},
|
||||
"max_size": 400,
|
||||
"type": "VarString"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "password",
|
||||
"ordinal": 1,
|
||||
"type_info": {
|
||||
"char_set": 224,
|
||||
"flags": {
|
||||
"bits": 4113
|
||||
},
|
||||
"max_size": 262140,
|
||||
"type": "Blob"
|
||||
}
|
||||
}
|
||||
],
|
||||
"nullable": [
|
||||
false,
|
||||
false
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
}
|
||||
},
|
||||
"query": "SELECT name, password FROM mcaptcha_users WHERE name = ?"
|
||||
},
|
||||
"dd9b4dec39405ff19af21faabb6a7c3bb3207e7e785fe15357146b88c6c27f01": {
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "secret",
|
||||
"ordinal": 0,
|
||||
"type_info": {
|
||||
"char_set": 224,
|
||||
"flags": {
|
||||
"bits": 4101
|
||||
},
|
||||
"max_size": 200,
|
||||
"type": "VarString"
|
||||
}
|
||||
}
|
||||
],
|
||||
"nullable": [
|
||||
false
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
}
|
||||
},
|
||||
"query": "SELECT secret FROM mcaptcha_users WHERE name = ?"
|
||||
},
|
||||
"df6de3b96afcfb7f364f98954995e506b19e80e7f88204405d970c360ad5e1a0": {
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "difficulty_factor",
|
||||
"ordinal": 0,
|
||||
"type_info": {
|
||||
"char_set": 63,
|
||||
"flags": {
|
||||
"bits": 4097
|
||||
},
|
||||
"max_size": 11,
|
||||
"type": "Long"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "visitor_threshold",
|
||||
"ordinal": 1,
|
||||
"type_info": {
|
||||
"char_set": 63,
|
||||
"flags": {
|
||||
"bits": 4097
|
||||
},
|
||||
"max_size": 11,
|
||||
"type": "Long"
|
||||
}
|
||||
}
|
||||
],
|
||||
"nullable": [
|
||||
false,
|
||||
false
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
}
|
||||
},
|
||||
"query": "SELECT difficulty_factor, visitor_threshold FROM mcaptcha_levels WHERE\n config_id = (\n SELECT config_id FROM mcaptcha_config where captcha_key= (?)\n AND user_id = (SELECT ID from mcaptcha_users WHERE name = ?)\n )\n ORDER BY difficulty_factor ASC;"
|
||||
},
|
||||
"e2b0b85f2afac1cbca43ce684641bf75ef070e44ce3d00404fc6151d2f4d7bcf": {
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"nullable": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
}
|
||||
},
|
||||
"query": "INSERT INTO mcaptcha_pow_solved_stats \n (config_id, time) VALUES ((SELECT config_id FROM mcaptcha_config where captcha_key= ?), ?)"
|
||||
},
|
||||
"e6569a6064d0e07abea4c0bd4686cdfdaac64f0109ac40efaed06a744a2eaf5e": {
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "name",
|
||||
"ordinal": 0,
|
||||
"type_info": {
|
||||
"char_set": 224,
|
||||
"flags": {
|
||||
"bits": 4101
|
||||
},
|
||||
"max_size": 400,
|
||||
"type": "VarString"
|
||||
}
|
||||
}
|
||||
],
|
||||
"nullable": [
|
||||
false
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
}
|
||||
},
|
||||
"query": "SELECT name from mcaptcha_users WHERE name = ?"
|
||||
},
|
||||
"e91116ebce127833488130cf1060e0817e5677f39588632452b8d621688c405a": {
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "avg_traffic",
|
||||
"ordinal": 0,
|
||||
"type_info": {
|
||||
"char_set": 63,
|
||||
"flags": {
|
||||
"bits": 4097
|
||||
},
|
||||
"max_size": 11,
|
||||
"type": "Long"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "peak_sustainable_traffic",
|
||||
"ordinal": 1,
|
||||
"type_info": {
|
||||
"char_set": 63,
|
||||
"flags": {
|
||||
"bits": 4097
|
||||
},
|
||||
"max_size": 11,
|
||||
"type": "Long"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "broke_my_site_traffic",
|
||||
"ordinal": 2,
|
||||
"type_info": {
|
||||
"char_set": 63,
|
||||
"flags": {
|
||||
"bits": 0
|
||||
},
|
||||
"max_size": 11,
|
||||
"type": "Long"
|
||||
}
|
||||
}
|
||||
],
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
true
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
}
|
||||
},
|
||||
"query": "SELECT \n avg_traffic, \n peak_sustainable_traffic, \n broke_my_site_traffic \n FROM \n mcaptcha_sitekey_user_provided_avg_traffic \n WHERE \n config_id = (\n SELECT \n config_id \n FROM \n mcaptcha_config \n WHERE \n captcha_key = ? \n AND user_id = (\n SELECT \n id \n FROM \n mcaptcha_users \n WHERE \n NAME = ?\n )\n )\n "
|
||||
},
|
||||
"ed943cbf7e16536d81010255ce2f5beb207b2b9d44cb859fa9f2233405b80ae0": {
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "name",
|
||||
"ordinal": 0,
|
||||
"type_info": {
|
||||
"char_set": 224,
|
||||
"flags": {
|
||||
"bits": 4101
|
||||
},
|
||||
"max_size": 400,
|
||||
"type": "VarString"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "password",
|
||||
"ordinal": 1,
|
||||
"type_info": {
|
||||
"char_set": 224,
|
||||
"flags": {
|
||||
"bits": 4113
|
||||
},
|
||||
"max_size": 262140,
|
||||
"type": "Blob"
|
||||
}
|
||||
}
|
||||
],
|
||||
"nullable": [
|
||||
false,
|
||||
false
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
}
|
||||
},
|
||||
"query": "SELECT name, password FROM mcaptcha_users WHERE email = ?"
|
||||
},
|
||||
"fc717ff0827ccfaa1cc61a71cc7f71c348ebb03d35895c54b011c03121ad2385": {
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"nullable": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
}
|
||||
},
|
||||
"query": "DELETE FROM mcaptcha_sitekey_user_provided_avg_traffic\n WHERE config_id = (\n SELECT config_id \n FROM \n mcaptcha_config \n WHERE\n captcha_key = ?\n AND \n user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?)\n );"
|
||||
}
|
||||
}
|
||||
55
db/db-sqlx-maria/src/errors.rs
Normal file
55
db/db-sqlx-maria/src/errors.rs
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
//! Error-handling utilities
|
||||
use std::borrow::Cow;
|
||||
|
||||
use db_core::dev::*;
|
||||
use sqlx::Error;
|
||||
|
||||
/// map custom row not found error to DB error
|
||||
pub fn map_row_not_found_err(e: Error, row_not_found: DBError) -> DBError {
|
||||
if let Error::RowNotFound = e {
|
||||
row_not_found
|
||||
} else {
|
||||
map_register_err(e)
|
||||
}
|
||||
}
|
||||
|
||||
/// map postgres errors to [DBError](DBError) types
|
||||
pub fn map_register_err(e: Error) -> DBError {
|
||||
if let Error::Database(err) = e {
|
||||
if err.code() == Some(Cow::from("23000")) {
|
||||
let msg = err.message();
|
||||
if msg.contains("for key 'name'") {
|
||||
DBError::UsernameTaken
|
||||
} else if msg.contains("for key 'email'") {
|
||||
DBError::EmailTaken
|
||||
} else if msg.contains("for key 'secret'") {
|
||||
DBError::SecretTaken
|
||||
} else if msg.contains("for key 'captcha_key'") {
|
||||
DBError::CaptchaKeyTaken
|
||||
} else {
|
||||
DBError::DBError(Box::new(Error::Database(err)))
|
||||
}
|
||||
} else {
|
||||
DBError::DBError(Box::new(Error::Database(err)))
|
||||
}
|
||||
} else {
|
||||
DBError::DBError(Box::new(e))
|
||||
}
|
||||
}
|
||||
24
db/db-sqlx-maria/src/get_all_unread_notifications.sql
Normal file
24
db/db-sqlx-maria/src/get_all_unread_notifications.sql
Normal file
@@ -0,0 +1,24 @@
|
||||
-- gets all unread notifications a user has
|
||||
SELECT
|
||||
mcaptcha_notifications.id,
|
||||
mcaptcha_notifications.heading,
|
||||
mcaptcha_notifications.message,
|
||||
mcaptcha_notifications.received,
|
||||
mcaptcha_users.name
|
||||
FROM
|
||||
mcaptcha_notifications
|
||||
INNER JOIN
|
||||
mcaptcha_users
|
||||
ON
|
||||
mcaptcha_notifications.tx = mcaptcha_users.id
|
||||
WHERE
|
||||
mcaptcha_notifications.rx = (
|
||||
SELECT
|
||||
id
|
||||
FROM
|
||||
mcaptcha_users
|
||||
WHERE
|
||||
name = ?
|
||||
)
|
||||
AND
|
||||
mcaptcha_notifications.read_notification IS NULL;
|
||||
965
db/db-sqlx-maria/src/lib.rs
Normal file
965
db/db-sqlx-maria/src/lib.rs
Normal file
@@ -0,0 +1,965 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
use std::str::FromStr;
|
||||
|
||||
use db_core::dev::*;
|
||||
|
||||
use sqlx::mysql::MySqlPoolOptions;
|
||||
use sqlx::types::time::OffsetDateTime;
|
||||
use sqlx::ConnectOptions;
|
||||
use sqlx::MySqlPool;
|
||||
|
||||
pub mod errors;
|
||||
#[cfg(test)]
|
||||
pub mod tests;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Database {
|
||||
pub pool: MySqlPool,
|
||||
}
|
||||
|
||||
/// Use an existing database pool
|
||||
pub struct Conn(pub MySqlPool);
|
||||
|
||||
/// Connect to database
|
||||
pub enum ConnectionOptions {
|
||||
/// fresh connection
|
||||
Fresh(Fresh),
|
||||
/// existing connection
|
||||
Existing(Conn),
|
||||
}
|
||||
|
||||
pub struct Fresh {
|
||||
pub pool_options: MySqlPoolOptions,
|
||||
pub disable_logging: bool,
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
pub mod dev {
|
||||
pub use super::errors::*;
|
||||
pub use super::Database;
|
||||
pub use db_core::dev::*;
|
||||
pub use prelude::*;
|
||||
pub use sqlx::Error;
|
||||
}
|
||||
|
||||
pub mod prelude {
|
||||
pub use super::*;
|
||||
pub use db_core::prelude::*;
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl Connect for ConnectionOptions {
|
||||
type Pool = Database;
|
||||
async fn connect(self) -> DBResult<Self::Pool> {
|
||||
let pool = match self {
|
||||
Self::Fresh(fresh) => {
|
||||
let mut connect_options =
|
||||
sqlx::mysql::MySqlConnectOptions::from_str(&fresh.url).unwrap();
|
||||
if fresh.disable_logging {
|
||||
connect_options.disable_statement_logging();
|
||||
}
|
||||
sqlx::mysql::MySqlConnectOptions::from_str(&fresh.url)
|
||||
.unwrap()
|
||||
.disable_statement_logging();
|
||||
fresh
|
||||
.pool_options
|
||||
.connect_with(connect_options)
|
||||
.await
|
||||
.map_err(|e| DBError::DBError(Box::new(e)))?
|
||||
}
|
||||
|
||||
Self::Existing(conn) => conn.0,
|
||||
};
|
||||
Ok(Database { pool })
|
||||
}
|
||||
}
|
||||
|
||||
use dev::*;
|
||||
|
||||
#[async_trait]
|
||||
impl Migrate for Database {
|
||||
async fn migrate(&self) -> DBResult<()> {
|
||||
sqlx::migrate!("./migrations/")
|
||||
.run(&self.pool)
|
||||
.await
|
||||
.map_err(|e| DBError::DBError(Box::new(e)))?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl MCDatabase for Database {
|
||||
/// ping DB
|
||||
async fn ping(&self) -> bool {
|
||||
use sqlx::Connection;
|
||||
|
||||
if let Ok(mut con) = self.pool.acquire().await {
|
||||
con.ping().await.is_ok()
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
/// register a new user
|
||||
async fn register(&self, p: &Register) -> DBResult<()> {
|
||||
let res = if let Some(email) = &p.email {
|
||||
sqlx::query!(
|
||||
"insert into mcaptcha_users
|
||||
(name , password, email, secret) values (?, ?, ?, ?)",
|
||||
&p.username,
|
||||
&p.hash,
|
||||
&email,
|
||||
&p.secret,
|
||||
)
|
||||
.execute(&self.pool)
|
||||
.await
|
||||
} else {
|
||||
sqlx::query!(
|
||||
"INSERT INTO mcaptcha_users
|
||||
(name , password, secret) VALUES (?, ?, ?)",
|
||||
&p.username,
|
||||
&p.hash,
|
||||
&p.secret,
|
||||
)
|
||||
.execute(&self.pool)
|
||||
.await
|
||||
};
|
||||
res.map_err(map_register_err)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// delete a user
|
||||
async fn delete_user(&self, username: &str) -> DBResult<()> {
|
||||
sqlx::query!("DELETE FROM mcaptcha_users WHERE name = (?)", username)
|
||||
.execute(&self.pool)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::AccountNotFound))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// check if username exists
|
||||
async fn username_exists(&self, username: &str) -> DBResult<bool> {
|
||||
match sqlx::query!("SELECT name from mcaptcha_users WHERE name = ?", username,)
|
||||
.fetch_one(&self.pool)
|
||||
.await
|
||||
{
|
||||
Ok(_) => Ok(true),
|
||||
Err(sqlx::Error::RowNotFound) => Ok(false),
|
||||
Err(e) => Err(map_register_err(e)),
|
||||
}
|
||||
}
|
||||
|
||||
/// get user email
|
||||
async fn get_email(&self, username: &str) -> DBResult<Option<String>> {
|
||||
struct Email {
|
||||
email: Option<String>,
|
||||
}
|
||||
|
||||
let res = sqlx::query_as!(
|
||||
Email,
|
||||
"SELECT email FROM mcaptcha_users WHERE name = ?",
|
||||
username
|
||||
)
|
||||
.fetch_one(&self.pool)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::AccountNotFound))?;
|
||||
Ok(res.email)
|
||||
}
|
||||
|
||||
/// check if email exists
|
||||
async fn email_exists(&self, email: &str) -> DBResult<bool> {
|
||||
match sqlx::query!("SELECT name from mcaptcha_users WHERE email = ?", email)
|
||||
.fetch_one(&self.pool)
|
||||
.await
|
||||
{
|
||||
Ok(_) => Ok(true),
|
||||
Err(sqlx::Error::RowNotFound) => Ok(false),
|
||||
Err(e) => Err(map_register_err(e)),
|
||||
}
|
||||
}
|
||||
|
||||
/// update a user's email
|
||||
async fn update_email(&self, p: &UpdateEmail) -> DBResult<()> {
|
||||
sqlx::query!(
|
||||
"UPDATE mcaptcha_users set email = ?
|
||||
WHERE name = ?",
|
||||
&p.new_email,
|
||||
&p.username,
|
||||
)
|
||||
.execute(&self.pool)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::AccountNotFound))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// get a user's password
|
||||
async fn get_password(&self, l: &Login) -> DBResult<NameHash> {
|
||||
struct Password {
|
||||
name: String,
|
||||
password: String,
|
||||
}
|
||||
|
||||
let rec = match l {
|
||||
Login::Username(u) => sqlx::query_as!(
|
||||
Password,
|
||||
r#"SELECT name, password FROM mcaptcha_users WHERE name = ?"#,
|
||||
u,
|
||||
)
|
||||
.fetch_one(&self.pool)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::AccountNotFound))?,
|
||||
|
||||
Login::Email(e) => sqlx::query_as!(
|
||||
Password,
|
||||
r#"SELECT name, password FROM mcaptcha_users WHERE email = ?"#,
|
||||
e,
|
||||
)
|
||||
.fetch_one(&self.pool)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::AccountNotFound))?,
|
||||
};
|
||||
|
||||
let res = NameHash {
|
||||
hash: rec.password,
|
||||
username: rec.name,
|
||||
};
|
||||
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
/// update user's password
|
||||
async fn update_password(&self, p: &NameHash) -> DBResult<()> {
|
||||
sqlx::query!(
|
||||
"UPDATE mcaptcha_users set password = ?
|
||||
WHERE name = ?",
|
||||
&p.hash,
|
||||
&p.username,
|
||||
)
|
||||
.execute(&self.pool)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::AccountNotFound))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// update username
|
||||
async fn update_username(&self, current: &str, new: &str) -> DBResult<()> {
|
||||
sqlx::query!(
|
||||
"UPDATE mcaptcha_users set name = ?
|
||||
WHERE name = ?",
|
||||
new,
|
||||
current,
|
||||
)
|
||||
.execute(&self.pool)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::AccountNotFound))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// get a user's secret
|
||||
async fn get_secret(&self, username: &str) -> DBResult<Secret> {
|
||||
let secret = sqlx::query_as!(
|
||||
Secret,
|
||||
r#"SELECT secret FROM mcaptcha_users WHERE name = ?"#,
|
||||
username,
|
||||
)
|
||||
.fetch_one(&self.pool)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::AccountNotFound))?;
|
||||
|
||||
Ok(secret)
|
||||
}
|
||||
|
||||
/// get a user's secret from a captcha key
|
||||
async fn get_secret_from_captcha(&self, key: &str) -> DBResult<Secret> {
|
||||
let secret = sqlx::query_as!(
|
||||
Secret,
|
||||
r#"SELECT secret FROM mcaptcha_users WHERE ID = (
|
||||
SELECT user_id FROM mcaptcha_config WHERE captcha_key = ?
|
||||
)"#,
|
||||
key,
|
||||
)
|
||||
.fetch_one(&self.pool)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::AccountNotFound))?;
|
||||
|
||||
Ok(secret)
|
||||
}
|
||||
|
||||
/// update a user's secret
|
||||
async fn update_secret(&self, username: &str, secret: &str) -> DBResult<()> {
|
||||
sqlx::query!(
|
||||
"UPDATE mcaptcha_users set secret = ?
|
||||
WHERE name = ?",
|
||||
&secret,
|
||||
&username,
|
||||
)
|
||||
.execute(&self.pool)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::AccountNotFound))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// create new captcha
|
||||
async fn create_captcha(&self, username: &str, p: &CreateCaptcha) -> DBResult<()> {
|
||||
sqlx::query!(
|
||||
"INSERT INTO mcaptcha_config
|
||||
(`captcha_key`, `user_id`, `duration`, `name`)
|
||||
VALUES (?, (SELECT ID FROM mcaptcha_users WHERE name = ?), ?, ?)",
|
||||
p.key,
|
||||
username,
|
||||
p.duration as i32,
|
||||
p.description,
|
||||
)
|
||||
.execute(&self.pool)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::AccountNotFound))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Get captcha config
|
||||
async fn get_captcha_config(&self, username: &str, key: &str) -> DBResult<Captcha> {
|
||||
let captcha = sqlx::query_as!(
|
||||
InternaleCaptchaConfig,
|
||||
"SELECT `config_id`, `duration`, `name`, `captcha_key` from mcaptcha_config WHERE
|
||||
`captcha_key` = ? AND
|
||||
user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?) ",
|
||||
&key,
|
||||
&username,
|
||||
)
|
||||
.fetch_one(&self.pool)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::CaptchaNotFound))?;
|
||||
|
||||
Ok(captcha.into())
|
||||
}
|
||||
|
||||
/// Get all captchas belonging to user
|
||||
async fn get_all_user_captchas(&self, username: &str) -> DBResult<Vec<Captcha>> {
|
||||
let mut res = sqlx::query_as!(
|
||||
InternaleCaptchaConfig,
|
||||
"SELECT captcha_key, name, config_id, duration FROM mcaptcha_config WHERE
|
||||
user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?) ",
|
||||
&username,
|
||||
)
|
||||
.fetch_all(&self.pool)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::AccountNotFound))?;
|
||||
|
||||
let mut captchas = Vec::with_capacity(res.len());
|
||||
|
||||
res.drain(0..).for_each(|r| captchas.push(r.into()));
|
||||
|
||||
Ok(captchas)
|
||||
}
|
||||
|
||||
/// update captcha metadata; doesn't change captcha key
|
||||
async fn update_captcha_metadata(
|
||||
&self,
|
||||
username: &str,
|
||||
p: &CreateCaptcha,
|
||||
) -> DBResult<()> {
|
||||
sqlx::query!(
|
||||
"UPDATE mcaptcha_config SET name = ?, duration = ?
|
||||
WHERE user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?)
|
||||
AND captcha_key = ?",
|
||||
p.description,
|
||||
p.duration,
|
||||
username,
|
||||
p.key,
|
||||
)
|
||||
.execute(&self.pool)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::CaptchaNotFound))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// update captcha key; doesn't change metadata
|
||||
async fn update_captcha_key(
|
||||
&self,
|
||||
username: &str,
|
||||
old_key: &str,
|
||||
new_key: &str,
|
||||
) -> DBResult<()> {
|
||||
sqlx::query!(
|
||||
"UPDATE mcaptcha_config SET captcha_key = ?
|
||||
WHERE captcha_key = ? AND user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?)",
|
||||
new_key,
|
||||
old_key,
|
||||
username,
|
||||
)
|
||||
.execute(&self.pool)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::CaptchaNotFound))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Add levels to captcha
|
||||
async fn add_captcha_levels(
|
||||
&self,
|
||||
username: &str,
|
||||
captcha_key: &str,
|
||||
levels: &[Level],
|
||||
) -> DBResult<()> {
|
||||
use futures::future::try_join_all;
|
||||
let mut futs = Vec::with_capacity(levels.len());
|
||||
|
||||
for level in levels.iter() {
|
||||
let difficulty_factor = level.difficulty_factor as i32;
|
||||
let visitor_threshold = level.visitor_threshold as i32;
|
||||
let fut = sqlx::query!(
|
||||
"INSERT INTO mcaptcha_levels (
|
||||
difficulty_factor,
|
||||
visitor_threshold,
|
||||
config_id) VALUES (
|
||||
?, ?, (
|
||||
SELECT config_id FROM mcaptcha_config WHERE
|
||||
captcha_key = (?) AND user_id = (
|
||||
SELECT ID FROM mcaptcha_users WHERE name = ?
|
||||
)));",
|
||||
difficulty_factor,
|
||||
visitor_threshold,
|
||||
&captcha_key,
|
||||
username,
|
||||
)
|
||||
.execute(&self.pool);
|
||||
futs.push(fut);
|
||||
}
|
||||
|
||||
try_join_all(futs)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::CaptchaNotFound))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// check if captcha exists
|
||||
async fn captcha_exists(
|
||||
&self,
|
||||
username: Option<&str>,
|
||||
captcha_key: &str,
|
||||
) -> DBResult<bool> {
|
||||
// let mut exists = false;
|
||||
|
||||
#[allow(dead_code)]
|
||||
struct ConfigId {
|
||||
config_id: i32,
|
||||
}
|
||||
let res = match username {
|
||||
Some(username) => {
|
||||
sqlx::query_as!(
|
||||
ConfigId,
|
||||
"SELECT config_id FROM mcaptcha_config
|
||||
WHERE
|
||||
captcha_key = ?
|
||||
AND user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?)",
|
||||
captcha_key,
|
||||
username
|
||||
)
|
||||
.fetch_one(&self.pool)
|
||||
.await
|
||||
// if let Some(x) = x.exists {
|
||||
// exists = x;
|
||||
// };
|
||||
}
|
||||
|
||||
None => {
|
||||
sqlx::query_as!(
|
||||
ConfigId,
|
||||
"SELECT config_id from mcaptcha_config WHERE captcha_key = ?",
|
||||
&captcha_key,
|
||||
)
|
||||
.fetch_one(&self.pool)
|
||||
.await
|
||||
} //if let Some(x) = x.exists {
|
||||
// exists = x;
|
||||
//};
|
||||
};
|
||||
match res {
|
||||
Ok(_) => Ok(true),
|
||||
Err(sqlx::Error::RowNotFound) => Ok(false),
|
||||
Err(e) => Err(map_register_err(e)),
|
||||
}
|
||||
}
|
||||
|
||||
/// Delete all levels of a captcha
|
||||
async fn delete_captcha_levels(
|
||||
&self,
|
||||
username: &str,
|
||||
captcha_key: &str,
|
||||
) -> DBResult<()> {
|
||||
sqlx::query!(
|
||||
"DELETE FROM mcaptcha_levels
|
||||
WHERE config_id = (
|
||||
SELECT config_id FROM mcaptcha_config where captcha_key= (?)
|
||||
AND user_id = (
|
||||
SELECT ID from mcaptcha_users WHERE name = ?
|
||||
)
|
||||
)",
|
||||
captcha_key,
|
||||
username
|
||||
)
|
||||
.execute(&self.pool)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::CaptchaNotFound))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Delete captcha
|
||||
async fn delete_captcha(&self, username: &str, captcha_key: &str) -> DBResult<()> {
|
||||
sqlx::query!(
|
||||
"DELETE FROM mcaptcha_config where captcha_key= (?)
|
||||
AND
|
||||
user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?)",
|
||||
captcha_key,
|
||||
username,
|
||||
)
|
||||
.execute(&self.pool)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::CaptchaNotFound))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Get captcha levels
|
||||
async fn get_captcha_levels(
|
||||
&self,
|
||||
username: Option<&str>,
|
||||
captcha_key: &str,
|
||||
) -> DBResult<Vec<Level>> {
|
||||
struct I32Levels {
|
||||
difficulty_factor: i32,
|
||||
visitor_threshold: i32,
|
||||
}
|
||||
let levels = match username {
|
||||
None => sqlx::query_as!(
|
||||
I32Levels,
|
||||
"SELECT difficulty_factor, visitor_threshold FROM mcaptcha_levels WHERE
|
||||
config_id = (
|
||||
SELECT config_id FROM mcaptcha_config where captcha_key= (?)
|
||||
) ORDER BY difficulty_factor ASC;",
|
||||
captcha_key,
|
||||
)
|
||||
.fetch_all(&self.pool)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::CaptchaNotFound))?,
|
||||
|
||||
Some(username) => sqlx::query_as!(
|
||||
I32Levels,
|
||||
"SELECT difficulty_factor, visitor_threshold FROM mcaptcha_levels WHERE
|
||||
config_id = (
|
||||
SELECT config_id FROM mcaptcha_config where captcha_key= (?)
|
||||
AND user_id = (SELECT ID from mcaptcha_users WHERE name = ?)
|
||||
)
|
||||
ORDER BY difficulty_factor ASC;",
|
||||
captcha_key,
|
||||
username
|
||||
)
|
||||
.fetch_all(&self.pool)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::CaptchaNotFound))?,
|
||||
};
|
||||
|
||||
let mut new_levels = Vec::with_capacity(levels.len());
|
||||
for l in levels.iter() {
|
||||
new_levels.push(Level {
|
||||
difficulty_factor: l.difficulty_factor as u32,
|
||||
visitor_threshold: l.visitor_threshold as u32,
|
||||
});
|
||||
}
|
||||
Ok(new_levels)
|
||||
}
|
||||
|
||||
/// Get captcha's cooldown period
|
||||
async fn get_captcha_cooldown(&self, captcha_key: &str) -> DBResult<i32> {
|
||||
struct DurationResp {
|
||||
duration: i32,
|
||||
}
|
||||
|
||||
let resp = sqlx::query_as!(
|
||||
DurationResp,
|
||||
"SELECT duration FROM mcaptcha_config
|
||||
where captcha_key= ?",
|
||||
captcha_key,
|
||||
)
|
||||
.fetch_one(&self.pool)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::CaptchaNotFound))?;
|
||||
|
||||
Ok(resp.duration)
|
||||
}
|
||||
/// Add traffic configuration
|
||||
async fn add_traffic_pattern(
|
||||
&self,
|
||||
username: &str,
|
||||
captcha_key: &str,
|
||||
pattern: &TrafficPattern,
|
||||
) -> DBResult<()> {
|
||||
sqlx::query!(
|
||||
"INSERT INTO mcaptcha_sitekey_user_provided_avg_traffic (
|
||||
config_id,
|
||||
avg_traffic,
|
||||
peak_sustainable_traffic,
|
||||
broke_my_site_traffic
|
||||
) VALUES (
|
||||
(SELECT config_id FROM mcaptcha_config where captcha_key= (?)
|
||||
AND user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?)
|
||||
), ?, ?, ?)",
|
||||
//payload.avg_traffic,
|
||||
captcha_key,
|
||||
username,
|
||||
pattern.avg_traffic as i32,
|
||||
pattern.peak_sustainable_traffic as i32,
|
||||
pattern.broke_my_site_traffic.as_ref().map(|v| *v as i32),
|
||||
)
|
||||
.execute(&self.pool)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::CaptchaNotFound))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Get traffic configuration
|
||||
async fn get_traffic_pattern(
|
||||
&self,
|
||||
username: &str,
|
||||
captcha_key: &str,
|
||||
) -> DBResult<TrafficPattern> {
|
||||
struct Traffic {
|
||||
peak_sustainable_traffic: i32,
|
||||
avg_traffic: i32,
|
||||
broke_my_site_traffic: Option<i32>,
|
||||
}
|
||||
let res = sqlx::query_as!(
|
||||
Traffic,
|
||||
"SELECT
|
||||
avg_traffic,
|
||||
peak_sustainable_traffic,
|
||||
broke_my_site_traffic
|
||||
FROM
|
||||
mcaptcha_sitekey_user_provided_avg_traffic
|
||||
WHERE
|
||||
config_id = (
|
||||
SELECT
|
||||
config_id
|
||||
FROM
|
||||
mcaptcha_config
|
||||
WHERE
|
||||
captcha_key = ?
|
||||
AND user_id = (
|
||||
SELECT
|
||||
id
|
||||
FROM
|
||||
mcaptcha_users
|
||||
WHERE
|
||||
NAME = ?
|
||||
)
|
||||
)
|
||||
",
|
||||
captcha_key,
|
||||
username
|
||||
)
|
||||
.fetch_one(&self.pool)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::TrafficPatternNotFound))?;
|
||||
Ok(TrafficPattern {
|
||||
broke_my_site_traffic: res.broke_my_site_traffic.as_ref().map(|v| *v as u32),
|
||||
avg_traffic: res.avg_traffic as u32,
|
||||
peak_sustainable_traffic: res.peak_sustainable_traffic as u32,
|
||||
})
|
||||
}
|
||||
|
||||
/// Delete traffic configuration
|
||||
async fn delete_traffic_pattern(
|
||||
&self,
|
||||
username: &str,
|
||||
captcha_key: &str,
|
||||
) -> DBResult<()> {
|
||||
sqlx::query!(
|
||||
"DELETE FROM mcaptcha_sitekey_user_provided_avg_traffic
|
||||
WHERE config_id = (
|
||||
SELECT config_id
|
||||
FROM
|
||||
mcaptcha_config
|
||||
WHERE
|
||||
captcha_key = ?
|
||||
AND
|
||||
user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?)
|
||||
);",
|
||||
captcha_key,
|
||||
username,
|
||||
)
|
||||
.execute(&self.pool)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::TrafficPatternNotFound))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// create new notification
|
||||
async fn create_notification(&self, p: &AddNotification) -> DBResult<()> {
|
||||
let now = now_unix_time_stamp();
|
||||
sqlx::query!(
|
||||
"INSERT INTO mcaptcha_notifications (
|
||||
heading, message, tx, rx, received)
|
||||
VALUES (
|
||||
?, ?,
|
||||
(SELECT ID FROM mcaptcha_users WHERE name = ?),
|
||||
(SELECT ID FROM mcaptcha_users WHERE name = ?),
|
||||
?
|
||||
);",
|
||||
p.heading,
|
||||
p.message,
|
||||
p.from,
|
||||
p.to,
|
||||
now
|
||||
)
|
||||
.execute(&self.pool)
|
||||
.await
|
||||
.map_err(map_register_err)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// get all unread notifications
|
||||
async fn get_all_unread_notifications(
|
||||
&self,
|
||||
username: &str,
|
||||
) -> DBResult<Vec<Notification>> {
|
||||
let mut inner_notifications = sqlx::query_file_as!(
|
||||
InnerNotification,
|
||||
"./src/get_all_unread_notifications.sql",
|
||||
&username
|
||||
)
|
||||
.fetch_all(&self.pool)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::AccountNotFound))?;
|
||||
|
||||
let mut notifications = Vec::with_capacity(inner_notifications.len());
|
||||
|
||||
inner_notifications
|
||||
.drain(0..)
|
||||
.for_each(|n| notifications.push(n.into()));
|
||||
|
||||
Ok(notifications)
|
||||
}
|
||||
|
||||
/// mark a notification read
|
||||
async fn mark_notification_read(&self, username: &str, id: i32) -> DBResult<()> {
|
||||
sqlx::query_file_as!(
|
||||
Notification,
|
||||
"./src/mark_notification_read.sql",
|
||||
id,
|
||||
&username
|
||||
)
|
||||
.execute(&self.pool)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::NotificationNotFound))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// record PoWConfig fetches
|
||||
async fn record_fetch(&self, key: &str) -> DBResult<()> {
|
||||
let now = now_unix_time_stamp();
|
||||
let _ = sqlx::query!(
|
||||
"INSERT INTO mcaptcha_pow_fetched_stats
|
||||
(config_id, time) VALUES ((SELECT config_id FROM mcaptcha_config where captcha_key= ?), ?)",
|
||||
key,
|
||||
&now,
|
||||
)
|
||||
.execute(&self.pool)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::CaptchaNotFound))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// record PoWConfig solves
|
||||
async fn record_solve(&self, key: &str) -> DBResult<()> {
|
||||
let now = OffsetDateTime::now_utc();
|
||||
let _ = sqlx::query!(
|
||||
"INSERT INTO mcaptcha_pow_solved_stats
|
||||
(config_id, time) VALUES ((SELECT config_id FROM mcaptcha_config where captcha_key= ?), ?)",
|
||||
key,
|
||||
&now,
|
||||
)
|
||||
.execute(&self.pool)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::CaptchaNotFound))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// record PoWConfig confirms
|
||||
async fn record_confirm(&self, key: &str) -> DBResult<()> {
|
||||
let now = now_unix_time_stamp();
|
||||
let _ = sqlx::query!(
|
||||
"INSERT INTO mcaptcha_pow_confirmed_stats
|
||||
(config_id, time) VALUES ((SELECT config_id FROM mcaptcha_config where captcha_key= ?), ?)",
|
||||
key,
|
||||
&now
|
||||
)
|
||||
.execute(&self.pool)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::CaptchaNotFound))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// fetch PoWConfig fetches
|
||||
async fn fetch_config_fetched(&self, user: &str, key: &str) -> DBResult<Vec<i64>> {
|
||||
let records = sqlx::query_as!(
|
||||
Date,
|
||||
"SELECT time FROM mcaptcha_pow_fetched_stats
|
||||
WHERE
|
||||
config_id = (
|
||||
SELECT
|
||||
config_id FROM mcaptcha_config
|
||||
WHERE
|
||||
captcha_key = ?
|
||||
AND
|
||||
user_id = (
|
||||
SELECT
|
||||
ID FROM mcaptcha_users WHERE name = ?))
|
||||
ORDER BY time DESC",
|
||||
&key,
|
||||
&user,
|
||||
)
|
||||
.fetch_all(&self.pool)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::CaptchaNotFound))?;
|
||||
|
||||
Ok(Date::dates_to_unix(records))
|
||||
}
|
||||
|
||||
/// fetch PoWConfig solves
|
||||
async fn fetch_solve(&self, user: &str, key: &str) -> DBResult<Vec<i64>> {
|
||||
let records = sqlx::query_as!(
|
||||
Date,
|
||||
"SELECT time FROM mcaptcha_pow_solved_stats
|
||||
WHERE config_id = (
|
||||
SELECT config_id FROM mcaptcha_config
|
||||
WHERE
|
||||
captcha_key = ?
|
||||
AND
|
||||
user_id = (
|
||||
SELECT
|
||||
ID FROM mcaptcha_users WHERE name = ?))
|
||||
ORDER BY time DESC",
|
||||
&key,
|
||||
&user
|
||||
)
|
||||
.fetch_all(&self.pool)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::CaptchaNotFound))?;
|
||||
|
||||
Ok(Date::dates_to_unix(records))
|
||||
}
|
||||
|
||||
/// fetch PoWConfig confirms
|
||||
async fn fetch_confirm(&self, user: &str, key: &str) -> DBResult<Vec<i64>> {
|
||||
let records = sqlx::query_as!(
|
||||
Date,
|
||||
"SELECT time FROM mcaptcha_pow_confirmed_stats
|
||||
WHERE
|
||||
config_id = (
|
||||
SELECT config_id FROM mcaptcha_config
|
||||
WHERE
|
||||
captcha_key = ?
|
||||
AND
|
||||
user_id = (
|
||||
SELECT
|
||||
ID FROM mcaptcha_users WHERE name = ?))
|
||||
ORDER BY time DESC",
|
||||
&key,
|
||||
&user
|
||||
)
|
||||
.fetch_all(&self.pool)
|
||||
.await
|
||||
.map_err(|e| map_row_not_found_err(e, DBError::CaptchaNotFound))?;
|
||||
|
||||
Ok(Date::dates_to_unix(records))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct Date {
|
||||
time: OffsetDateTime,
|
||||
}
|
||||
|
||||
impl Date {
|
||||
fn dates_to_unix(mut d: Vec<Self>) -> Vec<i64> {
|
||||
let mut dates = Vec::with_capacity(d.len());
|
||||
d.drain(0..)
|
||||
.for_each(|x| dates.push(x.time.unix_timestamp()));
|
||||
dates
|
||||
}
|
||||
}
|
||||
|
||||
fn now_unix_time_stamp() -> OffsetDateTime {
|
||||
OffsetDateTime::now_utc()
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
/// Represents notification
|
||||
pub struct InnerNotification {
|
||||
/// receiver name of the notification
|
||||
pub name: String,
|
||||
/// heading of the notification
|
||||
pub heading: String,
|
||||
/// message of the notification
|
||||
pub message: String,
|
||||
/// when notification was received
|
||||
pub received: OffsetDateTime,
|
||||
/// db assigned ID of the notification
|
||||
pub id: i32,
|
||||
}
|
||||
|
||||
impl From<InnerNotification> for Notification {
|
||||
fn from(n: InnerNotification) -> Self {
|
||||
Notification {
|
||||
name: Some(n.name),
|
||||
heading: Some(n.heading),
|
||||
message: Some(n.message),
|
||||
received: Some(n.received.unix_timestamp()),
|
||||
id: Some(n.id),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct InternaleCaptchaConfig {
|
||||
config_id: i32,
|
||||
duration: i32,
|
||||
name: String,
|
||||
captcha_key: String,
|
||||
}
|
||||
|
||||
impl From<InternaleCaptchaConfig> for Captcha {
|
||||
fn from(i: InternaleCaptchaConfig) -> Self {
|
||||
Self {
|
||||
config_id: i.config_id,
|
||||
duration: i.duration,
|
||||
description: i.name,
|
||||
key: i.captcha_key,
|
||||
}
|
||||
}
|
||||
}
|
||||
14
db/db-sqlx-maria/src/mark_notification_read.sql
Normal file
14
db/db-sqlx-maria/src/mark_notification_read.sql
Normal file
@@ -0,0 +1,14 @@
|
||||
-- mark a notification as read
|
||||
UPDATE mcaptcha_notifications
|
||||
SET read_notification = TRUE
|
||||
WHERE
|
||||
mcaptcha_notifications.id = ?
|
||||
AND
|
||||
mcaptcha_notifications.rx = (
|
||||
SELECT
|
||||
id
|
||||
FROM
|
||||
mcaptcha_users
|
||||
WHERE
|
||||
name = ?
|
||||
);
|
||||
92
db/db-sqlx-maria/src/tests.rs
Normal file
92
db/db-sqlx-maria/src/tests.rs
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#![cfg(test)]
|
||||
|
||||
use sqlx::mysql::MySqlPoolOptions;
|
||||
use std::env;
|
||||
|
||||
use crate::*;
|
||||
|
||||
use db_core::tests::*;
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn everyting_works() {
|
||||
const EMAIL: &str = "mariadbuser@foo.com";
|
||||
const NAME: &str = "mariadbuser";
|
||||
const PASSWORD: &str = "pasdfasdfasdfadf";
|
||||
const SECRET1: &str = "mariadbsecret1";
|
||||
// captcha config
|
||||
const CAPTCHA_SECRET: &str = "mariadbcaptchasecret";
|
||||
const CAPTCHA_DESCRIPTION: &str = "mariadbcaptchadescription";
|
||||
const CAPTCHA_DURATION: i32 = 30;
|
||||
// notification config
|
||||
const HEADING: &str = "testing notifications get db mariadb";
|
||||
const MESSAGE: &str = "testing notifications get message db mariadb";
|
||||
|
||||
// easy traffic pattern
|
||||
const TRAFFIC_PATTERN: TrafficPattern = TrafficPattern {
|
||||
avg_traffic: 500,
|
||||
peak_sustainable_traffic: 5_000,
|
||||
broke_my_site_traffic: Some(10_000),
|
||||
};
|
||||
|
||||
const LEVELS: [Level; 3] = [
|
||||
Level {
|
||||
difficulty_factor: 1,
|
||||
visitor_threshold: 1,
|
||||
},
|
||||
Level {
|
||||
difficulty_factor: 2,
|
||||
visitor_threshold: 2,
|
||||
},
|
||||
Level {
|
||||
difficulty_factor: 3,
|
||||
visitor_threshold: 3,
|
||||
},
|
||||
];
|
||||
|
||||
const ADD_NOTIFICATION: AddNotification = AddNotification {
|
||||
from: NAME,
|
||||
to: NAME,
|
||||
message: MESSAGE,
|
||||
heading: HEADING,
|
||||
};
|
||||
|
||||
let url = env::var("MARIA_DATABASE_URL").unwrap();
|
||||
let pool_options = MySqlPoolOptions::new().max_connections(2);
|
||||
let connection_options = ConnectionOptions::Fresh(Fresh {
|
||||
pool_options,
|
||||
url,
|
||||
disable_logging: false,
|
||||
});
|
||||
let db = connection_options.connect().await.unwrap();
|
||||
|
||||
db.migrate().await.unwrap();
|
||||
let p = Register {
|
||||
username: NAME,
|
||||
email: Some(EMAIL),
|
||||
hash: PASSWORD,
|
||||
secret: SECRET1,
|
||||
};
|
||||
|
||||
let c = CreateCaptcha {
|
||||
duration: CAPTCHA_DURATION,
|
||||
key: CAPTCHA_SECRET,
|
||||
description: CAPTCHA_DESCRIPTION,
|
||||
};
|
||||
database_works(&db, &p, &c, &LEVELS, &TRAFFIC_PATTERN, &ADD_NOTIFICATION).await;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"query": "SELECT name, password FROM mcaptcha_users WHERE email = ?",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": {
|
||||
"bits": 4101
|
||||
},
|
||||
"char_set": 224,
|
||||
"max_size": 400
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "password",
|
||||
"type_info": {
|
||||
"type": "Blob",
|
||||
"flags": {
|
||||
"bits": 4113
|
||||
},
|
||||
"char_set": 224,
|
||||
"max_size": 262140
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "ed943cbf7e16536d81010255ce2f5beb207b2b9d44cb859fa9f2233405b80ae0"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "INSERT INTO mcaptcha_users \n (name , password, secret) VALUES (?, ?, ?)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 3
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "5d5a106981345e9f62bc2239c00cdc683d3aaaa820d63da300dc51e3f6f363d3"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "INSERT INTO mcaptcha_notifications (\n heading, message, tx, rx, received)\n VALUES (\n ?, ?,\n (SELECT ID FROM mcaptcha_users WHERE name = ?),\n (SELECT ID FROM mcaptcha_users WHERE name = ?),\n ?\n );",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 5
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "89386c46668a2653a54687e65958af5cf7a8da268339a1f5a379ede47b3c6d2a"
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"query": "SELECT name, password FROM mcaptcha_users WHERE name = ?",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": {
|
||||
"bits": 4101
|
||||
},
|
||||
"char_set": 224,
|
||||
"max_size": 400
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "password",
|
||||
"type_info": {
|
||||
"type": "Blob",
|
||||
"flags": {
|
||||
"bits": 4113
|
||||
},
|
||||
"char_set": 224,
|
||||
"max_size": 262140
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "dd5ff10b88fa6f374e105b6bed9e34e0870ac8dd7ce36dfb09d13a1b7005b2eb"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "UPDATE mcaptcha_config SET captcha_key = ? \n WHERE captcha_key = ? AND user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 3
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "8e6026abf7c0e8ab90ee8eb7ada9f66962ab6999d3127944b058d6f96346e72f"
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"query": "SELECT captcha_key, name, config_id, duration FROM mcaptcha_config WHERE\n user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?) ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "captcha_key",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": {
|
||||
"bits": 4101
|
||||
},
|
||||
"char_set": 224,
|
||||
"max_size": 400
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": {
|
||||
"bits": 4097
|
||||
},
|
||||
"char_set": 224,
|
||||
"max_size": 400
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "config_id",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": {
|
||||
"bits": 515
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 11
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "duration",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": {
|
||||
"bits": 1
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 11
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "3812693a9ae4402d900bcbf680981e6194073bd1937af11a77daa3776fb4c873"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "UPDATE mcaptcha_users set email = ?\n WHERE name = ?",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "9cb416de904872d66af90baa0024f382ce6f8344464c607fe6e6c2572816dfc2"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "UPDATE mcaptcha_config SET captcha_key = ? \n WHERE captcha_key = ? AND user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 3
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "8e6026abf7c0e8ab90ee8eb7ada9f66962ab6999d3127944b058d6f96346e72f"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "DELETE FROM mcaptcha_sitekey_user_provided_avg_traffic\n WHERE config_id = (\n SELECT config_id \n FROM \n mcaptcha_config \n WHERE\n captcha_key = ?\n AND \n user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?)\n );",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "fc717ff0827ccfaa1cc61a71cc7f71c348ebb03d35895c54b011c03121ad2385"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "UPDATE mcaptcha_users set password = ?\n WHERE name = ?",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "cad5b403470f26c565e74a1dca19b7dee066141dec0f708070067e34d5bf72cc"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"query": "SELECT config_id FROM mcaptcha_config\n WHERE\n captcha_key = ? \n AND user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?)",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "config_id",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": {
|
||||
"bits": 515
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 11
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": [
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "66ec7df10484f8e0206f3c97afc9136021589556c38dbbed341d6574487f79f2"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "DELETE FROM mcaptcha_levels \n WHERE config_id = (\n SELECT config_id FROM mcaptcha_config where captcha_key= (?) \n AND user_id = (\n SELECT ID from mcaptcha_users WHERE name = ?\n )\n )",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "7894dda54cd65559fe3b81bab7df8cc848e21ed5c7f5e88951bf1c98c78ed820"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"query": "SELECT duration FROM mcaptcha_config \n where captcha_key= ?",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "duration",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": {
|
||||
"bits": 1
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 11
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "8acbf84d4801e86221d8f6324ae50488a0986182d66b20ad414bce4e2ac18eca"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "UPDATE mcaptcha_users set name = ?\n WHERE name = ?",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "676a9f1761c3b63cf16d7d4dd6261507cc7707feb32d458f4b946ed9caa53721"
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"query": "SELECT `config_id`, `duration`, `name`, `captcha_key` from mcaptcha_config WHERE\n `captcha_key` = ? AND\n user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?) ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "config_id",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": {
|
||||
"bits": 515
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 11
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "duration",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": {
|
||||
"bits": 1
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 11
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": {
|
||||
"bits": 4097
|
||||
},
|
||||
"char_set": 224,
|
||||
"max_size": 400
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "captcha_key",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": {
|
||||
"bits": 4101
|
||||
},
|
||||
"char_set": 224,
|
||||
"max_size": 400
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "9c435148ed5655e79dd1e73e3566ce23b7c6d38edcedbb988c95813c5da893ed"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "DELETE FROM mcaptcha_config where captcha_key= (?)\n AND\n user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "b95e5a60a202cb646d5e76df8c7395e4bf881a6dd14e28e6f2e8b93e0536b331"
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"query": "SELECT difficulty_factor, visitor_threshold FROM mcaptcha_levels WHERE\n config_id = (\n SELECT config_id FROM mcaptcha_config where captcha_key= (?)\n AND user_id = (SELECT ID from mcaptcha_users WHERE name = ?)\n )\n ORDER BY difficulty_factor ASC;",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "difficulty_factor",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": {
|
||||
"bits": 4097
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 11
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "visitor_threshold",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": {
|
||||
"bits": 4097
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 11
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "df6de3b96afcfb7f364f98954995e506b19e80e7f88204405d970c360ad5e1a0"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "INSERT INTO mcaptcha_config\n (`captcha_key`, `user_id`, `duration`, `name`)\n VALUES (?, (SELECT ID FROM mcaptcha_users WHERE name = ?), ?, ?)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 4
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "d05b84966f4e70c53789221f961bf3637f404f3ba45e880115e97ed1ba5a2809"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "INSERT INTO mcaptcha_levels (\n difficulty_factor, \n visitor_threshold,\n config_id) VALUES (\n ?, ?, (\n SELECT config_id FROM mcaptcha_config WHERE\n captcha_key = (?) AND user_id = (\n SELECT ID FROM mcaptcha_users WHERE name = ?\n )));",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 4
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "74d68a86f852d3d85957e94ed04e8acd8e6144744f7b13e383ebcb2bcf3360ae"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "UPDATE mcaptcha_config SET name = ?, duration = ?\n WHERE user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?)\n AND captcha_key = ?",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 4
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "3a8381eb0f0542a492d9dd51368e769e2b313e0576a1873e5c7630011e463daf"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"query": "SELECT email FROM mcaptcha_users WHERE name = ?",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "email",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": {
|
||||
"bits": 4
|
||||
},
|
||||
"char_set": 224,
|
||||
"max_size": 400
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
true
|
||||
]
|
||||
},
|
||||
"hash": "413ea53cea8b8f114fc009bad527b054a68a94477dfcc50d860d45bbd864d4f1"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "UPDATE mcaptcha_users set secret = ?\n WHERE name = ?",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "7838ade4a48068e25c6f117ee8e38f088b867b1ab08a7dd0269b76891266ace6"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"query": "SELECT name from mcaptcha_users WHERE email = ?",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": {
|
||||
"bits": 4101
|
||||
},
|
||||
"char_set": 224,
|
||||
"max_size": 400
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "caa1638ee510ef62b86817e5d2baeaca8dfa432c23d7630c0e70737211a4680b"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "UPDATE mcaptcha_users set email = ?\n WHERE name = ?",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "9cb416de904872d66af90baa0024f382ce6f8344464c607fe6e6c2572816dfc2"
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"query": "SELECT difficulty_factor, visitor_threshold FROM mcaptcha_levels WHERE\n config_id = (\n SELECT config_id FROM mcaptcha_config where captcha_key= (?)\n ) ORDER BY difficulty_factor ASC;",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "difficulty_factor",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": {
|
||||
"bits": 4097
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 11
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "visitor_threshold",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": {
|
||||
"bits": 4097
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 11
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "6d43e6ceb54a0ff8a803bd96dd9134b15da01d48776ac0cf3d66a2997dadce5e"
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
{
|
||||
"query": "-- gets all unread notifications a user has\nSELECT \n mcaptcha_notifications.id,\n mcaptcha_notifications.heading,\n mcaptcha_notifications.message,\n mcaptcha_notifications.received,\n mcaptcha_users.name\nFROM\n mcaptcha_notifications \nINNER JOIN \n mcaptcha_users \nON \n mcaptcha_notifications.tx = mcaptcha_users.id\nWHERE \n mcaptcha_notifications.rx = (\n SELECT \n id \n FROM \n mcaptcha_users\n WHERE\n name = ?\n )\nAND \n mcaptcha_notifications.read_notification IS NULL;\n",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": {
|
||||
"bits": 515
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 11
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "heading",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": {
|
||||
"bits": 4097
|
||||
},
|
||||
"char_set": 224,
|
||||
"max_size": 400
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "message",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": {
|
||||
"bits": 4097
|
||||
},
|
||||
"char_set": 224,
|
||||
"max_size": 1000
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "received",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": {
|
||||
"bits": 1185
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": {
|
||||
"bits": 4101
|
||||
},
|
||||
"char_set": 224,
|
||||
"max_size": 400
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "b9b0c63380bc0dfdea8aae092dcefceb316fe94667d74f53d53063810cdd2ba8"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "INSERT INTO mcaptcha_notifications (\n heading, message, tx, rx, received)\n VALUES (\n ?, ?,\n (SELECT ID FROM mcaptcha_users WHERE name = ?),\n (SELECT ID FROM mcaptcha_users WHERE name = ?),\n ?\n );",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 5
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "89386c46668a2653a54687e65958af5cf7a8da268339a1f5a379ede47b3c6d2a"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "DELETE FROM mcaptcha_users WHERE name = (?)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "6d1b6e5e58ca2ba285cab7b050bbdc43de1f3e46cf7d420bc95c124a1c7c9d1f"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "INSERT INTO mcaptcha_pow_confirmed_stats \n (config_id, time) VALUES ((SELECT config_id FROM mcaptcha_config where captcha_key= ?), ?)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "34b29417f9ff3f4d5987df0ce81023b1985eb84e560602b36182f55de6cd9d83"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "INSERT INTO mcaptcha_pow_solved_stats \n (config_id, time) VALUES ((SELECT config_id FROM mcaptcha_config where captcha_key= ?), ?)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "e2b0b85f2afac1cbca43ce684641bf75ef070e44ce3d00404fc6151d2f4d7bcf"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "-- mark a notification as read\nUPDATE mcaptcha_notifications\n SET read_notification = TRUE\nWHERE \n mcaptcha_notifications.id = ?\nAND\n mcaptcha_notifications.rx = (\n SELECT\n id\n FROM\n mcaptcha_users\n WHERE\n name = ?\n );\n",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "cf333541509213f11a9bf7119dcb3289bb77abf1482fc1d47e7f5bb27bdc8d97"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "INSERT INTO mcaptcha_pow_fetched_stats \n (config_id, time) VALUES ((SELECT config_id FROM mcaptcha_config where captcha_key= ?), ?)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "598a8202942771eff460faa6f09bd3fb1fc910d5fab7edb07c49dadbbaeb1cb8"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "INSERT INTO mcaptcha_sitekey_user_provided_avg_traffic (\n config_id,\n avg_traffic,\n peak_sustainable_traffic,\n broke_my_site_traffic\n ) VALUES ( \n (SELECT config_id FROM mcaptcha_config where captcha_key= (?)\n AND user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?)\n ), ?, ?, ?)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 5
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "22e697114c3ed5b0156cdceab11a398f1ef3a804f482e1cd948bc615ef95fc92"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"query": "SELECT email FROM mcaptcha_users WHERE name = ?",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "email",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": {
|
||||
"bits": 4
|
||||
},
|
||||
"char_set": 224,
|
||||
"max_size": 400
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
true
|
||||
]
|
||||
},
|
||||
"hash": "413ea53cea8b8f114fc009bad527b054a68a94477dfcc50d860d45bbd864d4f1"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"query": "SELECT duration FROM mcaptcha_config \n where captcha_key= ?",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "duration",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": {
|
||||
"bits": 1
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 11
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "8acbf84d4801e86221d8f6324ae50488a0986182d66b20ad414bce4e2ac18eca"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"query": "SELECT time FROM mcaptcha_pow_fetched_stats\n WHERE \n config_id = (\n SELECT \n config_id FROM mcaptcha_config \n WHERE \n captcha_key = ?\n AND\n user_id = (\n SELECT \n ID FROM mcaptcha_users WHERE name = ?))\n ORDER BY time DESC",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "time",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": {
|
||||
"bits": 1185
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": [
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "daac5e937aeac2f106eb89154b431fa8bd1bd7baa95e51704fdcdf50bd970a1d"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"query": "SELECT secret FROM mcaptcha_users WHERE name = ?",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "secret",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": {
|
||||
"bits": 4101
|
||||
},
|
||||
"char_set": 224,
|
||||
"max_size": 200
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "dd9b4dec39405ff19af21faabb6a7c3bb3207e7e785fe15357146b88c6c27f01"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "insert into mcaptcha_users \n (name , password, email, secret) values (?, ?, ?, ?)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 4
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "8ec8bbde0c02a99f74d12e6778f123a973283e6d56b6861b30f559768617848a"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "INSERT INTO mcaptcha_pow_fetched_stats \n (config_id, time) VALUES ((SELECT config_id FROM mcaptcha_config where captcha_key= ?), ?)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "598a8202942771eff460faa6f09bd3fb1fc910d5fab7edb07c49dadbbaeb1cb8"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "DELETE FROM mcaptcha_levels \n WHERE config_id = (\n SELECT config_id FROM mcaptcha_config where captcha_key= (?) \n AND user_id = (\n SELECT ID from mcaptcha_users WHERE name = ?\n )\n )",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "7894dda54cd65559fe3b81bab7df8cc848e21ed5c7f5e88951bf1c98c78ed820"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "UPDATE mcaptcha_users set password = ?\n WHERE name = ?",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "cad5b403470f26c565e74a1dca19b7dee066141dec0f708070067e34d5bf72cc"
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"query": "SELECT difficulty_factor, visitor_threshold FROM mcaptcha_levels WHERE\n config_id = (\n SELECT config_id FROM mcaptcha_config where captcha_key= (?)\n AND user_id = (SELECT ID from mcaptcha_users WHERE name = ?)\n )\n ORDER BY difficulty_factor ASC;",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "difficulty_factor",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": {
|
||||
"bits": 4097
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 11
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "visitor_threshold",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": {
|
||||
"bits": 4097
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 11
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "df6de3b96afcfb7f364f98954995e506b19e80e7f88204405d970c360ad5e1a0"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "UPDATE mcaptcha_users set secret = ?\n WHERE name = ?",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "7838ade4a48068e25c6f117ee8e38f088b867b1ab08a7dd0269b76891266ace6"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"query": "SELECT config_id from mcaptcha_config WHERE captcha_key = ?",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "config_id",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": {
|
||||
"bits": 515
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 11
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "a89c066db044cddfdebee6a0fd0d80a5a26dcb7ecc00a9899f5634b72ea0a952"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"query": "SELECT config_id FROM mcaptcha_config\n WHERE\n captcha_key = ? \n AND user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?)",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "config_id",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": {
|
||||
"bits": 515
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 11
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": [
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "66ec7df10484f8e0206f3c97afc9136021589556c38dbbed341d6574487f79f2"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "INSERT INTO mcaptcha_pow_solved_stats \n (config_id, time) VALUES ((SELECT config_id FROM mcaptcha_config where captcha_key= ?), ?)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "e2b0b85f2afac1cbca43ce684641bf75ef070e44ce3d00404fc6151d2f4d7bcf"
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"query": "SELECT name, password FROM mcaptcha_users WHERE name = ?",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": {
|
||||
"bits": 4101
|
||||
},
|
||||
"char_set": 224,
|
||||
"max_size": 400
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "password",
|
||||
"type_info": {
|
||||
"type": "Blob",
|
||||
"flags": {
|
||||
"bits": 4113
|
||||
},
|
||||
"char_set": 224,
|
||||
"max_size": 262140
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "dd5ff10b88fa6f374e105b6bed9e34e0870ac8dd7ce36dfb09d13a1b7005b2eb"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "INSERT INTO mcaptcha_users \n (name , password, secret) VALUES (?, ?, ?)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 3
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "5d5a106981345e9f62bc2239c00cdc683d3aaaa820d63da300dc51e3f6f363d3"
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"query": "SELECT name, password FROM mcaptcha_users WHERE email = ?",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": {
|
||||
"bits": 4101
|
||||
},
|
||||
"char_set": 224,
|
||||
"max_size": 400
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "password",
|
||||
"type_info": {
|
||||
"type": "Blob",
|
||||
"flags": {
|
||||
"bits": 4113
|
||||
},
|
||||
"char_set": 224,
|
||||
"max_size": 262140
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "ed943cbf7e16536d81010255ce2f5beb207b2b9d44cb859fa9f2233405b80ae0"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"query": "SELECT name from mcaptcha_users WHERE email = ?",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": {
|
||||
"bits": 4101
|
||||
},
|
||||
"char_set": 224,
|
||||
"max_size": 400
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "caa1638ee510ef62b86817e5d2baeaca8dfa432c23d7630c0e70737211a4680b"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"query": "SELECT time FROM mcaptcha_pow_confirmed_stats \n WHERE \n config_id = (\n SELECT config_id FROM mcaptcha_config \n WHERE \n captcha_key = ?\n AND\n user_id = (\n SELECT \n ID FROM mcaptcha_users WHERE name = ?))\n ORDER BY time DESC",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "time",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": {
|
||||
"bits": 1185
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": [
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "1367dceb151a766a901b5dd771d0b75d0bc61d2fef17a94a90c8ffa0065e2c44"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "INSERT INTO mcaptcha_levels (\n difficulty_factor, \n visitor_threshold,\n config_id) VALUES (\n ?, ?, (\n SELECT config_id FROM mcaptcha_config WHERE\n captcha_key = (?) AND user_id = (\n SELECT ID FROM mcaptcha_users WHERE name = ?\n )));",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 4
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "74d68a86f852d3d85957e94ed04e8acd8e6144744f7b13e383ebcb2bcf3360ae"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"query": "SELECT config_id from mcaptcha_config WHERE captcha_key = ?",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "config_id",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": {
|
||||
"bits": 515
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 11
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "a89c066db044cddfdebee6a0fd0d80a5a26dcb7ecc00a9899f5634b72ea0a952"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"query": "SELECT name from mcaptcha_users WHERE name = ?",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": {
|
||||
"bits": 4101
|
||||
},
|
||||
"char_set": 224,
|
||||
"max_size": 400
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "e6569a6064d0e07abea4c0bd4686cdfdaac64f0109ac40efaed06a744a2eaf5e"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"query": "SELECT config_id from mcaptcha_config WHERE captcha_key = ?",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "config_id",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": {
|
||||
"bits": 515
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 11
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "a89c066db044cddfdebee6a0fd0d80a5a26dcb7ecc00a9899f5634b72ea0a952"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "DELETE FROM mcaptcha_sitekey_user_provided_avg_traffic\n WHERE config_id = (\n SELECT config_id \n FROM \n mcaptcha_config \n WHERE\n captcha_key = ?\n AND \n user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?)\n );",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "fc717ff0827ccfaa1cc61a71cc7f71c348ebb03d35895c54b011c03121ad2385"
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
{
|
||||
"query": "-- gets all unread notifications a user has\nSELECT \n mcaptcha_notifications.id,\n mcaptcha_notifications.heading,\n mcaptcha_notifications.message,\n mcaptcha_notifications.received,\n mcaptcha_users.name\nFROM\n mcaptcha_notifications \nINNER JOIN \n mcaptcha_users \nON \n mcaptcha_notifications.tx = mcaptcha_users.id\nWHERE \n mcaptcha_notifications.rx = (\n SELECT \n id \n FROM \n mcaptcha_users\n WHERE\n name = ?\n )\nAND \n mcaptcha_notifications.read_notification IS NULL;\n",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": {
|
||||
"bits": 515
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 11
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "heading",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": {
|
||||
"bits": 4097
|
||||
},
|
||||
"char_set": 224,
|
||||
"max_size": 400
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "message",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": {
|
||||
"bits": 4097
|
||||
},
|
||||
"char_set": 224,
|
||||
"max_size": 1000
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "received",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": {
|
||||
"bits": 1185
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": {
|
||||
"bits": 4101
|
||||
},
|
||||
"char_set": 224,
|
||||
"max_size": 400
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "b9b0c63380bc0dfdea8aae092dcefceb316fe94667d74f53d53063810cdd2ba8"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"query": "SELECT secret FROM mcaptcha_users WHERE name = ?",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "secret",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": {
|
||||
"bits": 4101
|
||||
},
|
||||
"char_set": 224,
|
||||
"max_size": 200
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "dd9b4dec39405ff19af21faabb6a7c3bb3207e7e785fe15357146b88c6c27f01"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"query": "SELECT name from mcaptcha_users WHERE name = ?",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": {
|
||||
"bits": 4101
|
||||
},
|
||||
"char_set": 224,
|
||||
"max_size": 400
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "e6569a6064d0e07abea4c0bd4686cdfdaac64f0109ac40efaed06a744a2eaf5e"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "DELETE FROM mcaptcha_users WHERE name = (?)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "6d1b6e5e58ca2ba285cab7b050bbdc43de1f3e46cf7d420bc95c124a1c7c9d1f"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "DELETE FROM mcaptcha_config where captcha_key= (?)\n AND\n user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "b95e5a60a202cb646d5e76df8c7395e4bf881a6dd14e28e6f2e8b93e0536b331"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"query": "SELECT time FROM mcaptcha_pow_solved_stats \n WHERE config_id = (\n SELECT config_id FROM mcaptcha_config \n WHERE \n captcha_key = ?\n AND\n user_id = (\n SELECT \n ID FROM mcaptcha_users WHERE name = ?)) \n ORDER BY time DESC",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "time",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": {
|
||||
"bits": 1185
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": [
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "d4b92e8099cd29cfdb99aadeeada739bb6858667fc65f528ec484e98a9da21bc"
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"query": "SELECT \n avg_traffic, \n peak_sustainable_traffic, \n broke_my_site_traffic \n FROM \n mcaptcha_sitekey_user_provided_avg_traffic \n WHERE \n config_id = (\n SELECT \n config_id \n FROM \n mcaptcha_config \n WHERE \n captcha_key = ? \n AND user_id = (\n SELECT \n id \n FROM \n mcaptcha_users \n WHERE \n NAME = ?\n )\n )\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "avg_traffic",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": {
|
||||
"bits": 4097
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 11
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "peak_sustainable_traffic",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": {
|
||||
"bits": 4097
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 11
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "broke_my_site_traffic",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": {
|
||||
"bits": 0
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 11
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
true
|
||||
]
|
||||
},
|
||||
"hash": "e91116ebce127833488130cf1060e0817e5677f39588632452b8d621688c405a"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "INSERT INTO mcaptcha_pow_confirmed_stats \n (config_id, time) VALUES ((SELECT config_id FROM mcaptcha_config where captcha_key= ?), ?)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "34b29417f9ff3f4d5987df0ce81023b1985eb84e560602b36182f55de6cd9d83"
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"query": "SELECT `config_id`, `duration`, `name`, `captcha_key` from mcaptcha_config WHERE\n `captcha_key` = ? AND\n user_id = (SELECT ID FROM mcaptcha_users WHERE name = ?) ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "config_id",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": {
|
||||
"bits": 515
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 11
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "duration",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": {
|
||||
"bits": 1
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 11
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": {
|
||||
"bits": 4097
|
||||
},
|
||||
"char_set": 224,
|
||||
"max_size": 400
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "captcha_key",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": {
|
||||
"bits": 4101
|
||||
},
|
||||
"char_set": 224,
|
||||
"max_size": 400
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "9c435148ed5655e79dd1e73e3566ce23b7c6d38edcedbb988c95813c5da893ed"
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"query": "SELECT \n avg_traffic, \n peak_sustainable_traffic, \n broke_my_site_traffic \n FROM \n mcaptcha_sitekey_user_provided_avg_traffic \n WHERE \n config_id = (\n SELECT \n config_id \n FROM \n mcaptcha_config \n WHERE \n captcha_key = ? \n AND user_id = (\n SELECT \n id \n FROM \n mcaptcha_users \n WHERE \n NAME = ?\n )\n )\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "avg_traffic",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": {
|
||||
"bits": 4097
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 11
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "peak_sustainable_traffic",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": {
|
||||
"bits": 4097
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 11
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "broke_my_site_traffic",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": {
|
||||
"bits": 0
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 11
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
true
|
||||
]
|
||||
},
|
||||
"hash": "e91116ebce127833488130cf1060e0817e5677f39588632452b8d621688c405a"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"query": "-- mark a notification as read\nUPDATE mcaptcha_notifications\n SET read_notification = TRUE\nWHERE \n mcaptcha_notifications.id = ?\nAND\n mcaptcha_notifications.rx = (\n SELECT\n id\n FROM\n mcaptcha_users\n WHERE\n name = ?\n );\n",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "cf333541509213f11a9bf7119dcb3289bb77abf1482fc1d47e7f5bb27bdc8d97"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"query": "SELECT time FROM mcaptcha_pow_fetched_stats\n WHERE \n config_id = (\n SELECT \n config_id FROM mcaptcha_config \n WHERE \n captcha_key = ?\n AND\n user_id = (\n SELECT \n ID FROM mcaptcha_users WHERE name = ?))\n ORDER BY time DESC",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "time",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": {
|
||||
"bits": 1185
|
||||
},
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": [
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "daac5e937aeac2f106eb89154b431fa8bd1bd7baa95e51704fdcdf50bd970a1d"
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user