mock auth

This commit is contained in:
2025-11-30 17:54:58 +01:00
parent 2d0956251b
commit d38f8891f5
6 changed files with 223 additions and 0 deletions
+9
View File
@@ -7,6 +7,9 @@ pub mod items {
include!(concat!(env!("OUT_DIR"), "/items.rs"));
}
mod auth;
mod proto_utils;
#[get("/<name>")]
fn get_user(user_list: &rocket::State<Vec<items::Person>>, name: String) -> Option<items::Person> {
user_list.iter().find(|user| user.name == name).cloned()
@@ -53,6 +56,7 @@ fn rocket() -> _ {
min_players: 1,
max_players: 90,
price: 0,
remote_id: 0,
}),
would_play: true,
}],
@@ -60,7 +64,12 @@ fn rocket() -> _ {
rocket::build()
.manage(user_list)
.manage(auth::AuthState::new())
.mount("/api", routes![get_users, get_user])
.mount(
"/auth",
routes![auth::login, auth::logout, auth::get_auth_status],
)
.mount("/", routes![index_fallback])
.mount("/", FileServer::new("../frontend/dist"))
}