mirror of
https://git.ethanthesleepy.one/ethanaobrien/ew.git
synced 2025-05-13 11:37:33 -05:00
Cleanup gree
This commit is contained in:
parent
14d73774e3
commit
5c21bb6e2d
1 changed files with 25 additions and 98 deletions
|
@ -177,6 +177,16 @@ fn decrypt_transfer_password(password: &str) -> String {
|
||||||
String::from_utf8_lossy(&decoded).to_string()
|
String::from_utf8_lossy(&decoded).to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn send(req: HttpRequest, resp: JsonValue) -> HttpResponse {
|
||||||
|
HttpResponse::Ok()
|
||||||
|
.insert_header(ContentType::json())
|
||||||
|
.insert_header(("Expires", "-1"))
|
||||||
|
.insert_header(("Pragma", "no-cache"))
|
||||||
|
.insert_header(("Cache-Control", "must-revalidate, no-cache, no-store, private"))
|
||||||
|
.insert_header(("Vary", "Authorization,Accept-Encoding"))
|
||||||
|
.insert_header(("X-GREE-Authorization", gree_authorize(&req)))
|
||||||
|
.body(json::stringify(resp))
|
||||||
|
}
|
||||||
|
|
||||||
pub fn initialize(req: HttpRequest, body: String) -> HttpResponse {
|
pub fn initialize(req: HttpRequest, body: String) -> HttpResponse {
|
||||||
let body = json::parse(&body).unwrap();
|
let body = json::parse(&body).unwrap();
|
||||||
|
@ -189,28 +199,15 @@ pub fn initialize(req: HttpRequest, body: String) -> HttpResponse {
|
||||||
uuid: token
|
uuid: token
|
||||||
};
|
};
|
||||||
|
|
||||||
HttpResponse::Ok()
|
send(req, resp)
|
||||||
.insert_header(ContentType::json())
|
|
||||||
.insert_header(("Expires", "-1"))
|
|
||||||
.insert_header(("Pragma", "no-cache"))
|
|
||||||
.insert_header(("Cache-Control", "must-revalidate, no-cache, no-store, private"))
|
|
||||||
.insert_header(("Vary", "Authorization,Accept-Encoding"))
|
|
||||||
.insert_header(("X-GREE-Authorization", gree_authorize(&req)))
|
|
||||||
.body(json::stringify(resp))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn authorize(req: HttpRequest, _body: String) -> HttpResponse {
|
pub fn authorize(req: HttpRequest, _body: String) -> HttpResponse {
|
||||||
let resp = object!{
|
let resp = object!{
|
||||||
result: "OK"
|
result: "OK"
|
||||||
};
|
};
|
||||||
HttpResponse::Ok()
|
|
||||||
.insert_header(ContentType::json())
|
send(req, resp)
|
||||||
.insert_header(("Expires", "-1"))
|
|
||||||
.insert_header(("Pragma", "no-cache"))
|
|
||||||
.insert_header(("Cache-Control", "must-revalidate, no-cache, no-store, private"))
|
|
||||||
.insert_header(("Vary", "Authorization,Accept-Encoding"))
|
|
||||||
.insert_header(("X-GREE-Authorization", gree_authorize(&req)))
|
|
||||||
.body(json::stringify(resp))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn moderate_keyword(req: HttpRequest) -> HttpResponse {
|
pub fn moderate_keyword(req: HttpRequest) -> HttpResponse {
|
||||||
|
@ -221,27 +218,15 @@ pub fn moderate_keyword(req: HttpRequest) -> HttpResponse {
|
||||||
keywords: [{"id":"1","type":"0","keyword":"oink","rank":"0"}]
|
keywords: [{"id":"1","type":"0","keyword":"oink","rank":"0"}]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
HttpResponse::Ok()
|
|
||||||
.insert_header(ContentType::json())
|
send(req, resp)
|
||||||
.insert_header(("Expires", "-1"))
|
|
||||||
.insert_header(("Pragma", "no-cache"))
|
|
||||||
.insert_header(("Cache-Control", "must-revalidate, no-cache, no-store, private"))
|
|
||||||
.insert_header(("Vary", "Authorization,Accept-Encoding"))
|
|
||||||
.insert_header(("X-GREE-Authorization", gree_authorize(&req)))
|
|
||||||
.body(json::stringify(resp))
|
|
||||||
}
|
}
|
||||||
pub fn moderate_commit(req: HttpRequest, _body: String) -> HttpResponse {
|
pub fn moderate_commit(req: HttpRequest, _body: String) -> HttpResponse {
|
||||||
let resp = object!{
|
let resp = object!{
|
||||||
result: "OK"
|
result: "OK"
|
||||||
};
|
};
|
||||||
HttpResponse::Ok()
|
|
||||||
.insert_header(ContentType::json())
|
send(req, resp)
|
||||||
.insert_header(("Expires", "-1"))
|
|
||||||
.insert_header(("Pragma", "no-cache"))
|
|
||||||
.insert_header(("Cache-Control", "must-revalidate, no-cache, no-store, private"))
|
|
||||||
.insert_header(("Vary", "Authorization,Accept-Encoding"))
|
|
||||||
.insert_header(("X-GREE-Authorization", gree_authorize(&req)))
|
|
||||||
.body(json::stringify(resp))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn uid(req: HttpRequest) -> HttpResponse {
|
pub fn uid(req: HttpRequest) -> HttpResponse {
|
||||||
|
@ -255,10 +240,8 @@ pub fn uid(req: HttpRequest) -> HttpResponse {
|
||||||
uid = uid_str.to_string();
|
uid = uid_str.to_string();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//println!("{}", uid);
|
|
||||||
|
|
||||||
let user = userdata::get_acc(&uid);
|
let user = userdata::get_acc(&uid);
|
||||||
//println!("{}", user["user"]["id"].to_string());
|
|
||||||
|
|
||||||
let resp = object!{
|
let resp = object!{
|
||||||
result: "OK",
|
result: "OK",
|
||||||
|
@ -266,14 +249,7 @@ pub fn uid(req: HttpRequest) -> HttpResponse {
|
||||||
x_app_id: "100900301"
|
x_app_id: "100900301"
|
||||||
};
|
};
|
||||||
|
|
||||||
HttpResponse::Ok()
|
send(req, resp)
|
||||||
.insert_header(ContentType::json())
|
|
||||||
.insert_header(("Expires", "-1"))
|
|
||||||
.insert_header(("Pragma", "no-cache"))
|
|
||||||
.insert_header(("Cache-Control", "must-revalidate, no-cache, no-store, private"))
|
|
||||||
.insert_header(("Vary", "Authorization"))
|
|
||||||
.insert_header(("X-GREE-Authorization", gree_authorize(&req)))
|
|
||||||
.body(json::stringify(resp))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn payment(req: HttpRequest) -> HttpResponse {
|
pub fn payment(req: HttpRequest) -> HttpResponse {
|
||||||
|
@ -285,14 +261,7 @@ pub fn payment(req: HttpRequest) -> HttpResponse {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
HttpResponse::Ok()
|
send(req, resp)
|
||||||
.insert_header(ContentType::json())
|
|
||||||
.insert_header(("Expires", "-1"))
|
|
||||||
.insert_header(("Pragma", "no-cache"))
|
|
||||||
.insert_header(("Cache-Control", "must-revalidate, no-cache, no-store, private"))
|
|
||||||
.insert_header(("Vary", "Authorization"))
|
|
||||||
.insert_header(("X-GREE-Authorization", gree_authorize(&req)))
|
|
||||||
.body(json::stringify(resp))
|
|
||||||
}
|
}
|
||||||
pub fn payment_ticket(req: HttpRequest) -> HttpResponse {
|
pub fn payment_ticket(req: HttpRequest) -> HttpResponse {
|
||||||
let resp = object!{
|
let resp = object!{
|
||||||
|
@ -300,14 +269,7 @@ pub fn payment_ticket(req: HttpRequest) -> HttpResponse {
|
||||||
entry: []
|
entry: []
|
||||||
};
|
};
|
||||||
|
|
||||||
HttpResponse::Ok()
|
send(req, resp)
|
||||||
.insert_header(ContentType::json())
|
|
||||||
.insert_header(("Expires", "-1"))
|
|
||||||
.insert_header(("Pragma", "no-cache"))
|
|
||||||
.insert_header(("Cache-Control", "must-revalidate, no-cache, no-store, private"))
|
|
||||||
.insert_header(("Vary", "Authorization"))
|
|
||||||
.insert_header(("X-GREE-Authorization", gree_authorize(&req)))
|
|
||||||
.body(json::stringify(resp))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn migration_verify(req: HttpRequest, body: String) -> HttpResponse {
|
pub fn migration_verify(req: HttpRequest, body: String) -> HttpResponse {
|
||||||
|
@ -337,14 +299,7 @@ pub fn migration_verify(req: HttpRequest, body: String) -> HttpResponse {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpResponse::Ok()
|
send(req, resp)
|
||||||
.insert_header(ContentType::json())
|
|
||||||
.insert_header(("Expires", "-1"))
|
|
||||||
.insert_header(("Pragma", "no-cache"))
|
|
||||||
.insert_header(("Cache-Control", "must-revalidate, no-cache, no-store, private"))
|
|
||||||
.insert_header(("Vary", "Authorization"))
|
|
||||||
.insert_header(("X-GREE-Authorization", gree_authorize(&req)))
|
|
||||||
.body(json::stringify(resp))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn migration(req: HttpRequest, body: String) -> HttpResponse {
|
pub fn migration(req: HttpRequest, body: String) -> HttpResponse {
|
||||||
|
@ -362,14 +317,7 @@ pub fn migration(req: HttpRequest, body: String) -> HttpResponse {
|
||||||
result: "OK"
|
result: "OK"
|
||||||
};
|
};
|
||||||
|
|
||||||
HttpResponse::Ok()
|
send(req, resp)
|
||||||
.insert_header(ContentType::json())
|
|
||||||
.insert_header(("Expires", "-1"))
|
|
||||||
.insert_header(("Pragma", "no-cache"))
|
|
||||||
.insert_header(("Cache-Control", "must-revalidate, no-cache, no-store, private"))
|
|
||||||
.insert_header(("Vary", "Authorization"))
|
|
||||||
.insert_header(("X-GREE-Authorization", gree_authorize(&req)))
|
|
||||||
.body(json::stringify(resp))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn balance(req: HttpRequest) -> HttpResponse {
|
pub fn balance(req: HttpRequest) -> HttpResponse {
|
||||||
|
@ -395,14 +343,7 @@ pub fn balance(req: HttpRequest) -> HttpResponse {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
HttpResponse::Ok()
|
send(req, resp)
|
||||||
.insert_header(ContentType::json())
|
|
||||||
.insert_header(("Expires", "-1"))
|
|
||||||
.insert_header(("Pragma", "no-cache"))
|
|
||||||
.insert_header(("Cache-Control", "must-revalidate, no-cache, no-store, private"))
|
|
||||||
.insert_header(("Vary", "Authorization"))
|
|
||||||
.insert_header(("X-GREE-Authorization", gree_authorize(&req)))
|
|
||||||
.body(json::stringify(resp))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn migration_code(req: HttpRequest) -> HttpResponse {
|
pub fn migration_code(req: HttpRequest) -> HttpResponse {
|
||||||
|
@ -424,14 +365,7 @@ pub fn migration_code(req: HttpRequest) -> HttpResponse {
|
||||||
migration_code: uid_to_code(user["user"]["id"].to_string())
|
migration_code: uid_to_code(user["user"]["id"].to_string())
|
||||||
};
|
};
|
||||||
|
|
||||||
HttpResponse::Ok()
|
send(req, resp)
|
||||||
.insert_header(ContentType::json())
|
|
||||||
.insert_header(("Expires", "-1"))
|
|
||||||
.insert_header(("Pragma", "no-cache"))
|
|
||||||
.insert_header(("Cache-Control", "must-revalidate, no-cache, no-store, private"))
|
|
||||||
.insert_header(("Vary", "Authorization"))
|
|
||||||
.insert_header(("X-GREE-Authorization", gree_authorize(&req)))
|
|
||||||
.body(json::stringify(resp))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn migration_password_register(req: HttpRequest, body: String) -> HttpResponse {
|
pub fn migration_password_register(req: HttpRequest, body: String) -> HttpResponse {
|
||||||
|
@ -457,14 +391,7 @@ pub fn migration_password_register(req: HttpRequest, body: String) -> HttpRespon
|
||||||
result: "OK"
|
result: "OK"
|
||||||
};
|
};
|
||||||
|
|
||||||
HttpResponse::Ok()
|
send(req, resp)
|
||||||
.insert_header(ContentType::json())
|
|
||||||
.insert_header(("Expires", "-1"))
|
|
||||||
.insert_header(("Pragma", "no-cache"))
|
|
||||||
.insert_header(("Cache-Control", "must-revalidate, no-cache, no-store, private"))
|
|
||||||
.insert_header(("Vary", "Authorization"))
|
|
||||||
.insert_header(("X-GREE-Authorization", gree_authorize(&req)))
|
|
||||||
.body(json::stringify(resp))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue