FriendsOfGalaxy / galaxy-integration-uplay

uplay integration with g2.0
MIT License
120 stars 20 forks source link

updated app ids #34

Open fl4shback opened 2 years ago

fl4shback commented 2 years ago

Some parts of the Ubisoft API recently started to reject requests made by the legacy "Ubisoft Club" app IDs.

I changed the IDs to the new ones.

Fixes #33, #37

wearepariah commented 2 years ago

Can confirm, fixes #33 - thank you!

yessenbayev commented 2 years ago

This PR needs to merge ASAP, the Ubisoft Connect plugin does not work at all anymore, as of 1/25/2022.

@FriendsOfGalaxy could you prioritize reviewing it?

TrakoDev commented 2 years ago

just used this connect library today, changed lines to

CLUB_APPID = "314d4fef-e568-454a-ae06-43e3bece12a6" CLUB_GENOME_ID = "85c31714-0941-4876-a18d-2c7e9dce8d40"

confirmed fix

image

SparrowBrain commented 2 years ago

Works for me too.

adrianinsaval commented 2 years ago

Any reason why this isn't getting merged?

fl4shback commented 2 years ago

@FriendsOfGalaxy seems inactive since last September, maybe they stopped maintaining the plugins..

francoisaudic commented 2 years ago

Works for me too. Hope someone could fix the problem by merging the fix with the master.

eduardo-publi commented 2 years ago

Updated GOG Client to 2.0.46 Beta (Feb 16, 2022), but disconnect remains... just updated Ids like this PR, and started working again

draeath commented 2 years ago

