dont get stuck if cloudflared failed to download correctly

This commit is contained in:
Concedo 2024-01-08 21:11:17 +08:00
parent f04b6e7287
commit 550829ed98

View file

@ -2149,13 +2149,13 @@ def setuptunnel():
tunnelproc.wait()
if os.name == 'nt':
if os.path.exists("cloudflared.exe"):
if os.path.exists("cloudflared.exe") and os.path.getsize("cloudflared.exe") > 100000:
print("Cloudflared file exists, reusing it...")
else:
print("Downloading Cloudflare Tunnel for Windows...")
subprocess.run("curl -L https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-windows-amd64.exe -o cloudflared.exe", shell=True, capture_output=True, text=True, check=True, encoding='utf-8')
else:
if os.path.exists("cloudflared-linux-amd64"):
if os.path.exists("cloudflared-linux-amd64") and os.path.getsize("cloudflared-linux-amd64") > 100000:
print("Cloudflared file exists, reusing it...")
else:
print("Downloading Cloudflare Tunnel for Linux...")