fix(server): only mount the static files if the _next directory exists

This commit is contained in:
Nicholas Tindle
2024-07-15 22:09:51 -05:00
parent 9be9dbed08
commit 66384c1795

View File

@@ -203,11 +203,13 @@ class AgentServer(AppService):
#! DO NOT ADD ANY FUNCTIONS BETWEEN THESE FUNCTIONS
#! DO NOT REMOVE ANY OF THESE FUNCTIONS
#! YOU WILL BREAK THE FRONTEND PACKAGED WITH THE SERVER
app.mount(
path="/_next",
app=SPAStaticFiles(directory=get_frontend_path() / "_next", html=True),
name="frontend",
)
if os.path.exists(get_frontend_path() / "_next"):
app.mount(
path="/_next",
app=SPAStaticFiles(directory=get_frontend_path() / "_next", html=True),
name="frontend",
)
@app.websocket("/ws")
async def websocket_endpoint(websocket: WebSocket): # type: ignore