Merge pull request #348 from mayaeary/feature/koboldai-api-share
flask_cloudflared for shared tunnels
This commit is contained in:
commit
d3a280e603
2 changed files with 10 additions and 1 deletions
1
extensions/api/requirements.txt
Normal file
1
extensions/api/requirements.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
flask_cloudflared==0.0.12
|
|
@ -75,6 +75,14 @@ class Handler(BaseHTTPRequestHandler):
|
||||||
def run_server():
|
def run_server():
|
||||||
server_addr = ('0.0.0.0' if shared.args.listen else '127.0.0.1', params['port'])
|
server_addr = ('0.0.0.0' if shared.args.listen else '127.0.0.1', params['port'])
|
||||||
server = ThreadingHTTPServer(server_addr, Handler)
|
server = ThreadingHTTPServer(server_addr, Handler)
|
||||||
|
if shared.args.share:
|
||||||
|
try:
|
||||||
|
from flask_cloudflared import _run_cloudflared
|
||||||
|
public_url = _run_cloudflared(params['port'], params['port'] + 1)
|
||||||
|
print(f'Starting KoboldAI compatible api at {public_url}/api')
|
||||||
|
except ImportError:
|
||||||
|
print('You should install flask_cloudflared manually')
|
||||||
|
else:
|
||||||
print(f'Starting KoboldAI compatible api at http://{server_addr[0]}:{server_addr[1]}/api')
|
print(f'Starting KoboldAI compatible api at http://{server_addr[0]}:{server_addr[1]}/api')
|
||||||
server.serve_forever()
|
server.serve_forever()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue