Merge branch 'main' into hf/towards-a-working-spawn

This commit is contained in:
dr-frmr 2023-10-12 14:12:40 -04:00
commit 1c8ae26c6d
No known key found for this signature in database

View File

@ -171,23 +171,19 @@ pub async fn login(
port: u16,
) {
let login_page = include_str!("login.html");
let redirect_to_login =
warp::path::end().map(|| warp::redirect(warp::http::Uri::from_static("/login")));
let routes = warp::path("login")
.and(
// 1. serve login.html right here
warp::get()
.map(move || warp::reply::html(login_page))
// 2. await a single POST
// - password
.or(warp::post()
.and(warp::body::content_length_limit(1024 * 16))
.and(warp::body::json())
.and(warp::any().map(move || keyfile.clone()))
.and(warp::any().map(move || tx.clone()))
.and_then(handle_password)),
)
.or(redirect_to_login);
let routes = warp::path("login").and(
// 1. serve login.html right here
warp::get()
.map(move || warp::reply::html(login_page))
// 2. await a single POST
// - password
.or(warp::post()
.and(warp::body::content_length_limit(1024 * 16))
.and(warp::body::json())
.and(warp::any().map(move || keyfile.clone()))
.and(warp::any().map(move || tx.clone()))
.and_then(handle_password)),
);
let _ = open::that(format!("http://localhost:{}/login", port));
warp::serve(routes)