gameconfig parsing correctly
This commit is contained in:
parent
99eb044062
commit
3f4b281841
@ -60,6 +60,7 @@ async fn basicinfo() -> HttpResponse {
|
||||
|
||||
#[get("/alive/{id}/Alive.txt")]
|
||||
async fn alive(id: web::Path<String>, req: actix_web::HttpRequest) -> HttpResponse {
|
||||
println!("{}",format!("[+] Game started!").green());
|
||||
resp!("")
|
||||
}
|
||||
|
||||
@ -85,7 +86,7 @@ async fn shop() -> HttpResponse {
|
||||
|
||||
#[post("/service/respone/respone.php")]
|
||||
async fn respone() -> HttpResponse {
|
||||
println!("[+] Machine started nesys service!");
|
||||
println!("{}",format!("[+] Nesys service started!").green());
|
||||
resp!("1")
|
||||
}
|
||||
|
||||
@ -124,6 +125,7 @@ pub struct Certify {
|
||||
|
||||
#[get("/server/certify.php")]
|
||||
async fn certify() -> HttpResponse {
|
||||
println!("{}",format!("[+] Certificates validated!").green());
|
||||
//async fn certify(data: web::Query<Certify>, req: HttpRequest) -> HttpResponse {
|
||||
/*
|
||||
dbg!(&data);
|
||||
|
@ -37,18 +37,24 @@ struct Terminal {
|
||||
terminal_attrib: i32,
|
||||
terminal_id: String,
|
||||
}
|
||||
|
||||
fn clean_json_string(input: &str) -> String {
|
||||
// Remove whitespace characters, including line breaks and extra spaces
|
||||
let cleaned_str = input
|
||||
.chars()
|
||||
.filter(|c| !c.is_control() || c == &'\n' || c == &'\r')
|
||||
.collect();
|
||||
cleaned_str
|
||||
}
|
||||
#[post("/game")]
|
||||
pub async fn game_stuff(body: web::Bytes, req: actix_web::HttpRequest) -> HttpResponse {
|
||||
// For getting the game online, we need to give it a json type encrypted!
|
||||
let ct = String::from_utf8_lossy(&body).trim().replace("\n", "").replace("\0", "");
|
||||
let ct = String::from_utf8_lossy(&body).trim().replace("\n", "").replace("\0", "").replace("\r","").replace("\t","");
|
||||
println!("{}",format!("Ciphertext:").black().on_red());
|
||||
println!("{}", &ct.red());
|
||||
println!("{}",format!("Plaintext:").black().on_green());
|
||||
let pt = aes_dec(&body);
|
||||
let cleaned = &pt.trim().replace("\n", "").replace("\0", "").replace("\r", "");
|
||||
let cleaned = clean_json_string(&pt).replace("\n","");
|
||||
println!("{}", &cleaned.green());
|
||||
|
||||
// Given the plaintext of the request body
|
||||
// Attempt to deserialize the JSON into your custom struct
|
||||
match serde_json::from_str::<GameData>(&cleaned) {
|
||||
@ -65,5 +71,4 @@ pub async fn game_stuff(body: web::Bytes, req: actix_web::HttpRequest) -> HttpRe
|
||||
return resp!("");
|
||||
}
|
||||
}
|
||||
// }
|
||||
https://github.com/BocuD/LLServer/blob/2ab726cc298c613b5fa3d046ed95267c04486fd1/LLServer/Controllers/Game/GameController.cs
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user