@@ -71,9 +71,19 @@ async def custom_swagger_ui_html():
7171async def get_openapi_endpoint ():
7272 return custom_openapi ()
7373
74- app .mount ("/ui" , StaticFiles (directory = (os .path .join (__location__ , "../cloudproxy-ui/dist" )), html = True ), name = "static" )
75- app .mount ("/css" , StaticFiles (directory = (os .path .join (__location__ , "../cloudproxy-ui/dist/css" )), html = True ), name = "cssstatic" )
76- app .mount ("/js" , StaticFiles (directory = (os .path .join (__location__ , "../cloudproxy-ui/dist/js" ))), name = "jsstatic" )
74+ # Check if UI directories exist before mounting
75+ ui_dir = os .path .join (__location__ , "../cloudproxy-ui/dist" )
76+ css_dir = os .path .join (__location__ , "../cloudproxy-ui/dist/css" )
77+ js_dir = os .path .join (__location__ , "../cloudproxy-ui/dist/js" )
78+
79+ if os .path .exists (ui_dir ):
80+ app .mount ("/ui" , StaticFiles (directory = ui_dir , html = True ), name = "static" )
81+ if os .path .exists (css_dir ):
82+ app .mount ("/css" , StaticFiles (directory = css_dir , html = True ), name = "cssstatic" )
83+ if os .path .exists (js_dir ):
84+ app .mount ("/js" , StaticFiles (directory = js_dir ), name = "jsstatic" )
85+ else :
86+ logger .warning (f"UI directory { ui_dir } does not exist. UI will not be available." )
7787
7888origins = ["*" ]
7989
0 commit comments