mirror of
https://github.com/derrod/legendary.git
synced 2025-08-04 15:01:02 +00:00
Directly handling Epic Games login without legendary-gl api for now.
This commit is contained in:
parent
3963382b3f
commit
f69d0e5142
|
@ -10,6 +10,8 @@ import shlex
|
|||
import subprocess
|
||||
import time
|
||||
import webbrowser
|
||||
import colorama
|
||||
from colorama import Fore, Back, Style
|
||||
|
||||
from collections import defaultdict, namedtuple
|
||||
from logging.handlers import QueueListener
|
||||
|
@ -39,6 +41,7 @@ logger = logging.getLogger('cli')
|
|||
|
||||
|
||||
class LegendaryCLI:
|
||||
_clientID = '34a02cf8f4414e29b15921876da36f9a'
|
||||
def __init__(self, override_config=None, api_timeout=None):
|
||||
self.core = LegendaryCore(override_config, timeout=api_timeout)
|
||||
self.logger = logging.getLogger('cli')
|
||||
|
@ -149,12 +152,17 @@ class LegendaryCLI:
|
|||
from legendary.utils.webview_login import webview_available, do_webview_login
|
||||
|
||||
if not webview_available or args.no_webview or self.core.webview_killswitch:
|
||||
# unfortunately the captcha stuff makes a complete CLI login flow kinda impossible right now...
|
||||
print('Please login via the epic web login!')
|
||||
url = 'https://legendary.gl/epiclogin'
|
||||
# Captcha Prevents Automated Cli Login Sessions
|
||||
print(Fore.MAGENTA+'Webview login is not available right now, we will need to complete things in your browser')
|
||||
print(Fore.YELLOW + "Make sure you have logged in into your epic games account ")
|
||||
input(Fore.CYAN + "Press any key to continue...")
|
||||
url = f'https://www.epicgames.com/id/api/redirect?clientId={self._clientID}&responseType=code'
|
||||
webbrowser.open(url)
|
||||
print(f'If the web page did not open automatically, please manually open the following URL: {url}')
|
||||
auth_code = input('Please enter the "authorizationCode" value from the JSON response: ')
|
||||
input_code = ''
|
||||
while input_code == '':
|
||||
input_code = input(Fore.GREEN+'Please enter the authorization code from the JSON in your browser: ')
|
||||
auth_code = input_code
|
||||
auth_code = auth_code.strip()
|
||||
if auth_code[0] == '{':
|
||||
tmp = json.loads(auth_code)
|
||||
|
|
|
@ -399,7 +399,7 @@ class LegendaryCore:
|
|||
return self.get_game_and_dlc_list(update_assets=update_assets, platform=platform)[0]
|
||||
|
||||
def get_game_and_dlc_list(self, update_assets=True, platform='Windows',
|
||||
force_refresh=False, skip_ue=True) -> (List[Game], Dict[str, List[Game]]):
|
||||
force_refresh=False, skip_ue=True) -> tuple[List[Game], Dict[str, List[Game]]]:
|
||||
_ret = []
|
||||
_dlc = defaultdict(list)
|
||||
meta_updated = False
|
||||
|
@ -524,8 +524,7 @@ class LegendaryCore:
|
|||
self.log.debug(f'Removing old/unused metadata for "{app_name}"')
|
||||
self.lgd.delete_game_meta(app_name)
|
||||
|
||||
def get_non_asset_library_items(self, force_refresh=False,
|
||||
skip_ue=True) -> (List[Game], Dict[str, List[Game]]):
|
||||
def get_non_asset_library_items(self, force_refresh=False, skip_ue=True) -> tuple[List[Game], Dict[str, List[Game]]]:
|
||||
"""
|
||||
Gets a list of Games without assets for installation, for instance Games delivered via
|
||||
third-party stores that do not have assets for installation
|
||||
|
@ -961,7 +960,7 @@ class LegendaryCore:
|
|||
|
||||
return absolute_path
|
||||
|
||||
def check_savegame_state(self, path: str, save: SaveGameFile) -> (SaveGameStatus, (datetime, datetime)):
|
||||
def check_savegame_state(self, path: str, save: SaveGameFile) -> tuple[SaveGameStatus, (datetime, datetime)]:
|
||||
latest = 0
|
||||
for _dir, _, _files in os.walk(path):
|
||||
for _file in _files:
|
||||
|
@ -1331,7 +1330,7 @@ class LegendaryCore:
|
|||
repair: bool = False, repair_use_latest: bool = False,
|
||||
disable_delta: bool = False, override_delta_manifest: str = '',
|
||||
egl_guid: str = '', preferred_cdn: str = None,
|
||||
disable_https: bool = False, bind_ip: str = None) -> (DLManager, AnalysisResult, ManifestMeta):
|
||||
disable_https: bool = False, bind_ip: str = None) -> tuple[DLManager, AnalysisResult, ManifestMeta]:
|
||||
# load old manifest
|
||||
old_manifest = None
|
||||
|
||||
|
@ -1725,7 +1724,7 @@ class LegendaryCore:
|
|||
igame.prereq_info['installed'] = True
|
||||
self.lgd.set_installed_game(app_name, igame)
|
||||
|
||||
def import_game(self, game: Game, app_path: str, egl_guid='', platform='Windows') -> (Manifest, InstalledGame):
|
||||
def import_game(self, game: Game, app_path: str, egl_guid='', platform='Windows') -> tuple[Manifest, InstalledGame]:
|
||||
needs_verify = True
|
||||
manifest_data = None
|
||||
|
||||
|
|
Loading…
Reference in a new issue