Split giant router api function mess

This commit is contained in:
Ethan O'Brien
2026-06-11 15:47:03 -05:00
parent df83adf710
commit e631b34945
24 changed files with 701 additions and 555 deletions

View File

@@ -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!{}))
}