From c28a138dfea2935f3610d92f515d4ebd5a7083de Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Fri, 19 Jul 2024 12:55:40 +0200 Subject: [PATCH] Revert "Add static routes for frontend modern and legacy service workers" (#122172) --- homeassistant/components/frontend/__init__.py | 5 +---- tests/components/frontend/test_init.py | 7 ++----- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/homeassistant/components/frontend/__init__.py b/homeassistant/components/frontend/__init__.py index 6b0d69ba99d..8fe3a98864b 100644 --- a/homeassistant/components/frontend/__init__.py +++ b/homeassistant/components/frontend/__init__.py @@ -398,10 +398,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: static_paths_configs: list[StaticPathConfig] = [] for path, should_cache in ( - ("sw-modern.js", False), - ("sw-modern.js.map", False), - ("sw-legacy.js", False), - ("sw-legacy.js.map", False), + ("service_worker.js", False), ("robots.txt", False), ("onboarding.html", not is_dev), ("static", not is_dev), diff --git a/tests/components/frontend/test_init.py b/tests/components/frontend/test_init.py index 5006adedd77..0856d81e205 100644 --- a/tests/components/frontend/test_init.py +++ b/tests/components/frontend/test_init.py @@ -174,12 +174,9 @@ async def test_frontend_and_static(mock_http_client: TestClient) -> None: assert "public" in resp.headers.get("cache-control") -@pytest.mark.parametrize("sw_url", ["/sw-modern.js", "/sw-legacy.js"]) -async def test_dont_cache_service_worker( - mock_http_client: TestClient, sw_url: str -) -> None: +async def test_dont_cache_service_worker(mock_http_client: TestClient) -> None: """Test that we don't cache the service worker.""" - resp = await mock_http_client.get(sw_url) + resp = await mock_http_client.get("/service_worker.js") assert resp.status == 200 assert "cache-control" not in resp.headers