[cli/core/utils] Fix webview login now requiring EGL UA

Why are you like this Epic?
This commit is contained in:
derrod 2023-12-08 14:37:42 +01:00
parent d2963db5b2
commit 2fdacb75d3
3 changed files with 7 additions and 3 deletions

View file

@ -162,7 +162,8 @@ class LegendaryCLI:
else:
auth_code = auth_code.strip('"')
else:
if do_webview_login(callback_code=self.core.auth_ex_token):
if do_webview_login(callback_code=self.core.auth_ex_token,
user_agent=f'EpicGamesLauncher/{self.core.get_egl_version()}'):
logger.info(f'Successfully logged in as "{self.core.lgd.userdata["displayName"]}" via WebView')
else:
logger.error('WebView login attempt failed, please see log for details.')

View file

@ -301,6 +301,9 @@ class LegendaryCore:
if lgd_config := version_info.get('legendary_config'):
self.webview_killswitch = lgd_config.get('webview_killswitch', False)
def get_egl_version(self):
return self._egl_version
def get_update_info(self):
return self.lgd.get_cached_version()['data'].get('release_info')

View file

@ -124,7 +124,7 @@ class MockLauncher:
self.window.load_url(logout_url)
def do_webview_login(callback_sid=None, callback_code=None):
def do_webview_login(callback_sid=None, callback_code=None, user_agent=None):
api = MockLauncher(callback_sid=callback_sid, callback_code=callback_code)
url = login_url
@ -143,7 +143,7 @@ def do_webview_login(callback_sid=None, callback_code=None):
window.events.loaded += api.on_loaded
try:
webview.start()
webview.start(user_agent=user_agent)
except Exception as we:
logger.error(f'Running webview failed with {we!r}. If this error persists try the manual '
f'login process by adding --disable-webview to your command line.')