DavidoTek / ProtonUp-Qt

Install and manage GE-Proton, Luxtorpeda & more for Steam and Wine-GE & more for Lutris with this graphical user interface.
https://davidotek.github.io/protonup-qt
GNU General Public License v3.0
1.24k stars 40 forks source link

Add UI indicator for GitHub API limit #161

Closed dysonsphere-startmail closed 1 year ago

dysonsphere-startmail commented 1 year ago

Please fill out following when reporting a new bug:

Describe the bug
When choosing to install a compatibility tool the drop-down list does not populate with available versions

To Reproduce
Steps to reproduce the behavior:

  1. Click Add version
  2. Choose a comparability tool

Expected behavior
A list of versions of the selected compatability tool should be displayed in the version drop-down list.

Screenshots
Screenshot from 2022-12-19 13-36-21

Desktop (please complete the following information):

Terminal output

Python 3.10.6 (main, Nov 10 2011, 15:00:00) [GCC 12.1.0], PySide 6.4.0.1
Platform: Linux-6.0.6-76060006-generic-x86_64-with-glibc2.35
Gtk-Message: 13:45:56.375: Failed to load module "appmenu-gtk-module"
Gtk-Message: 13:45:56.415: Failed to load module "canberra-gtk-module"
Gtk-Message: 13:45:56.415: Failed to load module "canberra-gtk-module"
Qt: Session management error: None of the authentication protocols specified are supported
Loading locale en / en_CA
Loaded ctmod GE-Proton
Loaded ctmod Wine-GE
Loaded ctmod Boxtron
Loaded ctmod Kron4ek Wine-Builds Vanilla
Loaded ctmod Lutris-Wine
Loaded ctmod Luxtorpeda
Loaded ctmod Proton Tkg
Loaded ctmod Roberta
Loaded ctmod SteamTinkerLaunch
Loaded ctmod SteamTinkerLaunch-git
Loaded ctmod DXVK
Loaded ctmod DXVK Async
Loaded ctmod DXVK (nightly)
qt.pysideplugin: Environment variable PYSIDE_DESIGNER_PLUGINS is not set, bailing out.
qt.pysideplugin: No instance of QPyDesignerCustomWidgetCollection was found.
Gamepad error: No gamepad found.
DavidoTek commented 1 year ago

See https://github.com/DavidoTek/ProtonUp-Qt/wiki/GitHub-and-GitLab-API-Tokens


Have you used ProtonUp-Qt before without this issue?

There is a known "issue":

It uses the GitHub API. If the API is used too much it can happen that it won't load new releases. In that case you have to wait a few hours and it should work again (or you can specify a GitHub Auth Token, that's more of a developer thing and not necessary in most cases). You can check if the API is working for you by clicking following link, it should show a list of URLs: https://api.github.com/repos/GloriousEggroll/proton-ge-custom/releases

Specify a GitHub token

Create a new Token: https://github.com/settings/tokens (no extra scopes required) Run ProtonUp-Qt using following command: PUPGUI_GHA_TOKEN=token_here flatpak run net.davidotek.pupgui2

Please let me know if the problem persists.

Config file (only for versions 2.9.0 and newer)

In ProtonUp-Qt version 2.9.0 and newer, it is also possible to configure the tokens in ProtonUp-Qt's configuration file without requiring environment variables. A GUI option will follow.

You can find the configuration file under ~/.var/app/net.davidotek.pupgui2/config/pupgui/config.ini (installed from app store) or ~/.config/pupgui/config.ini (AppImage from GitHub).

Append the following lines to the config file or edit them if they already exist:

github_api_token = your-GitHub.com-token-here
gitlab_api_token = your-GitLab.com-token-here

You may, but don't have to configure both a GitHub and a GitLab token.

NOTE: If the environment variables are set, they will override the tokens configured in the config file!

dysonsphere-startmail commented 1 year ago

Have you used ProtonUp-Qt before without this issue?

There is a known "issue":

It uses the GitHub API. If the API is used too much it can happen that it won't load new releases. In that case you have to wait a few hours and it should work again (or you can specify a GitHub Auth Token, that's more of a developer thing and not necessary in most cases). You can check if the API is working for you by clicking following link, it should show a list of URLs: https://api.github.com/repos/GloriousEggroll/proton-ge-custom/releases

Please let me know if the problem persists.

That was it! I ran ProtonPlus and there was a notification indicating that I had exceeded my quota of allowed API calls. I tried on vpn and it worked. Thanks!

tavinus commented 1 year ago

Lost an hour uninstalling and reinstalling while wondering why the versions list would not populate. Thought something was corrupted.

This is quite annoying. Indeed it worked after connecting a VPN.

I was just playing with it for some minutes and installing some stuff. Maybe it does too many requests and should cache stuff instead? Or maybe make an easy way for people to add their own GitHub account auth token from the ui?

DavidoTek commented 1 year ago

Maybe it does too many requests and should cache stuff instead?

