chore: update actix-* deps
This commit is contained in:
parent
6d6b494c6f
commit
91c6f77cab
16 changed files with 1101 additions and 1006 deletions
1386
Cargo.lock
generated
1386
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
36
Cargo.toml
36
Cargo.toml
|
@ -22,35 +22,35 @@ name = "tests-migrate"
|
|||
path = "./src/tests-migrate.rs"
|
||||
|
||||
[dependencies]
|
||||
actix-web = "4.0.0-beta.12"
|
||||
actix = "0.12"
|
||||
actix-identity = "0.4.0-beta.4"
|
||||
actix-http = "3.0.0-beta.13"
|
||||
actix-web = "4.0.1"
|
||||
actix = "0.13"
|
||||
actix-identity = "0.4.0"
|
||||
actix-http = "3.0.4"
|
||||
actix-rt = "2"
|
||||
actix-cors = "0.6.0-beta.4"
|
||||
actix-cors = "0.6.1"
|
||||
actix-service = "2.0.0"
|
||||
my-codegen = {version="0.5.0-beta.5", package = "actix-web-codegen", git ="https://github.com/realaravinth/actix-web"}
|
||||
|
||||
#my-codegen = {version="0.5.0-beta.5", package = "actix-web-codegen", git ="https://github.com/realaravinth/actix-web"}
|
||||
mime_guess = "2.0.3"
|
||||
rust-embed = "6.0.0"
|
||||
rust-embed = "6.4.0"
|
||||
cache-buster = { git = "https://github.com/realaravinth/cache-buster" }
|
||||
|
||||
futures = "0.3.15"
|
||||
tokio = { version = "1.14", features = ["sync"]}
|
||||
|
||||
sqlx = { version = "0.5.5", features = [ "runtime-actix-rustls", "postgres", "time", "offline" ] }
|
||||
sqlx = { version = "0.5.13", features = [ "runtime-actix-rustls", "postgres", "time", "offline" ] }
|
||||
argon2-creds = { branch = "master", git = "https://github.com/realaravinth/argon2-creds"}
|
||||
#argon2-creds = { version="*", path = "../../argon2-creds/" }
|
||||
config = "0.11"
|
||||
validator = { version = "0.14", features = ["derive"]}
|
||||
validator = { version = "0.15", features = ["derive"]}
|
||||
|
||||
derive_builder = "0.10"
|
||||
derive_builder = "0.11"
|
||||
derive_more = "0.99"
|
||||
|
||||
serde = "1"
|
||||
serde_json = "1"
|
||||
|
||||
url = "2.2"
|
||||
urlencoding = "2.1.0"
|
||||
|
||||
pretty_env_logger = "0.4"
|
||||
log = "0.4"
|
||||
|
@ -63,7 +63,7 @@ libmcaptcha = { branch = "master", git = "https://github.com/mCaptcha/libmcaptch
|
|||
|
||||
rand = "0.8"
|
||||
|
||||
sailfish = "0.3.2"
|
||||
sailfish = "0.4.0"
|
||||
|
||||
mime = "0.3.16"
|
||||
|
||||
|
@ -76,16 +76,24 @@ lettre = { version = "0.10.0-rc.3", features = [
|
|||
|
||||
openssl = { version = "0.10.29", features = ["vendored"] }
|
||||
|
||||
[dependencies.my-codegen]
|
||||
git = "https://github.com/realaravinth/actix-web"
|
||||
package = "actix-web-codegen"
|
||||
|
||||
[dependencies.actix-auth-middleware]
|
||||
version = "0.2.0"
|
||||
git = "https://github.com/realaravinth/actix-auth-middleware"
|
||||
features = ["actix_identity_backend"]
|
||||
|
||||
[build-dependencies]
|
||||
serde_json = "1"
|
||||
cache-buster = { version = "0.2.0", git = "https://github.com/realaravinth/cache-buster" }
|
||||
mime = "0.3.16"
|
||||
sqlx = { version = "0.5.5", features = [ "runtime-actix-rustls", "postgres", "time", "offline" ] }
|
||||
sqlx = { version = "0.5.13", features = [ "runtime-actix-rustls", "postgres", "time", "offline" ] }
|
||||
|
||||
[dev-dependencies]
|
||||
pow_sha256 = { version = "0.2.1", git = "https://github.com/mcaptcha/pow_sha256" }
|
||||
awc = "3.0.0-beta.11"
|
||||
awc = "3.0.0"
|
||||
|
||||
|
||||
[target.x86_64-unknown-linux-musl]
|
||||
|
|
610
sqlx-data.json
610
sqlx-data.json
File diff suppressed because it is too large
Load diff
|
@ -230,16 +230,17 @@ async fn register(
|
|||
async fn login(
|
||||
id: Identity,
|
||||
payload: web::Json<runners::Login>,
|
||||
path: web::Path<super::RedirectQuery>,
|
||||
query: web::Query<super::RedirectQuery>,
|
||||
data: AppData,
|
||||
) -> ServiceResult<impl Responder> {
|
||||
let username = runners::login_runner(payload.into_inner(), &data).await?;
|
||||
id.remember(username);
|
||||
// Ok(HttpResponse::Ok())
|
||||
|
||||
if let Some(redirect_to) = &path.redirect_to {
|
||||
let query = query.into_inner();
|
||||
if let Some(redirect_to) = query.redirect_to {
|
||||
Ok(HttpResponse::Found()
|
||||
.insert_header((header::LOCATION, redirect_to))
|
||||
.append_header((header::LOCATION, redirect_to))
|
||||
.finish())
|
||||
} else {
|
||||
Ok(HttpResponse::Ok().finish())
|
||||
|
|
12
src/docs.rs
12
src/docs.rs
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
use std::borrow::Cow;
|
||||
|
||||
use actix_web::body::AnyBody;
|
||||
use actix_web::body::BoxBody;
|
||||
use actix_web::{http::header, web, HttpResponse, Responder};
|
||||
use mime_guess::from_path;
|
||||
use rust_embed::RustEmbed;
|
||||
|
@ -54,12 +54,15 @@ struct Asset;
|
|||
pub fn handle_embedded_file(path: &str) -> HttpResponse {
|
||||
match Asset::get(path) {
|
||||
Some(content) => {
|
||||
let body: AnyBody = match content.data {
|
||||
Cow::Borrowed(bytes) => bytes.into(),
|
||||
Cow::Owned(bytes) => bytes.into(),
|
||||
let body: BoxBody = match content.data {
|
||||
Cow::Borrowed(bytes) => BoxBody::new(bytes),
|
||||
Cow::Owned(bytes) => BoxBody::new(bytes),
|
||||
};
|
||||
|
||||
HttpResponse::Ok()
|
||||
.insert_header(header::CacheControl(vec![
|
||||
header::CacheDirective::Public,
|
||||
header::CacheDirective::Extension("immutable".into(), None),
|
||||
header::CacheDirective::MaxAge(CACHE_AGE),
|
||||
]))
|
||||
.content_type(from_path(path).first_or_octet_stream().as_ref())
|
||||
|
@ -69,6 +72,7 @@ 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)
|
||||
|
|
|
@ -42,5 +42,5 @@ lazy_static! {
|
|||
pub async fn login() -> impl Responder {
|
||||
HttpResponse::Ok()
|
||||
.content_type("text/html; charset=utf-8")
|
||||
.body(&*INDEX)
|
||||
.body(&**INDEX)
|
||||
}
|
||||
|
|
|
@ -39,5 +39,5 @@ lazy_static! {
|
|||
pub async fn join() -> impl Responder {
|
||||
HttpResponse::Ok()
|
||||
.content_type("text/html; charset=utf-8")
|
||||
.body(&*INDEX)
|
||||
.body(&**INDEX)
|
||||
}
|
||||
|
|
|
@ -56,11 +56,11 @@ async fn error(path: web::Path<usize>) -> impl Responder {
|
|||
let resp = match path.into_inner() {
|
||||
500 => HttpResponse::InternalServerError()
|
||||
.content_type("text/html; charset=utf-8")
|
||||
.body(&*INTERNAL_SERVER_ERROR_BODY),
|
||||
.body(&**INTERNAL_SERVER_ERROR_BODY),
|
||||
|
||||
_ => HttpResponse::InternalServerError()
|
||||
.content_type("text/html; charset=utf-8")
|
||||
.body(&*UNKNOWN_ERROR_BODY),
|
||||
.body(&**UNKNOWN_ERROR_BODY),
|
||||
};
|
||||
|
||||
resp
|
||||
|
|
|
@ -104,7 +104,7 @@ async fn delete_account() -> impl Responder {
|
|||
.unwrap();
|
||||
HttpResponse::Ok()
|
||||
.content_type("text/html; charset=utf-8")
|
||||
.body(&page)
|
||||
.body(page)
|
||||
}
|
||||
|
||||
#[my_codegen::get(
|
||||
|
@ -117,5 +117,5 @@ async fn update_secret() -> impl Responder {
|
|||
.unwrap();
|
||||
HttpResponse::Ok()
|
||||
.content_type("text/html; charset=utf-8")
|
||||
.body(&page)
|
||||
.body(page)
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ impl<'a> Default for AdvanceIndexPage<'a> {
|
|||
pub async fn advance() -> impl Responder {
|
||||
HttpResponse::Ok()
|
||||
.content_type("text/html; charset=utf-8")
|
||||
.body(&*ADVANCE_INDEX)
|
||||
.body(&**ADVANCE_INDEX)
|
||||
}
|
||||
|
||||
#[derive(TemplateOnce, Clone)]
|
||||
|
@ -86,5 +86,5 @@ impl<'a> Default for EasyIndexPage<'a> {
|
|||
pub async fn easy() -> impl Responder {
|
||||
HttpResponse::Ok()
|
||||
.content_type("text/html; charset=utf-8")
|
||||
.body(&*EASY_INDEX)
|
||||
.body(&**EASY_INDEX)
|
||||
}
|
||||
|
|
|
@ -34,5 +34,5 @@ pub async fn delete_sitekey(path: web::Path<String>) -> impl Responder {
|
|||
.unwrap();
|
||||
HttpResponse::Ok()
|
||||
.content_type("text/html; charset=utf-8")
|
||||
.body(&page)
|
||||
.body(page)
|
||||
}
|
||||
|
|
|
@ -50,5 +50,5 @@ lazy_static! {
|
|||
pub async fn sitemap() -> impl Responder {
|
||||
HttpResponse::Ok()
|
||||
.content_type("application/xml; charset=utf-8")
|
||||
.body(&*INDEX)
|
||||
.body(&**INDEX)
|
||||
}
|
||||
|
|
|
@ -121,10 +121,6 @@ impl Settings {
|
|||
pub fn new() -> Result<Self, ConfigError> {
|
||||
let mut s = Config::new();
|
||||
|
||||
// setting default values
|
||||
#[cfg(test)]
|
||||
s.set_default("database.pool", 2.to_string())
|
||||
.expect("Couldn't get the number of CPUs");
|
||||
|
||||
const CURRENT_DIR: &str = "./config/default.toml";
|
||||
const ETC: &str = "/etc/mcaptcha/config.toml";
|
||||
|
@ -162,6 +158,13 @@ impl Settings {
|
|||
|
||||
set_database_url(&mut s);
|
||||
|
||||
// setting default values
|
||||
#[cfg(test)]
|
||||
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))),
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
use std::borrow::Cow;
|
||||
|
||||
use actix_web::body::AnyBody;
|
||||
use actix_web::body::BoxBody;
|
||||
use actix_web::{get, http::header, web, HttpResponse, Responder};
|
||||
use log::debug;
|
||||
use mime_guess::from_path;
|
||||
|
@ -82,9 +82,9 @@ struct Asset;
|
|||
fn handle_assets(path: &str) -> HttpResponse {
|
||||
match Asset::get(path) {
|
||||
Some(content) => {
|
||||
let body: AnyBody = match content.data {
|
||||
Cow::Borrowed(bytes) => bytes.into(),
|
||||
Cow::Owned(bytes) => bytes.into(),
|
||||
let body: BoxBody = match content.data {
|
||||
Cow::Borrowed(bytes) => BoxBody::new(bytes),
|
||||
Cow::Owned(bytes) => BoxBody::new(bytes),
|
||||
};
|
||||
|
||||
HttpResponse::Ok()
|
||||
|
@ -100,6 +100,7 @@ fn handle_assets(path: &str) -> HttpResponse {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#[get("/assets/{_:.*}")]
|
||||
pub async fn static_files(path: web::Path<String>) -> impl Responder {
|
||||
handle_assets(&path)
|
||||
|
@ -112,9 +113,9 @@ struct Favicons;
|
|||
fn handle_favicons(path: &str) -> HttpResponse {
|
||||
match Favicons::get(path) {
|
||||
Some(content) => {
|
||||
let body: AnyBody = match content.data {
|
||||
Cow::Borrowed(bytes) => bytes.into(),
|
||||
Cow::Owned(bytes) => bytes.into(),
|
||||
let body: BoxBody = match content.data {
|
||||
Cow::Borrowed(bytes) => BoxBody::new(bytes),
|
||||
Cow::Owned(bytes) => BoxBody::new(bytes),
|
||||
};
|
||||
|
||||
HttpResponse::Ok()
|
||||
|
@ -130,6 +131,7 @@ fn handle_favicons(path: &str) -> HttpResponse {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#[get("/{file}")]
|
||||
pub async fn favicons(path: web::Path<String>) -> impl Responder {
|
||||
debug!("searching favicons");
|
||||
|
|
|
@ -3,6 +3,7 @@ use std::sync::Arc;
|
|||
use actix_web::test;
|
||||
use actix_web::{
|
||||
dev::ServiceResponse, error::ResponseError, http::StatusCode,
|
||||
body::{EitherBody, BoxBody},
|
||||
middleware as actix_middleware,
|
||||
};
|
||||
use libmcaptcha::defense::Level;
|
||||
|
@ -85,7 +86,7 @@ pub async fn register_and_signin(
|
|||
name: &str,
|
||||
email: &str,
|
||||
password: &str,
|
||||
) -> (Arc<data::Data>, Login, ServiceResponse) {
|
||||
) -> (Arc<data::Data>, Login, ServiceResponse<EitherBody<BoxBody>>) {
|
||||
register(name, email, password).await;
|
||||
signin(name, password).await
|
||||
}
|
||||
|
@ -109,7 +110,7 @@ pub async fn register(name: &str, email: &str, password: &str) {
|
|||
}
|
||||
|
||||
/// signin util
|
||||
pub async fn signin(name: &str, password: &str) -> (Arc<Data>, Login, ServiceResponse) {
|
||||
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;
|
||||
|
||||
|
@ -172,7 +173,7 @@ pub fn get_level_data() -> CreateCaptcha {
|
|||
pub async fn add_levels_util(
|
||||
name: &str,
|
||||
password: &str,
|
||||
) -> (Arc<data::Data>, Login, ServiceResponse, 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;
|
||||
|
|
|
@ -58,7 +58,7 @@ lazy_static! {
|
|||
async fn show_widget() -> PageResult<impl Responder> {
|
||||
Ok(HttpResponse::Ok()
|
||||
.content_type("text/html; charset=utf-8")
|
||||
.body(&*INDEX_PAGE))
|
||||
.body(&**INDEX_PAGE))
|
||||
}
|
||||
|
||||
/// widget services
|
||||
|
|
Loading…
Reference in a new issue