mirror of
https://github.com/derrod/legendary.git
synced 2024-12-22 17:55:27 +00:00
[core] Apply disable_https to manifest downloads as well
Since we know the hash ahead of time this is relatively low-risk. Delta manifests don't have an associated API call that would tell us the hash, so still use HTTPS for those unless the base url is overridden.
This commit is contained in:
parent
180692195f
commit
778ecacbd3
|
@ -1190,8 +1190,12 @@ class LegendaryCore:
|
||||||
|
|
||||||
return manifest_urls, base_urls, manifest_hash
|
return manifest_urls, base_urls, manifest_hash
|
||||||
|
|
||||||
def get_cdn_manifest(self, game, platform='Windows'):
|
def get_cdn_manifest(self, game, platform='Windows', disable_https=False):
|
||||||
manifest_urls, base_urls, manifest_hash = self.get_cdn_urls(game, platform)
|
manifest_urls, base_urls, manifest_hash = self.get_cdn_urls(game, platform)
|
||||||
|
|
||||||
|
if disable_https:
|
||||||
|
manifest_urls = [url.replace('https://', 'http://') for url in manifest_urls]
|
||||||
|
|
||||||
self.log.debug(f'Downloading manifest from {manifest_urls[0]} ...')
|
self.log.debug(f'Downloading manifest from {manifest_urls[0]} ...')
|
||||||
r = self.egs.unauth_session.get(manifest_urls[0])
|
r = self.egs.unauth_session.get(manifest_urls[0])
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
|
@ -1257,6 +1261,11 @@ class LegendaryCore:
|
||||||
old_manifest = self.load_manifest(old_bytes)
|
old_manifest = self.load_manifest(old_bytes)
|
||||||
|
|
||||||
base_urls = game.base_urls
|
base_urls = game.base_urls
|
||||||
|
|
||||||
|
# The EGS client uses plaintext HTTP by default for the purposes of enabling simple DNS based
|
||||||
|
# CDN redirection to a (local) cache. In Legendary this will be a config option.
|
||||||
|
disable_https = disable_https or self.lgd.config.getboolean('Legendary', 'disable_https', fallback=False)
|
||||||
|
|
||||||
if override_manifest:
|
if override_manifest:
|
||||||
self.log.info(f'Overriding manifest with "{override_manifest}"')
|
self.log.info(f'Overriding manifest with "{override_manifest}"')
|
||||||
new_manifest_data, _base_urls = self.get_uri_manifest(override_manifest)
|
new_manifest_data, _base_urls = self.get_uri_manifest(override_manifest)
|
||||||
|
@ -1264,7 +1273,7 @@ class LegendaryCore:
|
||||||
if _base_urls:
|
if _base_urls:
|
||||||
base_urls = _base_urls
|
base_urls = _base_urls
|
||||||
else:
|
else:
|
||||||
new_manifest_data, base_urls = self.get_cdn_manifest(game, platform)
|
new_manifest_data, base_urls = self.get_cdn_manifest(game, platform, disable_https=disable_https)
|
||||||
# overwrite base urls in metadata with current ones to avoid using old/dead CDNs
|
# overwrite base urls in metadata with current ones to avoid using old/dead CDNs
|
||||||
game.base_urls = base_urls
|
game.base_urls = base_urls
|
||||||
# save base urls to game metadata
|
# save base urls to game metadata
|
||||||
|
@ -1376,9 +1385,7 @@ class LegendaryCore:
|
||||||
raise ValueError('No base URLs found, please try again.')
|
raise ValueError('No base URLs found, please try again.')
|
||||||
base_url = base_urls[0]
|
base_url = base_urls[0]
|
||||||
|
|
||||||
# The EGS client uses plaintext HTTP by default for the purposes of enabling simple DNS based
|
if disable_https:
|
||||||
# CDN redirection to a (local) cache. In Legendary this will be a config option.
|
|
||||||
if disable_https or self.lgd.config.getboolean('Legendary', 'disable_https', fallback=False):
|
|
||||||
base_url = base_url.replace('https://', 'http://')
|
base_url = base_url.replace('https://', 'http://')
|
||||||
|
|
||||||
self.log.debug(f'Using base URL: {base_url}')
|
self.log.debug(f'Using base URL: {base_url}')
|
||||||
|
|
Loading…
Reference in a new issue