Skip to content

fix(update): use server-side status endpoint instead of GitHub API from browser - #116

Merged
gnacho merged 1 commit into
mainfrom
fix/update-ribbon-server-side
Aug 28, 2026
Merged

fix(update): use server-side status endpoint instead of GitHub API from browser#116
gnacho merged 1 commit into
mainfrom
fix/update-ribbon-server-side

Conversation

@gnacho

@gnacho gnacho commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Problem

Both UpdateRibbon.tsx and the check button in Ajustes.tsx were fetching the latest release directly from github.com/ghapi in the browser. This causes GitHub rate-limit errors (403) on shared IPs (60 req/h unauthenticated), silently degrading to 'no updates available' with no user feedback.

The backend already had a proper server-side cached endpoint (GET /api/update/status) with a 5-minute kv cache, but the frontend was not using it.

Fix

  • UpdateRibbon.tsx: replaced direct github.com/ghapi fetch with apiFetch('/api/update/status'). The endpoint returns { current, latest, available } from the server-side cache. Removed the now-unused compareSemver helper and pkg import.
  • Ajustes.tsx checkUpdates: same fix - replaced the github.com/ghapi call (including the fallback to /tags) with the server-side endpoint. Removed the dead compareSemver function.

Result

-50 lines of duplicated GitHub API logic, +10 lines using the existing cached endpoint. The frontend no longer hits github.com/ghapi at all - all update checks go through the server, which rate-limits itself via the kv cache (5 min TTL).

Verified

  • npm run build (vite): OK
  • npm test (vitest): 105/105 passed
  • eslint: 0 errors on touched files

@gnacho
gnacho merged commit 143c4ce into main Aug 28, 2026
4 checks passed
@gnacho
gnacho deleted the fix/update-ribbon-server-side branch August 28, 2026 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant