-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrevanced_mgr.sh
executable file
·182 lines (172 loc) · 6.08 KB
/
revanced_mgr.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
#!/bin/bash
<<'////'
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
////
cli_api="https://api.github.com/repos/revanced/revanced-cli/releases/latest"
patches_api="https://api.github.com/repos/revanced/revanced-patches/releases/latest"
integrations_api="https://api.github.com/repos/revanced/revanced-integrations/releases/latest"
vc=5
apps=("youtube" "music" "twitter" "reddit" "tiktoka" "tiktokg" "spotify" "windyapp" "nyx" "backdrops" "expensemgr" "hexedit" "ticktick" "warnapp" "iconpack" "citra" "myexpenses" "twitch")
youtube=(
"Youtube"
"https://apkcombo.com/youtube/com.google.android.youtube"
)
music=(
"Youtube Music"
"https://apkcombo.com/youtube-music/com.google.android.apps.youtube.music"
)
twitter=(
"Twitter"
"https://apkcombo.com/twitter/com.twitter.android"
)
reddit=(
"Reddit"
"https://apkcombo.com/reddit/com.reddit.frontpage"
)
tiktoka=(
"TikTok(Asia)"
"https://apkcombo.com/tiktok-asia/com.ss.android.ugc.trill"
)
tiktokg=(
"Tiktok(Global)"
"https://apkcombo.com/tiktok/com.zhiliaoapp.musically"
)
spotify=(
"Spotify"
"https://apkcombo.com/spotify/com.spotify.music"
)
windyapp=(
"Windy.app"
"https://apkcombo.com/windy-app/co.windyapp.android"
)
nyx=(
"Nyx Music Player"
"https://apkcombo.com/nyx-music-player/com.awedea.nyx"
)
backdrops=(
"Backdrops - Wallpapers"
"https://apkcombo.com/backdrops-wallpapers/com.backdrops.wallpapers"
)
expensemgr=(
"Money Manager"
"https://apkcombo.com/money-manager-expense-budget/com.ithebk.expensemanager"
)
hexedit=(
"HEX Editor"
"https://apkcombo.com/hex-editor/com.myprog.hexedit"
)
ticktick=(
"TickTick"
"https://apkcombo.com/ticktick/com.ticktick.task"
)
warnapp=(
"WarnWetter"
"https://apkcombo.com/warnwetter/de.dwd.warnapp"
)
iconpack=(
"Icon Pack Studio"
"https://apkcombo.com/icon-pack-studio/ginlemon.iconpackstudio"
)
citra=(
"Citra Emulator"
"https://apkcombo.com/citra-emulator/org.citra.citra_emu"
)
myexpenses=(
"My Expenses"
"https://apkcombo.com/my-expenses/org.totschnig.myexpenses"
)
twitch=(
"Twitch"
"https://apkcombo.com/twitch/tv.twitch.android.app"
)
pwd=$(pwd)
mkdir ~/.revanced &>/dev/null; cd ~/.revanced
[[ $(uname -a | awk '{print $NF}') = "Android" ]] && isDroid=true || isDroid=false
function getappver(){
ver=$(jq -r ".[].compatiblePackages[]|select(.name==\"$(eval echo \${$1[1]} | awk -F/ '{print $NF}')\")|.versions[]" ./patches | awk '{if(m<$NF) m=$NF} END{print m}')
[[ -n "$ver" ]] || ver="all"
echo $ver
}
#Check script version
[[ $(curl -fsSL https://github.com/gnuhead-chieb/revanced-automatic-builder/raw/aapt2/vc) -gt $vc ]] && {
. <(curl -fsSL https://github.com/gnuhead-chieb/revanced-automatic-builder/raw/main/installer.sh)
echo "Script updated!, please run again!"
exit
}
##Check version and download revanced packages
for pkg in cli patches integrations
do
ver=$(eval curl -s '$'${pkg}_api | jq -r ".name")
download=$(eval curl -s '$'${pkg}_api | jq -r ".assets[-1].browser_download_url")
[[ $ver == "null" ]] && { echo "${pkg^}:API Error"; continue; }
ls $pkg-$ver &>/dev/null && echo ${pkg^}:updated! || { rm -f $pkg-*; wget "$download" -c -t 15 -O $pkg-$ver; }
done
$isDroid && [[ ! -e aapt2 ]] && wget https://github.com/gnuhead-chieb/revanced-automatic-builder/raw/aapt2/$(getprop ro.product.cpu.abi)/aapt2
#Fetch Patches database
wget https://releases.revanced.app/patches &>/dev/null
exclude=""
if [ $# -eq 2 ]; then
if [ "$1" == "--exclude" ] || [ "$1" == "-e" ]; then
excludes=$2
exclude=" -e ${excludes//,/ -e }"
fi
fi
#List patch available app versions
echo -e "Loading apps... \n"
{
opt=0
for pkg in ${apps[@]}
do
eval echo "$opt:\${$pkg[0]},$(getappver $pkg)"
((opt++))
done; }|column -t -s,
while true
do
read -p ">" menuinput
chk=0
for i in $menuinput
do
{ [[ $i =~ ^[0-9]+$ ]] && [[ $i -ge 0 ]] && [[ $i -lt ${#apps[@]} ]]; } || chk=1
done
[[ $chk = 0 ]] && break
done
#Download required apk from APKCombo and patch
for i in $menuinput
do
rm -f ${apps[$i]}-orig.apk &>/dev/null
ver=$(getappver ${apps[$i]})
[[ "$ver" = "all" ]] && req="apk" || req="phone-${ver}-apk"
wget $(eval curl -s "\${${apps[$i]}[1]}/download/${req}" | grep -oPm1 "(?<=href=\")https://download.apkcombo.com/.*?(?=\")")\&$(curl -s "https://apkcombo.com/checkin") -O ${apps[$i]}-orig.apk
java -jar cli-* -b patches-* -m integrations-*$exclude -a ${apps[$i]}-orig.apk -c -o ${apps[$i]}-patched.apk --experimental $($isDroid && echo "--custom-aapt2-binary ./aapt2")
mv ${apps[$i]}-patched.apk $pwd
done
#Install apk by Termux or ADB
for i in $menuinput
do
$isDroid && {
mv $pwd/${apps[$i]}-patched.apk /sdcard/
grep -P "^allow-external-apps *= *true$" ~/.termux/termux.properties >/dev/null || echo "allow-external-apps = true" >>~/.termux/termux.properties
echo "Your patched apk was saved in \"/storage/emulated/0/\""
echo "Do you want install patched apk?(y/n)"
while true
do
read -p ">" isinstall
case "$isinstall" in
[yY]es | [yY] ) { termux-open /sdcard/${apps[$i]}-patched.apk; break; } ;;
[nN]o | [nN] ) break ;;
esac
done
} || {
echo "Do you want install patched apk by ADB?(y/n)"
while true
do
read -p ">" isinstall
case "$isinstall" in
[yY]es | [yY] ) { adb install $pwd/${apps[$i]}-patched.apk; break; } ;;
[nN]o | [nN] ) break ;;
esac
done
}
done