Implement /api/serial_code/events

This commit is contained in:
Ethan O'Brien 2024-04-08 15:34:19 -05:00
parent 9dd6572ed3
commit 299e60e4d5
3 changed files with 21 additions and 0 deletions

View file

@ -153,6 +153,9 @@ async fn gglrequestmigrationcode(req: HttpRequest, body: String) -> HttpResponse
#[post("/api/user/gglverifymigrationcode")]
async fn gglverifymigrationcode(req: HttpRequest, body: String) -> HttpResponse { router::user::verify_migration_code(req, body) }
#[get("/api/serial_code/events")]
async fn serial_code_events(req: HttpRequest) -> HttpResponse { router::serial_code::events(req) }
async fn log_unknown_request(req: HttpRequest, body: String) -> HttpResponse {
if body != String::new() {
println!("{}", encryption::decrypt_packet(&body).unwrap());
@ -218,6 +221,7 @@ async fn main() -> std::io::Result<()> {
.service(migration)
.service(gglrequestmigrationcode)
.service(gglverifymigrationcode)
.service(serial_code_events)
.default_service(web::route().to(log_unknown_request)))
.bind(("0.0.0.0", 8080))?
.run();

View file

@ -16,3 +16,4 @@ pub mod story;
pub mod notice;
pub mod debug;
pub mod gree;
pub mod serial_code;

16
src/router/serial_code.rs Normal file
View file

@ -0,0 +1,16 @@
use json;
use json::object;
use crate::router::global;
use actix_web::{HttpResponse, HttpRequest};
pub fn events(_req: HttpRequest) -> HttpResponse {
let resp = object!{
"code": 0,
"server_time": global::timestamp(),
"data": {
"serial_code_list": []
}
};
global::send(resp)
}