mirror of
https://github.com/SinTan1729/ReVancedBuilder.git
synced 2024-12-27 05:08:35 -06:00
Auto detect compatible version
This commit is contained in:
parent
2b1002e40d
commit
efe0ca6d2f
3 changed files with 14 additions and 8 deletions
2
build_revanced.sh
Executable file → Normal file
2
build_revanced.sh
Executable file → Normal file
|
@ -49,7 +49,7 @@ populate_patches() {
|
||||||
|
|
||||||
# cleanup to fetch new revanced on next run
|
# cleanup to fetch new revanced on next run
|
||||||
if [[ "$1" == "clean" ]]; then
|
if [[ "$1" == "clean" ]]; then
|
||||||
rm -f revanced-cli.jar revanced-integrations.apk revanced-patches.jar
|
rm -f revanced-cli.jar revanced-integrations.apk revanced-patches.jar patches.json
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
declare -A apks
|
declare -A apks
|
||||||
|
|
||||||
apks["com.google.android.youtube.apk"]=dl_yt
|
apks["com.google.android.youtube"]=dl_yt
|
||||||
apks["com.google.android.apps.youtube.music.apk"]=dl_ytm
|
apks["com.google.android.apps.youtube.music"]=dl_ytm
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
|
|
||||||
|
@ -86,7 +86,17 @@ dl_ytm() {
|
||||||
for apk in "${!apks[@]}"; do
|
for apk in "${!apks[@]}"; do
|
||||||
if [ ! -f $apk ]; then
|
if [ ! -f $apk ]; then
|
||||||
echo "Downloading $apk"
|
echo "Downloading $apk"
|
||||||
version=$(jq -r ".\"$apk\"" <versions.json)
|
[ ! -f patches.json ] && req "https://raw.githubusercontent.com/revanced/revanced-patches/main/patches.json" patches.json
|
||||||
|
supported_vers="$(jq -r '.[].compatiblePackages[] | select(.name == "'$apk'") | .versions | last' patches.json)"
|
||||||
|
version=0
|
||||||
|
for vers in $supported_vers; do
|
||||||
|
if [ $vers != "null" ]; then
|
||||||
|
if [[ ${vers//[!0-9]/} -gt ${version//[!0-9]/} ]]; then
|
||||||
|
version=$vers
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
# version=$(jq -r ".\"$apk\"" <versions.json)
|
||||||
${apks[$apk]}
|
${apks[$apk]}
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
{
|
|
||||||
"com.google.android.youtube.apk": "17.36.37",
|
|
||||||
"com.google.android.apps.youtube.music.apk": "5.26.52"
|
|
||||||
}
|
|
Loading…
Reference in a new issue