mirror of
https://git.ethanthesleepy.one/ethanaobrien/ew
synced 2026-07-14 09:42:17 +08:00
Split giant router api function mess
This commit is contained in:
@@ -1,12 +1,17 @@
|
||||
use jzon::{JsonValue, object};
|
||||
use actix_web::{HttpRequest};
|
||||
use jzon::object;
|
||||
use actix_web::{web, HttpRequest, Responder};
|
||||
|
||||
use crate::encryption;
|
||||
use crate::router::global;
|
||||
|
||||
pub fn error(_req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
|
||||
println!("client error: {}", body["code"]);
|
||||
|
||||
Some(object!{})
|
||||
pub fn routes(cfg: &mut web::ServiceConfig) {
|
||||
cfg.route("/debug/error", web::post().to(error));
|
||||
}
|
||||
|
||||
async fn error(req: HttpRequest, body: String) -> impl Responder {
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
|
||||
println!("client error: {}", body["code"]);
|
||||
|
||||
global::api(&req, Some(object!{}))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user