worked on the api abit, nearly finished with choice implementation

This commit is contained in:
2026-05-08 23:13:33 +01:00
parent 1d2966a494
commit 7175f2a776
4 changed files with 11 additions and 4 deletions
BIN
View File
Binary file not shown.
Binary file not shown.
+3 -1
View File
@@ -72,9 +72,11 @@ pub async fn api_process
.map(|index: usize, tx_handle: Sender<(bool,usize)>| {
debug!("Choice: {}", index);
let _ = tx_handle.send((true,index));
let reply = "ack";
warp::reply::json(&reply)
}).boxed();
let routes = main.or(characters);
let routes = main.or(characters).or(choice);
// Start the server
warp::serve(routes)
.run(([127, 0, 0, 1],config::API_PORT))
+8 -3
View File
@@ -62,11 +62,16 @@ pub async fn token_parse(
},
"choice" =>
{
index += match choice_parse(index+1, &tokens, &data_to_send).await
let (_,jump_points) = match choice_parse(index+1, &tokens, &data_to_send).await
{
Ok(increment) => increment,
Ok((increment,jump_point)) => (increment,jump_point),
Err(error) => return Err(error),
}
};
if rx.recv().is_err() { warn!("Error sending choices to client"); };
let (_, choice) = rx.recv().unwrap(); // TODO eh
index = jump_points[choice];
debug!("{:?} {} {}",jump_points, choice, index);
continue
}
_ =>
{