From 30c8b07077e641accc78365a55fe70bbcb00534e Mon Sep 17 00:00:00 2001 From: Ave Date: Thu, 28 May 2020 15:53:24 +0300 Subject: [PATCH] ctcci: Pull version from patchport-state.json --- ctcci/ctcci.py | 11 ++--------- ctcci/ctcconfig.example.py | 5 ----- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/ctcci/ctcci.py b/ctcci/ctcci.py index 980d69e7..448d3f98 100644 --- a/ctcci/ctcci.py +++ b/ctcci/ctcci.py @@ -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}") diff --git a/ctcci/ctcconfig.example.py b/ctcci/ctcconfig.example.py index ad03c0fc..bc2e9982 100644 --- a/ctcci/ctcconfig.example.py +++ b/ctcci/ctcconfig.example.py @@ -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"