mirror of
https://git.ethanthesleepy.one/ethanaobrien/ew.git
synced 2025-05-13 11:37:33 -05:00
Implement /api/album/sif
This commit is contained in:
parent
89eaf11414
commit
f226ef41eb
3 changed files with 28 additions and 6 deletions
|
@ -174,6 +174,9 @@ async fn gglverifymigrationcode(req: HttpRequest, body: String) -> HttpResponse
|
||||||
#[get("/api/serial_code/events")]
|
#[get("/api/serial_code/events")]
|
||||||
async fn serial_code_events(req: HttpRequest) -> HttpResponse { router::serial_code::events(req) }
|
async fn serial_code_events(req: HttpRequest) -> HttpResponse { router::serial_code::events(req) }
|
||||||
|
|
||||||
|
#[get("/api/album/sif")]
|
||||||
|
async fn sif_album(req: HttpRequest) -> HttpResponse { router::user::sif(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());
|
||||||
|
@ -191,6 +194,7 @@ async fn main() -> std::io::Result<()> {
|
||||||
println!("Request: {}", req.path());
|
println!("Request: {}", req.path());
|
||||||
srv.call(req)
|
srv.call(req)
|
||||||
})
|
})
|
||||||
|
.service(sif_album)
|
||||||
.service(preset)
|
.service(preset)
|
||||||
.service(preset_get)
|
.service(preset_get)
|
||||||
.service(gree_init)
|
.service(gree_init)
|
||||||
|
|
|
@ -410,6 +410,19 @@ pub fn detail(_req: HttpRequest, body: String) -> HttpResponse {
|
||||||
global::send(resp)
|
global::send(resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn sif(req: HttpRequest) -> HttpResponse {
|
||||||
|
let key = global::get_login(req.headers(), "");
|
||||||
|
let cards = userdata::get_acc_sif(&key);
|
||||||
|
|
||||||
|
let resp = object!{
|
||||||
|
"code": 0,
|
||||||
|
"server_time": global::timestamp(),
|
||||||
|
"data": {
|
||||||
|
cards: cards
|
||||||
|
}
|
||||||
|
};
|
||||||
|
global::send(resp)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn initialize(req: HttpRequest, body: String) -> HttpResponse {
|
pub fn initialize(req: HttpRequest, body: String) -> HttpResponse {
|
||||||
let key = global::get_login(req.headers(), &body);
|
let key = global::get_login(req.headers(), &body);
|
||||||
|
|
|
@ -148,17 +148,19 @@ fn create_acc(uid: i64, login: &str) {
|
||||||
new_user["stamina"]["last_updated_time"] = global::timestamp().into();
|
new_user["stamina"]["last_updated_time"] = global::timestamp().into();
|
||||||
|
|
||||||
create_store(&format!("SELECT userhome FROM _{}_", key), &format!("CREATE TABLE _{}_ (
|
create_store(&format!("SELECT userhome FROM _{}_", key), &format!("CREATE TABLE _{}_ (
|
||||||
userdata TEXT NOT NULL,
|
userdata TEXT NOT NULL,
|
||||||
userhome TEXT NOT NULL,
|
userhome TEXT NOT NULL,
|
||||||
missions TEXT NOT NULL,
|
missions TEXT NOT NULL,
|
||||||
loginbonus TEXT NOT NULL
|
loginbonus TEXT NOT NULL,
|
||||||
|
sifcards TEXT NOT NULL
|
||||||
)", key),
|
)", key),
|
||||||
&format!("INSERT INTO _{}_ (userdata, userhome, missions, loginbonus) VALUES (?1, ?2, ?3, ?4)", key),
|
&format!("INSERT INTO _{}_ (userdata, userhome, missions, loginbonus, sifcards) VALUES (?1, ?2, ?3, ?4, ?5)", key),
|
||||||
params!(
|
params!(
|
||||||
json::stringify(new_user),
|
json::stringify(new_user),
|
||||||
include_str!("new_user_home.json"),
|
include_str!("new_user_home.json"),
|
||||||
include_str!("chat_missions.json"),
|
include_str!("chat_missions.json"),
|
||||||
format!(r#"{{"last_rewarded": 0, "bonus_list": [], "start_time": {}}}"#, global::timestamp())
|
format!(r#"{{"last_rewarded": 0, "bonus_list": [], "start_time": {}}}"#, global::timestamp()),
|
||||||
|
"[]"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -235,6 +237,9 @@ pub fn get_acc_missions(auth_key: &str) -> JsonValue {
|
||||||
pub fn get_acc_loginbonus(auth_key: &str) -> JsonValue {
|
pub fn get_acc_loginbonus(auth_key: &str) -> JsonValue {
|
||||||
get_data(auth_key, "loginbonus")
|
get_data(auth_key, "loginbonus")
|
||||||
}
|
}
|
||||||
|
pub fn get_acc_sif(auth_key: &str) -> JsonValue {
|
||||||
|
get_data(auth_key, "sifcards")
|
||||||
|
}
|
||||||
|
|
||||||
pub fn save_data(auth_key: &str, row: &str, data: JsonValue) {
|
pub fn save_data(auth_key: &str, row: &str, data: JsonValue) {
|
||||||
let key = get_key(&auth_key);
|
let key = get_key(&auth_key);
|
||||||
|
|
Loading…
Add table
Reference in a new issue