Skip to content

Commit

Permalink
Fix error with daily reward routes
Browse files Browse the repository at this point in the history
  • Loading branch information
seriaati committed Oct 10, 2024
1 parent cd58cd6 commit 7759703
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions genshin/client/components/daily.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ async def request_daily_reward(
base_url = routes.REWARD_URL.get_url(self.region, game)
url = (base_url / endpoint).update_query(**base_url.query)

if game is types.Game.GENSHIN:
headers["x-rpc-signgame"] = "hk4e"
elif game is types.Game.ZZZ:
headers["x-rpc-signgame"] = "zzz"

if self.region == types.Region.OVERSEAS:
params["lang"] = lang or self.lang
headers["referer"] = "https://act.hoyolab.com/"
Expand All @@ -66,16 +71,8 @@ async def request_daily_reward(
headers["x-rpc-channel"] = "miyousheluodi"
headers["x-rpc-device_model"] = str(self.hoyolab_id) or ""

if game is types.Game.GENSHIN:
headers["x-rpc-signgame"] = "hk4e"
elif game is types.Game.ZZZ:
headers["x-rpc-signgame"] = "zzz"

headers["ds"] = ds_utility.generate_dynamic_secret(constants.DS_SALT["cn_signin"])

else:
raise TypeError(f"{self.region!r} is not a valid region.")

if challenge:
headers["x-rpc-challenge"] = challenge["challenge"]
headers["x-rpc-seccode"] = challenge["seccode"]
Expand Down

0 comments on commit 7759703

Please sign in to comment.