diff --git a/.functions b/.functions index fa32d2e..32c4cbc 100644 --- a/.functions +++ b/.functions @@ -20,11 +20,11 @@ search_linux() { } torrent_linux() { - setsid -f "$TERMINAL" -e "$HOME/repos_scripts/torrent" "$1" + setsid -f "$TERMINAL" -e "$(dirname "$0")/torrent" "$1" } torrent_droid() { - "$HOME/.shortcuts/torrent" "$1" + "$(dirname "$0")/torrent" "$1" } info_droid() { @@ -45,6 +45,7 @@ error_linux() { player_droid() { am start --user 0 -a android.intent.action.VIEW -d "$1" -n is.xyz.mpv/.MPVActivity >/dev/null 2>&1 + #am start --user 0 -a android.intent.action.VIEW -d "$1" -n org.videolan.vlc/org.videolan.vlc.gui.video.VideoPlayerActivity -e "title" "$2" >/dev/null 2>&1 } player_linux() { diff --git a/ani-new b/ani-new index 81c7b09..6706df7 100755 --- a/ani-new +++ b/ani-new @@ -11,25 +11,23 @@ EOF chmod +x "$run_file" -# shellcheck source=/tmp/ani-new_run +# shellcheck disable=SC1091,SC1090 . "$run_file" case $(uname -o) in *ndroid*) os="droid" download_dir="/sdcard" - script_dir="$HOME/.shortcuts" ;; *) os="linux" download_dir="$HOME/Downloads" [ -t 1 ] || terminal="${TERMINAL:-foot} -e" - script_dir="$HOME/repos_scripts" ;; esac -# shellcheck source=./.functions -. "$script_dir/.functions" +# shellcheck disable=SC1091,SC1090 +. "$(dirname "$0")"/.functions trap "exit 0" INT HUP info_$os "Parsing $domain.. Please wait..." diff --git a/download b/download index 2e990b0..aa4454b 100755 --- a/download +++ b/download @@ -36,6 +36,7 @@ conv_to_octal(){ done res=$(printf '%03o' "$((res-${3}))") + #shellcheck disable=SC2059 printf "\\$res" | sed 's/[\/&]/\\&/g' } diff --git a/fap-cli b/fap-cli index 582caee..c41c8b5 100755 --- a/fap-cli +++ b/fap-cli @@ -30,7 +30,7 @@ err() { } get_query() { - [ -z "$*" ] && printf "${c_green}Search>${c_reset} " && read -r query || query=$* + [ -z "$*" ] && printf "%sSearch>%s " "$c_green" "$c_reset" && read -r query || query=$* query=$(printf "%s" "$query" | tr " " "+") } @@ -129,7 +129,7 @@ while getopts 'dhp:v' OPT; do v) player_fn="vlc" ;; - * | h) + *) help_text exit 0 ;; diff --git a/revanced b/revanced deleted file mode 100755 index b266378..0000000 --- a/revanced +++ /dev/null @@ -1,108 +0,0 @@ -#!/bin/sh - -info() { - printf "\033[1;35m=> \033[1;${2:-36}m%s\033[0m\n" "$1" -} - -download_apk() { - [ -z "$1" ] && info "[ $app ][ v$version ] Version doesn't Exist!" "31" && exit 1 - info "[ $app ][ v$version ] Fetching Download page.." - final_page=$(curl -s "${apk_provider_url}${1}" --tlsv1.3 -A "$agent" | sed -nE 's|.*href="(.*\/download\/[^"]*)".*|\1|p' | sed 's|&|\&|g') - [ -z "$final_page" ] && info "[ $app ][ v$version ] Unable to Fetch Download Page.." "31" && exit 1 - info "[ $app ][ v$version ] Fetching Download URL.." - download_url=$(curl -s "${apk_provider_url}${final_page}" --tlsv1.3 -A "$agent" | sed -nE 's|.*href="(.*download.php[^"]*)".*|\1|p' | sed 's|&|\&|g') - [ -z "$download_url" ] && info "[ $app ][ v$version ] Unable to Fetch Download URL.." "31" && exit 1 - info "[ $app ][ v$version ] Downloading App.." - aria2c -x16 -s16 "${apk_provider_url}${download_url}" --user-agent="$agent" -d "$tmp_dir" -o "$app-$version.apk" --allow-overwrite=true --check-certificate=false --download-result=hide --summary-interval=0 && info "[ $app ][ v$version ] App Downloaded.." && return 0 - info "[ $app ][ v$version ] Unable to Download.." "31" && exit 1 -} - -download_keystore() { - RV_KEYSTORE_URL="https://raw.githubusercontent.com/CoolnsX/revanced-build/master/yt-revanced.keystore" - RV_KEYSTORE="yt-revanced.keystore" - 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="${TMPDIR:-/tmp}/revanced" -agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/12$(head /dev/urandom | tr -dc '2-5' | cut -c1).0.0.0 Safari/537.36" -apk_provider_url="https://www.apkmirror.com" -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" - -#pre-requisite -if [ ! -f "$tmp_dir/$rv_cli.aria2" ] && [ ! -f "$tmp_dir/$rv_patch.aria2" ] && [ ! -f "$tmp_dir/$rv_inte.aria2" ] && [ -f "$tmp_dir/$rv_cli" ] && [ -f "$tmp_dir/$rv_patch" ] && [ -f "$tmp_dir/$rv_inte" ]; then - info "revanced-cli,revanced-patches,revanced-integrations already downloaded" "32" -else - rm -f "$tmp_dir"/*.aria2 - info "Downloading revanced-cli,revanced-patches,revanced-integrations.." - 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 - -[ -z "$app" ] && exit 0 - -#set variables according to selected app -case $app in - youtube) - arch="universal" - [ -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-repeat,disable-auto-captions,disable-zoom-haptics,enable-debugging,downloads,hide-autoplay-button,hide-captions-button,hide-cast-button,hide-floating-microphone-button,hide-layout-components,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) - arch="arm64-v8a" - [ -z "$2" ] && version="6.10.53" || version=$2 - 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 - info "Latest Recommended $app v$version already downloaded" "32" -else - info "[ $app ][ v$version ] Fetching App.." - download_apk "$(curl -s "$apk_provider_url/apk/google-inc/$app/$app-$version-release/" -A "$agent" --tlsv1.3 | tr -d '\n' | sed 's|svg class|\n|g' | sed -nE "s|.*$arch.*nodpi.*accent_color\" href=\"([^\"]*)\".*|\1|p")" -fi - -info "Checking Patches for excluding.." -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" - for i in $(printf "%s" "$exclude_patch_list" | tr ',' '\n'); do - if printf "%s" "$patch_list" | grep -iq "$(printf '%s' "$i" | tr '-' ' ')"; then - res="32m ✓" - else - res="31m " - check=1 - fi - printf "\033[2K\r\033[1;%s %s\n" "$res" "$i" - done - exclude_patches=$(printf "%s" "$exclude_patch_list" | tr ',' '\n' | sed 's|^|--exclude |g' | tr '\n' ' ') -else - info "Nothing to Exclude.." "32" -fi - -[ -n "$check" ] && info "Some of the patches are not Excluded,Check all failed patches using :" "31" && info "java -jar '$tmp_dir/$rv_cli' list-patches '$tmp_dir/$rv_patch' --with-packages" "33" && exit 1 -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" $keystore -t "$tmp_dir/revanced-resource-cache" "$tmp_dir/$app-$version.apk" $exclude_patches diff --git a/screen b/screen index c69eb70..2b18fcc 100755 --- a/screen +++ b/screen @@ -8,7 +8,7 @@ info() { } menu() { - bemenu --fn 'IBM Plex Sans 15' -i -c -W "0.${2:-5}" -B 3 -p "$1" -l 26 --accept-single + bemenu --fn 'IBM Plex Sans 15' -i -c -W "0.${2:-5}" -B 3 -p "$1" -l 26 --accept-single --bdr="#$GLOBAL_ACCENT" --tf="#$GLOBAL_ACCENT" --hf="#$GLOBAL_ACCENT" } compress() { diff --git a/tor-bay b/tor-bay index 1a62d9c..2845e69 100755 --- a/tor-bay +++ b/tor-bay @@ -6,31 +6,24 @@ cal_size() { } display() { - for i in $(seq $(printf "%s\nlol" "$2" | wc -l)); do + for i in $(seq "$(printf "%s\nlol" "$2" | wc -l)"); do printf "[%s GB;S:%s\n" "$(cal_size "$(printf "%s" "$1" | sed -n "${i}p")")" "$(printf "%s" "$2" | sed -n "${i}p")" & done wait } -case $(uname -o) in - *ndroid*) - os="droid" - script_dir="$HOME/.shortcuts" - ;; - *) - os="linux" - script_dir="$HOME/repos_scripts" - ;; -esac +os="linux" +uname -o | grep -q "ndroid" && os="droid" -. $script_dir/.functions +# shellcheck disable=SC1091,SC1090 +. "$(dirname "$0")"/.functions [ -z "$*" ] && search_$os "Search Torrent: " || query=$* [ -z "$query" ] && exit 0 [ "$os" = "linux" ] && tmp=$(notify-send -e "Searching query" -p) query=$(printf "%s" "$query" | tr " " "+") -data=$(curl -s "https://apibay.org/q.php?q=$query" | tee data | sed 's/},/}\n/g' | tr -d "[]") +data=$(curl -s "https://apibay.org/q.php?q=$query" | sed 's/},/}\n/g' | tr -d "[]") -[ "$os" = "linux" ] && notify-send -e "tidying up data" -r $tmp +[ "$os" = "linux" ] && notify-send -e "tidying up data" -r "$tmp" size=$(printf "%s" "$data" | sed -nE 's/.*name.*size":"(.*)",.*user.*/\1/p') name_seed=$(printf "%s" "$data" | sed -nE 's/.*name":"(.*)","info_hash.*seeders":"(.*)",.*num.*/\2] \1/p') sel=$(display "$size" "$name_seed" | menu_$os "Select Torrent: " | cut -d" " -f3-) diff --git a/tor-cli b/tor-cli index 4bac787..d56c4cd 100755 --- a/tor-cli +++ b/tor-cli @@ -1,17 +1,10 @@ #!/bin/sh -case $(uname -o) in - *ndroid*) - os="droid" - script_dir="$HOME/.shortcuts" - ;; - *) - os="linux" - script_dir="$HOME/repos_scripts" - ;; -esac +os="linux" +uname -o | grep -q "ndroid" && os="droid" +# shellcheck disable=SC1091,SC1090 +. "$(dirname "$0")"/.functions -. $script_dir/.functions [ -z "$*" ] && search_$os "Search Torrent: " || query=$* [ -z "$query" ] && exit 0 query=$(printf "%s" "$query" | tr ' ' '+') diff --git a/yt-music b/yt-music index f5444a3..9484d4e 100755 --- a/yt-music +++ b/yt-music @@ -198,7 +198,7 @@ play() { #get song's audio url random_no=$(head /dev/urandom | tr -dc '0-4' | cut -c1) - andy_yt_ver="6.50.53" + andy_yt_ver="7.03.52" extra_up=$((random_no > 1)) droid_agent="com.google.android.apps.youtube.music/$andy_yt_ver (Linux; U; Android 1$random_no) gzip" json="{ @@ -329,7 +329,7 @@ base_url="https://music.youtube.com" [ -d "$logdir" ] || mkdir "$logdir" [ -p "$presence" ] || mkfifo "$presence" cookie="$logdir/cookies" -agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" +agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36" #call this script by script-name "function_name" "query" [ -z "$1" ] && help "$@"