Skip to content

Commit 2ba85cd

Browse files
kiyeonjeon21claude
andcommitted
fix: install.sh — use GitHub redirect instead of API to avoid rate limits
The API endpoint (api.github.com) has 60 req/hour limit for unauthenticated users. The redirect method (github.com/releases/latest) has no rate limit. API is now fallback only. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 31bd259 commit 2ba85cd

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

install.sh

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,23 @@ detect_platform() {
3737

3838
# Get latest release tag
3939
get_latest_version() {
40-
local url="https://api.github.com/repos/${REPO}/releases/latest"
4140
local version
4241

42+
# Method 1: GitHub redirect (no API rate limit)
4343
if command -v curl &>/dev/null; then
44-
version=$(curl -fsSL "$url" | grep '"tag_name"' | head -1 | sed 's/.*"tag_name": *"//;s/".*//')
45-
elif command -v wget &>/dev/null; then
46-
version=$(wget -qO- "$url" | grep '"tag_name"' | head -1 | sed 's/.*"tag_name": *"//;s/".*//')
47-
else
48-
error "Neither curl nor wget found. Please install one of them."
44+
version=$(curl -fsSLI -o /dev/null -w '%{url_effective}' "https://github.com/${REPO}/releases/latest" | sed 's|.*/||')
45+
fi
46+
47+
# Method 2: GitHub API (fallback, subject to rate limits)
48+
if [ -z "$version" ] || [ "$version" = "latest" ]; then
49+
local api_url="https://api.github.com/repos/${REPO}/releases/latest"
50+
if command -v curl &>/dev/null; then
51+
version=$(curl -fsSL "$api_url" 2>/dev/null | grep '"tag_name"' | head -1 | sed 's/.*"tag_name": *"//;s/".*//')
52+
elif command -v wget &>/dev/null; then
53+
version=$(wget -qO- "$api_url" 2>/dev/null | grep '"tag_name"' | head -1 | sed 's/.*"tag_name": *"//;s/".*//')
54+
else
55+
error "Neither curl nor wget found. Please install one of them."
56+
fi
4957
fi
5058

5159
if [ -z "$version" ]; then

0 commit comments

Comments
 (0)