It's not doing that many requests. One requests when selecting a compatibility tool to fetch the available versions and another requests to gather information about the selected version. It may do more requests when chaning the selected version. Installing like 5 compatibility tools should not be a problem.

Or maybe make an easy way for people to add their own GitHub account auth token from the ui?

Having an indicator whether the API limit is reached might be a good idea. Not sure about the API token. It's an advanced feature and if you have one, you can set the environment variable PUPGUI_GHA_TOKEN.

cimba007 commented 1 year ago

PUPGUI_GHA_TOKEN

Can you explain more on how to get this token?

DavidoTek commented 1 year ago

Can you explain more on how to get this token?

Open GitHub, click the profile menu in the top right corner. Then click on the entry Settings. In the list on the left, scroll down and select Developer settings. There you can press Personal access tokens and then Tokens (classic). To create a new token, click on the button Generate new token and in the menu Generate new token (classic). You can choose a Note for the token (e.g. My ProtonUp-Qt Token) and an expiration time, until when the token will be valid (e.g. 90 days or No expiration). You do not need to give additional permissions for the token. Just click Generate token in the bottom of the page. It should return to the overview page where it shows the token. You can copy it and run ProtonUp-Qt with following command:

Flatpak: flatpak run --env=PUPGUI_GHA_TOKEN=tokenHere net.davidotek.pupgui2 AppImage: PUPGUI_GHA_TOKEN=tokenHere ./ProtonUp-Qt*.AppImage (Replace tokenHere with your access token)

RogerBytes commented 8 months ago

Have you used ProtonUp-Qt before without this issue?

There is a known "issue":

It uses the GitHub API. If the API is used too much it can happen that it won't load new releases. In that case you have to wait a few hours and it should work again (or you can specify a GitHub Auth Token, that's more of a developer thing and not necessary in most cases). You can check if the API is working for you by clicking following link, it should show a list of URLs: https://api.github.com/repos/GloriousEggroll/proton-ge-custom/releases

Specify a GitHub token

Create a new Token: https://github.com/settings/tokens (no extra scopes required) Run ProtonUp-Qt using following command: PUPGUI_GHA_TOKEN=token_here flatpak run net.davidotek.pupgui2

Please let me know if the problem persists.

Config file (only for versions above 2.8.2)

In versions newer than 2.8.2, it is also possible to configure the tokens in ProtonUp-Qt's configuration file without requiring environment variables. A GUI option will follow.

You can find the configuration file under ~/.var/app/net.davidotek.pupgui2/config/pupgui/config.ini (installed from app store) or ~/.config/pupgui/config.ini (AppImage from GitHub).

Append the following lines to the config file or edit them if they already exist:

github_api_token = your-GitHub.com-token-here
gitlab_api_token = your-GitLab.com-token-here

You may, but don't have to configure both a GitHub and a GitLab token.

NOTE: If the environment variables are set, they will override the tokens configured in the config file!

Thanks for the advices ! By my side using my token with

PUPGUI_GHA_TOKEN=token_here flatpak run net.davidotek.pupgui2

or with the path

PUPGUI_GHA_TOKEN=$(cat ~/.github/mytoken.txt) flatpak run net.davidotek.pupgui2

Work flawlessly. But editing ~/.var/app/net.davidotek.pupgui2/config/pupgui/config.ini don't work, I don't know why.

Cheers from France, thanks for your application, it's a great one, very useful.

Ps : here is any way to use a path with the token stored in a file ? Like ~/.github/mytoken.txt in my case. log.txt

DavidoTek commented 8 months ago

Thanks for the advices ! Work flawlessly.

Cheers from France, thanks for your application, it's a great one, very useful.

You're welcome. Great to hear that.

But editing ~/.var/app/net.davidotek.pupgui2/config/pupgui/config.ini don't work, I don't know why. Like ~/.github/mytoken.txt in my case

Adding the token to the config will be supported with ProtonUp-Qt version 2.9.0 which isn't released yet. I hope I'll get around doing that "soon". I will edit the comment you cited to make that more clear for others.

Having a separate "token.txt" file as you described isn't planned unless we find a real advantage having that.

RogerBytes commented 8 months ago

Thanks for the advices ! Work flawlessly.

Cheers from France, thanks for your application, it's a great one, very useful.

You're welcome. Great to hear that.

But editing ~/.var/app/net.davidotek.pupgui2/config/pupgui/config.ini don't work, I don't know why. Like ~/.github/mytoken.txt in my case

Adding the token to the config will be supported with ProtonUp-Qt version 2.9.0 which isn't released yet. I hope I'll get around doing that "soon". I will edit the comment you cited to make that more clear for others.

Having a separate "token.txt" file as you described isn't planned unless we find a real advantage having that.

Never mind for the token.txt, with cat it work nicely :

PUPGUI_GHA_TOKEN=$(cat ~/.github/mytoken.txt) flatpak run net.davidotek.pupgui2