mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2025-03-14 13:08:27 +03:00
chore: rust fmpt
This commit is contained in:
parent
b7a8716a82
commit
1d8554cb36
7 changed files with 16 additions and 15 deletions
|
@ -17,8 +17,6 @@
|
|||
//! Test utilities
|
||||
use crate::prelude::*;
|
||||
|
||||
pub async fn database_works<'a, T: MCDatabase>(
|
||||
db: &T,
|
||||
) {
|
||||
pub async fn database_works<'a, T: MCDatabase>(db: &T) {
|
||||
unimplemented!("database tests");
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@ use db_core::dev::*;
|
|||
use std::str::FromStr;
|
||||
|
||||
use sqlx::postgres::PgPoolOptions;
|
||||
use sqlx::PgPool;
|
||||
use sqlx::types::time::OffsetDateTime;
|
||||
use sqlx::PgPool;
|
||||
|
||||
pub mod errors;
|
||||
#[cfg(test)]
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/*
|
||||
* Copyright (C) 2022 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
*
|
||||
|
|
|
@ -72,7 +72,6 @@ pub fn handle_embedded_file(path: &str) -> HttpResponse {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#[my_codegen::get(path = "DOCS.assets")]
|
||||
async fn dist(path: web::Path<String>) -> impl Responder {
|
||||
handle_embedded_file(&path)
|
||||
|
|
|
@ -121,7 +121,6 @@ impl Settings {
|
|||
pub fn new() -> Result<Self, ConfigError> {
|
||||
let mut s = Config::new();
|
||||
|
||||
|
||||
const CURRENT_DIR: &str = "./config/default.toml";
|
||||
const ETC: &str = "/etc/mcaptcha/config.toml";
|
||||
|
||||
|
@ -163,8 +162,6 @@ impl Settings {
|
|||
s.set("database.pool", 2.to_string())
|
||||
.expect("Couldn't set database pool count");
|
||||
|
||||
|
||||
|
||||
match s.try_into() {
|
||||
Ok(val) => Ok(val),
|
||||
Err(e) => Err(ConfigError::Message(format!("\n\nError: {}. If it says missing fields, then please refer to https://github.com/mCaptcha/mcaptcha#configuration to learn more about how mcaptcha reads configuration\n\n", e))),
|
||||
|
|
|
@ -100,7 +100,6 @@ fn handle_assets(path: &str) -> HttpResponse {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#[get("/assets/{_:.*}")]
|
||||
pub async fn static_files(path: web::Path<String>) -> impl Responder {
|
||||
handle_assets(&path)
|
||||
|
@ -131,7 +130,6 @@ fn handle_favicons(path: &str) -> HttpResponse {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#[get("/{file}")]
|
||||
pub async fn favicons(path: web::Path<String>) -> impl Responder {
|
||||
debug!("searching favicons");
|
||||
|
|
|
@ -2,8 +2,10 @@ use std::sync::Arc;
|
|||
|
||||
use actix_web::test;
|
||||
use actix_web::{
|
||||
dev::ServiceResponse, error::ResponseError, http::StatusCode,
|
||||
body::{EitherBody, BoxBody},
|
||||
body::{BoxBody, EitherBody},
|
||||
dev::ServiceResponse,
|
||||
error::ResponseError,
|
||||
http::StatusCode,
|
||||
middleware as actix_middleware,
|
||||
};
|
||||
use libmcaptcha::defense::Level;
|
||||
|
@ -110,7 +112,10 @@ pub async fn register(name: &str, email: &str, password: &str) {
|
|||
}
|
||||
|
||||
/// signin util
|
||||
pub async fn signin(name: &str, password: &str) -> (Arc<Data>, Login, ServiceResponse<EitherBody<BoxBody>>) {
|
||||
pub async fn signin(
|
||||
name: &str,
|
||||
password: &str,
|
||||
) -> (Arc<Data>, Login, ServiceResponse<EitherBody<BoxBody>>) {
|
||||
let data = Data::new().await;
|
||||
let app = get_app!(data.clone()).await;
|
||||
|
||||
|
@ -173,7 +178,12 @@ pub fn get_level_data() -> CreateCaptcha {
|
|||
pub async fn add_levels_util(
|
||||
name: &str,
|
||||
password: &str,
|
||||
) -> (Arc<data::Data>, Login, ServiceResponse<EitherBody<BoxBody>>, MCaptchaDetails) {
|
||||
) -> (
|
||||
Arc<data::Data>,
|
||||
Login,
|
||||
ServiceResponse<EitherBody<BoxBody>>,
|
||||
MCaptchaDetails,
|
||||
) {
|
||||
let (data, creds, signin_resp) = signin(name, password).await;
|
||||
let cookies = get_cookie!(signin_resp);
|
||||
let app = get_app!(data).await;
|
||||
|
|
Loading…
Add table
Reference in a new issue