Exemplo n.º 1
0
 async def web_index():
     return FileResponse(landing_dir("index.html"))
Exemplo n.º 2
0
    logger.info("[email protected] - Registering broadcast routers")
    api.add_websocket_route("/broadcast",
                            broadcast_index,
                            name="broadcast.index")
    api.add_websocket_route("/broadcast/auth",
                            broadcast_auth,
                            name="broadcast.auth.index")


@api.get("/")
async def webui_redir():
    return RedirectResponse(url="/landing/", status_code=302)


# served by nginx
if Path(landing_dir("index.html")).is_file():
    logger.info("[email protected] - Registering landing routers")

    @api.get("/landing/")
    async def web_index():
        return FileResponse(landing_dir("index.html"))

    api.mount("/landing", StaticFiles(directory=landing_dir()))

# served by nginx
if Path(webui_dir("dist")).is_dir():
    logger.info("[email protected] - Registering webui routers")

    # served by nginx
    @api.get("/webui")
    async def webui_redir():