mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-06 02:13:41 +03:00
Merge pull request #886 from EDCD/enhancement/870-frontier-auth-via-steam-or-egs
Add Steam and EGS to Frontier Auth audiences.
This commit is contained in:
commit
2037cf73a5
@ -662,17 +662,25 @@ class AppWindow(object):
|
|||||||
config.set('querytime', querytime)
|
config.set('querytime', querytime)
|
||||||
|
|
||||||
# Validation
|
# Validation
|
||||||
if not data.get('commander', {}).get('name'):
|
if 'commander' not in data:
|
||||||
|
# This can happen with EGS Auth if no commander created yet
|
||||||
|
self.status['text'] = _('CAPI: No commander data returned')
|
||||||
|
|
||||||
|
elif not data.get('commander', {}).get('name'):
|
||||||
self.status['text'] = _("Who are you?!") # Shouldn't happen
|
self.status['text'] = _("Who are you?!") # Shouldn't happen
|
||||||
|
|
||||||
elif (not data.get('lastSystem', {}).get('name')
|
elif (not data.get('lastSystem', {}).get('name')
|
||||||
or (data['commander'].get('docked')
|
or (data['commander'].get('docked')
|
||||||
and not data.get('lastStarport', {}).get('name'))): # Only care if docked
|
and not data.get('lastStarport', {}).get('name'))): # Only care if docked
|
||||||
self.status['text'] = _("Where are you?!") # Shouldn't happen
|
self.status['text'] = _("Where are you?!") # Shouldn't happen
|
||||||
|
|
||||||
elif not data.get('ship', {}).get('name') or not data.get('ship', {}).get('modules'):
|
elif not data.get('ship', {}).get('name') or not data.get('ship', {}).get('modules'):
|
||||||
self.status['text'] = _("What are you flying?!") # Shouldn't happen
|
self.status['text'] = _("What are you flying?!") # Shouldn't happen
|
||||||
|
|
||||||
elif monitor.cmdr and data['commander']['name'] != monitor.cmdr:
|
elif monitor.cmdr and data['commander']['name'] != monitor.cmdr:
|
||||||
# Companion API return doesn't match Journal
|
# Companion API return doesn't match Journal
|
||||||
raise companion.CmdrError()
|
raise companion.CmdrError()
|
||||||
|
|
||||||
elif ((auto_update and not data['commander'].get('docked'))
|
elif ((auto_update and not data['commander'].get('docked'))
|
||||||
or (data['lastSystem']['name'] != monitor.system)
|
or (data['lastSystem']['name'] != monitor.system)
|
||||||
or ((data['commander']['docked']
|
or ((data['commander']['docked']
|
||||||
|
@ -46,6 +46,9 @@
|
|||||||
/* Folder selection button on Windows. [prefs.py] */
|
/* Folder selection button on Windows. [prefs.py] */
|
||||||
"Browse..." = "Browse...";
|
"Browse..." = "Browse...";
|
||||||
|
|
||||||
|
/* No 'commander' data in CAPI [EDMarketConnector.py] */
|
||||||
|
"CAPI: No commander data returned" = "CAPI: No commander data returned";
|
||||||
|
|
||||||
/* Federation rank. [stats.py] */
|
/* Federation rank. [stats.py] */
|
||||||
"Cadet" = "Cadet";
|
"Cadet" = "Cadet";
|
||||||
|
|
||||||
|
12
companion.py
12
companion.py
@ -277,7 +277,7 @@ class Auth(object):
|
|||||||
logger.info(f'Trying auth from scratch for Commander "{self.cmdr}"')
|
logger.info(f'Trying auth from scratch for Commander "{self.cmdr}"')
|
||||||
challenge = self.base64_url_encode(hashlib.sha256(self.verifier).digest())
|
challenge = self.base64_url_encode(hashlib.sha256(self.verifier).digest())
|
||||||
webbrowser.open(
|
webbrowser.open(
|
||||||
f'{SERVER_AUTH}{URL_AUTH}?response_type=code&audience=frontier&scope=capi&client_id={CLIENT_ID}&code_challenge={challenge}&code_challenge_method=S256&state={self.state}&redirect_uri={protocolhandler.redirect}' # noqa: E501 # I cant make this any shorter
|
f'{SERVER_AUTH}{URL_AUTH}?response_type=code&audience=frontier,steam,epic&scope=capi&client_id={CLIENT_ID}&code_challenge={challenge}&code_challenge_method=S256&state={self.state}&redirect_uri={protocolhandler.redirect}' # noqa: E501 # I cant make this any shorter
|
||||||
)
|
)
|
||||||
|
|
||||||
return None
|
return None
|
||||||
@ -527,11 +527,19 @@ class Session(object):
|
|||||||
|
|
||||||
def profile(self) -> CAPIData:
|
def profile(self) -> CAPIData:
|
||||||
"""Perform general CAPI /profile endpoint query."""
|
"""Perform general CAPI /profile endpoint query."""
|
||||||
return self.query(URL_QUERY)
|
data = self.query(URL_QUERY)
|
||||||
|
if 'commander' not in data:
|
||||||
|
logger.error('No commander in returned data')
|
||||||
|
|
||||||
|
return data
|
||||||
|
|
||||||
def station(self) -> CAPIData:
|
def station(self) -> CAPIData:
|
||||||
"""Perform CAPI /profile endpoint query for station data."""
|
"""Perform CAPI /profile endpoint query for station data."""
|
||||||
data = self.query(URL_QUERY)
|
data = self.query(URL_QUERY)
|
||||||
|
if 'commander' not in data:
|
||||||
|
logger.error('No commander in returned data')
|
||||||
|
return data
|
||||||
|
|
||||||
if not data['commander'].get('docked'):
|
if not data['commander'].get('docked'):
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user