From b4b5d223a62a37e070f03e603ba1a5e911274f78 Mon Sep 17 00:00:00 2001 From: XLion Date: Sat, 23 Nov 2024 16:53:28 +0800 Subject: [PATCH] Adjust curl behavior --- rustdesk_latest.sh | 8 ++++---- rustdesk_nightly.sh | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/rustdesk_latest.sh b/rustdesk_latest.sh index 052bfde..c18dcc2 100644 --- a/rustdesk_latest.sh +++ b/rustdesk_latest.sh @@ -8,11 +8,11 @@ REPO="rustdesk/rustdesk" #API_URL="https://api.github.com/repos/$REPO/releases/tags/$TAG" API_URL="https://api.github.com/repos/$REPO/releases/latest" # Fetch the release data for the specified tag using curl -RELEASE_DATA=$(curl --retry 3 -s "$API_URL") +RELEASE_DATA=$(curl --retry 12 --retry-all-errors -s "$API_URL") -# Check if RELEASE_DATA is not empty -if [ -z "$RELEASE_DATA" ]; then - echo "Failed to fetch release data. Please check your internet connection or the repository/tag name." +# Check if RELEASE_DATA contains "browser_download_url" +if ! echo "$RELEASE_DATA" | grep -q "browser_download_url"; then + echo "'browser_download_url' not found in release data. Please check the repository/tag name or API response." exit 1 fi diff --git a/rustdesk_nightly.sh b/rustdesk_nightly.sh index e602882..93ebabf 100644 --- a/rustdesk_nightly.sh +++ b/rustdesk_nightly.sh @@ -8,11 +8,11 @@ TAG="nightly" # Change this to any tag you want API_URL="https://api.github.com/repos/$REPO/releases/tags/$TAG" #API_URL="https://api.github.com/repos/$REPO/releases/latest" # Fetch the release data for the specified tag using curl -RELEASE_DATA=$(curl --retry 3 -s "$API_URL") +RELEASE_DATA=$(curl --retry 12 --retry-all-errors -s "$API_URL") -# Check if RELEASE_DATA is not empty -if [ -z "$RELEASE_DATA" ]; then - echo "Failed to fetch release data. Please check your internet connection or the repository/tag name." +# Check if RELEASE_DATA contains "browser_download_url" +if ! echo "$RELEASE_DATA" | grep -q "browser_download_url"; then + echo "'browser_download_url' not found in release data. Please check the repository/tag name or API response." exit 1 fi