forked from distok/cutthecord
		
	ctcci: Pull version from patchport-state.json
This commit is contained in:
		
							parent
							
								
									cf6f10a0e1
								
							
						
					
					
						commit
						30c8b07077
					
				
					 2 changed files with 2 additions and 14 deletions
				
			
		| 
						 | 
				
			
			@ -38,15 +38,8 @@ os.environ["DISTOK_EXTRACTED_DISCORD_PATH"] = WORK_APK_PATH
 | 
			
		|||
 | 
			
		||||
os.makedirs(WORK_FOLDER, exist_ok=True)
 | 
			
		||||
 | 
			
		||||
if LOCAL_STATE:
 | 
			
		||||
    # Get the version of the APK from distok state file
 | 
			
		||||
    with open(STATE_FILE) as f:
 | 
			
		||||
        STATE = json.load(f)
 | 
			
		||||
else:
 | 
			
		||||
    # Get the version of the APK from distok.top
 | 
			
		||||
    STATE = requests.get("https://distok.top/state.json").json()
 | 
			
		||||
 | 
			
		||||
VERSION = STATE["android"][PACKAGE_ID]["version"]
 | 
			
		||||
with open(os.path.join(REPO_FOLDER, "patchport-state.json")) as f:
 | 
			
		||||
    VERSION = f["versioncode"]
 | 
			
		||||
 | 
			
		||||
BASE_APK_PATH = os.path.join(WORK_FOLDER, f"discord-base-{VERSION}")
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,11 +2,6 @@ import os
 | 
			
		|||
 | 
			
		||||
APKTOOL_BIN = "java -jar /home/ave/apktool-cli-all.jar"  # use latest
 | 
			
		||||
 | 
			
		||||
# Set to false if you're going to use a local state.json file
 | 
			
		||||
# state.json has information about the latest discord version
 | 
			
		||||
LOCAL_STATE = False
 | 
			
		||||
STATE_FILE = "/home/ave/distok/state.json"
 | 
			
		||||
 | 
			
		||||
# APKs must be placed under $DISTOK_FOLDER/android/$PACKAGE_ID-$VERSION_NUMBER.apk
 | 
			
		||||
# Example: /home/ave/distok/android/com.discord-909.apk
 | 
			
		||||
DISTOK_FOLDER = "/home/ave/distok"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue