goober quits forcing user 2 restart

This commit is contained in:
expect 2025-06-21 00:14:01 +02:00
parent e6be6b2f04
commit d2771dc14e
2 changed files with 5 additions and 21 deletions

View file

@ -12,6 +12,7 @@ showmemenabled="true"
NAME="an instance of goober" NAME="an instance of goober"
locale=fi locale=fi
ALIVEPING="true" ALIVEPING="true"
AUTOUPDATE="True"
gooberTOKEN= gooberTOKEN=
song="War Without Reason" song="War Without Reason"
POSITIVE_GIFS="https://media.discordapp.net/attachments/821047460151427135/1181371808566493184/jjpQGeno.gif, https://tenor.com/view/chill-guy-my-new-character-gif-2777893510283028272,https://tenor.com/view/goodnight-goodnight-friends-weezer-weezer-goodnight-gif-7322052181075806988" POSITIVE_GIFS="https://media.discordapp.net/attachments/821047460151427135/1181371808566493184/jjpQGeno.gif, https://tenor.com/view/chill-guy-my-new-character-gif-2777893510283028272,https://tenor.com/view/goodnight-goodnight-friends-weezer-weezer-goodnight-gif-7322052181075806988"

View file

@ -4,6 +4,7 @@ from modules.globalvars import *
import traceback import traceback
import requests import requests
import subprocess import subprocess
import sys
def run_cmd(cmd): def run_cmd(cmd):
result = subprocess.run(cmd, shell=True, capture_output=True, text=True) result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
@ -21,16 +22,10 @@ def auto_update(branch='main', remote='origin'):
print(f"Remote {remote}/{branch} is ahead. Updating...") print(f"Remote {remote}/{branch} is ahead. Updating...")
pull_result = run_cmd(f'git pull {remote} {branch}') pull_result = run_cmd(f'git pull {remote} {branch}')
print(pull_result) print(pull_result)
print("Please Restart goober!")
sys.exit(0)
else: else:
print(f"Local {remote}/{branch} is ahead. Not Updating...") print(f"Local {remote}/{branch} is ahead and/or up to par. Not Updating...")
def generate_sha256_of_current_file():
global currenthash
sha256_hash = hashlib.sha256()
with open(__file__, "rb") as f:
for byte_block in iter(lambda: f.read(4096), b""):
sha256_hash.update(byte_block)
currenthash = sha256_hash.hexdigest()
def get_latest_version_info(): def get_latest_version_info():
@ -68,22 +63,10 @@ def check_for_update():
print(f"{RED}I cant find the local_version variable! Or its been tampered with and its not an interger!{RESET}") print(f"{RED}I cant find the local_version variable! Or its been tampered with and its not an interger!{RESET}")
return return
generate_sha256_of_current_file()
gooberhash = latest_version_info.get("hash")
if local_version < latest_version: if local_version < latest_version:
print(f"{YELLOW}{get_translation(LOCALE, 'new_version').format(latest_version=latest_version, local_version=local_version)}{RESET}") print(f"{YELLOW}{get_translation(LOCALE, 'new_version').format(latest_version=latest_version, local_version=local_version)}{RESET}")
print(f"{YELLOW}{get_translation(LOCALE, 'changelog').format(VERSION_URL=VERSION_URL)}{RESET}") print(f"{YELLOW}{get_translation(LOCALE, 'changelog').format(VERSION_URL=VERSION_URL)}{RESET}")
auto_update() auto_update()
elif local_version == latest_version: elif local_version == latest_version:
print(f"{GREEN}{get_translation(LOCALE, 'latest_version')} {local_version}{RESET}") print(f"{GREEN}{get_translation(LOCALE, 'latest_version')} {local_version}{RESET}")
print(f"{get_translation(LOCALE, 'latest_version2').format(VERSION_URL=VERSION_URL)}\n\n") print(f"{get_translation(LOCALE, 'latest_version2').format(VERSION_URL=VERSION_URL)}\n\n")
# finally fucking fixed this i tell you
if gooberhash != currenthash:
print(f"{YELLOW}{get_translation(LOCALE, 'modification_warning')}{RESET}")
print(f"{YELLOW}{get_translation(LOCALE, 'reported_version')} {local_version}{RESET}")
print(f"{DEBUG}{get_translation(LOCALE, 'current_hash')} {currenthash}{RESET}")
print(f"{DEBUG}{get_translation(LOCALE, 'current_hash')} {currenthash}{RESET}")