Can we get some attention on this PR, please? We have a known-working fix here. Seems like a quick and safe merge. (assuming maintainer wouldn't want the two commits squashed to one, that is)

abelcheung commented 2 years ago

Wonder if anybody else in GoG has commit access to this account. It has a email address, so if anybody is willing to ping them with email...

dCSeven commented 2 years ago

I pinged friendsofgalaxy per email, but am not confident, that he responds, since the github user seems inactive for half a year now.

abelcheung commented 2 years ago

I have tried to file support request in GoG client, but things don't look good so far:

Although I'd like to hope for situation improving in future, but please also prepare for the worst too -- we players are on our own now.

milroneth commented 2 years ago

I have tried to file support request in GoG client

As it is clearly stated in GOG Galaxy, they are not responsible for 3rd party integrations so they can do nothing about this anyway and we shouldn't bug them about it, we have always been on our own regarding this. The GOG client is already understuffed and hanging by a thread, let's please not waste their limited time with things that are out of their control.

Friends of galaxy is a community project, the bad news is that the maintainer has gone dark for the past months.

muhasturk commented 2 years ago

is it possible to change integration url that is embedded in GOG Galaxy official client?

abelcheung commented 2 years ago

@muhasturk Nope, that's why I think official intervention is needed. But, well, check the comment above. Not gonna discuss anymore, situation won't change anyway. GoG had possibly pulled the plug on python integration development as a whole, as the main workhorse developer has quitted or at least no longer working on it. Right now manual modification of ID is the way to go.

scyto commented 2 years ago

@milroneth @turbo25 @yessenbayev any chance one of you can approve this PR? i also confirm it fixed the issue.

milroneth commented 2 years ago

@milroneth @turbo25 @yessenbayev any chance one of you can approve this PR? i also confirm it fixed the issue.

We already have, and you can too! An approval on GitHub is just the proper way to say "this works as intended and the code looks good, I approve of this, please merge it", instead of commenting without offering anything more. That way the maintainer can easily see that a PR has a certain number of approvals without reading and counting comments, and go ahead and merge it.

None of us has the power to merge, only the (now disappeared) maintainer of the repo.

scyto commented 2 years ago

@milroneth thanks for explaining reviewers don't get merge rights, never realized that.

Is the disappeared maintainer at the repo or the org (FriendsOfGalaxy) level?

I always thought folks at the org level can take control of any repo in the org?

yessenbayev commented 2 years ago

In the worst case scenario, if the maintainer is no longer available, we can collaborate with GOG, by cloning the integrations to a new user/organization and asking GOG to pull integrations from that new cloned repo.

yessenbayev commented 2 years ago

In the worst case scenario, if the maintainer is no longer available, we can collaborate with GOG, by cloning the integrations to a new user/organization and asking GOG to pull integrations from that new cloned repo.

If you would like to discuss further, please, feel free to reach out over email: alan.yessenbayev@gmail.com with subject "GOG Integration".

flabbamann commented 2 years ago

In the worst case scenario, if the maintainer is no longer available, we can collaborate with GOG, by cloning the integrations to a new user/organization and asking GOG to pull integrations from that new cloned repo.

If we do this, we should set up an organization with more than one person having permissions, to avoid a situation like this in the future.

brdtheo commented 2 years ago

please merge this asap

grnassar commented 2 years ago

@milroneth thanks for explaining reviewers don't get merge rights, never realized that.

Is the disappeared maintainer at the repo or the org (FriendsOfGalaxy) level?

I always thought folks at the org level can take control of any repo in the org?

The maintainer of FriendsOfGalaxy/galaxy-integration-uplay is clearly the user FriendsOfGalaxy, unfortunately. There is no "repo or org level" distinction because FriendsOfGalaxy is not an org account. (You can tell because it shows an email address contact instead of a weblink, and there's no "People" nav where one could see the members of the org.) Since the Galaxy client searches from and pulls that user's repos specifically, it is not useful to make forks of the repos themselves. Only the FriendsOfGalaxy account can approve the PRs, so if that doesn't happen the only other way to get auto-updates showing back up in the Galaxy client is by changing the Galaxy code itself, it would seem. This is not the only integration that is 100% broken due to this issue, either, unfortunately. So hopefully they'll do something.

urwrstkn8mare commented 2 years ago

Has anyone tried to contact GOG and gotten any response?

panther7 commented 2 years ago

+1

dCSeven commented 2 years ago

Has anyone tried to contact GOG and gotten any response?

Jep, i contacted them more than a month ago via Ticket in Gog Galaxy about this situation, mentioning the open PRs and my wish that they either

I think they either are hopelessly overstrained, not interested in plugins anymore or can't decide what would be best. Either way it doesn't seem to be easy to get the changes upstream. (And I doubt, that more users contacting gog about this, will accelerate or change anything)

Maybe we should just create an org, merge it there and contact gog again (hoping that they don't ignore that too).

(Also the war in the neighboring countries too may not help to accelerate any development here, but what do I know)

yessenbayev commented 2 years ago

image

georgehank commented 2 years ago

I have tried to file support request in GoG client

As it is clearly stated in GOG Galaxy, they are not responsible for 3rd party integrations so they can do nothing about this anyway and we shouldn't bug them about it, we have always been on our own regarding this. The GOG client is already understuffed and hanging by a thread, let's please not waste their limited time with things that are out of their control.

Friends of galaxy is a community project, the bad news is that the maintainer has gone dark for the past months.

Two things here: Friends of Galaxy is the officially approved 3rd party integrations project. No fork of these repos will be seen or used by Galaxy. Only this. And I haven't seen even a hint of this being user-configurable. For shame, actually. I often do wonder if it's actually 2022… The other is that CDP does these 3rd party integrations as an actual feature of Galaxy 2.0, "All your games and friends in one place." Note the "all".

(I strongly suspect the person(s) behind it have at least some connections to CDP, if they're not employees who are either doing (or did) this in their off hours or actually on company time but anonymously so the legal ruse works).

InfiniteLukeOne commented 2 years ago

I've created an entry on the gog-whishlist over here: https://www.gog.com/wishlist/galaxy/let_integration_updates_happen_again Don't know if it will help, but maybe it will get attention if it has enough votes.

eduardo-publi commented 2 years ago

🙏

Icemasta commented 2 years ago

The ID has once again changed

francoisaudic commented 2 years ago

The ID has once again changed

What are the new ID ?

Icemasta commented 2 years ago

The ID has once again changed

What are the new ID ?

Credit to JustThat70 CLUB_APPID = "f35adcb5-1911-440c-b1c9-48fdc1701c68" CLUB_GENOME_ID = "5b36b900-65d8-47f3-93c8-86bdaa48ab50"

francoisaudic commented 2 years ago

The ID has once again changed

What are the new ID ?

Credit to JustThat70 CLUB_APPID = "f35adcb5-1911-440c-b1c9-48fdc1701c68" CLUB_GENOME_ID = "5b36b900-65d8-47f3-93c8-86bdaa48ab50"

Thank you

fl4shback commented 2 years ago

Updated the IDs in the PR in case it ever gets merged...

bradgearon commented 2 years ago

Well I noticed another pull request that had been merged with a similar id at first and then I canceled this one - since I noticed it was already in the repo history. Thank you! Sorry for the confusion :)

On Sat, Aug 6, 2022 at 6:12 PM Bjarne Krottjé @.***> wrote:

Any idea when this will be merged?

— Reply to this email directly, view it on GitHub https://github.com/FriendsOfGalaxy/galaxy-integration-uplay/pull/34#issuecomment-1207296167, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANG2ZZQREBGMVXCWKA7DUTVX3WMJANCNFSM5MTGPT5A . You are receiving this because you commented.Message ID: @.***>

drmaxx commented 2 years ago

Here is a one-liner to quickly check/get the IDs:

# short version
curl -s https://ubisoftconnect.com/invalid | grep -Eo 'APP_ID.{0,40}|GENOME_ID.{0,40}'
# long version, readable parameter
curl --silent https://ubisoftconnect.com/invalid | grep --extended-regexp --only-matching 'APP_ID.{0,40}|GENOME_ID.{0,40}'

I'm sure this can be enhanced, but for me it helps. 😄

Let's hope GOG sorts out the Plugin updates / repo access fuu soonish. Has been a year now since the last update in this repo. 😞

wearepariah commented 2 years ago

Have taken what @drmaxx has suggested above, and written it in python to replace what's currently hardcoded in to the consts.py file for this plugin. So long as they don't go changing the urls/response format, this should keep itself updated rather than needing a code change each time the APP_ID/GENOME_ID changes. EDIT: notice that @KS-HTK suggested this as an option earlier - tested and seems to work on my machine.

import requests
import re
ids_url = 'https://ubisoftconnect.com/invalid'
ids_response = requests.get(ids_url)
regex_ids_response = re.findall('APP_ID.{0,40}|GENOME_ID.{0,40}', ids_response.text) 

ids_result = []
for sub in regex_ids_response:
    sub = sub.replace('"','')
    if ':' in sub:
        ids_result.append(map(str.strip, sub.split(':', 1)))

ids_result = dict(ids_result)

CLUB_APPID = ids_result.get('APP_ID','')
CLUB_GENOME_ID = ids_result.get('GENOME_ID','')
KS-HTK commented 2 years ago
import requests
ids_url = 'https://ubisoftconnect.com/invalid'
ids_response = requests.get(ids_url)
regex_ids_response = re.findall('APP_ID.{0,40}|GENOME_ID.{0,40}', ids_response.text) 

ids_result = []
for sub in regex_ids_response:
    sub = sub.replace('"','')
    if ':' in sub:
        ids_result.append(map(str.strip, sub.split(':', 1)))

ids_result = dict(ids_result)

CLUB_APPID = ids_result.get('APP_ID','')
CLUB_GENOME_ID = ids_result.get('GENOME_ID','')

Thanks for implementing it. That is exactly what I suggested doing, just did not have the time yet. A minor change that i would suggest is wrapping it in a try, in case of connection error:

import requests
ids_url = 'https://ubisoftconnect.com/invalid'
try:
  ids_response = requests.get(ids_url)
  regex_ids_response = re.findall('APP_ID.{0,40}|GENOME_ID.{0,40}', ids_response.text) 
  ids_result = []

  for sub in regex_ids_response:
      sub = sub.replace('"','')
      if ':' in sub:
          ids_result.append(map(str.strip, sub.split(':', 1)))

  ids_result = dict(ids_result)

  CLUB_APPID = ids_result.get('APP_ID','')
  CLUB_GENOME_ID = ids_result.get('GENOME_ID','')
except requests.exceptions.ConnectionError:
  CLUB_APPID = "314d4fef-e568-454a-ae06-43e3bece12a6"
  CLUB_GENOME_ID = "85c31714-0941-4876-a18d-2c7e9dce8d40"

but then again, if fetching the url does not work, there should be no connection anyway, so maybe this is unnecessary.

Now lets hope that it will eventually be merged.

EDIT: @wearepariah I suggest you should submit it as a PR to @fl4shback fork of this repo.

wearepariah commented 2 years ago

thanks @KS-HTK - i have created the pull request to @fl4shback repo. I did think about a try/except for connection errors as you suggested, but if the connection errors out and it falls back to last-hardcoded value, it puts us back where we are now (with needing to update the hardcodes frequently), and like you said - if the connection errors, it's going to fail regardless. i don't see value in it, but something to capture the error might be good?

KS-HTK commented 2 years ago

also this should close #35 and #42

turbo25 commented 2 years ago

thanks @KS-HTK - i have created the pull request to @fl4shback repo. I did think about a try/except for connection errors as you suggested, but if the connection errors out and it falls back to last-hardcoded value, it puts us back where we are now (with needing to update the hardcodes frequently), and like you said - if the connection errors, it's going to fail regardless. i don't see value in it, but something to capture the error might be good?


import requests
ids_url = 'https://ubisoftconnect.com/invalid'
old_app_id = CLUB_APPID
old_genome_id = CLUB_GENOME_ID
try:
ids_response = requests.get(ids_url)
regex_ids_response = re.findall('APP_ID.{0,40}|GENOME_ID.{0,40}', ids_response.text) 
ids_result = []

for sub in regex_ids_response: sub = sub.replace('"','') if ':' in sub: ids_result.append(map(str.strip, sub.split(':', 1)))

ids_result = dict(ids_result)

CLUB_APPID = ids_result.get('APP_ID','') CLUB_GENOME_ID = ids_result.get('GENOME_ID','') except requests.exceptions.ConnectionError: CLUB_APPID = old_app_id CLUB_GENOME_ID = old_genome_id


Maybe this can do the trick?
KS-HTK commented 2 years ago

[…]

import requests
ids_url = 'https://ubisoftconnect.com/invalid'
old_app_id = CLUB_APPID
old_genome_id = CLUB_GENOME_ID
try:
  […]

  CLUB_APPID = ids_result.get('APP_ID','')
  CLUB_GENOME_ID = ids_result.get('GENOME_ID','')
except requests.exceptions.ConnectionError:
  CLUB_APPID = old_app_id
  CLUB_GENOME_ID = old_genome_id

Maybe this can do the trick?

No it won't. It would require saving them to a file. You now assign CLUB_APPID to old_app_id before CLUB_APPID is even initialized. so you cant store them in a variable between runtimes, as this is not how variables work.

SpikeBadguy commented 2 years ago
import requests
ids_url = 'https://ubisoftconnect.com/invalid'
ids_response = requests.get(ids_url)
regex_ids_response = re.findall('APP_ID.{0,40}|GENOME_ID.{0,40}', ids_response.text) 

ids_result = []
for sub in regex_ids_response:
    sub = sub.replace('"','')
    if ':' in sub:
        ids_result.append(map(str.strip, sub.split(':', 1)))

ids_result = dict(ids_result)

CLUB_APPID = ids_result.get('APP_ID','')
CLUB_GENOME_ID = ids_result.get('GENOME_ID','')

I tried this but now the add-on is constantly timing out. What did I do wrong?

KS-HTK commented 2 years ago

I tried this but now the add-on is constantly timing out. What did I do wrong?

Difficult to say without seeing how you modified consts.py But here is a link to the full file: https://github.com/wearepariah/galaxy-integration-uplay/blob/master/src/consts.py

try replacing yours with that one.

SpikeBadguy commented 2 years ago

I tried this but now the add-on is constantly timing out. What did I do wrong?

Difficult to say without seeing how you modified consts.py But here is a link to the full file: https://github.com/wearepariah/galaxy-integration-uplay/blob/master/src/consts.py

try replacing yours with that one.

That helped Me fix it. Thanks! I believe I was missing a couple of lines at the top.

JokeDeity commented 2 years ago

I tried this but now the add-on is constantly timing out. What did I do wrong?

Difficult to say without seeing how you modified consts.py But here is a link to the full file: https://github.com/wearepariah/galaxy-integration-uplay/blob/master/src/consts.py

try replacing yours with that one.

This works much longer for me, but it's not a permanent fix. After a few hours I must reconnect (including pulling out my goddamn phone for the stupid 2 factor authentication). Before it would instantly disconnect in a second after connecting, so this new consts.py is much better, but not a real full solution.

wearepariah commented 2 years ago

I tried this but now the add-on is constantly timing out. What did I do wrong?

Difficult to say without seeing how you modified consts.py But here is a link to the full file: https://github.com/wearepariah/galaxy-integration-uplay/blob/master/src/consts.py

try replacing yours with that one.

This works much longer for me, but it's not a permanent fix. After a few hours I must reconnect (including pulling out my goddamn phone for the stupid 2 factor authentication). Before it would instantly disconnect in a second after connecting, so this new consts.py is much better, but not a real full solution.

I am not sure that's caused by this change, the constant changing of the ID's could indicate that Ubi have changed something else at their end causing this - the Ubisoft Connect app on my machine has forced me to log back in a bunch of times in the past week, correlation in timing rather than causation.

KS-HTK commented 2 years ago

No, this is not a fix for a disconnect every 5-6h this is a fix for not being able to connect at all. I get those spaced out disconnects as well. I guess the reason is because that is when the api key for the account runs out and is not auto renewed by this plugin. (gussing they are using OAUTH2 control flow) I have not had time to look further into it though. I had asked ubisoft support for a developer api as they do have a section in the accounts page for 3rd party apps. But there is currently no public developer api. And trying to capture the instance when ubisoft connect refetches the key is going to be a heck of a job, as this only happens when the key runs out.

I am not sure there is going to be a fix for that any time soon.

Icemasta commented 2 years ago

I am about to make the most useless of comments but I got fed up that Ubisoft wasn't showing up in my GoG library so I decided to dig a bit. I verified Backend.py and it does support OAUTH2 and it does handle refreshing tokens already, but I've noticed disconnection there.

I have looked through some of my logs and the originator of the issue seems to begin from a call to _do_safe_request which receives a weird answer. Not wanting to wait, I decided to log to file the tokens and expiry dates, and to subtract a good chunk of time from expiry time.... and it just called _refresh_auth properly? And then again and again and again. So using the fix by @wearepariah in combination by just refreshing the token long before it expires, I seem to be doing good. There is no refresh token rotation. Always the same refresh token.

Now, I am not sure what happens if I turn off GoG for a couple of hours, but combing through the code I've found a couple potential issues, the main ones revolving around improper handling of errors on requests.

We have 3 layers of requests.

We have request which handles the actual request. If it fails, it raises an error, it uses an handle_exception function.

We have _do_request which is a wrapper around request, it has zero error handling.

We have _do_safe_request which is a wrapper around _do_request. It has a preemptive ticket refresh (which is what I used) and a try/except situation to refresh auth but only on AccessDenied, AuthenticationRequired errors, as defined by handle_exception, any errors outside of those 2 is a dead end.

My take aways right now are: Gotta refactor requests so that they always fallback to refreshing auth if it fails and if that fails, kill stored credentials. Request and _do_request are called and can cause this situation. There will probably need to be some method of fallback for exceptions. Some errors I've noticed is that a request returns 401 but the handle_exception doesn't know what to do with it, so it returns unknown handle. We do have situations where we get 401 while doing a token refresh.

Oh and for some reasons _do_options_request has an hardcoded appID