Add count to update_oauth_resources.sh

This commit is contained in:
Matthew Esposito 2023-12-28 15:52:54 -05:00
parent 0955f902f8
commit 05f9d4f3bd
No known key found for this signature in database

View File

@ -26,11 +26,13 @@ echo "// Filled in with real app versions" >> "$filename"
# Open the array in the source file # Open the array in the source file
echo "pub static IOS_APP_VERSION_LIST: &[&str; $ios_app_count] = &[" >> "$filename" echo "pub static IOS_APP_VERSION_LIST: &[&str; $ios_app_count] = &[" >> "$filename"
num=0
# Append the version list to the source file # Append the version list to the source file
echo "$ios_version_list" | while IFS= read -r line; do echo "$ios_version_list" | while IFS= read -r line; do
num=$((num+1))
echo " \"$line\"," >> "$filename" echo " \"$line\"," >> "$filename"
echo -e "Fetched \e[34m$line\e[0m." echo -e "[$num/$ios_app_count] Fetched \e[34m$line\e[0m."
done done
# Close the array in the source file # Close the array in the source file
@ -63,13 +65,16 @@ echo -e "Fetching \e[32m$android_count Android app versions...\e[0m"
# Append to the source file # Append to the source file
echo "pub static ANDROID_APP_VERSION_LIST: &[&str; $android_count] = &[" >> "$filename" echo "pub static ANDROID_APP_VERSION_LIST: &[&str; $android_count] = &[" >> "$filename"
num=0
# For each in versions, curl the page and extract the build number # For each in versions, curl the page and extract the build number
echo "$versions" | while IFS= read -r line; do echo "$versions" | while IFS= read -r line; do
num=$((num+1))
fetch_page=$(curl -s "$line") fetch_page=$(curl -s "$line")
build=$(echo "$fetch_page" | rg "<span class=\"vercode\">\((\d+)\)</span>" --only-matching -r "\$1" | head -n1) build=$(echo "$fetch_page" | rg "<span class=\"vercode\">\((\d+)\)</span>" --only-matching -r "\$1" | head -n1)
version=$(echo "$fetch_page" | rg "<span class=\"vername\">Reddit (20\d{2}\.\d+\.\d+)</span>" --only-matching -r "\$1" | head -n1) version=$(echo "$fetch_page" | rg "<span class=\"vername\">Reddit (20\d{2}\.\d+\.\d+)</span>" --only-matching -r "\$1" | head -n1)
echo " \"Version $version/Build $build\"," >> "$filename" echo " \"Version $version/Build $build\"," >> "$filename"
echo -e "Fetched \e[32mVersion $version/Build $build\e[0m" echo -e "[$num/$android_count] Fetched \e[32mVersion $version/Build $build\e[0m"
done done
# Close the array in the source file # Close the array in the source file
@ -86,10 +91,13 @@ echo -e "Fetching \e[34m$ios_count iOS versions...\e[0m"
# Append to the source file # Append to the source file
echo "pub static IOS_OS_VERSION_LIST: &[&str; $ios_count] = &[" >> "$filename" echo "pub static IOS_OS_VERSION_LIST: &[&str; $ios_count] = &[" >> "$filename"
num=0
# For each in versions, curl the page and extract the build number # For each in versions, curl the page and extract the build number
echo "$table" | while IFS= read -r line; do echo "$table" | while IFS= read -r line; do
num=$((num+1))
echo " \"$line\"," >> "$filename" echo " \"$line\"," >> "$filename"
echo -e "Fetched $line\e[0m" echo -e "[$num/$ios_count] Fetched $line\e[0m"
done done
# Close the array in the source file # Close the array in the source file