From 5cd93328f5968d1d1e7c098e3bebf0cd95e443ca Mon Sep 17 00:00:00 2001 From: rootiest Date: Thu, 6 Aug 2026 00:00:40 -0400 Subject: [PATCH] fix: dynamically resolve release download URL via API --- install.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 3836921..eb09982 100755 --- a/install.sh +++ b/install.sh @@ -2,7 +2,7 @@ set -e REPO_URL="https://git.rootiest.dev/rootiest/icon-color-tool.git" -DOWNLOAD_URL="https://git.rootiest.dev/rootiest/icon-color-tool/releases/latest/download/icon-color-tool" +API_URL="https://git.rootiest.dev/api/v1/repos/rootiest/icon-color-tool/releases/latest" INSTALL_DIR="${XDG_BIN_HOME:-$HOME/.local/bin}" TMP_DIR=$(mktemp -d) @@ -35,9 +35,16 @@ if [ "$BUILD" -eq 1 ]; then cd - > /dev/null else echo "Mode: Downloading pre-built binary" + DOWNLOAD_URL=$(curl -sL "$API_URL" | grep -o '"browser_download_url":"[^"]*"' | cut -d'"' -f4 | head -n 1) + + if [ -z "$DOWNLOAD_URL" ]; then + echo "Error: Could not find latest release binary download URL." + echo "If the release doesn't exist yet, you can use the --build flag to build from source." + exit 1 + fi + if ! curl -sfL "$DOWNLOAD_URL" -o "$TMP_DIR/icon-color-tool"; then echo "Error: Failed to download binary from $DOWNLOAD_URL" - echo "If the release doesn't exist yet, you can use the --build flag to build from source." exit 1 fi fi