Fix #162: fall back to the release page when the GitHub API is rate-limited #190

Manually merged
github merged 1 commit from github-bot/gh-190 into main 2026-12-04 18:12:51 +00:00 AGit
Owner

@⁠laalaalaee on GitHub · 2026-12-04 12:02 UTC · original
laalaalaee:fix/update-check-rate-limit → main · +101 −10 · 1 files · 1 commits · merged 2026-12-04 18:12 UTC

Fixes #162.

Without a token the GitHub API allows 60 requests an hour per IP, so players on a shared IP (CGNAT, VPN, campus networks) get 403 (rate limit exceeded) from Check for Updates and Auto Update.

Change

Only Services/LauncherUpdateService.cs:

  • On a 403/429 from the API, the check falls back to github.com/<repo>/releases/latest, which redirects to /releases/tag/<tag>. github.com pages are not under the API rate limit.
  • A HEAD request to the release zip (named as release.yml names it: AmericasLauncher-<tag>-win-x64.zip) tells whether it is uploaded yet and its size. The download is then checked against that size. If the zip isn't there yet, it is reported like a release without its zip (Open Release).
  • When the API answers, nothing changes: the SHA-256 digest check still runs. The digest is only available from the API, so the fallback relies on the size check.
  • If the fallback fails too, the error now reads "GitHub's request limit for this network was reached (resets at HH:mm). Please try again later." instead of the raw status code. Both cases are written to update.log.
  • The 404 / no-release result and the version comparison were moved into small helpers so both paths share them.

Testing

  • dotnet build -c Release passes (0 errors, no new warnings).
  • Ran the service against live GitHub with the API URL pointed at a local server that answers 403 with X-RateLimit-Reset:
    • API working: v2.2.2, zip URL, size 68531429, SHA-256 as before.
    • API 403: fallback finds v2.2.2, same zip URL and size.
    • API 403 and the release page unreachable: the rate-limit message with the reset time.
    • API 403 on a repo without releases: "No releases published yet".
    • API 403 on a release without a matching zip: update reported, no download URL (Open Release).

FoxHound, Leila and the Auto Save list also call the GitHub API and share the same limit; this PR keeps to the launcher update check shown in the issue.

**@⁠laalaalaee** on GitHub · 2026-12-04 12:02 UTC · [original](https://github.com/isaac-btw/AmericasLauncher/pull/190) `laalaalaee:fix/update-check-rate-limit` → `main` · +101 −10 · 1 files · 1 commits · merged 2026-12-04 18:12 UTC Fixes #162. Without a token the GitHub API allows 60 requests an hour per IP, so players on a shared IP (CGNAT, VPN, campus networks) get `403 (rate limit exceeded)` from **Check for Updates** and **Auto Update**. ### Change Only `Services/LauncherUpdateService.cs`: - On a 403/429 from the API, the check falls back to `github.com/<repo>/releases/latest`, which redirects to `/releases/tag/<tag>`. github.com pages are not under the API rate limit. - A HEAD request to the release zip (named as `release.yml` names it: `AmericasLauncher-<tag>-win-x64.zip`) tells whether it is uploaded yet and its size. The download is then checked against that size. If the zip isn't there yet, it is reported like a release without its zip (Open Release). - When the API answers, nothing changes: the SHA-256 digest check still runs. The digest is only available from the API, so the fallback relies on the size check. - If the fallback fails too, the error now reads "GitHub's request limit for this network was reached (resets at HH:mm). Please try again later." instead of the raw status code. Both cases are written to `update.log`. - The 404 / no-release result and the version comparison were moved into small helpers so both paths share them. ### Testing - `dotnet build -c Release` passes (0 errors, no new warnings). - Ran the service against live GitHub with the API URL pointed at a local server that answers 403 with `X-RateLimit-Reset`: - API working: v2.2.2, zip URL, size 68531429, SHA-256 as before. - API 403: fallback finds v2.2.2, same zip URL and size. - API 403 and the release page unreachable: the rate-limit message with the reset time. - API 403 on a repo without releases: "No releases published yet". - API 403 on a release without a matching zip: update reported, no download URL (Open Release). FoxHound, Leila and the Auto Save list also call the GitHub API and share the same limit; this PR keeps to the launcher update check shown in the issue.
Without a token the GitHub API allows 60 requests an hour per IP, so players
on a shared IP (CGNAT, VPN, campus networks) get "403 (rate limit exceeded)"
from Check for Updates and Auto Update (#162).

On a 403/429 the check now reads the tag from where
github.com/<repo>/releases/latest redirects to, and checks with a HEAD
request that the release zip (named as release.yml names it) is there and
how big it is. github.com pages are not under the API's rate limit. The
download is then checked against that size; the SHA-256 check still runs
whenever the API answers.

If the fallback fails too, the error says the limit was reached and when it
resets, instead of the raw status code.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-04 12:03:46 +00:00
Author
Owner

@⁠copilot-pull-request-reviewer[bot] on GitHub · 2026-12-04 12:02 UTC · original · reviewed

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

**@⁠copilot-pull-request-reviewer[bot]** on GitHub · 2026-12-04 12:02 UTC · [original](https://github.com/isaac-btw/AmericasLauncher/pull/190#pullrequestreview-6188560613) · **reviewed** Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Author
Owner

@⁠C1berCanarri on GitHub · 2026-12-04 16:19 UTC · original · approved these changes

**@⁠C1berCanarri** on GitHub · 2026-12-04 16:19 UTC · [original](https://github.com/isaac-btw/AmericasLauncher/pull/190#pullrequestreview-6192520211) · **approved these changes**
github manually merged commit cd7bd1ace2 into main 2026-12-04 18:12:51 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.