mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2025-11-24 06:25:46 +00:00
commit
9cd7cf3a02
2
.github/workflows/linux.yml
vendored
2
.github/workflows/linux.yml
vendored
@ -84,7 +84,7 @@ jobs:
|
|||||||
|
|
||||||
- uses: actions/setup-node@v2
|
- uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: "20.0.0"
|
node-version: "22"
|
||||||
|
|
||||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
|
||||||
|
|||||||
29
.woodpecker.yaml
Normal file
29
.woodpecker.yaml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
steps:
|
||||||
|
frontend:
|
||||||
|
image: node:22
|
||||||
|
commands:
|
||||||
|
- make frontend
|
||||||
|
when:
|
||||||
|
- event: [pull_request, push]
|
||||||
|
- branch:
|
||||||
|
include: [woodpecker-pipeline]
|
||||||
|
exclude:
|
||||||
|
- renovate/\*
|
||||||
|
volumes:
|
||||||
|
- /var/lib/woodpercker-cache/mcaptcha/yarn:/root/.cache/yarn
|
||||||
|
|
||||||
|
backend:
|
||||||
|
image: rust:latest
|
||||||
|
when:
|
||||||
|
- event: [pull_request, push]
|
||||||
|
- branch:
|
||||||
|
include: [woodpecker-pipeline]
|
||||||
|
exclude:
|
||||||
|
- renovate/\*
|
||||||
|
commands:
|
||||||
|
- cargo --version
|
||||||
|
- make cache-bust
|
||||||
|
- cargo build --release
|
||||||
|
volumes:
|
||||||
|
- /var/lib/woodpercker-cache/mcaptcha/cargo:/root/.cargo
|
||||||
|
- /var/lib/woodpercker-cache/mcaptcha/target:/woodpecker/src/git.batsense.net/mCaptcha/mCaptcha/target
|
||||||
2962
Cargo.lock
generated
2962
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
22
Cargo.toml
22
Cargo.toml
@ -28,23 +28,23 @@ actix = "0.13"
|
|||||||
actix-identity = "0.4.0"
|
actix-identity = "0.4.0"
|
||||||
actix-http = "3.0.4"
|
actix-http = "3.0.4"
|
||||||
actix-rt = "2"
|
actix-rt = "2"
|
||||||
actix-cors = "0.6.1"
|
actix-cors = "0.7.0"
|
||||||
actix-service = "2.0.0"
|
actix-service = "2.0.0"
|
||||||
async-trait = "0.1.51"
|
async-trait = "0.1.51"
|
||||||
mime_guess = "2.0.3"
|
mime_guess = "2.0.3"
|
||||||
rust-embed = "6.4.0"
|
rust-embed = "8.0.0"
|
||||||
libcachebust = "0.3.0"
|
libcachebust = "0.3.0"
|
||||||
|
|
||||||
futures = "0.3.15"
|
futures = "0.3.15"
|
||||||
tokio = { version = "1.14", features = ["sync"]}
|
tokio = { version = "1.14", features = ["sync"]}
|
||||||
|
|
||||||
sqlx = { version = "0.7", features = [ "runtime-tokio-rustls", "postgres", "time", "mysql"] }
|
sqlx = { version = "0.8", features = [ "runtime-tokio-rustls", "postgres", "time", "mysql"] }
|
||||||
argon2-creds = { branch = "master", git = "https://github.com/realaravinth/argon2-creds"}
|
argon2-creds = { branch = "master", git = "https://github.com/realaravinth/argon2-creds"}
|
||||||
#argon2-creds = { version="*", path = "../../argon2-creds/" }
|
#argon2-creds = { version="*", path = "../../argon2-creds/" }
|
||||||
config = "0.13"
|
config = "0.15"
|
||||||
validator = { version = "0.15", features = ["derive"]}
|
validator = { version = "0.20", features = ["derive"]}
|
||||||
|
|
||||||
derive_builder = "0.11"
|
derive_builder = "0.20"
|
||||||
derive_more = "0.99"
|
derive_more = "0.99"
|
||||||
|
|
||||||
serde = "1"
|
serde = "1"
|
||||||
@ -53,7 +53,7 @@ serde_json = "1"
|
|||||||
url = "2.2"
|
url = "2.2"
|
||||||
urlencoding = "2.1.0"
|
urlencoding = "2.1.0"
|
||||||
|
|
||||||
pretty_env_logger = "0.4"
|
pretty_env_logger = "0.5"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
|
|
||||||
lazy_static = "1.4"
|
lazy_static = "1.4"
|
||||||
@ -69,7 +69,7 @@ mime = "0.3.16"
|
|||||||
|
|
||||||
num_cpus = "1.13.1"
|
num_cpus = "1.13.1"
|
||||||
|
|
||||||
lettre = { version = "0.10.0-rc.3", features = [
|
lettre = { version = "0.11.0", features = [
|
||||||
"builder",
|
"builder",
|
||||||
"tokio1",
|
"tokio1",
|
||||||
"tokio1-native-tls",
|
"tokio1-native-tls",
|
||||||
@ -78,7 +78,7 @@ lettre = { version = "0.10.0-rc.3", features = [
|
|||||||
|
|
||||||
openssl = { version = "0.10.48", features = ["vendored"] }
|
openssl = { version = "0.10.48", features = ["vendored"] }
|
||||||
uuid = { version = "1.4.0", features = ["v4", "serde"] }
|
uuid = { version = "1.4.0", features = ["v4", "serde"] }
|
||||||
reqwest = { version = "0.11.18", features = ["json", "gzip"] }
|
reqwest = { version = "0.12.0", features = ["json", "gzip"] }
|
||||||
|
|
||||||
|
|
||||||
[dependencies.db-core]
|
[dependencies.db-core]
|
||||||
@ -101,10 +101,10 @@ features = ["actix_identity_backend"]
|
|||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
serde_json = "1"
|
serde_json = "1"
|
||||||
sqlx = { version = "0.7", features = [ "runtime-tokio-rustls", "postgres", "time", "mysql" ] }
|
sqlx = { version = "0.8", features = [ "runtime-tokio-rustls", "postgres", "time", "mysql" ] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
mcaptcha_pow_sha256 = "0.4"
|
mcaptcha_pow_sha256 = "0.5"
|
||||||
awc = "3.0.0"
|
awc = "3.0.0"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
# SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
# SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
FROM node:20 as frontend
|
FROM node:22 as frontend
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
apt-get update; \
|
apt-get update; \
|
||||||
DEBIAN_FRONTEND=noninteractive \
|
DEBIAN_FRONTEND=noninteractive \
|
||||||
@ -29,7 +29,7 @@ RUN cargo --version
|
|||||||
RUN make cache-bust
|
RUN make cache-bust
|
||||||
RUN cargo build --release
|
RUN cargo build --release
|
||||||
|
|
||||||
FROM debian:bookworm as mCaptcha
|
FROM debian:trixie as mCaptcha
|
||||||
LABEL org.opencontainers.image.source https://github.com/mCaptcha/mCaptcha
|
LABEL org.opencontainers.image.source https://github.com/mCaptcha/mCaptcha
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
apt-get update; \
|
apt-get update; \
|
||||||
|
|||||||
@ -10,7 +10,7 @@ authors = ["realaravinth <realaravinth@batsense.net>"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-trait = "0.1.51"
|
async-trait = "0.1.51"
|
||||||
thiserror = "1.0.30"
|
thiserror = "2.0.0"
|
||||||
serde = { version = "1", features = ["derive"]}
|
serde = { version = "1", features = ["derive"]}
|
||||||
url = { version = "2.2.2", features = ["serde"] }
|
url = { version = "2.2.2", features = ["serde"] }
|
||||||
libmcaptcha = "0.2.4"
|
libmcaptcha = "0.2.4"
|
||||||
|
|||||||
@ -10,4 +10,4 @@ authors = ["realaravinth <realaravinth@batsense.net>"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-rt = "2"
|
actix-rt = "2"
|
||||||
sqlx = { version = "0.7", features = [ "runtime-tokio-rustls", "postgres", "time", "mysql" ] }
|
sqlx = { version = "0.8", features = [ "runtime-tokio-rustls", "postgres", "time", "mysql" ] }
|
||||||
|
|||||||
@ -8,7 +8,6 @@ use std::env;
|
|||||||
use sqlx::postgres::PgPoolOptions;
|
use sqlx::postgres::PgPoolOptions;
|
||||||
use sqlx::mysql::MySqlPoolOptions;
|
use sqlx::mysql::MySqlPoolOptions;
|
||||||
|
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
#[actix_rt::main]
|
#[actix_rt::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
//TODO featuregate sqlite and postgres
|
//TODO featuregate sqlite and postgres
|
||||||
|
|||||||
@ -12,11 +12,11 @@ authors = ["realaravinth <realaravinth@batsense.net>"]
|
|||||||
async-trait = "0.1.51"
|
async-trait = "0.1.51"
|
||||||
db-core = {path = "../db-core"}
|
db-core = {path = "../db-core"}
|
||||||
futures = "0.3.15"
|
futures = "0.3.15"
|
||||||
sqlx = { version = "0.7", features = [ "runtime-tokio-rustls", "mysql", "time"] }
|
sqlx = { version = "0.8", features = [ "runtime-tokio-rustls", "mysql", "time"] }
|
||||||
uuid = { version = "1.4.0", features = ["v4", "serde"] }
|
uuid = { version = "1.4.0", features = ["v4", "serde"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
actix-rt = "2"
|
actix-rt = "2"
|
||||||
sqlx = { version = "0.7", features = [ "runtime-tokio-rustls", "mysql", "time" ] }
|
sqlx = { version = "0.8", features = [ "runtime-tokio-rustls", "mysql", "time" ] }
|
||||||
db-core = {path = "../db-core", features = ["test"]}
|
db-core = {path = "../db-core", features = ["test"]}
|
||||||
url = { version = "2.2.2", features = ["serde"] }
|
url = { version = "2.2.2", features = ["serde"] }
|
||||||
|
|||||||
@ -12,11 +12,11 @@ authors = ["realaravinth <realaravinth@batsense.net>"]
|
|||||||
async-trait = "0.1.51"
|
async-trait = "0.1.51"
|
||||||
db-core = {path = "../db-core"}
|
db-core = {path = "../db-core"}
|
||||||
futures = "0.3.15"
|
futures = "0.3.15"
|
||||||
sqlx = { version = "0.7", features = [ "runtime-tokio-rustls", "postgres", "time" ] }
|
sqlx = { version = "0.8", features = [ "runtime-tokio-rustls", "postgres", "time" ] }
|
||||||
uuid = { version = "1.4.0", features = ["v4", "serde"] }
|
uuid = { version = "1.4.0", features = ["v4", "serde"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
actix-rt = "2"
|
actix-rt = "2"
|
||||||
sqlx = { version = "0.7", features = [ "runtime-tokio-rustls", "postgres", "time"] }
|
sqlx = { version = "0.8", features = [ "runtime-tokio-rustls", "postgres", "time"] }
|
||||||
db-core = {path = "../db-core", features = ["test"]}
|
db-core = {path = "../db-core", features = ["test"]}
|
||||||
url = { version = "2.2.2", features = ["serde"] }
|
url = { version = "2.2.2", features = ["serde"] }
|
||||||
|
|||||||
@ -16,7 +16,7 @@ services:
|
|||||||
- mcaptcha_redis
|
- mcaptcha_redis
|
||||||
|
|
||||||
mcaptcha_postgres:
|
mcaptcha_postgres:
|
||||||
image: postgres:13.2
|
image: postgres:18.0
|
||||||
volumes:
|
volumes:
|
||||||
- mcaptcha-data:/var/lib/postgresql/
|
- mcaptcha-data:/var/lib/postgresql/
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
2357
docs/openapi/package-lock.json
generated
2357
docs/openapi/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -17,6 +17,6 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/mCaptcha/mCaptcha#readme",
|
"homepage": "https://github.com/mCaptcha/mCaptcha#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@redocly/cli": "^1.4.0"
|
"@redocly/cli": "^2.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
46
eslint.config.js
Normal file
46
eslint.config.js
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
const {
|
||||||
|
defineConfig,
|
||||||
|
} = require("eslint/config");
|
||||||
|
|
||||||
|
const globals = require("globals");
|
||||||
|
const tsParser = require("@typescript-eslint/parser");
|
||||||
|
const typescriptEslint = require("@typescript-eslint/eslint-plugin");
|
||||||
|
const js = require("@eslint/js");
|
||||||
|
|
||||||
|
const {
|
||||||
|
FlatCompat,
|
||||||
|
} = require("@eslint/eslintrc");
|
||||||
|
|
||||||
|
const compat = new FlatCompat({
|
||||||
|
baseDirectory: __dirname,
|
||||||
|
recommendedConfig: js.configs.recommended,
|
||||||
|
allConfig: js.configs.all
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = defineConfig([{
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
|
...globals.browser,
|
||||||
|
},
|
||||||
|
|
||||||
|
parser: tsParser,
|
||||||
|
ecmaVersion: 12,
|
||||||
|
sourceType: "module",
|
||||||
|
parserOptions: {},
|
||||||
|
},
|
||||||
|
|
||||||
|
extends: compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended"),
|
||||||
|
|
||||||
|
plugins: {
|
||||||
|
"@typescript-eslint": typescriptEslint,
|
||||||
|
},
|
||||||
|
|
||||||
|
rules: {
|
||||||
|
"@typescript-eslint/no-explicit-any": "off",
|
||||||
|
"@typescript-eslint/ban-types": "off",
|
||||||
|
indent: ["error", 2],
|
||||||
|
"linebreak-style": ["error", "unix"],
|
||||||
|
quotes: ["error", "double"],
|
||||||
|
semi: ["error", "always"],
|
||||||
|
},
|
||||||
|
}]);
|
||||||
19962
package-lock.json
generated
19962
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
39
package.json
39
package.json
@ -10,35 +10,38 @@
|
|||||||
"test": "jest"
|
"test": "jest"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^29.5.6",
|
"@eslint/eslintrc": "^3.3.1",
|
||||||
"@types/jsdom": "^21.1.4",
|
"@eslint/js": "^9.36.0",
|
||||||
"@types/node": "^20.8.9",
|
"@types/jest": "^30.0.0",
|
||||||
"@types/sinon": "^10.0.20",
|
"@types/jsdom": "^27.0.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.9.0",
|
"@types/node": "^22.0.0",
|
||||||
"@typescript-eslint/parser": "^6.9.0",
|
"@types/sinon": "^17.0.0",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
||||||
|
"@typescript-eslint/parser": "^8.0.0",
|
||||||
"@wasm-tool/wasm-pack-plugin": "^1.7.0",
|
"@wasm-tool/wasm-pack-plugin": "^1.7.0",
|
||||||
"css-loader": "^6.8.1",
|
"css-loader": "^7.0.0",
|
||||||
"css-minimizer-webpack-plugin": "^5.0.1",
|
"css-minimizer-webpack-plugin": "^7.0.0",
|
||||||
"eslint": "^8.52.0",
|
"eslint": "^9.0.0",
|
||||||
"jest": "^29.7.0",
|
"globals": "^16.4.0",
|
||||||
"jest-environment-jsdom": "^29.7.0",
|
"jest": "^30.0.0",
|
||||||
|
"jest-environment-jsdom": "^30.0.0",
|
||||||
"jest-fetch-mock": "^3.0.3",
|
"jest-fetch-mock": "^3.0.3",
|
||||||
"jsdom": "^22.1.0",
|
"jsdom": "^27.0.0",
|
||||||
"mini-css-extract-plugin": "^2.7.6",
|
"mini-css-extract-plugin": "^2.7.6",
|
||||||
"sass": "^1.69.5",
|
"sass": "^1.69.5",
|
||||||
"sass-loader": "^13.3.2",
|
"sass-loader": "^16.0.0",
|
||||||
"sinon": "^17.0.0",
|
"sinon": "^21.0.0",
|
||||||
"ts-jest": "^29.1.1",
|
"ts-jest": "^29.1.1",
|
||||||
"ts-loader": "^9.5.0",
|
"ts-loader": "^9.5.0",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"typescript": "^5.2.2",
|
"typescript": "^5.2.2",
|
||||||
"webpack": "^5.89.0",
|
"webpack": "^5.89.0",
|
||||||
"webpack-cli": "^5.1.4",
|
"webpack-cli": "^6.0.0",
|
||||||
"webpack-dev-server": "^4.15.1"
|
"webpack-dev-server": "^5.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mcaptcha/pow_sha256-polyfill": "^0.1.0-rc2",
|
"@mcaptcha/pow_sha256-polyfill": "^0.1.0-rc2",
|
||||||
"@mcaptcha/vanilla-glue": "^0.1.0-rc1",
|
"@mcaptcha/pow-wasm": "^0.1.0-rc2",
|
||||||
"@mcaptcha/pow-wasm": "^0.1.0-rc2"
|
"@mcaptcha/vanilla-glue": "^0.1.0-rc1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
21
renovate.json
Normal file
21
renovate.json
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
|
"extends": [
|
||||||
|
"config:recommended",
|
||||||
|
":dependencyDashboard"
|
||||||
|
],
|
||||||
|
"labels": [
|
||||||
|
"renovate-bot"
|
||||||
|
],
|
||||||
|
"prHourlyLimit": 0,
|
||||||
|
"timezone": "Asia/kolkata",
|
||||||
|
"prCreation": "immediate",
|
||||||
|
"vulnerabilityAlerts": {
|
||||||
|
"enabled": true,
|
||||||
|
"labels": [
|
||||||
|
"renovate-bot",
|
||||||
|
"renovate-security",
|
||||||
|
"security"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -22,8 +22,8 @@ is_ci(){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
docker-compose down -v --remove-orphans || true
|
docker compose down -v --remove-orphans || true
|
||||||
docker-compose up -d
|
docker compose up -d
|
||||||
cd $(mktemp -d)
|
cd $(mktemp -d)
|
||||||
pwd
|
pwd
|
||||||
find
|
find
|
||||||
@ -40,4 +40,4 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
cd $PROJECT_ROOT
|
cd $PROJECT_ROOT
|
||||||
docker-compose down -v --remove-orphans || true
|
docker compose down -v --remove-orphans || true
|
||||||
|
|||||||
@ -188,7 +188,6 @@ impl Data {
|
|||||||
.build()
|
.build()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
/// create new instance of app data
|
/// create new instance of app data
|
||||||
pub async fn new(s: &Settings, survey_secrets: SecretsStore) -> Arc<Self> {
|
pub async fn new(s: &Settings, survey_secrets: SecretsStore) -> Arc<Self> {
|
||||||
let creds = Self::get_creds();
|
let creds = Self::get_creds();
|
||||||
|
|||||||
@ -40,7 +40,6 @@ impl std::cmp::PartialEq for SmtpErrorWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Display, PartialEq, Error)]
|
#[derive(Debug, Display, PartialEq, Error)]
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
pub enum ServiceError {
|
pub enum ServiceError {
|
||||||
#[display(fmt = "internal server error")]
|
#[display(fmt = "internal server error")]
|
||||||
InternalServerError,
|
InternalServerError,
|
||||||
@ -114,14 +113,11 @@ pub enum ServiceError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
pub struct ErrorToResponse {
|
pub struct ErrorToResponse {
|
||||||
pub error: String,
|
pub error: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
impl ResponseError for ServiceError {
|
impl ResponseError for ServiceError {
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
fn error_response(&self) -> HttpResponse {
|
fn error_response(&self) -> HttpResponse {
|
||||||
HttpResponseBuilder::new(self.status_code())
|
HttpResponseBuilder::new(self.status_code())
|
||||||
.append_header((header::CONTENT_TYPE, "application/json; charset=UTF-8"))
|
.append_header((header::CONTENT_TYPE, "application/json; charset=UTF-8"))
|
||||||
@ -133,7 +129,6 @@ impl ResponseError for ServiceError {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
fn status_code(&self) -> StatusCode {
|
fn status_code(&self) -> StatusCode {
|
||||||
match self {
|
match self {
|
||||||
ServiceError::ClosedForRegistration => StatusCode::FORBIDDEN,
|
ServiceError::ClosedForRegistration => StatusCode::FORBIDDEN,
|
||||||
@ -177,7 +172,6 @@ impl ResponseError for ServiceError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl From<CredsError> for ServiceError {
|
impl From<CredsError> for ServiceError {
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
fn from(e: CredsError) -> ServiceError {
|
fn from(e: CredsError) -> ServiceError {
|
||||||
match e {
|
match e {
|
||||||
CredsError::UsernameCaseMappedError => ServiceError::UsernameCaseMappedError,
|
CredsError::UsernameCaseMappedError => ServiceError::UsernameCaseMappedError,
|
||||||
@ -192,7 +186,6 @@ impl From<CredsError> for ServiceError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl From<DBError> for ServiceError {
|
impl From<DBError> for ServiceError {
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
fn from(e: DBError) -> ServiceError {
|
fn from(e: DBError) -> ServiceError {
|
||||||
println!("from conversin: {}", e);
|
println!("from conversin: {}", e);
|
||||||
match e {
|
match e {
|
||||||
@ -208,57 +201,46 @@ impl From<DBError> for ServiceError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl From<ValidationErrors> for ServiceError {
|
impl From<ValidationErrors> for ServiceError {
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
fn from(_: ValidationErrors) -> ServiceError {
|
fn from(_: ValidationErrors) -> ServiceError {
|
||||||
ServiceError::NotAnEmail
|
ServiceError::NotAnEmail
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<ParseError> for ServiceError {
|
impl From<ParseError> for ServiceError {
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
fn from(_: ParseError) -> ServiceError {
|
fn from(_: ParseError) -> ServiceError {
|
||||||
ServiceError::NotAUrl
|
ServiceError::NotAUrl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
impl From<CaptchaError> for ServiceError {
|
impl From<CaptchaError> for ServiceError {
|
||||||
fn from(e: CaptchaError) -> ServiceError {
|
fn from(e: CaptchaError) -> ServiceError {
|
||||||
ServiceError::CaptchaError(e)
|
ServiceError::CaptchaError(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
impl From<SmtpError> for ServiceError {
|
impl From<SmtpError> for ServiceError {
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
fn from(e: SmtpError) -> Self {
|
fn from(e: SmtpError) -> Self {
|
||||||
ServiceError::UnableToSendEmail(SmtpErrorWrapper(e))
|
ServiceError::UnableToSendEmail(SmtpErrorWrapper(e))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
impl From<RecvError> for ServiceError {
|
impl From<RecvError> for ServiceError {
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
fn from(e: RecvError) -> Self {
|
fn from(e: RecvError) -> Self {
|
||||||
log::error!("{:?}", e);
|
log::error!("{:?}", e);
|
||||||
ServiceError::InternalServerError
|
ServiceError::InternalServerError
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
impl From<MailboxError> for ServiceError {
|
impl From<MailboxError> for ServiceError {
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
fn from(e: MailboxError) -> Self {
|
fn from(e: MailboxError) -> Self {
|
||||||
log::error!("{:?}", e);
|
log::error!("{:?}", e);
|
||||||
ServiceError::InternalServerError
|
ServiceError::InternalServerError
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
pub type ServiceResult<V> = std::result::Result<V, ServiceError>;
|
pub type ServiceResult<V> = std::result::Result<V, ServiceError>;
|
||||||
|
|
||||||
#[derive(Debug, Display, PartialEq, Error)]
|
#[derive(Debug, Display, PartialEq, Error)]
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
pub enum PageError {
|
pub enum PageError {
|
||||||
#[display(fmt = "Something weng wrong: Internal server error")]
|
#[display(fmt = "Something weng wrong: Internal server error")]
|
||||||
InternalServerError,
|
InternalServerError,
|
||||||
@ -267,17 +249,13 @@ pub enum PageError {
|
|||||||
ServiceError(ServiceError),
|
ServiceError(ServiceError),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
impl From<ServiceError> for PageError {
|
impl From<ServiceError> for PageError {
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
fn from(e: ServiceError) -> Self {
|
fn from(e: ServiceError) -> Self {
|
||||||
PageError::ServiceError(e)
|
PageError::ServiceError(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
impl From<DBError> for PageError {
|
impl From<DBError> for PageError {
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
fn from(e: DBError) -> Self {
|
fn from(e: DBError) -> Self {
|
||||||
let se: ServiceError = e.into();
|
let se: ServiceError = e.into();
|
||||||
se.into()
|
se.into()
|
||||||
@ -297,7 +275,6 @@ impl ResponseError for PageError {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
fn status_code(&self) -> StatusCode {
|
fn status_code(&self) -> StatusCode {
|
||||||
match self {
|
match self {
|
||||||
PageError::InternalServerError => StatusCode::INTERNAL_SERVER_ERROR,
|
PageError::InternalServerError => StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
@ -306,7 +283,6 @@ impl ResponseError for PageError {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
pub type PageResult<V> = std::result::Result<V, PageError>;
|
pub type PageResult<V> = std::result::Result<V, PageError>;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|||||||
@ -92,7 +92,6 @@ pub const CACHE_AGE: u32 = 604800;
|
|||||||
pub type ArcData = Arc<crate::data::Data>;
|
pub type ArcData = Arc<crate::data::Data>;
|
||||||
pub type AppData = actix_web::web::Data<ArcData>;
|
pub type AppData = actix_web::web::Data<ArcData>;
|
||||||
|
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> std::io::Result<()> {
|
async fn main() -> std::io::Result<()> {
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
@ -185,7 +184,6 @@ async fn main() -> std::io::Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
pub fn get_json_err() -> JsonConfig {
|
pub fn get_json_err() -> JsonConfig {
|
||||||
JsonConfig::default().error_handler(|err, _| {
|
JsonConfig::default().error_handler(|err, _| {
|
||||||
//debug!("JSON deserialization error: {:?}", &err);
|
//debug!("JSON deserialization error: {:?}", &err);
|
||||||
@ -193,7 +191,6 @@ pub fn get_json_err() -> JsonConfig {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
pub fn get_identity_service(
|
pub fn get_identity_service(
|
||||||
settings: &Settings,
|
settings: &Settings,
|
||||||
) -> IdentityService<CookieIdentityPolicy> {
|
) -> IdentityService<CookieIdentityPolicy> {
|
||||||
|
|||||||
@ -25,7 +25,6 @@ pub fn get_middleware() -> Authentication<routes::Routes> {
|
|||||||
Authentication::with_identity(routes::ROUTES)
|
Authentication::with_identity(routes::ROUTES)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use actix_web::http::StatusCode;
|
use actix_web::http::StatusCode;
|
||||||
|
|||||||
@ -56,7 +56,6 @@ pub struct Smtp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Server {
|
impl Server {
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
pub fn get_ip(&self) -> String {
|
pub fn get_ip(&self) -> String {
|
||||||
format!("{}:{}", self.ip, self.port)
|
format!("{}:{}", self.ip, self.port)
|
||||||
}
|
}
|
||||||
@ -205,7 +204,6 @@ const DEPRECATED_ENV_VARS: [(&str, &str); 23] = [
|
|||||||
("smtp.port", "MCAPTCHA_SMTP_PORT"),
|
("smtp.port", "MCAPTCHA_SMTP_PORT"),
|
||||||
];
|
];
|
||||||
|
|
||||||
#[cfg(not(tarpaulin_include))]
|
|
||||||
impl Settings {
|
impl Settings {
|
||||||
pub fn new() -> Result<Self, ConfigError> {
|
pub fn new() -> Result<Self, ConfigError> {
|
||||||
let mut s = Config::builder();
|
let mut s = Config::builder();
|
||||||
|
|||||||
@ -2,13 +2,13 @@
|
|||||||
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
"use strict";
|
||||||
|
|
||||||
import createError from "./index";
|
import createError from "./index";
|
||||||
import * as e from "./index";
|
import * as e from "./index";
|
||||||
|
|
||||||
import setup from "./setUpTests";
|
import setup from "./setUpTests";
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
jest.useFakeTimers();
|
jest.useFakeTimers();
|
||||||
|
|
||||||
|
|||||||
@ -2,10 +2,10 @@
|
|||||||
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
"use strict";
|
||||||
|
|
||||||
import {Router} from "./router";
|
import {Router} from "./router";
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
const result = {
|
const result = {
|
||||||
result: "",
|
result: "",
|
||||||
|
|||||||
@ -2,10 +2,10 @@
|
|||||||
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
"use strict";
|
||||||
|
|
||||||
import genJsonPayload from "./genJsonPayload";
|
import genJsonPayload from "./genJsonPayload";
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
const payload = {
|
const payload = {
|
||||||
username: "Jhon",
|
username: "Jhon",
|
||||||
|
|||||||
@ -2,12 +2,11 @@
|
|||||||
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
"use strict";
|
||||||
|
|
||||||
import getFormUrl from "./getFormUrl";
|
import getFormUrl from "./getFormUrl";
|
||||||
import {getLoginFormHtml} from "../setUpTests";
|
import {getLoginFormHtml} from "../setUpTests";
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
const formClassName = "form__box";
|
const formClassName = "form__box";
|
||||||
const formURL = "/api/v1/signin";
|
const formURL = "/api/v1/signin";
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
"use strict";
|
||||||
|
|
||||||
import isBlankString from "./isBlankString";
|
import isBlankString from "./isBlankString";
|
||||||
import {mockAlert} from "../setUpTests";
|
import {mockAlert} from "../setUpTests";
|
||||||
@ -9,7 +10,6 @@ import {mockAlert} from "../setUpTests";
|
|||||||
|
|
||||||
import setup from "../components/error/setUpTests";
|
import setup from "../components/error/setUpTests";
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
mockAlert();
|
mockAlert();
|
||||||
|
|
||||||
|
|||||||
@ -2,11 +2,10 @@
|
|||||||
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
"use strict";
|
||||||
|
|
||||||
import isNumber from "./isNumber";
|
import isNumber from "./isNumber";
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
it("getFromUrl workds", () => {
|
it("getFromUrl workds", () => {
|
||||||
expect(isNumber("test")).toBe(false);
|
expect(isNumber("test")).toBe(false);
|
||||||
expect(isNumber("1test213")).toBe(false);
|
expect(isNumber("1test213")).toBe(false);
|
||||||
|
|||||||
@ -30,7 +30,7 @@ const prove = async (
|
|||||||
config.string,
|
config.string,
|
||||||
config.difficulty_factor,
|
config.difficulty_factor,
|
||||||
STEPS,
|
STEPS,
|
||||||
(nonce: BigInt | number) => progress(Number(nonce))
|
(nonce: bigint | number) => progress(Number(nonce))
|
||||||
);
|
);
|
||||||
const t1 = performance.now();
|
const t1 = performance.now();
|
||||||
time = t1 - t0;
|
time = t1 - t0;
|
||||||
|
|||||||
46
utils/cache-bust/Cargo.lock
generated
46
utils/cache-bust/Cargo.lock
generated
@ -1,6 +1,6 @@
|
|||||||
# This file is automatically @generated by Cargo.
|
# This file is automatically @generated by Cargo.
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
version = 3
|
version = 4
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "block-buffer"
|
name = "block-buffer"
|
||||||
@ -177,6 +177,12 @@ dependencies = [
|
|||||||
"walkdir",
|
"walkdir",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "memchr"
|
||||||
|
version = "2.7.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mime"
|
name = "mime"
|
||||||
version = "0.3.17"
|
version = "0.3.17"
|
||||||
@ -195,18 +201,18 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.69"
|
version = "1.0.92"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da"
|
checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.33"
|
version = "1.0.38"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
|
checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
@ -228,33 +234,45 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.189"
|
version = "1.0.228"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537"
|
checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
|
||||||
|
dependencies = [
|
||||||
|
"serde_core",
|
||||||
|
"serde_derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_core"
|
||||||
|
version = "1.0.228"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.189"
|
version = "1.0.228"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5"
|
checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.38",
|
"syn 2.0.93",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
version = "1.0.107"
|
version = "1.0.145"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65"
|
checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itoa",
|
"itoa",
|
||||||
|
"memchr",
|
||||||
"ryu",
|
"ryu",
|
||||||
"serde",
|
"serde",
|
||||||
|
"serde_core",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -287,9 +305,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.38"
|
version = "2.0.93"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b"
|
checksum = "9c786062daee0d6db1132800e623df74274a0a87322d8e183338e01b3d98d058"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user