-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature request] Extra currencies for selected region #4
Comments
Hey, thanks for adding this feature request. I see what you're saying. It seems that in order to implement this, the plugin would need to call another external API to handle the conversions. Otherwise, the conversions would be made using static rates that may go out of date over time. I noticed a few packages on npm that may be able to help with this, but I will take a deep dive hopefully by the end of the week. |
Not sure if you're aware of this but I've found this GOG API method, which provides all available currencies and their prices for specific country. Example: https://api.gog.com/products/2093619782/prices?countryCode=DE |
Hey @DawEdhel sorry for the wait. Just want to give a heads up that I started implementing this today. I hope to have a release out by the end of this week. |
@DawEdhel Please see and test out this WIP version: https://gist.github.com/kevinfiol/fa89240425d7db6ffacc1b3ac72292b3/raw/2243ed40d1dcfe5d50ccafba316cd91c6f2089c8/enhanced-gog.user.js One limitation I realized while working on this is that I do not have the price conversions for the data provided by IsThereAnyDeal, only the latest prices available by GOG for a given title. Given that, I chose to instead add a feature where if the selected currency is different from the user's official GOG given currency, the different price is displayed alongside the current sale price. Personally, I'm not super happy with the result, but let me know if this is useful to you. EDIT: See a screenshot example: Since I am a US user, selecting UK + GBP will display the GBP price alongside my native US price. |
@kevinfiol Also I'll mention various findings of bugs and helpful additions:
|
Revisiting this again and leaving a note for myself: To implement this, I need to find a way to grab the current user's GOG Country Code from the page. This way, I can fetch the appropriate available prices from https://api.gog.com/products/{product_id}/prices?countryCode={country_code} |
Found local JSON 'window.gogMicroservices.menu' and 'window.productcardData', both of which contain 'country' field. |
Thanks, I am using productcardData. BTW, you can test the WIP version here: [redacted] |
Not sure, but I'm not getting anything new after the current stable 1.3.0, as there is neither the crossed-out extra currency price, nor the select list to choose as well. Am I missing something or is it too soon to test? Btw, can you change the @ script name to something else, like enhanced-gog-beta? My current extension always tries to update the stable release, instead of creating a new entry. |
@DawEdhel Sorry about that. Here is the updated version: https://gist.github.com/kevinfiol/e79dac59d567146ac1e3aacd21f1e382/raw/cc99fce024d2ad85a5e6657e09b1107cef9187a5/enhanced-gog-beta.user.js You can also grab it directly from the feature branch while I'm pushing changes: https://github.com/kevinfiol/enhanced-gog/tree/feature/currencies/bin |
Updated and tested - so far so good as discussed, except this mentioned part still change GOG site's params.
Sometimes it even happens on its own without any modification and/or even on different, non-game GOG pages. If you need help debugging, you can tell me, where to look at supposedly, and, just in case, how to do it properly, as I'm somewhat barely familiar with both JS and consoles. |
I'm not sure what is being affected here. You mean this select box is being affected randomly? Perhaps you can take a screenshot of this issue. I am not able to replicate it. |
I mean GOG personal settings located within its footer, like in this screenshot I provided earlier. What happens is after some changing manipulation within your script's section
It might be GOG doing when these currency/language get somewhat corrupted, so it does resetting them to most fitting default values closest to your country, which in my case is Russia. As for currencies to replicate, I guess, using VPN on new account for some country with several rates might help. Edit: decided to make a clip of the whole process on my side, see for yourself. Redrawing happens after hitting the F5 button. 2022-02-16.10-08-20.mp4 |
That is truly strange. Just a heads up, the "Language" and "Currency" settings in the Footer are outside of enhanced-gog's control. Those are set via cookie by GOG's backend, so You are right in that I am only able to select USD since I am located in the US. To confirm, I did, however, test by switching my language and seeing if it would drop back to I even tried setting my language specifically at https://www.gog.com/account/settings/personal , and even then it would switch back to English. Notice the discrepancy between the Footer language and the Locale Language Dropdown in this screenshot. My guess is that t his is a bug on GOG's side unfortunately, where they are reading your user agent and forcing a language/currency. By any chance, are you using Firefox or any cookie-blocking extensions? I would say to be lenient to cookie settings specifically on gog.com and see if that makes a difference (maybe allow 3rd party cookies?). I'll also investigate this myself. |
Yet I still don't understand then, why GOG suddenly only does that behaviour when modifying script's params, if these are only internal to the script and shouldn't be visible to GOG. Maybe something still gets affected indirectly by the modification that GOG doesn't like.
Usually I'm using Chrome while always logged in, and that's where is the clip from. I'd actually tested on Firefox as well while incognito and unlogged, and I couldn't reproduce it. So either it's login info or cookies that you've mentioned. Edit: turned off ublock temporarily - still the same behaviour. |
@DawEdhel Are you still getting this behavior from GOG? I seem to experience it regardless if I have enhanced-gog installed or not. Wondering if this is also still an issue for you. |
Do you mean the stable version or the beta one? Btw I've done same actions on stable release, and everything stays the same in terms of currency/language/etc on GOG side. |
I see. I wasn't aware that the issue didn't exist on the stable release. Very strange; as I mentioned before, enhanced-gog doesn't modify or add any cookies, so I don't see how it can affect this. I may need to look into specifically what cookies affect the GOG region -- perhaps I can override it. |
I would like to have extra currencies for selected region as another comparing baselines.
Currently, as I understand, selected region can only provide its forced currency, but as I have to use another one, it's required for me to do own conversion computations.
So overall, my request is to add the option of having along with current region's forced currency number another ones, selected opt-in by an user. For example, if currently selected region is US and its returned value is "5$", then after this request's implementation I select additionally EU currency, instead I will get "5$ (4€)" (interface's showcase may vary).
As I don't know ITAD API, but the way I see, to implement this request it requires at least to have selected region's individual conversion rates.
The text was updated successfully, but these errors were encountered: