mirror of
https://git.ethanthesleepy.one/ethanaobrien/ew.git
synced 2025-05-13 11:37:33 -05:00
Add 5 second serial code cooldown
This commit is contained in:
parent
e0ba14c686
commit
38f1aa6f82
1 changed files with 14 additions and 0 deletions
|
@ -19,6 +19,20 @@ pub fn serial_code(req: HttpRequest, body: String) -> HttpResponse {
|
||||||
let key = global::get_login(req.headers(), &body);
|
let key = global::get_login(req.headers(), &body);
|
||||||
let body = json::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
let body = json::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||||
let mut user = userdata::get_acc_home(&key);
|
let mut user = userdata::get_acc_home(&key);
|
||||||
|
let mut data = userdata::get_server_data(&key);
|
||||||
|
|
||||||
|
if data["last_serial_code"].as_u64().unwrap_or(0) + 5 > global::timestamp() {
|
||||||
|
let resp = object!{
|
||||||
|
"code": 0,
|
||||||
|
"server_time": global::timestamp(),
|
||||||
|
"data": {
|
||||||
|
"result_code": 3
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return global::send(resp, req);
|
||||||
|
}
|
||||||
|
data["last_serial_code"] = global::timestamp().into();
|
||||||
|
userdata::save_server_data(&key, data);
|
||||||
|
|
||||||
let itemz;
|
let itemz;
|
||||||
if body["input_code"].to_string() == "SIF2REVIVALREAL!" {
|
if body["input_code"].to_string() == "SIF2REVIVALREAL!" {
|
||||||
|
|
Loading…
Add table
Reference in a new issue