Never before had a small typo like this one caused so much damage.

This commit is contained in:
coolnsx
2023-10-17 13:20:59 +05:30
parent 95471a8bd8
commit c1c0ac78f3
4 changed files with 53 additions and 36 deletions

View File

@@ -18,6 +18,16 @@ download_apk(){
info "[ $app ][ v$version ] Unable to Download.." "31" && exit 1
}
download_keystore () {
[ ! -f "$HOME/.secrets" ] && return 0
#shellcheck disable=SC1091
. "$HOME/.secrets"
load_revanced_creds
keystore="--keystore $tmp_dir/$RV_KEYSTORE"
[ ! -f "$tmp_dir/$RV_KEYSTORE" ] && curl -s "$RV_KEYSTORE_URL" -o "$tmp_dir/$RV_KEYSTORE" && info "Downloaded Keystore file in $tmp_dir" "32" && return 0
[ ! -f "$tmp_dir/$RV_KEYSTORE" ] && keystore=""
}
tmp_dir="/tmp/revanced"
agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
apk_provider_url="https://www.apkmirror.com"
@@ -25,6 +35,7 @@ date=$(date +%F)
rv_cli="cli-$date.jar"
rv_patch="patches-$date.jar"
rv_inte="integrations-$date.apk"
keystore=""
#check if directory is there
[ -d "$tmp_dir" ] || mkdir "$tmp_dir"
@@ -38,6 +49,8 @@ else
printf "%s\n%s\n%s" "$(curl -s "https://api.github.com/repos/revanced/revanced-cli/releases/latest" -L -A "$agent" | sed -nE "s|.*browser_download_url\": \"([^\"]*.jar)\"|\1\n\tout=$rv_cli|p")" "$(curl -s "https://api.github.com/repos/revanced/revanced-patches/releases/latest" -L -A "$agent" | sed -nE "s|.*browser_download_url\": \"([^\"]*.jar)\"|\1\n\tout=$rv_patch|p")" "$(curl -s "https://api.github.com/repos/revanced/revanced-integrations/releases/latest" -L -A "$agent" | sed -nE "s|.*browser_download_url\": \"([^\"]*.apk)\"|\1\n\tout=$rv_inte|p")" | aria2c -j3 -x16 -s16 -i - --check-certificate=false --download-result=hide --summary-interval=0 --allow-overwrite=true -d "$tmp_dir" && info "Downloaded revanced-cli,revanced-patches,revanced-integrations at $tmp_dir"
fi
download_keystore
#choose your app
[ -z "$1" ] && app=$(printf "youtube\nyoutube-music" | fzf --prompt="Select Application:" --layout=reverse --height=8 --border) || app=$1
@@ -47,8 +60,8 @@ fi
case $app in
youtube)
arch="universal"
[ -z "$2" ] && version=$(curl -s "https://api.revanced.app/v2/patches/latest" | sed -nE 's|.*"compatiblePackages":\[\{"name":"com.google.android.youtube","versions":\[(.*[^\]]).*|\1|p' | tr -d ']}"' | tr ',' '\n' | tail -1) || version=$2
exclude_patch_list="always-autorepeat,disable-auto-captions,disable-zoom-haptics,enable-debugging,external-downloads,hide-autoplay-button,hide-captions-button,hide-cast-button,hide-floating-microphone-button,hide-layout-components,hide-load-more-button,hide-player-buttons,custom-player-overlay-opacity,hide-seekbar,hide-timestamp,hide-video-action-buttons,navigation-buttons,player-flyout-menu,remove-player-controls-background,spoof-app-version,swipe-controls"
[ -z "$2" ] && version=$(curl -s "https://api.revanced.app/v2/patches/latest" | sed -nE 's|.*youtube","versions":\[[0-9\.",]*,"([^\}]*)"\].*|\1|p') || version=$2
exclude_patch_list="always-autorepeat,disable-auto-captions,disable-zoom-haptics,enable-debugging,external-downloads,hide-autoplay-button,hide-captions-button,hide-cast-button,hide-floating-microphone-button,hide-layout-components,hide-'load-more'-button,hide-player-buttons,custom-player-overlay-opacity,hide-seekbar,hide-timestamp,hide-video-action-buttons,navigation-buttons,player-flyout-menu,remove-player-controls-background,spoof-app-version,swipe-controls"
out="yt-revanced-$version.apk"
;;
youtube-music)
@@ -57,6 +70,9 @@ case $app in
exclude_patch_list=""
out="yt-music-revanced-$version.apk"
;;
*)
info "Wrong Package Name, please pass either 'youtube' or 'youtube-music'" "31"
exit 1
esac
if [ -f "$tmp_dir/$app-$version.apk" ] && [ ! -f "$tmp_dir/$app-$version.apk.aria2" ];then
@@ -67,7 +83,7 @@ else
fi
info "Checking Patches for excluding.."
patch_list=$(java -jar "$tmp_dir/$rv_cli" list-patches "$tmp_dir/$rv_patch" --with-descriptions=false)
patch_list=$(java -jar "$tmp_dir/$rv_cli" list-patches "$tmp_dir/$rv_patch" --with-descriptions=false)
if [ -n "$exclude_patch_list" ];then
info "Excluding Patches.." "33"
@@ -91,4 +107,4 @@ info "All listed Patches Excluded"
info "Patching $app-$version.apk.."
#shellcheck disable=SC2086
java -jar "$tmp_dir/$rv_cli" patch --patch-bundle "$tmp_dir/$rv_patch" --merge "$tmp_dir/$rv_inte" --out "$HOME/$out" --resource-cache "$tmp_dir/revanced-resource-cache" "$tmp_dir/$app-$version.apk" $exclude_patches
java -jar "$tmp_dir/$rv_cli" patch --patch-bundle "$tmp_dir/$rv_patch" --merge "$tmp_dir/$rv_inte" --out "$HOME/$out" $keystore --resource-cache "$tmp_dir/revanced-resource-cache" "$tmp_dir/$app-$version.apk" $exclude_patches