diff --git a/custom_components/webrtc/utils.py b/custom_components/webrtc/utils.py index fb7e8d0..d0b9954 100644 --- a/custom_components/webrtc/utils.py +++ b/custom_components/webrtc/utils.py @@ -71,7 +71,10 @@ async def serve_file(request): return web.FileResponse(path) route = app.router.add_route("GET", url_path, serve_file) - app['allow_all_cors'](route) + if 'allow_all_cors' in app: + app['allow_all_cors'](route) + elif 'allow_cors' in app: + app['allow_cors'](route) async def init_resource(hass: HomeAssistantType, url: str, ver: str) -> bool: