Add a README.md to patches, split main README to two

This commit is contained in:
ave 2019-06-21 13:11:28 +03:00
parent 56f451009d
commit deeb9f1f3c
No known key found for this signature in database
GPG Key ID: 09356ABAA42C842B
9 changed files with 172 additions and 63 deletions

58
BUILDING.md Normal file
View File

@ -0,0 +1,58 @@
## CutTheCord: Building
#### Toolchain setup
- Get apktool (due to 2 bugs present in v2.3.4, you're strongly recommended to use v2.4.0 or higher)
- Get a keystore, see [here](https://stackoverflow.com/a/14994354/3286892), step 1.
- If you want Mutant Standard emoji patches, get 72x72 PNG copies of latest version of mutant standard emojis with codepoints. I have a zip [here](https://mutant.lavatech.top/72x72.zip).
- If you want Blob emoji patches, get 72x72 PNG copies of blobmojis with codepoints. I personally resized the png/128 folder in this [repo](https://github.com/C1710/blobmoji) (`find /home/ave/blobmoji/png/72 -iname '*.png' -exec convert \{\} -verbose -resize 72x72\> \{\} \;`).
- Extract the emojis you got somewhere.
- Clone this repo somewhere, edit `patches/mutant/emojireplace.py` and `patches/blobs/emojireplace.py`, set the `extracted_mutstd_path` and `extracted_blobmoji_path` folders respectively to the folder you just extracted emojis to.
- Get a Discord apk (*cough* [apkmirror](https://www.apkmirror.com/apk/discord-inc/discord-chat-for-gamers/), [aptoide API](https://ws75.aptoide.com/api/7/app/getMeta?package_name=com.discord)).
### Using CutTheCord CI
CutTheCord CI (CTCCI) is what powers the official builds. It allows for extensive customization. It relies on distok files and state. While state is public, files aren't, so you'll have to create a similar file structure.
CTCCI requires python3.6+, and also likely requires Linux (I haven't tried it on other OSes, and use of things like `patch` and pipes might limit it to Linux).
#### Initial setup
- Follow the "Toolchain setup" steps above in case you haven't already.
- Install dependencies (`python3 -m pip install -Ur requirements.txt`)
- Copy `ctcci/ctcconfig.example.py` to `ctcci/ctcconfig.py` and configure contents to your local data and your personal preferences.
- If you don't want to always automatically be required to use the latest discord version, set `LOCAL_STATE` to `True` and point `STATE_FILE` to a `state.json` file that looks like this: `{"android": {"com.discord": {"version": 909}}}`.
- Set up a local distok-style file storage for your APKs, and copy your APKs on it, and name them properly (the format is `$DISTOK_FOLDER/android/$PACKAGE_ID-$VERSION_NUMBER.apk`, example: `/home/ave/distok/android/com.discord-909.apk`).
#### Running builds
- Simply run the `ctcci.py` script, with first argument being branch name, and latter ones being name of patches you want to add in.
Example: `python3.6 /home/ave/distokrepos/cutthecord/ctcci/ctcci.py ave mutant customfont slashcommands tokenlogin customtheme customdefaultemoji customring bettertm notrack noprofilestrip nonearby experiments noblocked squareavatars`
### Manually
#### Building a patched discord app
- Extract it with apktool (`apktool d <apk path>`)
- Get all the necessary patches for that version. Necessary patches are not available for all versions and are only required to get some versions to pack together correctly.
- Get optional patches you want for your version. If the patch you want isn't available for your version, you'll have to port them yourself.
- Apply the patches (`patch -p1 < <patch name>`).
- If you want mutant (or other emoji patches), edit `patches/mutant/emojireplace.py` to point to extracted discord folder (`extracted_discord_path`), and apply emoji patches (`python3 emojireplace.py`)
- Build the new APK (`apktool b com.discord-832`)
- Sign the new APK (`jarsigner -keystore <keystore path> <foldername>/dist/<foldername>.apk <alias>`)
- Get your new APK from `<foldername>/dist/<foldername>.apk`, install and enjoy!
#### Building patches
After extracting the APK, copy it to a folder that you won't modify (`cp -r com.discord-836 com.discord-836-base`), so that you can easily diff them.
To get the diff, run `diff -crB -x "dist" -x "res/raw" -x "build" CleanFolder PatchedFolder > patchname.patch`
#### Porting patches
You can use `patchport.py` to easily attempt to port patches.
It's not really intelligent and doesn't do much more than manually preparing necessary patch, checking if an existing patch can be applied to a given version, replacing relevant variables required for porting various patches and eliminating offsets caused by updates, but it saves a lot of time if used carefully.
Example command: `python3 patchport.py /home/ave/Downloads/dic/com.discord-841`

View File

@ -6,13 +6,15 @@ Modular Client Mod for Discord's Android app.
New patch development will be done for the latest supported version.
![A CutTheCord screenshot](https://elixi.re/i/h3eirsy9.png)
Check out [README.md in patches folder to see what patches are available and what each of them do](patches/README.md)!
## Binaries (apk)
An F-Droid repo is available on https://fdroid.a3.pm/seabear/repo/?fingerprint=9DC9CB5FDD85D37121A5FEE99D24475F03FEA7F2EC25FB94DD51866D87933ED1
You can add that to your phone and get updates easily or just download directly from there.
**You will need to uninstall any and all existing Discord or CutTheCord applications from your phone before installing one, or else installation will fail.**
You can add that to your phone and get updates easily or just download directly from there. **Rooting is NOT needed, CutTheCord can be installed alongside official Discord and/or other CutTheCord branches.**
Feel free to ignore play protect, it's bullshit.
@ -26,59 +28,4 @@ If you're affected by this, ensure that your F-Droid version is 1.7 or higher. A
## Building
#### Toolchain setup
- Get apktool (due to 2 bugs present in v2.3.4, you're strongly recommended to use v2.4.0 or higher)
- Get a keystore, see [here](https://stackoverflow.com/a/14994354/3286892), step 1.
- If you want Mutant Standard emoji patches, get 72x72 PNG copies of latest version of mutant standard emojis with codepoints. I have a zip [here](https://mutant.lavatech.top/72x72.zip).
- If you want Blob emoji patches, get 72x72 PNG copies of blobmojis with codepoints. I personally resized the png/128 folder in this [repo](https://github.com/C1710/blobmoji) (`find /home/ave/blobmoji/png/72 -iname '*.png' -exec convert \{\} -verbose -resize 72x72\> \{\} \;`).
- Extract the emojis you got somewhere.
- Clone this repo somewhere, edit `patches/mutant/emojireplace.py` and `patches/blobs/emojireplace.py`, set the `extracted_mutstd_path` and `extracted_blobmoji_path` folders respectively to the folder you just extracted emojis to.
- Get a Discord apk (*cough* [apkmirror](https://www.apkmirror.com/apk/discord-inc/discord-chat-for-gamers/), [aptoide API](https://ws75.aptoide.com/api/7/app/getMeta?package_name=com.discord)).
### Using CutTheCord CI
CutTheCord CI (CTCCI) is what powers the official builds. It allows for extensive customization. It relies on distok files and state. While state is public, files aren't, so you'll have to create a similar file structure.
CTCCI requires python3.6+, and also likely requires Linux (I haven't tried it on other OSes, and use of things like `patch` and pipes might limit it to Linux).
#### Initial setup
- Follow the "Toolchain setup" steps above in case you haven't already.
- Install dependencies (`python3 -m pip install -Ur requirements.txt`)
- Copy `ctcci/ctcconfig.example.py` to `ctcci/ctcconfig.py` and configure contents to your local data and your personal preferences.
- If you don't want to always automatically be required to use the latest discord version, set `LOCAL_STATE` to `True` and point `STATE_FILE` to a `state.json` file that looks like this: `{"android": {"com.discord": {"version": 909}}}`.
- Set up a local distok-style file storage for your APKs, and copy your APKs on it, and name them properly (the format is `$DISTOK_FOLDER/android/$PACKAGE_ID-$VERSION_NUMBER.apk`, example: `/home/ave/distok/android/com.discord-909.apk`).
#### Running builds
- Simply run the `ctcci.py` script, with first argument being branch name, and latter ones being name of patches you want to add in.
Example: `python3.6 /home/ave/distokrepos/cutthecord/ctcci/ctcci.py ave mutant customfont slashcommands tokenlogin customtheme customdefaultemoji customring bettertm notrack noprofilestrip nonearby experiments noblocked squareavatars`
### Manually
#### Building a patched discord app
- Extract it with apktool (`apktool d <apk path>`)
- Get all the necessary patches for that version. Necessary patches are not available for all versions and are only required to get some versions to pack together correctly.
- Get optional patches you want for your version. If the patch you want isn't available for your version, you'll have to port them yourself.
- Apply the patches (`patch -p1 < <patch name>`).
- If you want mutant (or other emoji patches), edit `patches/mutant/emojireplace.py` to point to extracted discord folder (`extracted_discord_path`), and apply emoji patches (`python3 emojireplace.py`)
- Build the new APK (`apktool b com.discord-832`)
- Sign the new APK (`jarsigner -keystore <keystore path> <foldername>/dist/<foldername>.apk <alias>`)
- Get your new APK from `<foldername>/dist/<foldername>.apk`, install and enjoy!
#### Building patches
After extracting the APK, copy it to a folder that you won't modify (`cp -r com.discord-836 com.discord-836-base`), so that you can easily diff them.
To get the diff, run `diff -crB -x "dist" -x "res/raw" -x "build" CleanFolder PatchedFolder > patchname.patch`
#### Porting patches
You can use `patchport.py` to easily attempt to port patches.
It's not really intelligent and doesn't do much more than manually preparing necessary patch, checking if an existing patch can be applied to a given version, replacing relevant variables required for porting various patches and eliminating offsets caused by updates, but it saves a lot of time if used carefully.
Example command: `python3 patchport.py /home/ave/Downloads/dic/com.discord-841`
See [BUILDING.md](BUILDING.md).

94
patches/README.md Normal file
View File

@ -0,0 +1,94 @@
## CutTheCord: Patch List
This is the list of patches available for CutTheCord. Have an idea? Open an issue, and I'll get to work. PRs are also welcome!
The patches with **bold** names are the ones I'm most proud of.
---
- **bettertm**: Replaces the :tm: and :registered: emojis with rendered unicode variants, making them look much better.
Before bettertm:
![nearly unreadable tm and r characters](https://elixi.re/i/axb4coc0.png)
After bettertm:
![very readable tm and r characters](https://elixi.re/i/nzx9kghi.png)
- bettertmlight: same thing as bettertm, but designed for light theme users.
- blobs: Replaces official twemoji emojis with blobs
![Emoji drawer with blobs](https://elixi.re/i/0s9e9brg.png)
- branding: Changes app's name from Discord to a custom name, changes app icon to a custom image, changes version number to account better for cutthecord's release schedule (and fixes a captcha link). Also enables backup and debug abilities. This is automatically built into all branches.
![Custom logo and custom app name](https://elixi.re/i/m0tvus0u.png)
(that's not the official logo of CutTheCord, it's simply one I have on my own branch)
- compact: Discord's compact layout, but for android.
![Compact layout](https://elixi.re/i/nbuosbqc.png)
- customdefaultemoji: Changes default emojis, which show up in a couple places. It's uesd to insert star into the list, as many bots have starboards.
- customfont: Has instructions for changing the font used.
![Google Sans as font on Discord](https://cdn.discordapp.com/attachments/286612533757083648/582192745632890890/Screenshot_20190526-160508.png)
- customring: Has instructions for changing the ringtone.
Video demonstration: https://www.youtube.com/watch?v=NMRPsAgqtWQ
- **customtheme**: Allows setting a custom theme. The one on repo is a pitch black theme, with green links and red accent theme.
![pitch black theme on discord](https://elixi.re/i/h3eirsy9.png)
(square avatars are not a part of this patch, scroll down to `squareavatars` if you're looking for them)
- customversion: Changes the version string in settings to include branch information. This is automatically built into all branches.
![custom version string showing patch list, build time, and license information for mutant standard](https://elixi.re/i/e4yb05ds.png)
- disable-mobileindicator: This is the patch inspired me to start working on CutTheCord. It makes your device act like a desktop client, and disables the "mobile indicator" on discord. However, this breaks notifications.
- experiments: Enables some dev-only things, like developer options tab or a secret staff-only, half-assed AMOLED-optimized theme called "pure evil". The developer options tab does not work.
![Developer options tab](https://elixi.re/i/z0oakgla.png)
![Pure evil setting](https://elixi.re/i/f1e7t1y0.png)
- **litecord**: Changes the server the app connects to, and specifically tries to connect to a Litecord server. [Litecord is a FOSS re-implementation of Discord's backend.](https://wildcard.elixi.re/i/l3lxhd3a.png)
![Litecord screenshot](https://wildcard.elixi.re/i/l3lxhd3a.png)
- **mutant**: Replaces official twemoji emojis with [mutant standard emojis](https://mutant.tech/), and injects custom mutantstd emojis to the app. Second patch I ever developed!
![Emoji drawer with mutant standard emojis](https://wildcard.elixi.re/i/snmlwgnc.png)
- necessary: Does some necessary things that may be required to get the app running properly, not available for every version, but is automatically built into all branches.
- noblocked: Hides blocked messages and the "# blocked messages" thingy. Useful for those of us who just can't resist tapping those.
- nonearby: Intentionally breaks "add nearby people" feature.
- noprofilestrip: Hides your username and discriminator from the "profile strip" on the left bar. Useful to potentially avoid bans.
![An image of noprofilestrip](https://wildcard.elixi.re/i/zqcunmxi.png)
- nospoiler: Automatically shows all spoilers. Useful for moderation.
- **notrack**: Disables most of the tracking in Discord. Included in all official branches.
- nozlib: Disables zlib-stream field on wss, making it easier to parse wss communications when MITMing the app.
- pureevil: Enables a secret staff-only, half-assed AMOLED-optimized theme called "pure evil". You're recommended to use `customtheme` instead.
![Pure evil setting](https://elixi.re/i/f1e7t1y0.png)
- **slashcommands**: Adds a lot of slash commands (all the decent ones on desktop and more), alongside some other useful features such as an account switcher. Also allows enabling or disabling a couple patches such as `channelleak` (shows all channel names and topics, even those you lack the permissions to read) or `notyping` (disables sending typing event to discord servers). I'm quite proud of this patch :p [Read its own README.md for more information](slashcommands/README.md).
![account switching on cutthecord](https://wildcard.elixi.re/i/di6aq1l6.png)
![tableflip slash command](https://wildcard.elixi.re/i/27h0ghd6.png)
- **squareavatars**: Adds square avatars. Because circles are for losers.
![square avatars on discord](https://elixi.re/i/h3eirsy9.png)
(pitch black theme is not a part of this patch, scroll up to `customtheme` if you're looking for it)
- **tokenlogin**: Allows logging in with just a token, instead of having to enter email, password, do 2FA, do captcha and possibly also tap a link on email. Especially useful when you don't have gapps as it allows skipping captcha (which relies on GMS).

View File

@ -2,3 +2,6 @@
This patch replaces the :tm: emoji and :registered: emojis with rendered unicode variants, making them look slightly better.
#### Conflicts with
- bettertmlight

View File

@ -2,3 +2,6 @@
This patch replaces the :tm: emoji and :registered: emojis with rendered unicode variants, making them look slightly better.
#### Conflicts with
- bettertm

View File

@ -2,7 +2,8 @@
This patch enables developer options (empty), mobile experiments (of which there's none) and the secret AMOLED theme (which is shit).
Conflicts with pureevil as it's included here.
#### Conflicts with
- pureevil
#### Bugs / Side effects
- Discord banned people for using experiments before. Don't show stuff this publicly.

View File

@ -6,7 +6,8 @@ Just replace all mentions of `dev.litecord.top` to your instance (smth like `sed
Please keep in mind that litecord is free (gratis and libre) software, provided under a libre license. If you paid money for it, you got scammed.
Conflicts with nozlib as it's included here.
#### Conflicts with
- nozlib
#### Available and tested on:
- 8.3.2

View File

@ -2,7 +2,8 @@
This patch disables zlib-stream field on wss, making it easier to parse it.
Conflicts with litecord patch.
#### Conflicts with
- litecord
#### Available and tested on:
- 8.3.5g

View File

@ -2,7 +2,8 @@
This patch enables the secret AMOLED theme (which is shit).
Conflicts with experiments.
#### Conflicts with
- experiments
#### Bugs / Side effects
- Discord banned people for using experiments before, which is why this patch exists. It doesn't enable everything developer related, just AMOLED theme. Still, don't show stuff this publicly.