mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 13:34:54 +01:00
Update dashboard to 20210617.0 (#1930)
This commit is contained in:
parent
e5929225eb
commit
ef1e91d838
2 changed files with 14 additions and 16 deletions
|
@ -716,9 +716,6 @@ class LogoutHandler(BaseHandler):
|
||||||
self.redirect("./login")
|
self.redirect("./login")
|
||||||
|
|
||||||
|
|
||||||
_STATIC_FILE_HASHES = {}
|
|
||||||
|
|
||||||
|
|
||||||
def get_base_frontend_path():
|
def get_base_frontend_path():
|
||||||
if ENV_DEV not in os.environ:
|
if ENV_DEV not in os.environ:
|
||||||
import esphome_dashboard
|
import esphome_dashboard
|
||||||
|
@ -741,19 +738,23 @@ def get_static_path(*args):
|
||||||
return os.path.join(get_base_frontend_path(), "static", *args)
|
return os.path.join(get_base_frontend_path(), "static", *args)
|
||||||
|
|
||||||
|
|
||||||
|
@functools.lru_cache(maxsize=None)
|
||||||
def get_static_file_url(name):
|
def get_static_file_url(name):
|
||||||
|
base = f"./static/{name}"
|
||||||
|
|
||||||
|
if ENV_DEV in os.environ:
|
||||||
|
return base
|
||||||
|
|
||||||
# Module imports can't deduplicate if stuff added to url
|
# Module imports can't deduplicate if stuff added to url
|
||||||
if name == "js/esphome/index.js":
|
if name == "js/esphome/index.js":
|
||||||
return f"./static/{name}"
|
import esphome_dashboard
|
||||||
|
|
||||||
|
return base.replace("index.js", esphome_dashboard.entrypoint())
|
||||||
|
|
||||||
if name in _STATIC_FILE_HASHES:
|
|
||||||
hash_ = _STATIC_FILE_HASHES[name]
|
|
||||||
else:
|
|
||||||
path = get_static_path(name)
|
path = get_static_path(name)
|
||||||
with open(path, "rb") as f_handle:
|
with open(path, "rb") as f_handle:
|
||||||
hash_ = hashlib.md5(f_handle.read()).hexdigest()[:8]
|
hash_ = hashlib.md5(f_handle.read()).hexdigest()[:8]
|
||||||
_STATIC_FILE_HASHES[name] = hash_
|
return f"{base}?hash={hash_}"
|
||||||
return f"./static/{name}?hash={hash_}"
|
|
||||||
|
|
||||||
|
|
||||||
def make_app(debug=get_bool_env(ENV_DEV)):
|
def make_app(debug=get_bool_env(ENV_DEV)):
|
||||||
|
@ -820,9 +821,6 @@ def make_app(debug=get_bool_env(ENV_DEV)):
|
||||||
**app_settings,
|
**app_settings,
|
||||||
)
|
)
|
||||||
|
|
||||||
if debug:
|
|
||||||
_STATIC_FILE_HASHES.clear()
|
|
||||||
|
|
||||||
return app
|
return app
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,4 +11,4 @@ ifaddr==0.1.7
|
||||||
platformio==5.1.1
|
platformio==5.1.1
|
||||||
esptool==2.8
|
esptool==2.8
|
||||||
click==7.1.2
|
click==7.1.2
|
||||||
esphome-dashboard==20210615.0
|
esphome-dashboard==20210617.1
|
||||||
|
|
Loading…
Reference in a new issue