Add ability to supply custom asset hash

This commit is contained in:
Ethan O'Brien
2024-11-17 21:44:37 -06:00
parent 8bc07a6419
commit 643af93e6d
4 changed files with 54 additions and 14 deletions

View File

@@ -13,18 +13,7 @@ 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"] == 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
};
hash.to_string()
global::get_asset_hash(body["asset_version"].to_string(), android)
}
pub fn asset_hash(req: HttpRequest, body: String) -> Option<JsonValue> {