mirror of
https://git.ethanthesleepy.one/ethanaobrien/ew.git
synced 2025-05-13 11:37:33 -05:00
Implement /api/serial_code/events
This commit is contained in:
parent
9dd6572ed3
commit
299e60e4d5
3 changed files with 21 additions and 0 deletions
|
@ -153,6 +153,9 @@ async fn gglrequestmigrationcode(req: HttpRequest, body: String) -> HttpResponse
|
||||||
#[post("/api/user/gglverifymigrationcode")]
|
#[post("/api/user/gglverifymigrationcode")]
|
||||||
async fn gglverifymigrationcode(req: HttpRequest, body: String) -> HttpResponse { router::user::verify_migration_code(req, body) }
|
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 {
|
async fn log_unknown_request(req: HttpRequest, body: String) -> HttpResponse {
|
||||||
if body != String::new() {
|
if body != String::new() {
|
||||||
println!("{}", encryption::decrypt_packet(&body).unwrap());
|
println!("{}", encryption::decrypt_packet(&body).unwrap());
|
||||||
|
@ -218,6 +221,7 @@ async fn main() -> std::io::Result<()> {
|
||||||
.service(migration)
|
.service(migration)
|
||||||
.service(gglrequestmigrationcode)
|
.service(gglrequestmigrationcode)
|
||||||
.service(gglverifymigrationcode)
|
.service(gglverifymigrationcode)
|
||||||
|
.service(serial_code_events)
|
||||||
.default_service(web::route().to(log_unknown_request)))
|
.default_service(web::route().to(log_unknown_request)))
|
||||||
.bind(("0.0.0.0", 8080))?
|
.bind(("0.0.0.0", 8080))?
|
||||||
.run();
|
.run();
|
||||||
|
|
|
@ -16,3 +16,4 @@ pub mod story;
|
||||||
pub mod notice;
|
pub mod notice;
|
||||||
pub mod debug;
|
pub mod debug;
|
||||||
pub mod gree;
|
pub mod gree;
|
||||||
|
pub mod serial_code;
|
||||||
|
|
16
src/router/serial_code.rs
Normal file
16
src/router/serial_code.rs
Normal 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)
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue