From b9f320f4acdc6b1efa2bb7cc7e9195b585c94663 Mon Sep 17 00:00:00 2001 From: Alexey Khit Date: Sun, 5 Dec 2021 14:56:25 +0300 Subject: [PATCH] Fix support old Hass versions --- custom_components/webrtc/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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: