Several updates and fixes

- Removed all `thread::sleep` and use `tokio::time::sleep` now.
  This solves an issue with updating to Bullseye ( Resolves #1998 )
- Updated all Debian images to Bullseye
- Added MiMalloc feature and enabled it by default for Alpine based images
  This increases performance for the Alpine images because the default
  memory allocator for MUSL based binaries isn't that fast
- Updated `dotenv` to `dotenvy` a maintained and updated fork
- Fixed an issue with a newer jslib (not fully released yet)
  That version uses a different endpoint for `prelogin` Resolves #2378 )
This commit is contained in:
BlackDex
2022-03-20 18:51:24 +01:00
parent 8d06d9c111
commit b0faaf2527
27 changed files with 197 additions and 99 deletions

View File

@@ -9,8 +9,9 @@ use serde_json::Value;
use crate::{
api::{
core::accounts::{PreloginData, _prelogin},
core::two_factor::{duo, email, email::EmailTokenData, yubikey},
ApiResult, EmptyResult, JsonResult,
ApiResult, EmptyResult, JsonResult, JsonUpcase,
},
auth::ClientIp,
db::{models::*, DbConn},
@@ -19,7 +20,7 @@ use crate::{
};
pub fn routes() -> Vec<Route> {
routes![login]
routes![login, prelogin]
}
#[post("/connect/token", data = "<data>")]
@@ -449,6 +450,11 @@ async fn _json_err_twofactor(providers: &[i32], user_uuid: &str, conn: &DbConn)
Ok(result)
}
#[post("/accounts/prelogin", data = "<data>")]
async fn prelogin(data: JsonUpcase<PreloginData>, conn: DbConn) -> Json<Value> {
_prelogin(data, conn).await
}
// https://github.com/bitwarden/jslib/blob/master/common/src/models/request/tokenRequest.ts
// https://github.com/bitwarden/mobile/blob/master/src/Core/Models/Request/TokenRequest.cs
#[derive(Debug, Clone, Default, FromForm)]