This commit is contained in:
Nikita Podvirnyi 2024-06-17 14:13:42 +02:00
commit 8921ad9891
No known key found for this signature in database
GPG key ID: 859D416E5142AFF3

View file

@ -32,7 +32,12 @@ pub fn get_background_info() -> anyhow::Result<Background> {
let uri = json["data"]["game_info_list"].as_array()
.ok_or_else(|| anyhow::anyhow!("Failed to list games in the backgrounds API"))?
.iter()
.find(|game| game["game"]["biz"].as_str() == Some("hkrpg_global"))
.find(|game| {
match game["game"]["biz"].as_str() {
Some(biz) => biz.starts_with("hkrpg_"),
_ => false
}
})
.ok_or_else(|| anyhow::anyhow!("Failed to find the game in the backgrounds API"))?["backgrounds"]
.as_array()
.and_then(|backgrounds| backgrounds.iter().next())