mirror of
https://git.ethanthesleepy.one/ethanaobrien/ew
synced 2026-08-27 15:32:17 +08:00
Move response encryption handler to a response handler
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use jzon::{object, array, JsonValue};
|
||||
use actix_web::{web, HttpRequest, Responder};
|
||||
use actix_web::{web, Responder};
|
||||
|
||||
use crate::router::{global, items, userdata, databases, Login, Session};
|
||||
use crate::router::{global, items, userdata, databases, Login, Session, Api};
|
||||
|
||||
pub fn routes(cfg: &mut web::ServiceConfig) {
|
||||
cfg.service(
|
||||
@@ -37,7 +37,7 @@ pub fn add_chat_from_chapter_id(chapter_id: i64, chats: &mut JsonValue) -> bool
|
||||
add_chat(chapter["masterChatId"].as_i64().unwrap(), chapter["roomId"].as_i64().unwrap(), chats)
|
||||
}
|
||||
|
||||
async fn home(req: HttpRequest, Login(key): Login) -> impl Responder {
|
||||
async fn home(Login(key): Login) -> impl Responder {
|
||||
let chats = userdata::get_acc_chats(&key);
|
||||
|
||||
let mut rooms = array![];
|
||||
@@ -45,7 +45,7 @@ async fn home(req: HttpRequest, Login(key): Login) -> impl Responder {
|
||||
rooms.push(databases::CHATS[data["chat_id"].to_string()][data["room_id"].to_string()]["id"].clone()).unwrap();
|
||||
}
|
||||
|
||||
global::api(&req, Some(object!{
|
||||
Api(Some(object!{
|
||||
"progress_list": chats,
|
||||
"master_chat_room_ids": rooms,
|
||||
"master_chat_stamp_ids": [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,43,44,45,46,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,11001003,22001001,33001001,44001002],
|
||||
@@ -53,11 +53,11 @@ async fn home(req: HttpRequest, Login(key): Login) -> impl Responder {
|
||||
}))
|
||||
}
|
||||
|
||||
async fn start(req: HttpRequest) -> impl Responder {
|
||||
global::api(&req, Some(object!{"select_talk_id_list":[],"get_item_list":[],"is_read":0}))
|
||||
async fn start() -> impl Responder {
|
||||
Api(Some(object!{"select_talk_id_list":[],"get_item_list":[],"is_read":0}))
|
||||
}
|
||||
|
||||
async fn end(req: HttpRequest, Session { key, body }: Session) -> impl Responder {
|
||||
async fn end(Session { key, body }: Session) -> impl Responder {
|
||||
let mut missions = userdata::get_acc_missions(&key);
|
||||
let mut chats = userdata::get_acc_chats(&key);
|
||||
|
||||
@@ -73,5 +73,5 @@ async fn end(req: HttpRequest, Session { key, body }: Session) -> impl Responder
|
||||
}
|
||||
}
|
||||
|
||||
global::api(&req, Some(array![]))
|
||||
Api(Some(array![]))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user