mirror of
https://github.com/PaiGramTeam/MibooGram.git
synced 2024-11-16 12:51:45 +00:00
🎨 Added methods to generate the device_id from the v2 cookies
This commit is contained in:
parent
40e3ab0cce
commit
ceff8d0340
@ -13,6 +13,14 @@ from utils.patch.methods import patch, patchable
|
|||||||
DEVICE_ID = get_device_id()
|
DEVICE_ID = get_device_id()
|
||||||
|
|
||||||
|
|
||||||
|
def get_account_mid_v2(cookies: typing.Dict[str, str]) -> typing.Optional[str]:
|
||||||
|
for name, value in cookies.items():
|
||||||
|
if name == "account_mid_v2":
|
||||||
|
return value
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
@patch(genshin.client.components.calculator.CalculatorClient) # noqa
|
@patch(genshin.client.components.calculator.CalculatorClient) # noqa
|
||||||
class CalculatorClient:
|
class CalculatorClient:
|
||||||
@patchable
|
@patchable
|
||||||
@ -81,9 +89,13 @@ class BaseClient:
|
|||||||
"ds": ds.generate_dynamic_secret(),
|
"ds": ds.generate_dynamic_secret(),
|
||||||
}
|
}
|
||||||
elif region == types.Region.CHINESE:
|
elif region == types.Region.CHINESE:
|
||||||
uid = self.cookie_manager.get_user_id()
|
account_id = self.cookie_manager.user_id
|
||||||
if uid:
|
if account_id:
|
||||||
device_id = hex_digest(str(uid))
|
device_id = hex_digest(str(account_id))
|
||||||
|
else:
|
||||||
|
account_mid_v2 = get_account_mid_v2(self.cookie_manager.cookies)
|
||||||
|
if account_mid_v2:
|
||||||
|
device_id = hex_digest(account_mid_v2)
|
||||||
else:
|
else:
|
||||||
device_id = DEVICE_ID
|
device_id = DEVICE_ID
|
||||||
_app_version, _client_type, _ds = get_ds(new_ds=True, data=data, params=params)
|
_app_version, _client_type, _ds = get_ds(new_ds=True, data=data, params=params)
|
||||||
@ -195,9 +207,13 @@ class DailyRewardClient:
|
|||||||
params["uid"] = player_id
|
params["uid"] = player_id
|
||||||
params["region"] = utility.recognize_genshin_server(player_id)
|
params["region"] = utility.recognize_genshin_server(player_id)
|
||||||
|
|
||||||
account_id = self.cookie_manager.get_user_id()
|
account_id = self.cookie_manager.user_id
|
||||||
if account_id:
|
if account_id:
|
||||||
device_id = hex_digest(str(account_id))
|
device_id = hex_digest(str(account_id))
|
||||||
|
else:
|
||||||
|
account_mid_v2 = get_account_mid_v2(self.cookie_manager.cookies)
|
||||||
|
if account_mid_v2:
|
||||||
|
device_id = hex_digest(account_mid_v2)
|
||||||
else:
|
else:
|
||||||
device_id = DEVICE_ID
|
device_id = DEVICE_ID
|
||||||
if endpoint == "sign":
|
if endpoint == "sign":
|
||||||
|
Loading…
Reference in New Issue
Block a user