Update to latest API

This commit is contained in:
Sayantan Santra 2023-01-28 12:59:25 -06:00
parent 19ed213e0c
commit 4accd2dce8
2 changed files with 22 additions and 3 deletions

View file

@ -15,7 +15,7 @@ if [ -d "$1" ]; then
WDIR="$1" WDIR="$1"
else else
echo "Working directory not provided" echo "Working directory not provided"
exit -1 exit 1
fi fi
# File containing all patches # File containing all patches
@ -99,7 +99,17 @@ cd "$WDIR"
echo "$(date) | Starting check..." echo "$(date) | Starting check..."
# Fetch all the dependencies # Fetch all the dependencies
curl -X 'GET' 'https://releases.rvcd.win/tools' -H 'accept: application/json' | sed 's:\\\/:\/:g' > latest_versions.json try=0
while : ; do
try=$(($try+1))
echo $try
[ $try -gt 10 ] && echo "API error!" && exit 2
curl -X 'GET' 'https://releases.revanced.app/tools' -H 'accept: application/json' -o latest_versions.json
cat latest_versions.json | jq -e '.error' >/dev/null || break
echo "API failure, trying again. $((10-$try)) tries left..."
sleep 10
done
for artifact in $artifacts; do for artifact in $artifacts; do
#Check for updates #Check for updates
repo=$(echo $artifact | cut -d ':' -f1) repo=$(echo $artifact | cut -d ':' -f1)

View file

@ -106,7 +106,16 @@ else
fi fi
## Main ## Main
curl -X 'GET' 'https://releases.rvcd.win/patches' -H 'accept: application/json' -o patches.json try=0
while : ; do
try=$(($try+1))
[ $try -gt 10 ] && echo "API error!" && exit 3
curl -X 'GET' 'https://releases.revanced.app/patches' -H 'accept: application/json' -o patches.json
cat patches.json | jq -e '.error' >/dev/null 2>&1 || break
echo "API failure, trying again. $((10-$try)) tries left..."
sleep 10
done
for apk in "${!apks[@]}"; do for apk in "${!apks[@]}"; do
echo "Checking $apk" echo "Checking $apk"
supported_vers="$(jq -r '.[].compatiblePackages[] | select(.name == "'$apk'") | .versions | last' patches.json)" supported_vers="$(jq -r '.[].compatiblePackages[] | select(.name == "'$apk'") | .versions | last' patches.json)"