Skip to content

Commit

Permalink
version 0.54
Browse files Browse the repository at this point in the history
  • Loading branch information
FriendsOfGalaxy committed Apr 28, 2020
1 parent 7db1cbe commit 3daf3b8
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 20 deletions.
14 changes: 7 additions & 7 deletions src/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ async def _do_options_request(self):

async def _refresh_auth(self):
if self.__refresh_in_progress:
log.info(f'Refreshing already in progress.')
log.info('Refreshing already in progress.')
while self.__refresh_in_progress:
await asyncio.sleep(0.2)
else:
Expand All @@ -129,7 +129,7 @@ async def _refresh_remember_me(self):
await self._do_options_request()
j = await self._do_request(
'post',
f'https://public-ubiservices.ubi.com/v3/profiles/sessions',
'https://public-ubiservices.ubi.com/v3/profiles/sessions',
headers={
'Accept': '*/*',
'Accept-Encoding': 'gzip, deflate, br',
Expand All @@ -151,7 +151,7 @@ async def _refresh_ticket(self):
await self._do_options_request()
j = await self._do_request(
'put',
f'https://public-ubiservices.ubi.com/v3/profiles/sessions',
'https://public-ubiservices.ubi.com/v3/profiles/sessions',
headers={
'Accept': '*/*',
'Accept-Encoding': 'gzip, deflate, br',
Expand Down Expand Up @@ -228,7 +228,7 @@ async def get_user_data(self):
return await self._do_request_safe('get', f"https://public-ubiservices.ubi.com/v3/users/{self.user_id}")

async def get_friends(self):
r = await self._do_request_safe('get', f'https://api-ubiservices.ubi.com/v2/profiles/me/friends')
r = await self._do_request_safe('get', 'https://api-ubiservices.ubi.com/v2/profiles/me/friends')
return r

async def get_club_titles(self):
Expand All @@ -254,17 +254,17 @@ async def get_challenges(self, space_id):
return j

async def get_configuration(self):
r = await self._do_request_safe('get', f'https://uplaywebcenter.ubi.com/v1/configuration')
r = await self._do_request_safe('get', 'https://uplaywebcenter.ubi.com/v1/configuration')
return r.json()

async def post_sessions(self):
headers = {'Content-Type': 'application/json'}
j = await self._do_request_safe('post', f"https://public-ubiservices.ubi.com/v2/profiles/sessions", add_to_headers=headers)
j = await self._do_request_safe('post', "https://public-ubiservices.ubi.com/v2/profiles/sessions", add_to_headers=headers)
return j

async def get_subscription(self):
try:
sub_games = await self._do_request('get', f"https://api-uplayplusvault.ubi.com/v1/games")
sub_games = await self._do_request('get', "https://api-uplayplusvault.ubi.com/v1/games")
except AccessDenied:
log.info("Uplay plus Subscription not active")
return None
Expand Down
10 changes: 2 additions & 8 deletions src/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
UBISOFT_CONFIGURATIONS_BLACKLISTED_NAMES = ["gamename", "l1", '', 'ubisoft game', 'name']

CHROME_USERAGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36"
CLUB_APPID = "f35adcb5-1911-440c-b1c9-48fdc1701c68"
CLUB_GENOME_ID = "8ec37540-95c5-4a46-9174-86e04b8630cb"
CLUB_APPID = "b8fde481-327d-4031-85ce-7c10a202a700"
CLUB_GENOME_ID = "fbd6791c-a6c6-4206-a75e-77234080b87b"

AUTH_PARAMS = {
"window_title": "Login to Uplay",
Expand All @@ -27,9 +27,3 @@
COOKIES = [Cookie("thirdPartyOk", "ok", ".ubi.com"),
Cookie("TC_OPTOUT", "0@@@005@@@ALL", ".ubi.com"),
Cookie("TC_OPTOUT_categories", "18%2C19", ".ubi.com")]

# another skin:
# UPLAY_GENOME_ID = "031c6c79-623d-4831-9c01-0f01d1f77c88" # has to be matched with UPLAY APPID?
# Set with pixelated mac stuff
# CLUB_APPID = "314d4fef-e568-454a-ae06-43e3bece12a6"
# CLUB_GENOME_ID = "85c31714-0941-4876-a18d-2c7e9dce8d40"
2 changes: 1 addition & 1 deletion src/local_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def ownership_changed(self):
try:
stat = os.stat(path)
except TypeError:
log.warning(f'Undecided Ownership file path, uplay client might not be installed')
log.warning('Undecided Ownership file path, uplay client might not be installed')
self.refresh()
except FileNotFoundError:
log.warning(f'Ownership file at {path} path not present, user never logged in to uplay client.')
Expand Down
11 changes: 8 additions & 3 deletions src/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ async def launch_game(self, game_id):
log.info(f"Launching game '{game.name}' by protocol: [{url}]")

subprocess.Popen(url, shell=True)
self.reset_tick_count()
return

for game in self.games_collection:
Expand Down Expand Up @@ -421,10 +422,10 @@ def user_can_perform_actions(self):
return True

def open_uplay_client(self):
subprocess.Popen(f"start uplay://", shell=True)
subprocess.Popen("start uplay://", shell=True)

def open_uplay_browser(self):
url = f'https://uplay.ubisoft.com'
url = 'https://uplay.ubisoft.com'
log.info(f"Opening uplay website: {url}")
webbrowser.open(url, autoraise=True)

Expand Down Expand Up @@ -491,7 +492,7 @@ async def launch_platform_client(self):
if self.local_client.is_running():
log.info("Launch platform client called but Uplay is already running")
return
url = f"start uplay://"
url = "start uplay://"
subprocess.Popen(url, shell=True)
# Uplay tries to get focus a couple of times when being launched
end_time = time.time() + 15
Expand Down Expand Up @@ -555,6 +556,10 @@ async def get_game_library_settings(self, game_id, context):
return GameLibrarySettings(game_id, ['favorite'] if game_library_settings['favorite'] else [],
game_library_settings['hidden'])

def reset_tick_count(self):
# Resetting tick count ensures that certain operations performed on tick will be made with a known delay.
self.tick_count = 0

def tick(self):
loop = asyncio.get_event_loop()
if SYSTEM == System.WINDOWS:
Expand Down
2 changes: 1 addition & 1 deletion src/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.53'
__version__ = '0.54'

0 comments on commit 3daf3b8

Please sign in to comment.