This repository has been archived on 2021-08-24. You can view files and clone it, but cannot push or open issues or pull requests.
cutthecord/README.md

85 lines
5.7 KiB
Markdown
Raw Normal View History

2019-01-18 14:25:15 +00:00
# cutthecord
2019-05-14 21:51:54 +00:00
Modular Client Mod for Discord's Android app.
2019-01-18 16:46:27 +00:00
2019-06-07 22:35:44 +00:00
**Latest supported Discord Android version:** 9.0.9 (909), released on 2019-06-07.
2019-01-31 08:01:30 +00:00
New patch development will be done for the latest supported version.
2019-05-14 21:51:54 +00:00
## Binaries (apk)
2019-01-20 19:32:58 +00:00
2019-06-20 08:52:29 +00:00
An F-Droid repo is available on https://fdroid.a3.pm/seabear/repo/?fingerprint=9DC9CB5FDD85D37121A5FEE99D24475F03FEA7F2EC25FB94DD51866D87933ED1
2019-01-18 14:51:40 +00:00
2019-01-25 13:50:37 +00:00
You can add that to your phone and get updates easily or just download directly from there.
2019-01-20 19:32:58 +00:00
2019-01-25 13:50:37 +00:00
**You will need to uninstall any and all existing Discord or CutTheCord applications from your phone before installing one, or else installation will fail.**
2019-01-20 19:32:58 +00:00
2019-01-25 13:50:37 +00:00
Feel free to ignore play protect, it's bullshit.
2019-01-21 09:36:56 +00:00
2019-05-14 21:51:54 +00:00
If you fail recaptcha, [follow this](https://gitdab.com/distok/cutthecord/issues/22#issuecomment-82) (run through adb).
**PSA: Please keep in mind that you may be unable to receive updates due to an F-Droid bug.**
2019-05-26 13:15:46 +00:00
~~If you're affected by this, here's a workaround: F-Droid -> Settings -> Repositories -> Seabear, tap Share on top bar, copy to clipboard, tap Delete (next to share), then tap Add Repository. It should already be filled in (from clipboard), so add it and you should be able to get updates after that.~~
2019-05-14 21:51:54 +00:00
2019-05-26 13:15:46 +00:00
If you're affected by this, ensure that your F-Droid version is 1.7 or higher. As of time of writing, F-Droid 1.7 is alpha, and can only be downloaded by enabling Unstable Updates through Settings -> Advanced Settings.
2019-05-13 09:35:53 +00:00
2019-01-21 09:36:56 +00:00
## Building
#### Toolchain setup
2019-01-18 14:51:40 +00:00
- Get apktool (due to 2 bugs present in v2.3.4, you're strongly recommended to use v2.4.0 or higher)
2019-01-18 14:51:40 +00:00
- Get a keystore, see [here](https://stackoverflow.com/a/14994354/3286892), step 1.
2019-05-13 08:20:03 +00:00
- 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
2019-01-18 14:51:40 +00:00
2019-01-21 09:36:56 +00:00
#### Building a patched discord app
2019-01-18 14:51:40 +00:00
- 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.
2019-01-18 16:04:55 +00:00
- 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`)
2019-01-18 14:51:40 +00:00
- 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!
2019-01-18 16:04:55 +00:00
2019-01-21 09:36:56 +00:00
#### Building patches
2019-01-18 16:04:55 +00:00
2019-01-31 08:01:30 +00:00
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.
2019-01-18 16:20:40 +00:00
2019-01-31 08:01:30 +00:00
To get the diff, run `diff -crB -x "dist" -x "res/raw" -x "build" CleanFolder PatchedFolder > patchname.patch`
2019-01-18 16:20:40 +00:00
#### Porting patches
2019-03-08 11:53:24 +00:00
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`