From b529f3e7daa651117ff0a942837d2ead940ab67b Mon Sep 17 00:00:00 2001 From: Nikita Podvirnyi Date: Mon, 17 Jun 2024 14:01:31 +0200 Subject: [PATCH] feat: respect CN API for getting background image --- src/background.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/background.rs b/src/background.rs index 9cc1601..c7e10f8 100644 --- a/src/background.rs +++ b/src/background.rs @@ -32,7 +32,12 @@ pub fn get_background_info() -> anyhow::Result { 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("hk4e_global")) + .find(|game| { + match game["game"]["biz"].as_str() { + Some(biz) => biz.starts_with("hk4e_"), + _ => false + } + }) .ok_or_else(|| anyhow::anyhow!("Failed to find the game in the backgrounds API"))?["backgrounds"] .as_array() .and_then(|backgrounds| backgrounds.iter().next())