From fc291dd5abaafe5140c5dd5f26abb7af2b660c8a Mon Sep 17 00:00:00 2001 From: Andrey Date: Fri, 27 Oct 2017 08:28:07 +0300 Subject: [PATCH] Don't use pypi package in dev mode. Allow non-fingerprinted mdi. (#10144) --- homeassistant/components/frontend/__init__.py | 16 ++++++++-------- .../components/frontend/templates/index.html | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/homeassistant/components/frontend/__init__.py b/homeassistant/components/frontend/__init__.py index 1e2bb8ab456..7cb0235599d 100644 --- a/homeassistant/components/frontend/__init__.py +++ b/homeassistant/components/frontend/__init__.py @@ -264,13 +264,10 @@ def add_manifest_json_key(key, val): @asyncio.coroutine def async_setup(hass, config): """Set up the serving of the frontend.""" - import hass_frontend - hass.http.register_view(ManifestJSONView) conf = config.get(DOMAIN, {}) - frontend_path = hass_frontend.where() repo_path = conf.get(CONF_FRONTEND_REPO) is_dev = repo_path is not None @@ -282,12 +279,14 @@ def async_setup(hass, config): sw_path = os.path.join(repo_path, "build/service_worker.js") static_path = os.path.join(repo_path, 'hass_frontend') else: + import hass_frontend + frontend_path = hass_frontend.where() sw_path = os.path.join(frontend_path, "service_worker.js") static_path = frontend_path hass.http.register_static_path("/service_worker.js", sw_path, False) hass.http.register_static_path("/robots.txt", - os.path.join(frontend_path, "robots.txt")) + os.path.join(static_path, "robots.txt")) hass.http.register_static_path("/static", static_path) local = hass.config.path('www') @@ -409,8 +408,6 @@ class IndexView(HomeAssistantView): @asyncio.coroutine def get(self, request, extra=None): """Serve the index view.""" - import hass_frontend - hass = request.app['hass'] if self.use_repo: @@ -418,13 +415,18 @@ class IndexView(HomeAssistantView): compatibility_url = \ '/home-assistant-polymer/build/compatibility.js' ui_url = '/home-assistant-polymer/src/home-assistant.html' + icons_fp = '' + icons_url = '/static/mdi.html' else: + import hass_frontend core_url = '/static/core-{}.js'.format( hass_frontend.FINGERPRINTS['core.js']) compatibility_url = '/static/compatibility-{}.js'.format( hass_frontend.FINGERPRINTS['compatibility.js']) ui_url = '/static/frontend-{}.html'.format( hass_frontend.FINGERPRINTS['frontend.html']) + icons_fp = '-{}'.format(hass_frontend.FINGERPRINTS['mdi.html']) + icons_url = '/static/mdi{}.html'.format(icons_fp) if request.path == '/': panel = 'states' @@ -441,8 +443,6 @@ class IndexView(HomeAssistantView): # do not try to auto connect on load no_auth = 'false' - icons_fp = hass_frontend.FINGERPRINTS['mdi.html'] - icons_url = '/static/mdi-{}.html'.format(icons_fp) template = yield from hass.async_add_job( self.templates.get_template, 'index.html') diff --git a/homeassistant/components/frontend/templates/index.html b/homeassistant/components/frontend/templates/index.html index 9a1c4e54e9c..8ff3c64ef90 100644 --- a/homeassistant/components/frontend/templates/index.html +++ b/homeassistant/components/frontend/templates/index.html @@ -9,8 +9,8 @@ - {% if not dev_mode %} + {% for panel in panels.values() -%} {% endfor -%}