diff --git a/koboldcpp.py b/koboldcpp.py index a17c81fd3..66507e0f3 100644 --- a/koboldcpp.py +++ b/koboldcpp.py @@ -2377,6 +2377,9 @@ def setuptunnel(): if os.name == 'nt': print("Starting Cloudflare Tunnel for Windows, please wait...", flush=True) tunnelproc = subprocess.Popen(f"cloudflared.exe tunnel --url localhost:{args.port}", text=True, encoding='utf-8', shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE) + elif sys.platform=="darwin": + print("Starting Cloudflare Tunnel for MacOS, please wait...", flush=True) + tunnelproc = subprocess.Popen(f"./cloudflared-darwin tunnel --url http://localhost:{args.port}", text=True, encoding='utf-8', shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE) else: print("Starting Cloudflare Tunnel for Linux, please wait...", flush=True) tunnelproc = subprocess.Popen(f"./cloudflared-linux-amd64 tunnel --url http://localhost:{args.port}", text=True, encoding='utf-8', shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE) @@ -2413,6 +2416,14 @@ def setuptunnel(): else: print("Downloading Cloudflare Tunnel for Windows...") subprocess.run("curl -fL 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') + elif sys.platform=="darwin": + if os.path.exists("cloudflared-darwin") and os.path.getsize("cloudflared-darwin") > 1000000: + print("Cloudflared file exists, reusing it...") + else: + print("Downloading Cloudflare Tunnel for MacOS...") + subprocess.run("curl -fL https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-darwin-amd64.tgz -o cloudflared-darwin-amd64.tgz", shell=True, capture_output=True, text=True, check=True, encoding='utf-8') + subprocess.run("tar -xzf cloudflared-darwin-amd64.tgz > cloudflared-darwin", shell=True) + subprocess.run("chmod +x 'cloudflared-darwin'", shell=True) else: if os.path.exists("cloudflared-linux-amd64") and os.path.getsize("cloudflared-linux-amd64") > 1000000: print("Cloudflared file exists, reusing it...")