mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2025-09-11 17:44:38 +00:00
try add tunnels for macos
This commit is contained in:
parent
55af5446ad
commit
040de7d899
1 changed files with 11 additions and 0 deletions
11
koboldcpp.py
11
koboldcpp.py
|
@ -2377,6 +2377,9 @@ def setuptunnel():
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
print("Starting Cloudflare Tunnel for Windows, please wait...", flush=True)
|
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)
|
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:
|
else:
|
||||||
print("Starting Cloudflare Tunnel for Linux, please wait...", flush=True)
|
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)
|
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:
|
else:
|
||||||
print("Downloading Cloudflare Tunnel for Windows...")
|
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')
|
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:
|
else:
|
||||||
if os.path.exists("cloudflared-linux-amd64") and os.path.getsize("cloudflared-linux-amd64") > 1000000:
|
if os.path.exists("cloudflared-linux-amd64") and os.path.getsize("cloudflared-linux-amd64") > 1000000:
|
||||||
print("Cloudflared file exists, reusing it...")
|
print("Cloudflared file exists, reusing it...")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue