Download the decompiled code from apkfuckery
This commit is contained in:
parent
277641529d
commit
b6d701e9e8
|
@ -1,5 +1,5 @@
|
||||||
cutthecord/
|
cutthecord/
|
||||||
com.discord-*/
|
com.discord/
|
||||||
com.discord-*.apk
|
*.p12
|
||||||
*.jks
|
*.jks
|
||||||
*.keystore
|
*.keystore
|
||||||
|
|
22
README.md
22
README.md
|
@ -3,11 +3,10 @@
|
||||||
### Requires
|
### Requires
|
||||||
|
|
||||||
- `bash`
|
- `bash`
|
||||||
- `coreutils`
|
|
||||||
- `sed`
|
- `sed`
|
||||||
- `patch`
|
- `patch`
|
||||||
- `git`
|
|
||||||
- `curl`
|
- `curl`
|
||||||
|
- `tar`
|
||||||
- `apktool`
|
- `apktool`
|
||||||
- `keytool`
|
- `keytool`
|
||||||
- `jarsigner`
|
- `jarsigner`
|
||||||
|
@ -21,7 +20,6 @@
|
||||||
- `customversion`
|
- `customversion`
|
||||||
- `necessary`
|
- `necessary`
|
||||||
- `noblocked`
|
- `noblocked`
|
||||||
- `notrack`
|
|
||||||
- `squareavatars`
|
- `squareavatars`
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
@ -38,20 +36,28 @@ export KEYSTORE_ALIAS="ctc-key"
|
||||||
If the file doesn't exist, generate it with `keytool`.
|
If the file doesn't exist, generate it with `keytool`.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
keytool -genkeypair \
|
keytool -genkeypair -keystore "$KEYSTORE_PATH" -alias "$KEYSTORE_ALIAS"
|
||||||
-keystore "$KEYSTORE_PATH" \
|
```
|
||||||
-alias "$KEYSTORE_ALIAS"
|
|
||||||
|
You also need to set the following variables:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# the version code of the Discord APK
|
||||||
|
export VERCODE="1196"
|
||||||
|
# the apkfuckery commit hash corresponding to VERCODE
|
||||||
|
# https://gitdab.com/distok/apkfuckery/commits/branch/master
|
||||||
|
export COMMIT_HASH="2e0ee2fb8b4825de22cb43163be7072ea2f2b7b3"
|
||||||
```
|
```
|
||||||
|
|
||||||
Now, you can run the script.<br>You will
|
Now, you can run the script.<br>You will
|
||||||
be prompted to enter the keystore password.
|
be prompted to enter the keystore password.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
bash < <(curl -LSs https://ikl.sh/ctc-patcher)
|
bash < <(curl -LSs https://discord.coffee/5V4AnGq)
|
||||||
```
|
```
|
||||||
|
|
||||||
You can install the patched app manually by setting `SKIP_INSTALL`
|
You can install the patched app manually by setting `SKIP_INSTALL`
|
||||||
before running the script.<br>You will find it in `com.discord-*/dist/`.
|
before running the script.<br>You will find it in `com.discord/dist/`.
|
||||||
|
|
||||||
[CutTheCord]: https://gitdab.com/distok/cutthecord
|
[CutTheCord]: https://gitdab.com/distok/cutthecord
|
||||||
[Asap]: https://fonts.google.com/specimen/Asap
|
[Asap]: https://fonts.google.com/specimen/Asap
|
||||||
|
|
48
patch.sh
48
patch.sh
|
@ -13,63 +13,57 @@
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
: "$KEYSTORE_PATH" "$KEYSTORE_ALIAS"
|
trap 'exit 130' INT
|
||||||
|
|
||||||
URL='https://ws75.aptoide.com/api/7/app/getMeta?package_name=com.discord'
|
: "$KEYSTORE_PATH" "$KEYSTORE_ALIAS" "$VERCODE" "$COMMIT_HASH"
|
||||||
|
|
||||||
if [[ -n ${VERCODE+x} ]]; then
|
_dab() (curl --progress-bar -Lf "https://gitdab.com/distok/$1/archive/$2.tar.gz")
|
||||||
URL+="&max_vercode=$VERCODE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
[[ $(curl -Ssf "$URL") =~ \"vercode\":([0-9]+),.*\"path\":\"([^\"]+)\" ]]
|
printf 'Downloading Discord...\n'
|
||||||
|
|
||||||
discord="com.discord-${BASH_REMATCH[1]}"
|
_dab apkfuckery "$COMMIT_HASH" | tar xzf - --strip-components=1
|
||||||
|
|
||||||
printf 'Downloading %s...\n' "${BASH_REMATCH[2]}"
|
printf 'Downloading CutTheCord...\n'
|
||||||
|
|
||||||
curl --progress-bar -Lfo "$discord.apk" "${BASH_REMATCH[2]}"
|
_dab cutthecord master | tar xzf -
|
||||||
|
|
||||||
apktool d "$discord.apk" -o "$discord"
|
|
||||||
|
|
||||||
git clone --depth=1 https://gitdab.com/distok/cutthecord
|
|
||||||
|
|
||||||
printf 'Editing patches...\n'
|
printf 'Editing patches...\n'
|
||||||
|
|
||||||
sed -i cutthecord/patches/squareavatars/"${BASH_REMATCH[1]}".patch -e 's/3dp/5dp/'
|
sed -i cutthecord/patches/squareavatars/"$VERCODE".patch -e 's/3dp/5dp/'
|
||||||
sed -i cutthecord/patches/branding/"${BASH_REMATCH[1]}".patch \
|
sed -i cutthecord/patches/branding/"$VERCODE".patch \
|
||||||
-e 's/CTCNAME/Discord (CTC)/g;s/CTCBRANCH/chronobserver/g' \
|
-e 's/CTCNAME/Discord (CTC)/g;s/CTCBRANCH/chronobserver/g' \
|
||||||
-e "s/-CTCBUILD/-$(date --iso-8601)/g;s/CTCBUILD//g"
|
-e "s/-CTCBUILD/-$(date --iso-8601)/g;s/CTCBUILD//g"
|
||||||
sed -i cutthecord/patches/branding/customicon.sh -e 's/#rm/rm/'
|
sed -i cutthecord/patches/branding/customicon.sh -e 's/#rm/rm/'
|
||||||
|
|
||||||
for p in necessary notrack noblocked squareavatars branding customversion; do
|
for p in necessary noblocked nocamerabutton squareavatars branding customversion; do
|
||||||
patch -d "$discord" -p1 < "cutthecord/patches/$p/${BASH_REMATCH[1]}.patch"
|
printf 'Applying %s patch...\n' "$p"
|
||||||
|
patch -d com.discord -p1 < "cutthecord/patches/$p/$VERCODE.patch"
|
||||||
done
|
done
|
||||||
|
|
||||||
printf 'Replacing files...\n'
|
printf 'Replacing files...\n'
|
||||||
|
|
||||||
pushd "$discord" >/dev/null
|
pushd com.discord >/dev/null
|
||||||
bash ../cutthecord/patches/notrack/"${BASH_REMATCH[1]}"-post.sh
|
|
||||||
bash ../cutthecord/patches/branding/customicon.sh
|
bash ../cutthecord/patches/branding/customicon.sh
|
||||||
bash ../cutthecord/patches/branding/customdynamicicon.sh
|
bash ../cutthecord/patches/branding/customdynamicicon.sh
|
||||||
bash ../cutthecord/patches/bettertm/bettertm.sh ../cutthecord/patches/bettertm
|
bash ../cutthecord/patches/bettertm/bettertm.sh ../cutthecord/patches/bettertm
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
|
|
||||||
curl -LSsfo "$discord"/res/font/whitney_semibold.ttf \
|
curl -LSsfo com.discord/res/font/whitney_semibold.ttf \
|
||||||
https://github.com/google/fonts/raw/master/ofl/asap/Asap-Medium.ttf
|
https://github.com/google/fonts/raw/master/ofl/asap/Asap-Medium.ttf
|
||||||
curl -LSsfo "$discord"/res/font/whitney_bold.ttf \
|
curl -LSsfo com.discord/res/font/whitney_bold.ttf \
|
||||||
https://github.com/google/fonts/raw/master/ofl/asap/Asap-SemiBold.ttf
|
https://github.com/google/fonts/raw/master/ofl/asap/Asap-SemiBold.ttf
|
||||||
curl -LSsfo "$discord"/res/font/whitney_medium.ttf \
|
curl -LSsfo com.discord/res/font/whitney_medium.ttf \
|
||||||
https://github.com/google/fonts/raw/master/ofl/asap/Asap-Regular.ttf
|
https://github.com/google/fonts/raw/master/ofl/asap/Asap-Regular.ttf
|
||||||
curl -LSsfo "$discord"/res/font/sourcecodepro_semibold.ttf \
|
curl -LSsfo com.discord/res/font/sourcecodepro_semibold.ttf \
|
||||||
https://github.com/thiagolucio/code-editor-fonts/raw/master/Hasklig.ttf/Hasklig-Medium.ttf
|
https://github.com/thiagolucio/code-editor-fonts/raw/master/Hasklig.ttf/Hasklig-Medium.ttf
|
||||||
|
|
||||||
apktool b "$discord"
|
apktool b com.discord
|
||||||
|
|
||||||
while ! jarsigner -keystore "$KEYSTORE_PATH" \
|
while ! jarsigner -keystore "$KEYSTORE_PATH" \
|
||||||
"$discord/dist/$discord.apk" "$KEYSTORE_ALIAS"
|
"com.discord/dist/com.discord-$VERCODE.apk" "$KEYSTORE_ALIAS"
|
||||||
do :; done
|
do :; done
|
||||||
|
|
||||||
if [[ -z ${SKIP_INSTALL+x} ]]; then
|
if [[ -z ${SKIP_INSTALL+x} ]]; then
|
||||||
adb install -r "$discord/dist/$discord.apk"
|
adb install -r "com.discord/dist/com.discord-$VERCODE.apk"
|
||||||
rm -rf "$discord" "$discord.apk" cutthecord
|
rm -rf com.discord/ cutthecord/
|
||||||
fi
|
fi
|
Reference in New Issue