mirror of
https://github.com/uqbar-dao/nectar.git
synced 2024-12-29 19:41:39 +03:00
Merge branch 'main' into hf/towards-a-working-spawn
This commit is contained in:
commit
1c8ae26c6d
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user