Support revanced cli version 5 syntax

This commit is contained in:
Fioren
2024-10-12 02:00:20 +07:00
parent 806b328e6d
commit 7718be3c9a
40 changed files with 43 additions and 80 deletions

View File

@@ -90,13 +90,39 @@ dl_gh() {
get_patches_key() {
excludePatches=""
includePatches=""
while IFS= read -r line1; do
excludePatches+=" -e \"$line1\""
done < src/patches/$1/exclude-patches
excludeLinesFound=false
includeLinesFound=false
if [[ $(ls revanced-cli-*.jar) =~ revanced-cli-([0-9]+) ]]; then
num=${BASH_REMATCH[1]}
if [ $num -ge 5 ]; then
while IFS= read -r line1; do
excludePatches+=" -d \"$line1\""
excludeLinesFound=true
done < src/patches/$1/exclude-patches
while IFS= read -r line2; do
includePatches+=" -e \"$line2\""
includeLinesFound=true
done < src/patches/$1/include-patches
else
while IFS= read -r line1; do
excludePatches+=" -e \"$line1\""
excludeLinesFound=true
done < src/patches/$1/exclude-patches
while IFS= read -r line2; do
includePatches+=" -i \"$line2\""
includeLinesFound=true
done < src/patches/$1/include-patches
fi
fi
if [ "$excludeLinesFound" = false ]; then
excludePatches=""
fi
if [ "$includeLinesFound" = false ]; then
includePatches=""
fi
export excludePatches
while IFS= read -r line2; do
includePatches+=" -i \"$line2\""
done < src/patches/$1/include-patches
export includePatches
}
@@ -117,11 +143,8 @@ req() {
dl_apk() {
local url=$1 regexp=$2 output=$3
url="https://www.apkmirror.com$(req "$url" - | tr '\n' ' ' | sed -n "s/href=\"/@/g; s;.*${regexp}.*;\1;p")"
sleep 5
url=$(req "$url" - | $HTMLQ --base https://www.apkmirror.com --attribute href ".downloadButton")
sleep 5
url=$(req "$url" - | $HTMLQ --base https://www.apkmirror.com --attribute href "span > a[rel = nofollow]")
sleep 5
req "$url" "$output"
}
get_apk() {
@@ -188,35 +211,29 @@ get_apk() {
patch() {
green_log "[+] Patching $1:"
if [ -f "./download/$1.apk" ]; then
local p b m ks a pu
local p b m ks a pu opt
if [ "$3" = inotia ]; then
p="patch " b="--patch-bundle" m="--merge" a="" ks="_ks" pu="--purge=true"
p="patch " b="--patch-bundle *patch*.jar" m="--merge *integration*.apk " a="" ks="_ks" pu="--purge=true" opt="--options=./src/options/$2.json "
echo "Patching with Revanced-cli inotia"
else
if [[ $(ls revanced-cli-*.jar) =~ revanced-cli-([0-9]+) ]]; then
num=${BASH_REMATCH[1]}
if [ $num -ge 4 ]; then
p="patch " b="--patch-bundle" m="--merge" a="" ks="ks" pu="--purge=true"
echo "Patching with Revanced-cli version 4+"
if [ $num -ge 5 ]; then
p="patch " b="-p *.rvp" m="" a="" ks="ks" pu="--purge=true" opt=""
echo "Patching with Revanced-cli version 5+"
elif [ $num -eq 4 ]; then
p="patch " b="--patch-bundle *patch*.jar" m="--merge *integration*.apk " a="" ks="ks" pu="--purge=true" opt="--options=./src/options/$2.json "
echo "Patching with Revanced-cli version 4"
elif [ $num -eq 3 ]; then
p="patch " b="--patch-bundle" m="--merge" a="" ks="_ks" pu="--purge=true"
p="patch " b="--patch-bundle *patch*.jar" m="--merge *integration*.apk " a="" ks="_ks" pu="--purge=true" opt="--options=./src/options/$2.json "
echo "Patching with Revanced-cli version 3"
elif [ $num -eq 2 ]; then
p="" b="--bundle" m="--merge" a="--apk " ks="_ks" pu="--clean"
p="" b="--bundle *patch*.jar" m="--merge *integration*.apk " a="--apk " ks="_ks" pu="--clean" opt="--options=./src/options/$2.json "
echo "Patching with Revanced-cli version 2"
fi
fi
fi
eval java -jar *cli*.jar $p\
$b *patch*.jar \
$m *integration*.apk\
$excludePatches\
$includePatches \
--options=./src/options/$2.json \
--out=./release/$1-$2.apk \
--keystore=./src/$ks.keystore \
$pu \
$a./download/$1.apk
eval java -jar *cli*.jar $p$b $m$opt--out=./release/$1-$2.apk$excludePatches$includePatches --keystore=./src/$ks.keystore $pu $a./download/$1.apk
unset version
unset excludePatches
unset includePatches