@@ -289,7 +289,8 @@ def router_status():
289289@click .help_option ("-h" , "--help" )
290290@click .option ("-a" , "--address" , type = str , required = False , help = "Remote address to bind the tunnel to" )
291291@click .option ("-p" , "--profile" , type = str , required = False , help = "Profile to share" )
292- def share (address , profile ):
292+ @click .option ("--http" , type = bool , flag_value = True , required = False , help = "Use HTTP instead of HTTPS" )
293+ def share (address , profile , http ):
293294 """Create a share link for the MCPRouter daemon process.
294295
295296 Example:
@@ -301,6 +302,7 @@ def share(address, profile):
301302 # check if there is a router already running
302303 pid = read_pid_file ()
303304 config_manager = ConfigManager ()
305+ config = config_manager .get_router_config ()
304306 if not pid :
305307 console .print ("[yellow]MCPRouter is not running.[/]" )
306308 return
@@ -324,22 +326,19 @@ def share(address, profile):
324326 # get share address
325327 if not address :
326328 console .print ("[cyan]Using share address from config...[/]" )
327- config = config_manager .get_router_config ()
328329 address = config ["share_address" ]
329330
330331 # create share link
331332 remote_host , remote_port = address .split (":" )
332333
333334 # start tunnel
334- # TODO: tls certificate if necessary
335- tunnel = Tunnel (remote_host , remote_port , config ["host" ], config ["port" ], secrets .token_urlsafe (32 ), None )
335+ tunnel = Tunnel (remote_host , remote_port , config ["host" ], config ["port" ], secrets .token_urlsafe (32 ), http , None )
336336 share_url = tunnel .start_tunnel ()
337337 share_pid = tunnel .proc .pid if tunnel .proc else None
338338 # generate random api key
339339 api_key = str (uuid .uuid4 ())
340340 console .print (f"[bold green]Generated secret for share link: { api_key } [/]" )
341- # TODO: https is not supported yet
342- share_url = share_url .replace ("https://" , "http://" ) + "/sse"
341+ share_url = share_url + "/sse"
343342 # save share pid and link to config
344343 config_manager .save_share_config (share_url , share_pid , api_key )
345344 profile = profile or "<your_profile>"
0 commit comments