mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2024-12-18 07:51:47 +03:00
feat: respect CN API for getting background image
This commit is contained in:
parent
d0f731d68f
commit
b529f3e7da
1 changed files with 6 additions and 1 deletions
|
@ -32,7 +32,12 @@ pub fn get_background_info() -> anyhow::Result<Background> {
|
||||||
let uri = json["data"]["game_info_list"].as_array()
|
let uri = json["data"]["game_info_list"].as_array()
|
||||||
.ok_or_else(|| anyhow::anyhow!("Failed to list games in the backgrounds API"))?
|
.ok_or_else(|| anyhow::anyhow!("Failed to list games in the backgrounds API"))?
|
||||||
.iter()
|
.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"]
|
.ok_or_else(|| anyhow::anyhow!("Failed to find the game in the backgrounds API"))?["backgrounds"]
|
||||||
.as_array()
|
.as_array()
|
||||||
.and_then(|backgrounds| backgrounds.iter().next())
|
.and_then(|backgrounds| backgrounds.iter().next())
|
||||||
|
|
Loading…
Reference in a new issue