Allow more static files to be fingerprinted
This commit is contained in:
parent
728cd8bb5e
commit
c6b5a04312
1 changed files with 6 additions and 3 deletions
|
@ -25,6 +25,8 @@ FRONTEND_URLS = [
|
||||||
'/devEvent']
|
'/devEvent']
|
||||||
STATES_URL = re.compile(r'/states(/([a-zA-Z\._\-0-9/]+)|)')
|
STATES_URL = re.compile(r'/states(/([a-zA-Z\._\-0-9/]+)|)')
|
||||||
|
|
||||||
|
_FINGERPRINT = re.compile(r'^(\w+)-[a-z0-9]{32}\.(\w+)$', re.IGNORECASE)
|
||||||
|
|
||||||
|
|
||||||
def setup(hass, config):
|
def setup(hass, config):
|
||||||
""" Setup serving the frontend. """
|
""" Setup serving the frontend. """
|
||||||
|
@ -80,9 +82,10 @@ def _handle_get_static(handler, path_match, data):
|
||||||
""" Returns a static file for the frontend. """
|
""" Returns a static file for the frontend. """
|
||||||
req_file = util.sanitize_path(path_match.group('file'))
|
req_file = util.sanitize_path(path_match.group('file'))
|
||||||
|
|
||||||
# Strip md5 hash out of frontend filename
|
# Strip md5 hash out
|
||||||
if re.match(r'^frontend-[A-Za-z0-9]{32}\.html$', req_file):
|
fingerprinted = _FINGERPRINT.match(req_file)
|
||||||
req_file = "frontend.html"
|
if fingerprinted:
|
||||||
|
req_file = "{}.{}".format(*fingerprinted.groups())
|
||||||
|
|
||||||
path = os.path.join(os.path.dirname(__file__), 'www_static', req_file)
|
path = os.path.join(os.path.dirname(__file__), 'www_static', req_file)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue