fix(site): serve release data from a build-time snapshot, not the live API#3
Merged
Merged
Conversation
The download section fetched api.github.com/.../releases/latest on every page load. GitHub's anonymous REST limit is 60 req/hour PER IP (shared across a NAT), so a few refreshes or a busy network exhausted it and the site showed the generic error fallback (confirmed live: HTTP 403, x-ratelimit-remaining 0). The v0.1.1 release itself is fine and published. Fix: the deploy workflow now fetches the release server-side with GITHUB_TOKEN (authenticated, far higher limit) and bakes it into the site as public/latest-release.json. The hook reads that same-origin snapshot first — no CORS, no rate limit — and only falls back to the live API when the snapshot is missing (local dev, or a deploy where the fetch failed). The snapshot stays fresh via new `release: published` + daily `schedule` triggers on the deploy workflow. Also surface the real error (e.g. "GitHub API responded 403 (rate limit…)") in the fallback UI so future failures are self-diagnosing, and gitignore the generated snapshot. Verified locally: with the snapshot present the site renders v0.1.1 with per-OS buttons and makes zero api.github.com calls; with it removed it falls back to the live API correctly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The real cause (confirmed live, not guessed)
The download section fetched
api.github.com/repos/Coding-Moves/diskern/releases/lateston every page load. Captured from the deployed site's own origin:
x-ratelimit-remaining: 0/ limit 60, body: "API rate limit exceeded"./releases/latest→ 302 →/releases/tag/v0.1.1).GitHub's anonymous REST limit is 60 req/hour per IP, shared across a NAT — so a few
refreshes or a busy network exhausts it and everyone gets the error fallback. It self-heals
hourly, which is why it looked intermittent.
Fix
GITHUB_TOKEN(authenticated,far higher limit) and bakes it into
public/latest-release.json.back to the live API when the snapshot is missing (local dev / failed generation).
release: published+ dailyscheduletriggers.Verified locally
api.github.comcalls.that Pages serves for a missing file).