diff options
author | Jesusaves <cpntb1@ymail.com> | 2022-11-03 11:36:10 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2022-11-03 11:36:10 -0300 |
commit | 28017a181b201375e0e53e9453c4eb1a90c48ddc (patch) | |
tree | 48d9642ff45d6da8fb17f261383a519e99b9b7eb | |
parent | 5c42d7a7378355e9bfb92de4c0fef094c7b1d728 (diff) | |
download | renpy-28017a181b201375e0e53e9453c4eb1a90c48ddc.tar.gz renpy-28017a181b201375e0e53e9453c4eb1a90c48ddc.tar.bz2 renpy-28017a181b201375e0e53e9453c4eb1a90c48ddc.tar.xz renpy-28017a181b201375e0e53e9453c4eb1a90c48ddc.zip |
Fix bug in md5sum
-rw-r--r-- | game/3rdparty/manaverse.rpy | 11 | ||||
-rw-r--r-- | game/client.rpy | 16 |
2 files changed, 13 insertions, 14 deletions
diff --git a/game/3rdparty/manaverse.rpy b/game/3rdparty/manaverse.rpy index 1d33470..98f7d97 100644 --- a/game/3rdparty/manaverse.rpy +++ b/game/3rdparty/manaverse.rpy @@ -40,16 +40,9 @@ init 1 python: status_update(pc=64+(cstep / csize)) status_update("Verifying MD5 hash...", 70) - r=requests.get(persistent.host+"/%s.md5" % fname, timeout=10.0) - md5up=r.text.replace("\n", "") - - status_update("Verifying MD5 hash...", 71) - md5us=md5sum(installdir+"/%s" % fname) - if md5up != md5us: + if not md5check_client(True): status_update("MD5 Hash Error") - stdout("MD5 Mismatch: hashes differ", True) - stdout("Ours: %s" % md5us, True) - stdout("Them: %s" % md5up, True) + stdout("MD5 Mismatch: hashes diverged", True) return False return True diff --git a/game/client.rpy b/game/client.rpy index 032ab47..f9be113 100644 --- a/game/client.rpy +++ b/game/client.rpy @@ -184,19 +184,21 @@ init 2 python: return def md5check_client(silent=False): - renpy.notify("Checking md5sum...") + if not silent: + renpy.notify("Checking md5sum...") ## Theirs try: installdir=get_path("manaplus") ## Get the file name + fname=handle_client(launch=True, download=False).split("/").pop() ## Get the MD5 Hash - if renpy.linux and persistent.evol2cli == "manaverse: + if renpy.linux and persistent.evol2cli == "manaverse": r=requests.get(manaverseLinux+".md5", timeout=10.0) - elif renpy.windows and persistent.evol2cli == "manaverse: + elif renpy.windows and persistent.evol2cli == "manaverse": r=requests.get(manaverseWin64+".md5", timeout=10.0) elif (persistent.evol2cli != "builtin"): ## FIXME: Simplify - fname=handle_client(launch=True, download=False).split("/").pop() + stdout("[INFO] Client '%s' is supplied by the launcher team..." % persistent.evol2cli) r=requests.get(persistent.host+"/%s.md5" % fname, timeout=10.0) else: raise Exception("Built-in has no MD5 Hash (builtin)") @@ -214,6 +216,8 @@ init 2 python: md5us=md5sum(fname) else: md5us=md5sum(installdir+"/%s" % fname) + + ## The check itself if md5up != md5us: stdout("MD5 Mismatch: hashes differ", True) stdout("Ours: %s" % md5us, True) @@ -221,15 +225,17 @@ init 2 python: shutil.rmtree(get_path("manaplus")) if not silent: renpy.notify("Files are outdated!") + return False else: if not silent: renpy.notify("All files up to date!") + return True except: traceback.print_exc() shutil.rmtree(get_path("manaplus")) if not silent: renpy.notify("An error happened (outdated?)") - return + return False ############################################ # TODO: Launch thread requesting /soul data |