mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Don't use pypi package in dev mode. Allow non-fingerprinted mdi. (#10144)
This commit is contained in:
parent
583e57042b
commit
fc291dd5ab
@ -264,13 +264,10 @@ def add_manifest_json_key(key, val):
|
|||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_setup(hass, config):
|
def async_setup(hass, config):
|
||||||
"""Set up the serving of the frontend."""
|
"""Set up the serving of the frontend."""
|
||||||
import hass_frontend
|
|
||||||
|
|
||||||
hass.http.register_view(ManifestJSONView)
|
hass.http.register_view(ManifestJSONView)
|
||||||
|
|
||||||
conf = config.get(DOMAIN, {})
|
conf = config.get(DOMAIN, {})
|
||||||
|
|
||||||
frontend_path = hass_frontend.where()
|
|
||||||
repo_path = conf.get(CONF_FRONTEND_REPO)
|
repo_path = conf.get(CONF_FRONTEND_REPO)
|
||||||
is_dev = repo_path is not None
|
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")
|
sw_path = os.path.join(repo_path, "build/service_worker.js")
|
||||||
static_path = os.path.join(repo_path, 'hass_frontend')
|
static_path = os.path.join(repo_path, 'hass_frontend')
|
||||||
else:
|
else:
|
||||||
|
import hass_frontend
|
||||||
|
frontend_path = hass_frontend.where()
|
||||||
sw_path = os.path.join(frontend_path, "service_worker.js")
|
sw_path = os.path.join(frontend_path, "service_worker.js")
|
||||||
static_path = frontend_path
|
static_path = frontend_path
|
||||||
|
|
||||||
hass.http.register_static_path("/service_worker.js", sw_path, False)
|
hass.http.register_static_path("/service_worker.js", sw_path, False)
|
||||||
hass.http.register_static_path("/robots.txt",
|
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)
|
hass.http.register_static_path("/static", static_path)
|
||||||
|
|
||||||
local = hass.config.path('www')
|
local = hass.config.path('www')
|
||||||
@ -409,8 +408,6 @@ class IndexView(HomeAssistantView):
|
|||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def get(self, request, extra=None):
|
def get(self, request, extra=None):
|
||||||
"""Serve the index view."""
|
"""Serve the index view."""
|
||||||
import hass_frontend
|
|
||||||
|
|
||||||
hass = request.app['hass']
|
hass = request.app['hass']
|
||||||
|
|
||||||
if self.use_repo:
|
if self.use_repo:
|
||||||
@ -418,13 +415,18 @@ class IndexView(HomeAssistantView):
|
|||||||
compatibility_url = \
|
compatibility_url = \
|
||||||
'/home-assistant-polymer/build/compatibility.js'
|
'/home-assistant-polymer/build/compatibility.js'
|
||||||
ui_url = '/home-assistant-polymer/src/home-assistant.html'
|
ui_url = '/home-assistant-polymer/src/home-assistant.html'
|
||||||
|
icons_fp = ''
|
||||||
|
icons_url = '/static/mdi.html'
|
||||||
else:
|
else:
|
||||||
|
import hass_frontend
|
||||||
core_url = '/static/core-{}.js'.format(
|
core_url = '/static/core-{}.js'.format(
|
||||||
hass_frontend.FINGERPRINTS['core.js'])
|
hass_frontend.FINGERPRINTS['core.js'])
|
||||||
compatibility_url = '/static/compatibility-{}.js'.format(
|
compatibility_url = '/static/compatibility-{}.js'.format(
|
||||||
hass_frontend.FINGERPRINTS['compatibility.js'])
|
hass_frontend.FINGERPRINTS['compatibility.js'])
|
||||||
ui_url = '/static/frontend-{}.html'.format(
|
ui_url = '/static/frontend-{}.html'.format(
|
||||||
hass_frontend.FINGERPRINTS['frontend.html'])
|
hass_frontend.FINGERPRINTS['frontend.html'])
|
||||||
|
icons_fp = '-{}'.format(hass_frontend.FINGERPRINTS['mdi.html'])
|
||||||
|
icons_url = '/static/mdi{}.html'.format(icons_fp)
|
||||||
|
|
||||||
if request.path == '/':
|
if request.path == '/':
|
||||||
panel = 'states'
|
panel = 'states'
|
||||||
@ -441,8 +443,6 @@ class IndexView(HomeAssistantView):
|
|||||||
# do not try to auto connect on load
|
# do not try to auto connect on load
|
||||||
no_auth = 'false'
|
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(
|
template = yield from hass.async_add_job(
|
||||||
self.templates.get_template, 'index.html')
|
self.templates.get_template, 'index.html')
|
||||||
|
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
<link rel='apple-touch-icon' sizes='180x180'
|
<link rel='apple-touch-icon' sizes='180x180'
|
||||||
href='/static/icons/favicon-apple-180x180.png'>
|
href='/static/icons/favicon-apple-180x180.png'>
|
||||||
<link rel="mask-icon" href="/static/icons/home-assistant-icon.svg" color="#3fbbf4">
|
<link rel="mask-icon" href="/static/icons/home-assistant-icon.svg" color="#3fbbf4">
|
||||||
<link rel='preload' href='{{ core_url }}' as='script'/>
|
|
||||||
{% if not dev_mode %}
|
{% if not dev_mode %}
|
||||||
|
<link rel='preload' href='{{ core_url }}' as='script'/>
|
||||||
{% for panel in panels.values() -%}
|
{% for panel in panels.values() -%}
|
||||||
<link rel='prefetch' href='{{ panel.webcomponent_url }}'>
|
<link rel='prefetch' href='{{ panel.webcomponent_url }}'>
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user