@@ -334,14 +334,17 @@ async def get_network(session_user: UserSchema, app_name: str) -> Tuple[bool, An
334334
335335 @staticmethod
336336 async def list_port_mappings (
337- session_user : UserSchema , app_name : str
337+ session_user : UserSchema , app_name : str , use_proxy : bool = False
338338 ) -> Tuple [bool , Any ]:
339339 app_name = ResourceName (session_user , app_name , App ).for_system ()
340340
341341 if app_name not in session_user .apps :
342342 raise HTTPException (status_code = 404 , detail = "App does not exist" )
343-
344- success , message = await run_command (f"proxy:ports { app_name } " )
343+
344+ if use_proxy :
345+ success , message = await run_command (f"proxy:ports { app_name } " )
346+ else :
347+ success , message = await run_command (f"ports:list { app_name } " )
345348
346349 if "no port mappings" in message .lower ():
347350 return True , []
@@ -358,15 +361,21 @@ async def add_port_mapping(
358361 origin_port : int ,
359362 dest_port : int ,
360363 protocol : str ,
364+ use_proxy : bool = False ,
361365 ) -> Tuple [bool , Any ]:
362366 app_name = ResourceName (session_user , app_name , App ).for_system ()
363367
364368 if app_name not in session_user .apps :
365369 raise HTTPException (status_code = 404 , detail = "App does not exist" )
366370
367- return await run_command (
368- f"proxy:ports-add { app_name } { protocol } :{ origin_port } :{ dest_port } "
369- )
371+ if use_proxy :
372+ return await run_command (
373+ f"proxy:ports-add { app_name } { protocol } :{ origin_port } :{ dest_port } "
374+ )
375+ else :
376+ return await run_command (
377+ f"ports:add { app_name } { protocol } :{ origin_port } :{ dest_port } "
378+ )
370379
371380 @staticmethod
372381 async def remove_port_mapping (
@@ -375,15 +384,21 @@ async def remove_port_mapping(
375384 origin_port : int ,
376385 dest_port : int ,
377386 protocol : str ,
387+ use_proxy : bool = False ,
378388 ) -> Tuple [bool , Any ]:
379389 app_name = ResourceName (session_user , app_name , App ).for_system ()
380390
381391 if app_name not in session_user .apps :
382392 raise HTTPException (status_code = 404 , detail = "App does not exist" )
383393
384- return await run_command (
385- f"proxy:ports-remove { app_name } { protocol } :{ origin_port } :{ dest_port } "
386- )
394+ if use_proxy :
395+ return await run_command (
396+ f"proxy:ports-remove { app_name } { protocol } :{ origin_port } :{ dest_port } "
397+ )
398+ else :
399+ return await run_command (
400+ f"ports:remove { app_name } { protocol } :{ origin_port } :{ dest_port } "
401+ )
387402
388403 @staticmethod
389404 async def get_linked_databases (
0 commit comments