2 Commits

Author SHA1 Message Date
SG
ef7ee52ad9 Some fixes and updates 2023-05-11 21:20:23 +02:00
SG
4e583e39c3 Change default server URL 2023-05-11 20:04:45 +02:00

View File

@@ -95,7 +95,7 @@ async def send_encrypted_msg(ws, k, data):
async def main():
WS_RELAY_SERVER = "wss://transmat.exocortex.ru"
WS_RELAY_SERVER = "wss://transmat.exocortex.ru/ws"
parser = argparse.ArgumentParser()
arg_group = parser.add_mutually_exclusive_group(required=True)
arg_group.add_argument('--receive', '--recv', action='store_true', help='Receive a file from the remote party (mutually exclusive with --send and --relay)')
@@ -169,7 +169,16 @@ async def main():
bar = None
f = None
i = 1
number_of_chunks = None
while True:
if number_of_chunks is not None and i > number_of_chunks:
bar.index = 100
bar.suffix = '%(percent).1f%% complete'
bar.update()
f.close()
print("")
break
message = await ws.recv()
message = json.loads(message)
payload = message["payload"]
@@ -184,16 +193,11 @@ async def main():
else:
f.write(msg["chunk"])
msgtype = "proceed"
i += 1 # This increment has to happen before we try to send the confirmation message
await send_encrypted_msg(ws, k, (msgtype, peer_group_id, role, "", "", "", "", "")) # request the next chunk from sender
i += 1
bar.suffix = "%(percent).1f%% complete - %(eta_td)s remaining " + str(i) + "/" + str(number_of_chunks) + " msg sent"
bar.next()
if i > msg["number_of_chunks"] + 1:
bar.index = 100
bar.suffix = '%(percent).1f%% complete'
bar.update()
f.close()
print("")
break
asyncio.run(main())