From 8f5f32a17ec0e8bf6a75a612c369a0c67d7e4bf5 Mon Sep 17 00:00:00 2001 From: Ethan O'Brien <77750390+ethanaobrien@users.noreply.github.com> Date: Sat, 4 May 2024 14:59:33 -0500 Subject: [PATCH] Cleanup imports --- src/main.rs | 1 + src/router/card.rs | 5 +- src/router/chat.rs | 5 +- src/router/clear_rate.rs | 5 +- src/router/debug.rs | 6 +- src/router/event.rs | 5 +- src/router/exchange.rs | 7 +- src/router/friend.rs | 3 +- src/router/global.rs | 7 +- src/router/gree.rs | 14 +-- src/router/home.rs | 5 +- src/router/live.rs | 9 +- src/router/login.rs | 11 +- src/router/lottery/mod.rs | 8 +- src/router/mission.rs | 5 +- src/router/notice.rs | 4 +- src/router/purchase.rs | 242 +------------------------------------ src/router/serial_code.rs | 5 +- src/router/shop.rs | 9 +- src/router/start.rs | 43 ++----- src/router/story.rs | 7 +- src/router/tutorial.rs | 7 +- src/router/user.rs | 7 +- src/router/userdata/mod.rs | 3 +- src/router/webui.rs | 8 +- src/sql.rs | 1 + 26 files changed, 89 insertions(+), 343 deletions(-) diff --git a/src/main.rs b/src/main.rs index 027846a..ec4d37b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,7 @@ mod encryption; mod router; mod sql; + use json::object; use actix_web::{ App, diff --git a/src/router/card.rs b/src/router/card.rs index f63a3f4..e7e2902 100644 --- a/src/router/card.rs +++ b/src/router/card.rs @@ -1,8 +1,9 @@ use json::{object, array, JsonValue}; +use actix_web::{HttpResponse, HttpRequest}; + +use crate::router::userdata; use crate::router::global; use crate::encryption; -use actix_web::{HttpResponse, HttpRequest}; -use crate::router::userdata; fn do_reinforce(user: &mut JsonValue, body: &JsonValue, exp_id: &str, money_multiplier: i64, evolve: bool) -> JsonValue { for (i, data) in user["card_list"].members().enumerate() { diff --git a/src/router/chat.rs b/src/router/chat.rs index 192ba90..0b8f6eb 100644 --- a/src/router/chat.rs +++ b/src/router/chat.rs @@ -1,9 +1,8 @@ -use json; use json::object; -use crate::router::global; -//use crate::encryption; use actix_web::{HttpResponse, HttpRequest}; + use crate::router::userdata; +use crate::router::global; pub fn home(req: HttpRequest, body: String) -> HttpResponse { let key = global::get_login(req.headers(), &body); diff --git a/src/router/clear_rate.rs b/src/router/clear_rate.rs index 1253738..a0b5bdb 100644 --- a/src/router/clear_rate.rs +++ b/src/router/clear_rate.rs @@ -1,12 +1,13 @@ use json::{object, array, JsonValue}; -use crate::router::global; use actix_web::{HttpResponse, HttpRequest}; use rusqlite::params; use std::sync::Mutex; -use lazy_static::lazy_static; use std::thread; +use lazy_static::lazy_static; + use crate::encryption; use crate::sql::SQLite; +use crate::router::global; lazy_static! { static ref DATABASE: SQLite = SQLite::new("live_statistics.db", setup_tables); diff --git a/src/router/debug.rs b/src/router/debug.rs index 0f28e38..502e752 100644 --- a/src/router/debug.rs +++ b/src/router/debug.rs @@ -1,8 +1,8 @@ -use json; -use json::{object}; +use json::object; +use actix_web::{HttpResponse, HttpRequest}; + use crate::router::global; use crate::encryption; -use actix_web::{HttpResponse, HttpRequest}; pub fn error(_req: HttpRequest, body: String) -> HttpResponse { let body = json::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap(); diff --git a/src/router/event.rs b/src/router/event.rs index 91abc8c..ce0fe6d 100644 --- a/src/router/event.rs +++ b/src/router/event.rs @@ -1,8 +1,7 @@ -use json; use json::object; -use crate::router::global; use actix_web::{HttpResponse, HttpRequest}; -//use crate::router::userdata; + +use crate::router::global; pub fn event(_req: HttpRequest, _body: String) -> HttpResponse { diff --git a/src/router/exchange.rs b/src/router/exchange.rs index cba90bd..80ef580 100644 --- a/src/router/exchange.rs +++ b/src/router/exchange.rs @@ -1,10 +1,11 @@ -use crate::encryption; use json::{JsonValue, object}; -use crate::router::global; -use crate::router::userdata; use actix_web::{HttpResponse, HttpRequest}; use lazy_static::lazy_static; +use crate::router::global; +use crate::router::userdata; +use crate::encryption; + lazy_static! { static ref EXCHANGE_LIST: JsonValue = { let mut info = object!{}; diff --git a/src/router/friend.rs b/src/router/friend.rs index c451ee6..5c8951c 100644 --- a/src/router/friend.rs +++ b/src/router/friend.rs @@ -1,8 +1,9 @@ use json::{object, array}; -use crate::router::global; use actix_web::{HttpResponse, HttpRequest}; + use crate::router::userdata; use crate::encryption; +use crate::router::global; pub fn friend(req: HttpRequest, body: String) -> HttpResponse { let key = global::get_login(req.headers(), &body); diff --git a/src/router/global.rs b/src/router/global.rs index 9244929..dd98718 100644 --- a/src/router/global.rs +++ b/src/router/global.rs @@ -1,17 +1,18 @@ use json::{object, JsonValue, array}; -use crate::encryption; use actix_web::{ HttpResponse, http::header::{HeaderValue, HeaderMap} }; -use crate::router::gree; use std::time::{SystemTime, UNIX_EPOCH}; use base64::{Engine as _, engine::general_purpose}; -use crate::router::userdata; use lazy_static::lazy_static; use rand::Rng; use uuid::Uuid; +use crate::encryption; +use crate::router::userdata; +use crate::router::gree; + pub const ASSET_VERSION: &str = "cb87bc1468c8631a262ff65b2960470b"; pub const ASSET_HASH_ANDROID: &str = "4715e873031ae4abc3c625e2bd8c935b"; pub const ASSET_HASH_IOS: &str = "466d4616d14a8d8a842de06426e084c2"; diff --git a/src/router/gree.rs b/src/router/gree.rs index 0ec3c29..32a15d1 100644 --- a/src/router/gree.rs +++ b/src/router/gree.rs @@ -1,5 +1,4 @@ -use crate::router::global; -use actix_web::{HttpResponse, HttpRequest, http::header::HeaderValue, http::header::ContentType, http::header::HeaderMap}; +use actix_web::{HttpResponse, HttpRequest, http::header::{HeaderValue, ContentType, HeaderMap}}; use base64::{Engine as _, engine::general_purpose}; use std::collections::HashMap; use std::env; @@ -7,11 +6,6 @@ use sha1::Sha1; use substring::Substring; use json::{object, JsonValue}; use hmac::{Hmac, Mac}; -use crate::router::userdata; -use crate::encryption; -use crate::router::user::{code_to_uid, uid_to_code}; -use crate::sql::SQLite; - use rusqlite::params; use lazy_static::lazy_static; @@ -20,6 +14,12 @@ use openssl::rsa::Rsa; use openssl::hash::MessageDigest; use openssl::sign::Verifier; +use crate::router::global; +use crate::router::userdata; +use crate::encryption; +use crate::router::user::{code_to_uid, uid_to_code}; +use crate::sql::SQLite; + lazy_static! { static ref DATABASE: SQLite = SQLite::new("gree.db", setup_tables); } diff --git a/src/router/home.rs b/src/router/home.rs index 41ec7e5..3968b58 100644 --- a/src/router/home.rs +++ b/src/router/home.rs @@ -1,8 +1,9 @@ use json::{object, array, JsonValue}; +use actix_web::{HttpResponse, HttpRequest}; + +use crate::router::userdata; use crate::router::global; use crate::encryption; -use actix_web::{HttpResponse, HttpRequest}; -use crate::router::userdata; pub fn preset(req: HttpRequest, body: String) -> HttpResponse { let key = global::get_login(req.headers(), &body); diff --git a/src/router/live.rs b/src/router/live.rs index 8de1d3f..413cd8e 100644 --- a/src/router/live.rs +++ b/src/router/live.rs @@ -1,11 +1,12 @@ use json::{object, array, JsonValue}; +use actix_web::{HttpResponse, HttpRequest}; +use rand::Rng; +use lazy_static::lazy_static; + use crate::router::global; use crate::encryption; -use actix_web::{HttpResponse, HttpRequest}; -use crate::router::userdata; -use rand::Rng; use crate::router::clear_rate::live_completed; -use lazy_static::lazy_static; +use crate::router::userdata; pub fn retire(_req: HttpRequest, body: String) -> HttpResponse { let body = json::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap(); diff --git a/src/router/login.rs b/src/router/login.rs index b822749..ecc5b78 100644 --- a/src/router/login.rs +++ b/src/router/login.rs @@ -1,14 +1,11 @@ -use json; use json::{object, array, JsonValue}; -use crate::router::global; -//use crate::encryption; use actix_web::{HttpResponse, HttpRequest}; -use crate::router::userdata; use lazy_static::lazy_static; -//First time login handler +use crate::router::global; +use crate::router::userdata; + pub fn dummy(req: HttpRequest, body: String) -> HttpResponse { - //let body = json::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap(); let key = global::get_login(req.headers(), &body); let user = userdata::get_acc(&key); @@ -54,7 +51,6 @@ pub fn get_login_bonus_info(id: i64) -> JsonValue { } pub fn bonus(req: HttpRequest, body: String) -> HttpResponse { - //let body = json::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap(); let key = global::get_login(req.headers(), &body); let user = userdata::get_acc(&key); let mut user_home = userdata::get_acc_home(&key); @@ -92,7 +88,6 @@ pub fn bonus(req: HttpRequest, body: String) -> HttpResponse { } else { to_send = array![]; } - // println!("{}", json::stringify(to_send.clone())); userdata::save_acc_home(&key, user_home); diff --git a/src/router/lottery/mod.rs b/src/router/lottery/mod.rs index 6e84714..a5339cd 100644 --- a/src/router/lottery/mod.rs +++ b/src/router/lottery/mod.rs @@ -1,12 +1,12 @@ -use json; use json::{array, object, JsonValue}; -use crate::router::global; -use crate::encryption; use actix_web::{HttpResponse, HttpRequest}; -use crate::router::userdata; use lazy_static::lazy_static; use rand::Rng; +use crate::router::global; +use crate::encryption; +use crate::router::userdata; + lazy_static! { static ref CARDS: JsonValue = { let mut cardz = object!{}; diff --git a/src/router/mission.rs b/src/router/mission.rs index 38d7586..6779b90 100644 --- a/src/router/mission.rs +++ b/src/router/mission.rs @@ -1,8 +1,7 @@ -use json; use json::object; -use crate::router::global; use actix_web::{HttpResponse, HttpRequest}; -use crate::router::userdata; + +use crate::router::{global, userdata}; use crate::encryption; pub fn mission(req: HttpRequest) -> HttpResponse { diff --git a/src/router/notice.rs b/src/router/notice.rs index 2a966a9..5bce3aa 100644 --- a/src/router/notice.rs +++ b/src/router/notice.rs @@ -1,8 +1,8 @@ -use json; use json::object; -use crate::router::global; use actix_web::{HttpResponse, HttpRequest}; +use crate::router::global; + //todo pub fn reward(_req: HttpRequest) -> HttpResponse { diff --git a/src/router/purchase.rs b/src/router/purchase.rs index 151a0ec..a17faf1 100644 --- a/src/router/purchase.rs +++ b/src/router/purchase.rs @@ -1,10 +1,9 @@ -use json; use json::object; -use crate::router::global; use actix_web::{HttpResponse, HttpRequest}; +use crate::router::global; + pub fn purchase(_req: HttpRequest) -> HttpResponse { - let resp = object!{ "code": 0, "server_time": global::timestamp(), @@ -38,240 +37,3 @@ pub fn purchase(_req: HttpRequest) -> HttpResponse { }; global::send(resp) } - -/* -resp.data = { - "product_list": [ - { - "product_id": "com.bushiroad.global.lovelive.sif2.google.promo.4199", - "name": "6000 Love Gems", - "description": "6000 Paid Love Gems", - "thumbnail_url": null, - "charge_gem": 6000, - "free_gem": 0, - "campaign_type": 2, - "campaign_mode": 5, - "priority": 1, - "price": "34.99", - "currency_code": "USD", - "formatted_price": "USD$34.99", - "consumable": 0, - "limited_count": 2, - "product_type": 0, - "amenity_label": null, - "ticket_valid_days": null, - "ticket_issuing_gem": null, - "start_datetime": "2024-02-01 00:00:00", - "end_datetime": "2024-02-29 23:59:59", - "total_gem": 6000 - }, - { - "product_id": "com.bushiroad.global.lovelive.sif2.google.promo.8499", - "name": "13000 Love Gems", - "description": "13000 Paid Love Gems", - "thumbnail_url": null, - "charge_gem": 13000, - "free_gem": 0, - "campaign_type": 2, - "campaign_mode": 5, - "priority": 2, - "price": "69.99", - "currency_code": "USD", - "formatted_price": "USD$69.99", - "consumable": 0, - "limited_count": 2, - "product_type": 0, - "amenity_label": null, - "ticket_valid_days": null, - "ticket_issuing_gem": null, - "start_datetime": "2024-02-01 00:00:00", - "end_datetime": "2024-02-29 23:59:59", - "total_gem": 13000 - }, - { - "product_id": "com.bushiroad.global.lovelive.sif2.google.gem.299", - "name": "140 Love Gems", - "description": "140 Paid Love Gems", - "thumbnail_url": null, - "charge_gem": 140, - "free_gem": 0, - "campaign_type": 0, - "campaign_mode": 0, - "priority": 11, - "price": "0.99", - "currency_code": "USD", - "formatted_price": "USD$0.99", - "consumable": 1, - "limited_count": 0, - "product_type": 0, - "amenity_label": null, - "ticket_valid_days": null, - "ticket_issuing_gem": null, - "start_datetime": null, - "end_datetime": null, - "total_gem": 140 - }, - { - "product_id": "com.bushiroad.global.lovelive.sif2.google.gem.499", - "name": "430 Love Gems", - "description": "420 Paid Love Gems + 10 Free LoveGems", - "thumbnail_url": null, - "charge_gem": 420, - "free_gem": 10, - "campaign_type": 0, - "campaign_mode": 0, - "priority": 12, - "price": "2.99", - "currency_code": "USD", - "formatted_price": "USD$2.99", - "consumable": 1, - "limited_count": 0, - "product_type": 0, - "amenity_label": null, - "ticket_valid_days": null, - "ticket_issuing_gem": null, - "start_datetime": null, - "end_datetime": null, - "total_gem": 430 - }, - { - "product_id": "com.bushiroad.global.lovelive.sif2.google.gem.899", - "name": "910 Love Gems", - "description": "870 Paid Love Gems + 40 Free LoveGems", - "thumbnail_url": null, - "charge_gem": 870, - "free_gem": 40, - "campaign_type": 0, - "campaign_mode": 0, - "priority": 13, - "price": "6.99", - "currency_code": "USD", - "formatted_price": "USD$6.99", - "consumable": 1, - "limited_count": 0, - "product_type": 0, - "amenity_label": null, - "ticket_valid_days": null, - "ticket_issuing_gem": null, - "start_datetime": null, - "end_datetime": null, - "total_gem": 910 - }, - { - "product_id": "com.bushiroad.global.lovelive.sif2.google.gem.1299", - "name": "1380 Love Gems", - "description": "1310 Paid Love Gems + 70 Free LoveGems", - "thumbnail_url": null, - "charge_gem": 1310, - "free_gem": 70, - "campaign_type": 0, - "campaign_mode": 0, - "priority": 14, - "price": "9.99", - "currency_code": "USD", - "formatted_price": "USD$9.99", - "consumable": 1, - "limited_count": 0, - "product_type": 0, - "amenity_label": null, - "ticket_valid_days": null, - "ticket_issuing_gem": null, - "start_datetime": null, - "end_datetime": null, - "total_gem": 1380 - }, - { - "product_id": "com.bushiroad.global.lovelive.sif2.google.gem.2499", - "name": "2700 Love Gems", - "description": "2530 Paid Love Gems + 170 Free LoveGems", - "thumbnail_url": null, - "charge_gem": 2530, - "free_gem": 170, - "campaign_type": 0, - "campaign_mode": 0, - "priority": 15, - "price": "19.99", - "currency_code": "USD", - "formatted_price": "USD$19.99", - "consumable": 1, - "limited_count": 0, - "product_type": 0, - "amenity_label": null, - "ticket_valid_days": null, - "ticket_issuing_gem": null, - "start_datetime": null, - "end_datetime": null, - "total_gem": 2700 - }, - { - "product_id": "com.bushiroad.global.lovelive.sif2.google.gem.4199", - "name": "4800 Love Gems", - "description": "4460 Paid Love Gems + 340 Free LoveGems", - "thumbnail_url": null, - "charge_gem": 4460, - "free_gem": 340, - "campaign_type": 0, - "campaign_mode": 0, - "priority": 16, - "price": "34.99", - "currency_code": "USD", - "formatted_price": "USD$34.99", - "consumable": 1, - "limited_count": 0, - "product_type": 0, - "amenity_label": null, - "ticket_valid_days": null, - "ticket_issuing_gem": null, - "start_datetime": null, - "end_datetime": null, - "total_gem": 4800 - }, - { - "product_id": "com.bushiroad.global.lovelive.sif2.google.gem.6499", - "name": "7500 Love Gems", - "description": "6730 Paid Love Gems + 770 Free LoveGems", - "thumbnail_url": null, - "charge_gem": 6730, - "free_gem": 770, - "campaign_type": 0, - "campaign_mode": 0, - "priority": 17, - "price": "49.99", - "currency_code": "USD", - "formatted_price": "USD$49.99", - "consumable": 1, - "limited_count": 0, - "product_type": 0, - "amenity_label": null, - "ticket_valid_days": null, - "ticket_issuing_gem": null, - "start_datetime": null, - "end_datetime": null, - "total_gem": 7500 - }, - { - "product_id": "com.bushiroad.global.lovelive.sif2.google.gem.8499", - "name": "10100 Love Gems", - "description": "8910 Paid Love Gems + 1190 Free LoveGems", - "thumbnail_url": null, - "charge_gem": 8910, - "free_gem": 1190, - "campaign_type": 0, - "campaign_mode": 0, - "priority": 18, - "price": "69.99", - "currency_code": "USD", - "formatted_price": "USD$69.99", - "consumable": 1, - "limited_count": 0, - "product_type": 0, - "amenity_label": null, - "ticket_valid_days": null, - "ticket_issuing_gem": null, - "start_datetime": null, - "end_datetime": null, - "total_gem": 10100 - } - ] -} -*/ diff --git a/src/router/serial_code.rs b/src/router/serial_code.rs index ac7d5d2..eb4cd78 100644 --- a/src/router/serial_code.rs +++ b/src/router/serial_code.rs @@ -1,8 +1,9 @@ -use crate::encryption; use json::object; +use actix_web::{HttpResponse, HttpRequest}; + use crate::router::global; use crate::router::userdata; -use actix_web::{HttpResponse, HttpRequest}; +use crate::encryption; pub fn events(_req: HttpRequest) -> HttpResponse { let resp = object!{ diff --git a/src/router/shop.rs b/src/router/shop.rs index 0137627..5ad954d 100644 --- a/src/router/shop.rs +++ b/src/router/shop.rs @@ -1,10 +1,9 @@ -use crate::encryption; -use json::object; -use crate::router::global; -use json::JsonValue; +use json::{object, JsonValue}; use actix_web::{HttpResponse, HttpRequest}; use lazy_static::lazy_static; -use crate::router::userdata; + +use crate::router::{userdata, global}; +use crate::encryption; lazy_static! { static ref SHOP_INFO: JsonValue = { diff --git a/src/router/start.rs b/src/router/start.rs index bf41a63..d849f34 100644 --- a/src/router/start.rs +++ b/src/router/start.rs @@ -1,12 +1,10 @@ -use json; -use json::object; -use crate::router::global; -use crate::encryption; +use json::{JsonValue, object}; use actix_web::{HttpResponse, HttpRequest, http::header::HeaderValue}; -use crate::router::userdata; -pub fn asset_hash(req: HttpRequest, body: String) -> HttpResponse { - let body = json::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap(); +use crate::encryption; +use crate::router::{userdata, global}; + +fn get_asset_hash(req: &HttpRequest, body: &JsonValue) -> String { if body["asset_version"].to_string() != global::ASSET_VERSION && body["asset_version"].to_string() != global::ASSET_VERSION_JP { println!("Warning! Asset version is not what was expected. (Did the app update?)"); } @@ -28,12 +26,17 @@ pub fn asset_hash(req: HttpRequest, body: String) -> HttpResponse { global::ASSET_HASH_IOS } }; + return hash.to_string(); +} + +pub fn asset_hash(req: HttpRequest, body: String) -> HttpResponse { + let body = json::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap(); let resp = object!{ "code": 0, "server_time": global::timestamp(), "data": { - "asset_hash": hash + "asset_hash": get_asset_hash(&req, &body) } }; global::send(resp) @@ -42,33 +45,11 @@ pub fn asset_hash(req: HttpRequest, body: String) -> HttpResponse { pub fn start(req: HttpRequest, body: String) -> HttpResponse { let key = global::get_login(req.headers(), &body); let body = json::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap(); - if body["asset_version"].to_string() != global::ASSET_VERSION && body["asset_version"].to_string() != global::ASSET_VERSION_JP { - println!("Warning! Asset version is not what was expected. (Did the app update?)"); - } let mut user = userdata::get_acc(&key); println!("Signin from uid: {}", user["user"]["id"].clone()); user["user"]["last_login_time"] = global::timestamp().into(); - user["stamina"]["last_updated_time"] = global::timestamp().into(); - - let blank_header = HeaderValue::from_static(""); - let platform = req.headers().get("aoharu-platform").unwrap_or(&blank_header).to_str().unwrap_or(""); - let android = !platform.to_lowercase().contains("iphone"); - - let hash = if body["asset_version"].to_string() == global::ASSET_VERSION_JP { - if android { - global::ASSET_HASH_ANDROID_JP - } else { - global::ASSET_HASH_IOS_JP - } - } else { - if android { - global::ASSET_HASH_ANDROID - } else { - global::ASSET_HASH_IOS - } - }; userdata::save_acc(&key, user); @@ -76,7 +57,7 @@ pub fn start(req: HttpRequest, body: String) -> HttpResponse { "code": 0, "server_time": global::timestamp(), "data": { - "asset_hash": hash, + "asset_hash": get_asset_hash(&req, &body), "token": hex::encode("Hello") //what is this? } }; diff --git a/src/router/story.rs b/src/router/story.rs index 008ac77..ac8d786 100644 --- a/src/router/story.rs +++ b/src/router/story.rs @@ -1,12 +1,9 @@ -use json; use json::object; -use crate::router::global; -//use crate::encryption; use actix_web::{HttpResponse, HttpRequest}; -//use crate::router::userdata; + +use crate::router::global; pub fn read(_req: HttpRequest, _body: String) -> HttpResponse { - let resp = object!{ "code": 0, "server_time": global::timestamp(), diff --git a/src/router/tutorial.rs b/src/router/tutorial.rs index 795bacf..5b3b94a 100644 --- a/src/router/tutorial.rs +++ b/src/router/tutorial.rs @@ -1,9 +1,8 @@ -use json; use json::object; -use crate::router::global; -use crate::encryption; use actix_web::{HttpResponse, HttpRequest}; -use crate::router::userdata; + +use crate::router::{userdata, global}; +use crate::encryption; pub fn tutorial(req: HttpRequest, body: String) -> HttpResponse { let key = global::get_login(req.headers(), &body); diff --git a/src/router/user.rs b/src/router/user.rs index a9ffecd..88b65d2 100644 --- a/src/router/user.rs +++ b/src/router/user.rs @@ -1,11 +1,10 @@ -use json; use json::{array, object, JsonValue}; -use crate::router::global; -use crate::encryption; use actix_web::{HttpResponse, HttpRequest}; -use crate::router::userdata; use lazy_static::lazy_static; +use crate::encryption; +use crate::router::{userdata, global}; + pub fn deck(req: HttpRequest, body: String) -> HttpResponse { let key = global::get_login(req.headers(), &body); let body = json::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap(); diff --git a/src/router/userdata/mod.rs b/src/router/userdata/mod.rs index e073878..d18987b 100644 --- a/src/router/userdata/mod.rs +++ b/src/router/userdata/mod.rs @@ -1,10 +1,11 @@ use rusqlite::params; use lazy_static::lazy_static; use json::{JsonValue, array, object}; -use crate::router::global; use rand::Rng; use sha2::{Digest, Sha256}; use base64::{Engine as _, engine::general_purpose}; + +use crate::router::global; use crate::sql::SQLite; lazy_static! { diff --git a/src/router/webui.rs b/src/router/webui.rs index 51a79b9..5ddc217 100644 --- a/src/router/webui.rs +++ b/src/router/webui.rs @@ -1,5 +1,11 @@ -use actix_web::{HttpResponse, HttpRequest, http::header::HeaderValue, http::header::ContentType}; +use actix_web::{ + HttpResponse, + HttpRequest, + http::header::HeaderValue, + http::header::ContentType +}; use json::object; + use crate::router::userdata; use crate::router::global; diff --git a/src/sql.rs b/src/sql.rs index f3b32de..dfc8407 100644 --- a/src/sql.rs +++ b/src/sql.rs @@ -1,6 +1,7 @@ use rusqlite::{Connection, params, ToSql}; use std::sync::Mutex; use json::{JsonValue, array}; + use crate::router::clear_rate::Live; pub struct SQLite {