I DID NOT TEST THIS COMMIT CARGO CLIPPY DID STUFF FOR ME AND I'M TOO LAZY TO TEST SO HOPEFULLY NOTHING BROKE

This commit is contained in:
Ethan O'Brien
2024-05-24 00:56:25 -05:00
parent ea48327e10
commit 7df2f3e277
16 changed files with 188 additions and 201 deletions

View File

@@ -5,7 +5,7 @@ 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 {
if body["asset_version"] != global::ASSET_VERSION && body["asset_version"] != global::ASSET_VERSION_JP {
println!("Warning! Asset version is not what was expected. (Did the app update?)");
}
@@ -13,20 +13,18 @@ fn get_asset_hash(req: &HttpRequest, body: &JsonValue) -> String {
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 {
let hash = if body["asset_version"] == 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 {
if android {
global::ASSET_HASH_ANDROID
} else {
global::ASSET_HASH_IOS
}
global::ASSET_HASH_IOS
};
return hash.to_string();
hash.to_string()
}
pub fn asset_hash(req: HttpRequest, body: String) -> HttpResponse {