72 lines
2.6 KiB
Bash
Executable File
72 lines
2.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
###################################################
|
|
# "THE DRINK-WARE LICENSE" (Revision 42): #
|
|
# #
|
|
# As long as you retain this notice you can #
|
|
# do whatever you want with this stuff. #
|
|
# If we meet some day, and you think this stuff #
|
|
# is worth it, you can buy me a drink in return. #
|
|
# #
|
|
# -- Observer of Time <chronobserver@disroot.org> #
|
|
###################################################
|
|
|
|
set -euo pipefail
|
|
|
|
: "$KEYSTORE_PATH" "$KEYSTORE_ALIAS"
|
|
|
|
URL='https://ws75.aptoide.com/api/7/app/getMeta?package_name=com.discord'
|
|
|
|
[[ $(curl -Ssf "$URL") =~ \"vercode\":([0-9]+),.*\"path\":\"([^\"]+)\" ]]
|
|
|
|
discord="com.discord-${BASH_REMATCH[1]}"
|
|
|
|
printf 'Downloading %s...\n' "${BASH_REMATCH[2]}"
|
|
|
|
curl --progress-bar -Lfo "$discord.apk" "${BASH_REMATCH[2]}"
|
|
|
|
apktool d "$discord.apk" -o "$discord"
|
|
|
|
git clone --depth=1 https://gitdab.com/distok/cutthecord
|
|
|
|
printf 'Editing patches...\n'
|
|
|
|
sed -i cutthecord/patches/squareavatars/"${BASH_REMATCH[1]}".patch -e 's/3dp/5dp/'
|
|
sed -i cutthecord/patches/branding/"${BASH_REMATCH[1]}".patch \
|
|
-e 's/CTCNAME/Discord (CTC)/g;s/CTCBRANCH/chronobserver/g' \
|
|
-e "s/-CTCBUILD/-$(date --iso-8601)/g;s/CTCBUILD//g"
|
|
sed -i cutthecord/patches/branding/customicon.sh -e 's/#rm/rm/'
|
|
|
|
for p in necessary notrack noblocked squareavatars branding customversion; do
|
|
patch -d "$discord" -p1 < "cutthecord/patches/$p/${BASH_REMATCH[1]}.patch"
|
|
done
|
|
|
|
printf 'Replacing files...\n'
|
|
|
|
pushd "$discord" >/dev/null
|
|
bash ../cutthecord/patches/notrack/"${BASH_REMATCH[1]}"-post.sh
|
|
bash ../cutthecord/patches/branding/customicon.sh
|
|
bash ../cutthecord/patches/branding/customdynamicicon.sh
|
|
bash ../cutthecord/patches/bettertm/bettertm.sh ../cutthecord/patches/bettertm
|
|
popd >/dev/null
|
|
|
|
curl -LSsfo "$discord"/res/font/whitney_semibold.ttf \
|
|
https://github.com/google/fonts/raw/master/ofl/asap/Asap-Medium.ttf
|
|
curl -LSsfo "$discord"/res/font/whitney_bold.ttf \
|
|
https://github.com/google/fonts/raw/master/ofl/asap/Asap-SemiBold.ttf
|
|
curl -LSsfo "$discord"/res/font/whitney_medium.ttf \
|
|
https://github.com/google/fonts/raw/master/ofl/asap/Asap-Regular.ttf
|
|
curl -LSsfo "$discord"/res/font/sourcecodepro_semibold.ttf \
|
|
https://github.com/thiagolucio/code-editor-fonts/raw/master/Hasklig.ttf/Hasklig-Medium.ttf
|
|
|
|
apktool b "$discord"
|
|
|
|
while ! jarsigner -keystore "$KEYSTORE_PATH" \
|
|
"$discord/dist/$discord.apk" "$KEYSTORE_ALIAS"
|
|
do :; done
|
|
|
|
if [[ -z ${SKIP_INSTALL+x} ]]; then
|
|
adb install -r "$discord/dist/$discord.apk"
|
|
rm -rf "$discord" "$discord.apk" cutthecord
|
|
fi
|