From 56f451009db48a22b9e6eb4864dc7e738ac3ee59 Mon Sep 17 00:00:00 2001 From: Ave Ozkal Date: Fri, 21 Jun 2019 12:12:54 +0300 Subject: [PATCH] ctcci: commit some stuff I forgot to commit --- ctcci/ctcci.py | 18 ++++++++++++------ ctcci/ctcconfig.example.py | 1 + 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ctcci/ctcci.py b/ctcci/ctcci.py index 7cbb9c5..a8d5330 100644 --- a/ctcci/ctcci.py +++ b/ctcci/ctcci.py @@ -33,10 +33,15 @@ if os.path.exists(WORK_APK_PATH): os.makedirs(WORK_FOLDER, exist_ok=True) -# Get the version of the APK from distok state file -with open(STATE_FILE) as f: - STATE = json.load(f) - VERSION = STATE["android"][PACKAGE_ID]["version"] +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"] BASE_APK_PATH = os.path.join(WORK_FOLDER, f"discord-base-{VERSION}") @@ -60,8 +65,9 @@ if not FORCE and os.path.exists(OUTPUT_FILE): print("This version is already patched, bye!") sys.exit(1) -# Update cutthecord -subprocess.run("git pull", shell=True, cwd=REPO_FOLDER) +if DO_GITPULL: + # Update cutthecord + subprocess.run("git pull", shell=True, cwd=REPO_FOLDER) # Extract the APK if it's not already extracted to base cache if not os.path.exists(BASE_APK_PATH): diff --git a/ctcci/ctcconfig.example.py b/ctcci/ctcconfig.example.py index 72e3732..1624858 100644 --- a/ctcci/ctcconfig.example.py +++ b/ctcci/ctcconfig.example.py @@ -20,6 +20,7 @@ FDROID_FOLDER = "/var/www/fdroid/seabear" RESULT_FOLDER = FDROID_FOLDER + "/repo" # Repo for CutTheCord (https://gitdab.com/distok/cutthecord) +DO_GITPULL = True REPO_FOLDER = "/home/ave/distokrepos/cutthecord" # Keystore file, alias and pass. Required.