Add /api/debug/error endpoint

This commit is contained in:
Ethan O'Brien
2024-03-28 11:11:48 -05:00
parent 052b1297d6
commit b099cbe497
3 changed files with 23 additions and 0 deletions

18
src/router/debug.rs Normal file
View File

@ -0,0 +1,18 @@
use json;
use json::{object};
use crate::router::global;
use crate::encryption;
use actix_web::{HttpResponse, HttpRequest};
pub fn error(_req: HttpRequest, body: String) -> HttpResponse {
let body = json::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
println!("client error: {}", body["code"]);
let resp = object!{
"code": 4,
"server_time": global::timestamp(),
"message": ""
};
global::send(resp)
}