Implement needed handlers to get to the initial download

`/api/start`
`/api/dummy/login`
`/apt/user`
`/api/purchase`
This commit is contained in:
Ethan O'Brien
2024-02-23 13:28:44 -06:00
parent f48ae94c0e
commit 9ce5f9bd42
12 changed files with 740 additions and 1 deletions

20
src/router/user.rs Normal file
View File

@ -0,0 +1,20 @@
use json;
use json::object;
use crate::router::global;
use actix_web::{HttpResponse, HttpRequest, http::header::HeaderValue};
use crate::router::userdata;
pub fn user(req: HttpRequest) -> HttpResponse {
let blank_header = HeaderValue::from_static("");
let key = req.headers().get("a6573cbe").unwrap_or(&blank_header).to_str().unwrap_or("");
let uid = req.headers().get("aoharu-user-id").unwrap_or(&blank_header).to_str().unwrap_or("");
let user = userdata::get_acc(key, uid);
let resp = object!{
"code": 0,
"server_time": global::timestamp(),
"data": user
};
global::send(resp)
}