stuff idk

This commit is contained in:
Ethan O'Brien
2024-05-24 12:43:34 -05:00
parent 7df2f3e277
commit baa14654f5
24 changed files with 443 additions and 794 deletions

View File

@@ -27,20 +27,15 @@ fn get_asset_hash(req: &HttpRequest, body: &JsonValue) -> String {
hash.to_string()
}
pub fn asset_hash(req: HttpRequest, body: String) -> HttpResponse {
pub fn asset_hash(req: HttpRequest, body: String) -> Option<JsonValue> {
let body = json::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
let resp = object!{
"code": 0,
"server_time": global::timestamp(),
"data": {
"asset_hash": get_asset_hash(&req, &body)
}
};
global::send(resp, req)
Some(object!{
"asset_hash": get_asset_hash(&req, &body)
})
}
pub fn start(req: HttpRequest, body: String) -> HttpResponse {
pub fn start(req: HttpRequest, body: String) -> Option<JsonValue> {
let key = global::get_login(req.headers(), &body);
let body = json::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
let mut user = userdata::get_acc(&key);
@@ -51,13 +46,8 @@ pub fn start(req: HttpRequest, body: String) -> HttpResponse {
userdata::save_acc(&key, user);
let resp = object!{
"code": 0,
"server_time": global::timestamp(),
"data": {
"asset_hash": get_asset_hash(&req, &body),
"token": hex::encode("Hello") //what is this?
}
};
global::send(resp, req)
Some(object!{
"asset_hash": get_asset_hash(&req, &body),
"token": hex::encode("Hello") //what is this?
})
}