mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-08-14 10:56:11 +00:00
tunnel ports fix
This commit is contained in:
parent
84f2d94475
commit
02833a21cf
8 changed files with 42 additions and 38 deletions
|
|
@ -1,4 +1,5 @@
|
|||
from flask import Request, Response
|
||||
from python.helpers import runtime
|
||||
from python.helpers.api import ApiHandler
|
||||
from python.helpers.tunnel_manager import TunnelManager
|
||||
|
||||
|
|
@ -8,12 +9,11 @@ class Tunnel(ApiHandler):
|
|||
|
||||
tunnel_manager = TunnelManager.get_instance()
|
||||
|
||||
if action == "verify":
|
||||
if action == "health":
|
||||
return {"success": True}
|
||||
|
||||
if action == "create":
|
||||
# Get the port from the request or use default
|
||||
port = input.get("port", 5000)
|
||||
port = runtime.get_web_ui_port()
|
||||
tunnel_url = tunnel_manager.start_tunnel(port)
|
||||
if tunnel_url is None:
|
||||
# Add a little delay and check again - tunnel might be starting
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class TunnelProxy(ApiHandler):
|
|||
# first verify the service is running:
|
||||
service_ok = False
|
||||
try:
|
||||
response = requests.post(f"http://localhost:{tunnel_api_port}/", json={"action": "verify"})
|
||||
response = requests.post(f"http://localhost:{tunnel_api_port}/", json={"action": "health"})
|
||||
if response.status_code == 200:
|
||||
service_ok = True
|
||||
except Exception as e:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue