mirror of
https://git.ethanthesleepy.one/ethanaobrien/ew.git
synced 2025-05-13 11:37:33 -05:00
Add /api/debug/error endpoint
This commit is contained in:
parent
052b1297d6
commit
b099cbe497
3 changed files with 23 additions and 0 deletions
|
@ -9,6 +9,9 @@ use actix_web::{
|
|||
dev::Service
|
||||
};
|
||||
|
||||
#[post("/api/debug/error")]
|
||||
async fn debug_error(req: HttpRequest, body: String) -> HttpResponse { router::debug::error(req, body) }
|
||||
|
||||
#[post("/api/start")]
|
||||
async fn start_start(req: HttpRequest, body: String) -> HttpResponse { router::start::start(req, body) }
|
||||
|
||||
|
@ -104,6 +107,7 @@ async fn main() -> std::io::Result<()> {
|
|||
println!("Request: {}", req.path());
|
||||
srv.call(req)
|
||||
})
|
||||
.service(debug_error)
|
||||
.service(login_bonus)
|
||||
.service(reward)
|
||||
.service(live_guest)
|
||||
|
|
|
@ -14,3 +14,4 @@ pub mod event;
|
|||
pub mod chat;
|
||||
pub mod story;
|
||||
pub mod notice;
|
||||
pub mod debug;
|
||||
|
|
18
src/router/debug.rs
Normal file
18
src/router/debug.rs
Normal 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)
|
||||
}
|
Loading…
Add table
Reference in a new issue