forked from distok/cutthecord
		
	Switch to a simpler method of emoji stuffs
less fuckery needed now~
This commit is contained in:
		
							parent
							
								
									9d5b3f7d1b
								
							
						
					
					
						commit
						daedae4c7d
					
				
					 3 changed files with 52 additions and 15 deletions
				
			
		
							
								
								
									
										12
									
								
								README.md
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								README.md
									
										
									
									
									
								
							|  | @ -9,15 +9,17 @@ Automatically patched binaries are available on [distok.a3.pm/cutthecord](https: | ||||||
| - Get apktool | - Get apktool | ||||||
| - Get a keystore, see [here](https://stackoverflow.com/a/14994354/3286892), step 1. | - Get a keystore, see [here](https://stackoverflow.com/a/14994354/3286892), step 1. | ||||||
| - Get 72x72 copies of latest version of mutant standard emojis with codepoints. I have a zip [here](https://mutant.lavatech.top/72x72.zip). | - Get 72x72 copies of latest version of mutant standard emojis with codepoints. I have a zip [here](https://mutant.lavatech.top/72x72.zip). | ||||||
| - Extract the emojis you got somewhere, then prepend `emoji_` to their names (`for f in * ; do mv -- "$f" "emoji_$f" ; done`). | - Extract the emojis you got somewhere. | ||||||
| - Get rid of `-fe0f` on filenames to fix render of some emojis (`find . -name '*png' -exec bash -c ' mv $0 ${0/-fe0f/}' {} \;`, lots of mv errors will happen, that's fine). | - Clone this repo somewhere, edit `emojireplace.sh` and set the `extracted_mutstd_path` folder to the folder you just extracted emojis to. | ||||||
| - Clone this repo somewhere, edit `emojireplace.sh` and set the variables to the folders you want it to run on. |  | ||||||
| 
 | 
 | ||||||
| ## Building an patched discord app | ## Building an patched discord app | ||||||
| 
 | 
 | ||||||
| - Get a Discord apk (*cough* [aptoide](https://ws75.aptoide.com/api/7/app/getMeta?package_name=com.discord)), and get all the necessary patches and the optional patches you want for that version. If the patches aren't available, you'll have to port them yourself. | - Get a Discord apk (*cough* [aptoide](https://ws75.aptoide.com/api/7/app/getMeta?package_name=com.discord)). | ||||||
|  | - 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>`). | - Apply the patches (`patch -p1 < <patch name>`). | ||||||
| - Edit `emojireplace.sh` to point to right directories, and apply emoji patches (`bash emojireplace.sh`) | - Edit `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-831`) | - Build the new APK (`apktool b com.discord-831`) | ||||||
| - Sign the new APK (`jarsigner -keystore <keystore path> <foldername>/dist/<foldername>.apk <alias>`) | - 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! | - Get your new APK from `<foldername>/dist/<foldername>.apk`, install and enjoy! | ||||||
|  |  | ||||||
							
								
								
									
										45
									
								
								emojireplace.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								emojireplace.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,45 @@ | ||||||
|  | #!/bin/env python3 | ||||||
|  | import os | ||||||
|  | import shutil | ||||||
|  | 
 | ||||||
|  | # REPLACE THESE LINES | ||||||
|  | extracted_discord_path = "/tmp/cutthecord/discord" | ||||||
|  | extracted_mutstd_path = "/var/www/mutant/72x72" | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | def clean_emoji_name(name): | ||||||
|  |     name = name.lower().replace("_", "-")\ | ||||||
|  |         .replace("emoji_", "").replace("-fe0f", "") | ||||||
|  |     return name | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | discord_emoji_path = os.path.join(extracted_discord_path, "res", "raw") | ||||||
|  | # Get file listings in relevant folders | ||||||
|  | discord_emojis = os.listdir(discord_emoji_path) | ||||||
|  | mutstd_emojis = os.listdir(extracted_mutstd_path) | ||||||
|  | 
 | ||||||
|  | # Clean names of mutantstd emojis so thar we can compare them | ||||||
|  | # to clean discord emojis later | ||||||
|  | clean_mutstd_emojis = {clean_emoji_name(emoji): emoji for | ||||||
|  |                        emoji in mutstd_emojis} | ||||||
|  | 
 | ||||||
|  | replace_counter = 0 | ||||||
|  | 
 | ||||||
|  | # Go through each discord emoji, and clean their names | ||||||
|  | for emoji in discord_emojis: | ||||||
|  |     clean_discord_emoji = clean_emoji_name(emoji) | ||||||
|  | 
 | ||||||
|  |     # Check if said clean name of emoji is in clean mutstd list | ||||||
|  |     if clean_discord_emoji in clean_mutstd_emojis: | ||||||
|  |         # Get full unclean filename of mutantstd emoji, generate relevant paths | ||||||
|  |         full_mutstd_name = clean_mutstd_emojis[clean_discord_emoji] | ||||||
|  |         full_mutstd_path = os.path.join(extracted_mutstd_path, full_mutstd_name) | ||||||
|  |         full_discord_path = os.path.join(extracted_discord_path, emoji) | ||||||
|  | 
 | ||||||
|  |         # Copy and overwrite the discord emojis with the mutantstd alternatives | ||||||
|  |         shutil.copyfile(full_mutstd_path, full_discord_path) | ||||||
|  | 
 | ||||||
|  |         print("Replaced {} emoji.".format(full_mutstd_name)) | ||||||
|  |         replace_counter += 1 | ||||||
|  | 
 | ||||||
|  | print("Done, {} emojis replaced.".format(replace_counter)) | ||||||
|  | @ -1,10 +0,0 @@ | ||||||
| #!/bin/bash |  | ||||||
| EXTRACTED_DISCORD="/home/ave/Downloads/dic/com.discord-830" |  | ||||||
| EXTRACTED_MUTSTD="/home/ave/Downloads/emojo/72x72" |  | ||||||
| for filename in $EXTRACTED_DISCORD/res/raw/*.png; do |  | ||||||
|     basefilename=$(basename $filename) |  | ||||||
|     if [ -f $EXTRACTED_MUTSTD/$basefilename ]; then |  | ||||||
|         echo "$basefilename replaced" |  | ||||||
|         \cp $EXTRACTED_MUTSTD/$basefilename $filename |  | ||||||
|     fi |  | ||||||
| done |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue