Skip to content

Commit

Permalink
updater fixes p2
Browse files Browse the repository at this point in the history
  • Loading branch information
rapidslayer101 committed Sep 21, 2022
1 parent d925345 commit 1a526f6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions rdisc-server.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from datetime import datetime, timedelta
from rsa import PublicKey, encrypt
from zlib import error as zl_error
from os import listdir, remove, removedirs, rename
from os import listdir, remove, removedirs, path
from threading import Thread
from random import choices, randint
from hashlib import sha512
Expand Down Expand Up @@ -132,19 +132,20 @@ def new_ip(uid, secret, user_pass, u_name, xp, r_coin, d_coin):
current_hash = login_request[4:]
file = [file for file in listdir("dist") if file.endswith(".zip")][-1]
if current_hash == "N":
send_e(f"{file}🱫{(os.path.getsize(f'dist/{file}'))}")
send_e(f"{file}🱫{(path.getsize(f'dist/{file}'))}")
with open(f"dist/{file}", "rb") as f:
while True:
bytes_read = f.read(4096)
if not bytes_read:
cs.sendall(b"_BREAK_")
break
cs.sendall(bytes_read)
raise ConnectionResetError
else:
with open("dist/latest_hash.txt", "r", encoding="utf-8") as f:
latest_hash = f.read()
if login_request[4:] != latest_hash:
send_e(f"{file}🱫{(os.path.getsize(f'dist/{file}'))}")
send_e(f"{file}🱫{(path.getsize(f'dist/{file}'))}")
with open(f"dist/{file}", "rb") as f:
while True:
bytes_read = f.read(4096)
Expand Down
1 change: 1 addition & 0 deletions updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def update_system(self):
if not update_data == "V":
print("Update needed")
file_name, update_size = update_data.split("🱫")
print(update_size)
print(f"Updating to version {file_name}")
self.update_text = f"Downloading version {file_name[:-4].replace('rdisc', 'Rdisc')}..."
with open(f"app/{file_name}", "wb") as f:
Expand Down

0 comments on commit 1a526f6

Please sign in to comment.